/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
    height: 100%;
    background: #04080f;
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
    color: #c9d1d9;
}

/* ── Bubble canvas (full-screen background) ────────────────── */
.bubble-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ── Root wrapper ──────────────────────────────────────────── */
.harri-wrap {
    height: 100vh;
    overflow: hidden;
}

/* ── Chat overlay: centred column anchored to the bottom ───── */
.chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 1.5rem 1.5rem;
    pointer-events: none;
}

/* ── Message list ──────────────────────────────────────────── */
.chat-messages {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow-y: auto;
    max-height: 55vh;
    padding: 0.5rem 0 0.85rem;
    pointer-events: auto;
    scrollbar-width: none;
    mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 100%);
}
.chat-messages::-webkit-scrollbar { display: none; }

/* ── Base message ──────────────────────────────────────────── */
.msg {
    max-width: 78%;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(5px) saturate(1.2);
    -webkit-backdrop-filter: blur(5px) saturate(1.2);
    word-break: break-word;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── hArrI message ─────────────────────────────────────────── */
.msg--harri {
    align-self: flex-start;
    background: rgba(8, 18, 40, 0.28);
    border: 1px solid rgba(80, 160, 255, 0.14);
    border-left: 2px solid rgba(80, 200, 255, 0.4);
    border-radius: 3px 18px 18px 18px;
    color: #d0e8ff;
}

/* ── Player message ────────────────────────────────────────── */
.msg--player {
    align-self: flex-end;
    background: rgba(18, 8, 40, 0.28);
    border: 1px solid rgba(160, 80, 255, 0.14);
    border-right: 2px solid rgba(180, 80, 255, 0.4);
    border-radius: 18px 3px 18px 18px;
    color: #e4c8ff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Sender label inside harri bubbles ─────────────────────── */
.msg-author {
    font-size: 0.6rem;
    color: rgba(100, 200, 255, 0.6);
    letter-spacing: 0.1em;
    margin-bottom: 0.2rem;
    display: block;
}

/* ── Message text ──────────────────────────────────────────── */
.msg-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.msg--player .msg-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    white-space: normal;
}

/* ── Reveal clue ───────────────────────────────────────────── */
.msg--reveal {
    border-left-color: rgba(240, 136, 62, 0.6);
    background: rgba(26, 16, 6, 0.35);
    color: #e3b341;
}

.msg--reveal .msg-text { color: #e3b341; }

/* ── Thinking dots ─────────────────────────────────────────── */
.msg--thinking {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.65rem 1.1rem;
    min-height: 2.4rem;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(100, 190, 255, 0.65);
    animation: dotBounce 1.3s infinite ease-in-out;
    flex-shrink: 0;
}
.dot:nth-child(2) { animation-delay: 0.18s; }
.dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotBounce {
    0%, 55%, 100% { transform: translateY(0);    opacity: 0.35; }
    27%            { transform: translateY(-5px); opacity: 1;    }
}

/* ── Input form ────────────────────────────────────────────── */
.chat-form {
    width: 100%;
    max-width: 640px;
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    pointer-events: auto;
}

.chat-input {
    flex: 1;
    background: rgba(8, 14, 30, 0.55);
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 28px;
    color: #c8d8f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    padding: 0.7rem 1.35rem;
    outline: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.chat-input:focus {
    border-color: rgba(100, 200, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(80, 180, 255, 0.12),
                0 0 24px rgba(80, 180, 255, 0.1);
}

.chat-input::placeholder { color: rgba(140, 180, 230, 0.3); }

.chat-send {
    background: rgba(20, 50, 110, 0.7);
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 50%;
    color: rgba(160, 210, 255, 0.9);
    cursor: pointer;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    background: rgba(40, 80, 180, 0.85);
    color: #fff;
}

/* ── Code claim / game complete ────────────────────────────── */
.game-complete {
    width: 100%;
    max-width: 640px;
    padding: 1.25rem 0 1.5rem;
    text-align: center;
    color: #e3b341;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    pointer-events: auto;
}

.game-complete__label {
    font-size: 0.7rem;
    color: rgba(227, 179, 65, 0.6);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.game-complete__code {
    font-size: 2.2rem;
    font-weight: bold;
    letter-spacing: 0.4em;
    color: #e3b341;
    text-shadow: 0 0 18px rgba(227, 179, 65, 0.45);
    margin-bottom: 0.75rem;
}

.game-complete__hint {
    font-size: 0.75rem;
    color: rgba(227, 179, 65, 0.45);
    letter-spacing: 0.06em;
}

/* ── Save / restore progress ───────────────────────────────── */
.save-restore {
    width: 100%;
    max-width: 640px;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.6rem;
    pointer-events: auto;
}

.save-restore__link {
    color: rgba(140, 180, 230, 0.55);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.2s;
}

.save-restore__link:hover {
    color: rgba(180, 210, 255, 0.9);
}

.save-restore__form {
    max-width: 640px;
    flex-wrap: wrap;
    justify-content: center;
}

.save-restore__note {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(140, 180, 230, 0.6);
    margin-top: 0.35rem;
}

.save-restore__note--error {
    color: rgba(230, 120, 120, 0.75);
}

/* ── Logo (top-center overlay) ────────────────────────────── */
.harri-logo {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

.harri-logo__art {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    line-height: 1.45;
    color: rgba(185, 225, 255, 0.88);
    text-shadow: 0 0 8px rgba(80, 180, 255, 0.55),
                 0 0 22px rgba(60, 140, 255, 0.28);
    letter-spacing: 0.04em;
    margin: 0;
}

.harri-logo__payoff {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    color: rgba(140, 190, 255, 0.42);
    letter-spacing: 0.38em;
    margin-top: 0.25rem;
    text-indent: 0.38em;
}

/* ── Locale switch (top-left overlay) ─────────────────────── */
.locale-switch {
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 20;
    display: flex;
    gap: 0.4rem;
    pointer-events: auto;
}

.locale-switch__option {
    background: rgba(8, 14, 30, 0.55);
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 14px;
    color: rgba(140, 180, 230, 0.55);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: color 0.2s, border-color 0.2s;
}

.locale-switch__option:hover {
    color: rgba(180, 210, 255, 0.9);
}

.locale-switch__option--active {
    color: #c8d8f0;
    border-color: rgba(100, 200, 255, 0.55);
}

/* ── Clue corner (top-right overlay) ──────────────────────── */
.clue-corner {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 20;
    text-align: right;
}

.clue-count {
    font-size: 0.65rem;
    color: rgba(80, 200, 100, 0.7);
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.4rem;
}

.clue-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.clue-item {
    font-size: 0.65rem;
    color: rgba(80, 200, 100, 0.7);
    background: rgba(0, 20, 0, 0.4);
    border: 1px solid rgba(80, 200, 100, 0.2);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: slideUp 0.3s ease;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .chat-overlay { padding: 0 1rem 1rem; }
    .clue-corner  { display: none; }
}
