/* === LeSphinx Theme — Egyptian Mystique === */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700;800;900&family=Raleway:wght@300;400;500;600&display=swap');

:root {
    --bg: hsl(20 10% 5%);
    --bg-card: hsl(20 10% 8% / 0.8);
    --gold: #E6A000;
    --gold-light: #E8B84D;
    --gold-dark: #8B5A00;
    --gold-glow: rgba(230, 160, 0, 0.3);
    --gold-glow-strong: rgba(230, 160, 0, 0.5);
    --accent: #C77B00;
    --ember: #B34D00;
    --sand: hsl(35 30% 75%);
    --papyrus: hsl(40 40% 92%);
    --text: hsl(40 30% 90%);
    --text-dim: hsl(30 20% 55%);
    --red: #c44040;
    --green: #40a050;
    --border: hsl(30 15% 18%);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Raleway', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(230, 160, 0, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(230, 160, 0, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Cinzel', serif; }

#app {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   Screens & Transitions
   ========================================================================== */
.screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1;
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    z-index: 2;
}

.screen.exiting {
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.gold-gradient-text {
    background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-surface {
    background: hsl(20 10% 8% / 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid hsl(38 60% 50% / 0.15);
}

.glow-gold { box-shadow: 0 0 20px var(--gold-glow), 0 0 60px rgba(230, 160, 0, 0.1); }
.glow-text { text-shadow: 0 0 20px rgba(230, 160, 0, 0.5), 0 0 40px rgba(230, 160, 0, 0.2); }

.hidden { display: none !important; }

/* ==========================================================================
   Staggered Entrance Animations
   ========================================================================== */
.reveal-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--delay, 0s);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--delay, 0s);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--delay, 0s);
}

.screen.active .reveal-up,
.screen.active .reveal-scale,
.screen.active .reveal-left {
    opacity: 1;
    transform: none;
}

/* ==========================================================================
   Welcome / Hero Screen
   ========================================================================== */
#screen-welcome {
    align-items: center;
    overflow-y: auto;
    position: relative;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hero-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        hsl(20 10% 5% / 0.25) 0%,
        hsl(20 10% 5% / 0.55) 40%,
        hsl(20 10% 5% / 0.88) 75%,
        hsl(20 10% 5% / 0.97) 100%
    );
}

.hero-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1.25rem 1.5rem;
    position: relative;
    z-index: 5;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.nav-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: var(--text);
}

.lang-toggle {
    padding: 0.4rem 1rem;
    border-radius: 99px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid hsl(30 15% 18% / 0.5);
    color: var(--text);
    font-family: 'Raleway', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: border-color 0.2s;
}

.lang-toggle:hover { border-color: var(--gold-glow); }

.hero-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem 2rem;
    text-align: center;
    gap: 0.5rem;
    position: relative;
    z-index: 5;
}

.hero-gif {
    width: 140px;
    height: auto;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 30px rgba(230, 160, 0, 0.45));
    image-rendering: pixelated;
}

.hero-title {
    font-size: clamp(2.8rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-shadow: 0 0 30px rgba(230, 160, 0, 0.3);
    margin-bottom: 0.25rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-dim);
    max-width: 420px;
    font-weight: 300;
}

.hero-tagline {
    font-size: 0.9rem;
    color: hsl(30 15% 45%);
    max-width: 380px;
    font-style: italic;
    margin-bottom: 2rem;
}

/* ==========================================================================
   Sphinx Avatar
   ========================================================================== */
.sphinx-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(20 12% 10%) 0%, hsl(20 12% 14%) 100%);
    border: 2px solid var(--gold-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    position: relative;
    box-shadow: 0 0 30px rgba(230, 160, 0, 0.12);
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.sphinx-eye {
    width: 12px;
    height: 12px;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--gold-glow);
    transition: all 0.3s ease;
}

.sphinx-avatar.talking {
    border-color: var(--gold);
    box-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(230, 160, 0, 0.08);
}

.sphinx-avatar.talking .sphinx-eye {
    box-shadow: 0 0 20px var(--gold);
    animation: eye-glow 0.8s ease-in-out infinite alternate;
}

/* Answer-specific eye flash */
.sphinx-avatar.answer-yes .sphinx-eye { background: var(--green); box-shadow: 0 0 16px var(--green); }
.sphinx-avatar.answer-no .sphinx-eye { background: var(--red); box-shadow: 0 0 16px var(--red); }
.sphinx-avatar.answer-unknown .sphinx-eye { background: #6a7ec4; box-shadow: 0 0 16px #6a7ec4; }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes eye-glow {
    0% { transform: scale(1); }
    100% { transform: scale(1.25); box-shadow: 0 0 25px var(--gold); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.float-anim { animation: float 4s ease-in-out infinite; }

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(230, 160, 0, 0.2); }
    50% { box-shadow: 0 0 40px rgba(230, 160, 0, 0.4), 0 0 80px rgba(230, 160, 0, 0.1); }
}

.pulse-glow { animation: pulseGlow 3s ease-in-out infinite; }

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

@keyframes fadeSlideLeft {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideRight {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bounce-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-8px); opacity: 1; }
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(196, 64, 64, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(196, 64, 64, 0); }
}

@keyframes mic-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes scaleReveal {
    from { opacity: 0; transform: scale(0.8); filter: blur(8px); }
    to { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes spin-in {
    from { transform: scale(0) rotate(-180deg); }
    to { transform: scale(1) rotate(0deg); }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-gold {
    padding: 0.9rem 2.5rem;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--gold-glow);
}

.btn-gold:active { transform: translateY(0); }
.btn-gold:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-gold.btn-sm { padding: 0.6rem 1.5rem; font-size: 0.95rem; }

.btn-outline {
    padding: 0.6rem 1.5rem;
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Cinzel', serif;
}

.btn-outline:hover { border-color: var(--gold-dark); color: var(--text); }

.btn-back {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-back:hover { color: var(--text); }

.btn-back-small {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.25rem;
    transition: color 0.2s;
}

.btn-back-small:hover { color: var(--text); }

/* ==========================================================================
   Difficulty Screen
   ========================================================================== */
#screen-difficulty {
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    gap: 2rem;
}

.section-title {
    font-size: clamp(1.6rem, 5vw, 2.5rem);
    font-weight: 700;
    text-align: center;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 600px;
    width: 100%;
}

/* Theme select (on difficulty screen) */
.theme-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    max-width: 760px;
    width: 100%;
}

.theme-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    max-width: 420px;
    width: 100%;
}

.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 0.5rem;
    background: hsl(20 10% 8% / 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid hsl(38 60% 50% / 0.1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
    font-family: 'Raleway', sans-serif;
}

.theme-card.stagger-in {
    animation: cardPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--delay, 0s);
}

@keyframes cardPop {
    from { opacity: 0; transform: scale(0.8) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.theme-card:hover:not(.active) {
    border-color: hsl(38 60% 50% / 0.3);
    box-shadow: 0 0 16px rgba(230, 160, 0, 0.1);
    transform: translateY(-2px);
    color: var(--text);
}

.theme-card.active {
    border-color: hsl(38 80% 50% / 0.6);
    box-shadow: 0 0 24px rgba(230, 160, 0, 0.2);
    background: hsl(38 40% 12% / 0.8);
    color: var(--gold);
}

.theme-card-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.theme-card-name {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.difficulty-card {
    background: hsl(20 10% 8% / 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid hsl(38 60% 50% / 0.15);
    border-radius: var(--radius);
    padding: 1.8rem 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-card:hover {
    border-color: hsl(38 60% 50% / 0.4);
    box-shadow: 0 0 24px rgba(230, 160, 0, 0.15);
    transform: translateY(-3px);
}

.difficulty-card.selected {
    border-color: hsl(38 80% 50% / 0.7);
    box-shadow: 0 0 32px rgba(230, 160, 0, 0.25);
}

.diff-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.difficulty-card:hover .diff-icon {
    transform: scale(1.15) translateY(-2px);
}

.diff-name {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.diff-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Mic mode (on difficulty screen) */
.mic-mode-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mic-mode-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.mic-mode-buttons { display: flex; gap: 0.4rem; }

.mic-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Raleway', sans-serif;
    transition: all 0.2s;
}

.mic-btn.active {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
    font-weight: 600;
}

.mic-btn:hover:not(.active) { border-color: var(--gold-dark); color: var(--text); }

/* ==========================================================================
   Game Screen
   ========================================================================== */
#screen-game {
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.header-title {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
}

.header-counters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.counter-badge {
    background: var(--bg-card);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    border: 1px solid hsl(30 15% 18% / 0.5);
    transition: transform 0.2s;
}

.counter-badge.bump {
    animation: counter-bump 0.3s ease;
}

@keyframes counter-bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.sound-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    transition: opacity 0.2s;
}
.sound-toggle:hover { opacity: 0.7; }

/* Mic indicator */
.mic-indicator {
    display: inline-flex;
    align-items: center;
    color: var(--red);
    animation: mic-pulse 1.5s ease-in-out infinite;
}

.mic-indicator.hidden { display: none; }

/* ==========================================================================
   Chat Messages
   ========================================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    scroll-behavior: smooth;
    min-height: 0;
}

#messages-end { height: 1px; flex-shrink: 0; }

.message-row {
    display: flex;
    opacity: 0;
}

.message-row.player {
    justify-content: flex-end;
    animation: fadeSlideLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.message-row.sphinx {
    justify-content: flex-start;
    animation: fadeSlideRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-bubble {
    max-width: 82%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.55;
}

.sphinx-bubble {
    background: linear-gradient(135deg, hsl(38 30% 14% / 0.6), hsl(38 20% 10% / 0.4));
    border-left: 2px solid hsl(38 70% 50% / 0.5);
    color: var(--text);
}

.player-bubble {
    background: hsl(25 15% 15%);
    border-right: 2px solid hsl(30 15% 35% / 0.4);
    color: var(--text);
}

.msg-label {
    display: block;
    font-size: 0.7rem;
    font-family: 'Cinzel', serif;
    color: var(--gold);
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.player-bubble .msg-label { color: var(--text-dim); }

.msg-text { word-wrap: break-word; }

/* Answer indicator dot on sphinx messages */
.answer-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.answer-dot.yes { background: var(--green); box-shadow: 0 0 6px var(--green); }
.answer-dot.no { background: var(--red); box-shadow: 0 0 6px var(--red); }
.answer-dot.unknown { background: #6a7ec4; box-shadow: 0 0 6px #6a7ec4; }

/* ==========================================================================
   Thinking Indicator
   ========================================================================== */
.thinking-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.thinking-dots span:not(.thinking-text) {
    width: 7px;
    height: 7px;
    background: var(--gold);
    border-radius: 50%;
    animation: bounce-dot 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

.thinking-text {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-style: italic;
    margin-left: 0.5rem;
}

/* ==========================================================================
   Input Area
   ========================================================================== */
.input-area {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.action-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid hsl(30 15% 18% / 0.5);
    color: var(--text-dim);
}

.action-chip:hover { color: var(--text); border-color: var(--gold-dark); }

.action-chip.active {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
}

.action-chip-danger:hover { color: var(--red); border-color: hsl(0 50% 35%); }

.input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
}

#input-question {
    flex: 1;
    padding: 0.75rem 1rem;
    background: hsl(20 10% 8% / 0.6);
    border: 1px solid hsl(30 15% 18% / 0.5);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: 'Raleway', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

#input-question:focus {
    border-color: hsl(38 60% 45% / 0.5);
    box-shadow: 0 0 16px rgba(212, 168, 67, 0.1);
}

#input-question::placeholder { color: hsl(30 15% 40%); }

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    border: none;
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    box-shadow: 0 3px 16px var(--gold-glow);
    transform: translateY(-1px);
}

.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-mic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid hsl(30 15% 18% / 0.5);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-mic:hover { border-color: var(--gold-dark); color: var(--text); }

.btn-mic.recording {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--bg);
    box-shadow: 0 0 16px var(--gold-glow);
    animation: pulseGlow 2s ease-in-out infinite;
}

.btn-mic.hidden { display: none; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

.modal.hidden { display: none; }

.modal-content {
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
    animation: scaleReveal 0.25s ease forwards;
}

.modal-title { font-size: 1.2rem; }

#input-guess {
    width: 100%;
    padding: 0.75rem 1rem;
    background: hsl(20 10% 6%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    font-family: 'Raleway', sans-serif;
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
}

#input-guess:focus {
    border-color: hsl(38 60% 45% / 0.5);
    box-shadow: 0 0 12px rgba(212, 168, 67, 0.1);
}

#input-guess::placeholder { color: hsl(30 15% 40%); }

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.modal-buttons .btn-gold,
.modal-buttons .btn-outline {
    flex: 1;
    text-align: center;
}

/* ==========================================================================
   Voice Mode Container
   ========================================================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.voice-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 1rem;
    gap: 1.5rem;
}

.voice-container.hidden { display: none !important; }

.voice-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    position: relative;
}

.voice-sphinx-text {
    font-family: 'Cinzel', serif;
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: var(--gold);
    text-align: center;
    max-width: 500px;
    padding: 0 1rem;
    animation: fadeSlideIn 0.4s ease;
    text-shadow: 0 0 20px rgba(230, 160, 0, 0.3);
    line-height: 1.5;
}

.voice-sphinx-text.hidden { display: none; }

.voice-orb-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-timer-ring {
    position: absolute;
    width: 260px;
    height: 260px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.timer-progress {
    transition: stroke-dashoffset 1s linear;
}

.voice-orb {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, hsl(38 60% 20% / 0.6) 0%, hsl(20 10% 6%) 70%);
    border: 2px solid hsl(38 60% 50% / 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(230, 160, 0, 0.15);
    transition: box-shadow 0.3s;
}

.voice-orb.speaking {
    box-shadow: 0 0 60px rgba(230, 160, 0, 0.35), 0 0 120px rgba(230, 160, 0, 0.1);
    border-color: var(--gold);
}

.voice-orb.listening {
    box-shadow: 0 0 40px rgba(64, 160, 80, 0.2), 0 0 80px rgba(64, 160, 80, 0.05);
    border-color: var(--green);
}

#orb-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.voice-timer-text {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.voice-timer-text.hidden { display: none; }
.voice-timer-text.urgent { color: var(--red); animation: pulseGlow 0.5s ease-in-out infinite; }

.timer-icon { font-size: 1rem; }

.voice-transcript {
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    max-width: 400px;
    min-height: 1.4em;
}

.voice-transcript.hidden { display: none; }

.voice-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.voice-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid hsl(38 60% 50% / 0.2);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.voice-action-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    transform: scale(1.05);
}

.voice-action-btn:disabled { opacity: 0.3; cursor: not-allowed; }

#voice-hint-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gold);
    color: var(--bg);
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
}

.voice-submit-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
    border: none;
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-submit-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 40px var(--gold-glow);
}

.voice-submit-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    animation: none;
}

/* ==========================================================================
   Hint Counter
   ========================================================================== */
.hint-counter {
    background: var(--gold);
    color: var(--bg);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    margin-left: 0.2rem;
    transition: all 0.3s;
}

.hint-counter.depleted { background: var(--red); }

@keyframes hintBump {
    0% { transform: scale(1); }
    30% { transform: scale(1.6); }
    60% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

.hint-counter.bumping { animation: hintBump 0.4s ease; }

/* ==========================================================================
   End Screen
   ========================================================================== */
#screen-end {
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.end-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 480px;
}

.end-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--gold-glow);
    animation: spin-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    margin-bottom: 0.25rem;
}

.end-icon span { font-size: 2rem; }

.end-message {
    color: var(--text-dim);
    font-size: 1rem;
    max-width: 340px;
}

.end-reveal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    animation: fadeSlideIn 0.6s ease 0.3s both;
}

.end-reveal.hidden { display: none; }

.end-photo-frame {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    overflow: hidden;
    box-shadow: 0 0 40px rgba(230, 160, 0, 0.3), 0 0 80px rgba(230, 160, 0, 0.1);
    animation: scaleReveal 0.6s ease 0.5s both;
}

.end-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.revealed-character {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--gold);
    animation: scaleReveal 0.6s ease 0.7s both;
}

.end-summary {
    font-size: 0.92rem;
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 380px;
    animation: fadeSlideIn 0.5s ease 1s both;
}

.end-stats {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.toast {
    background: hsl(0 60% 40%);
    color: #fff;
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 90vw;
    text-align: center;
    backdrop-filter: blur(8px);
}

.toast.visible { opacity: 1; }

/* ==========================================================================
   Multiplayer
   ========================================================================== */

/* Mode selection on welcome screen */
.mode-select {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 1.5rem;
    background: hsl(30 10% 12% / 0.6);
    border: 2px solid hsl(30 15% 25% / 0.4);
    border-radius: 12px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--font-body);
}

.mode-btn:hover {
    border-color: hsl(38 50% 50% / 0.5);
    color: var(--text);
}

.mode-btn.active {
    border-color: var(--gold);
    color: var(--gold);
    background: hsl(38 30% 15% / 0.4);
    box-shadow: 0 0 15px hsl(38 60% 50% / 0.15);
}

.mode-icon {
    font-size: 1.6rem;
}

.mode-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mode badge on difficulty screen */
.mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.9rem;
    background: hsl(200 60% 20% / 0.5);
    border: 1px solid hsl(200 70% 60% / 0.5);
    border-radius: 20px;
    color: #4FC3F7;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

/* Turn indicator in game header */
.turn-indicator {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.3s ease;
    animation: turnPulse 0.4s ease;
}

.player-1-indicator {
    background: hsl(38 50% 20% / 0.5);
    border: 1px solid var(--gold);
    color: var(--gold);
}

.player-2-indicator {
    background: hsl(200 50% 20% / 0.5);
    border: 1px solid #4FC3F7;
    color: #4FC3F7;
}

@keyframes turnPulse {
    0% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Turn transition overlay */
.turn-transition {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: hsl(0 0% 0% / 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.turn-transition.hidden { display: none; }

.turn-transition-content {
    text-align: center;
    animation: turnSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.turn-transition-text {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.player-1-transition .turn-transition-text {
    color: var(--gold);
    text-shadow: 0 0 20px hsl(38 60% 50% / 0.5);
}

.player-2-transition .turn-transition-text {
    color: #4FC3F7;
    text-shadow: 0 0 20px hsl(200 70% 60% / 0.5);
}

@keyframes turnSlideIn {
    0% { transform: translateY(20px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Player-specific chat bubble styles */
.player-1-bubble {
    border-right-color: hsl(38 60% 50% / 0.5);
}

.player-2-bubble {
    border-right-color: hsl(200 70% 60% / 0.5);
}

.player-1-label {
    color: var(--gold) !important;
}

.player-2-label {
    color: #4FC3F7 !important;
}

/* End screen player stats */
.end-player-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 1rem 0;
}

.player-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    background: hsl(30 10% 12% / 0.5);
}

.player-1-stat {
    border: 1px solid hsl(38 60% 50% / 0.3);
}

.player-2-stat {
    border: 1px solid hsl(200 70% 60% / 0.3);
}

.player-stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-1-stat .player-stat-label { color: var(--gold); }
.player-2-stat .player-stat-label { color: #4FC3F7; }

.player-stat-value {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ==========================================================================
   Global Stats & Leaderboard Preview (Welcome Screen)
   ========================================================================== */
.global-stats {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
    font-style: italic;
}

.leaderboard-preview {
    width: 100%;
    max-width: 400px;
    margin-top: 0.75rem;
}

.leaderboard-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.leaderboard-preview th {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.leaderboard-preview td {
    padding: 0.25rem 0.5rem;
    color: var(--text-dim);
}

.leaderboard-preview tr:first-child td { color: var(--gold); font-weight: 600; }

.lb-rank { width: 2rem; text-align: center; }
.lb-score { text-align: right; font-variant-numeric: tabular-nums; }
.lb-diff { text-align: center; }
.lb-diff-easy { color: #4ade80; }
.lb-diff-medium { color: var(--gold); }
.lb-diff-hard { color: #f87171; }

/* ==========================================================================
   Confidence Meter & Streak Counter (Game Header)
   ========================================================================== */
.confidence-meter {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
}

.confidence-icon {
    font-size: 0.9rem;
    transition: opacity 0.3s;
}

.confidence-bar {
    width: 40px;
    height: 4px;
    background: hsl(20 10% 20%);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.6s;
}

.confidence-fill.low { background: #f87171; }
.confidence-fill.medium { background: var(--gold); }
.confidence-fill.high { background: #4ade80; }

.streak-badge {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fb923c;
    padding: 0.15rem 0.4rem;
    background: hsl(20 60% 15% / 0.6);
    border-radius: 6px;
    animation: streakPulse 0.4s ease;
}

@keyframes streakPulse {
    0% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   End Screen: Score, Achievements, Leaderboard Form
   ========================================================================== */
.end-score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.end-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.score-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.score-value {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.end-achievements {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    background: hsl(38 40% 12% / 0.7);
    border: 1px solid hsl(38 60% 50% / 0.3);
    border-radius: 8px;
    font-size: 0.72rem;
    color: var(--gold);
    animation: badgePop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--delay, 0s);
}

.achievement-badge .ach-icon { font-size: 1rem; }
.achievement-badge .ach-name { font-weight: 600; }

@keyframes badgePop {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

.end-leaderboard-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.leaderboard-prompt {
    font-size: 0.85rem;
    color: var(--gold);
    font-style: italic;
}

.leaderboard-input-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
}

.leaderboard-input-row input {
    flex: 1;
    background: hsl(20 10% 12%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
}

.leaderboard-input-row input::placeholder { color: hsl(30 15% 40%); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .hero-gif { width: 120px; }
    .difficulty-grid { gap: 0.75rem; }
    .theme-grid { grid-template-columns: repeat(2, 1fr); }
    .end-photo { width: 160px; height: 160px; }
}

@media (max-width: 520px) {
    .difficulty-grid {
        grid-template-columns: 1fr;
        max-width: 280px;
    }

    .hero-title { letter-spacing: 0.03em; }
    .hero-gif { width: 100px; }

    .game-header { padding: 0.6rem 0.8rem; }

    .chat-messages { padding: 0.75rem; }

    .message-bubble { max-width: 90%; }

    .mic-mode-buttons { flex-wrap: wrap; justify-content: center; }

    .theme-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }

    #screen-difficulty { padding: 1.5rem 1rem; gap: 1.2rem; }

    .voice-orb { width: 160px; height: 160px; }
    .voice-timer-ring { width: 220px; height: 220px; }
    .voice-submit-btn { width: 64px; height: 64px; }

    .end-photo { width: 130px; height: 130px; }
    .end-summary { font-size: 0.88rem; padding: 0 0.5rem; }
}

@media (max-width: 390px) {
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .hero-tagline { font-size: 0.8rem; }
    .btn-gold { padding: 0.75rem 1.8rem; font-size: 0.95rem; }
    .theme-grid { grid-template-columns: 1fr 1fr; }
    .section-title { font-size: 1.4rem; }
}
