/* ==========================================================================
   EMOJICO – Shared Styles (host + player)
   ========================================================================== */

/* ---------- CSS Variables ---------- */
:root {
    --bg:             #0a0a2e;
    --bg2:            #151545;
    --bg3:            #1a0a3e;
    --primary:        #ff6b9d;
    --secondary:      #c44dff;
    --accent:         #00d4ff;
    --success:        #00ff88;
    --warning:        #ffaa00;
    --danger:         #ff4757;
    --text:           #ffffff;
    --text-dim:       #8888bb;
    --card-bg:        rgba(255,255,255,0.06);
    --card-border:    rgba(255,255,255,0.10);
    --glass:          rgba(255,255,255,0.08);
    --radius:         16px;
    --radius-sm:      10px;
    --shadow:         0 8px 32px rgba(0,0,0,.35);
    --font-display:   'Fredoka One', cursive;
    --font-body:      'Nunito', sans-serif;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Background Blobs (host) ---------- */
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: .18;
    animation: floatBlob 20s ease-in-out infinite alternate;
}
.blob-1 { width: 600px; height: 600px; background: var(--primary);   top: -10%; left: -5%;  }
.blob-2 { width: 500px; height: 500px; background: var(--secondary); bottom: -15%; right: -8%; animation-delay: -7s; }
.blob-3 { width: 400px; height: 400px; background: var(--accent);    top: 40%; left: 50%; animation-delay: -13s; }
@keyframes floatBlob {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, -40px) scale(1.15); }
}

/* ---------- Screen System ---------- */
#app { position: relative; z-index: 1; min-height: 100vh; }
.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 30px 40px;
    text-align: center;
}

/* ======================================================================
   KEYFRAME ANIMATIONS
   ====================================================================== */
@keyframes fadeIn       { from { opacity:0 } to { opacity:1 } }
@keyframes fadeInUp     { from { opacity:0; transform:translateY(40px) } to { opacity:1; transform:translateY(0) } }
@keyframes fadeInDown   { from { opacity:0; transform:translateY(-40px)} to { opacity:1; transform:translateY(0) } }
@keyframes bounceIn {
    0%   { opacity:0; transform:scale(0) }
    50%  { opacity:1; transform:scale(1.25) }
    70%  { transform:scale(.9) }
    100% { transform:scale(1) }
}
@keyframes scaleIn {
    from { opacity:0; transform:scale(0) rotate(-12deg) }
    to   { opacity:1; transform:scale(1) rotate(0) }
}
@keyframes slideUp      { from { opacity:0; transform:translateY(100%) } to { opacity:1; transform:translateY(0) } }
@keyframes slideInLeft  { from { opacity:0; transform:translateX(-60px)} to { opacity:1; transform:translateX(0) } }
@keyframes slideInRight { from { opacity:0; transform:translateX(60px) } to { opacity:1; transform:translateX(0) } }
@keyframes pulse        { 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.06) } }
@keyframes pulseFast    { 0%,100%{ transform:scale(1); opacity:1 } 50%{ transform:scale(1.12); opacity:.8 } }
@keyframes shake        { 0%,100%{ transform:translateX(0) } 20%{ transform:translateX(-6px) } 40%{ transform:translateX(6px) } 60%{ transform:translateX(-4px) } 80%{ transform:translateX(4px) } }
@keyframes float        { 0%,100%{ transform:translateY(0) } 50%{ transform:translateY(-12px) } }
@keyframes glow         { 0%,100%{ box-shadow:0 0 20px rgba(255,107,157,.3) } 50%{ box-shadow:0 0 50px rgba(255,107,157,.6) } }
@keyframes trophy       { 0%{ transform:scale(0) rotate(-180deg) } 50%{ transform:scale(1.3) rotate(10deg) } 70%{ transform:scale(.9) rotate(-5deg) } 100%{ transform:scale(1) rotate(0) } }
@keyframes fillBar      { from { width:0 } }
@keyframes popIn        { 0%{ opacity:0; transform:scale(0) } 60%{ transform:scale(1.15) } 100%{ opacity:1; transform:scale(1) } }
@keyframes gradientShift {
    0%   { background-position: 0% 50% }
    50%  { background-position: 100% 50% }
    100% { background-position: 0% 50% }
}
@keyframes timerPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(255,71,87,.4) }
    50%     { box-shadow: 0 0 0 14px rgba(255,71,87,0) }
}

/* Utility classes */
.animate-fadeIn     { animation: fadeIn .5s ease both }
.animate-fadeInUp   { animation: fadeInUp .6s ease both }
.animate-fadeInDown { animation: fadeInDown .6s ease both }
.animate-bounceIn  { animation: bounceIn .6s cubic-bezier(.68,-.55,.265,1.55) both }
.animate-scaleIn   { animation: scaleIn .5s ease both }

/* ======================================================================
   HOST PAGE
   ====================================================================== */
.host-page {
    background: linear-gradient(-45deg, #0a0a2e, #151545, #1a0a3e, #0a1a3e);
    background-size: 400% 400%;
    animation: gradientShift 18s ease infinite;
}

/* --- Logo --- */
.logo {
    font-family: var(--font-display);
    font-size: clamp(3rem, 6vw, 5rem);
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.subtitle {
    font-size: 1.15rem;
    color: var(--text-dim);
    margin-bottom: 30px;
    font-weight: 600;
}

/* --- Lobby Layout --- */
.lobby-content {
    display: flex;
    gap: 60px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 1100px;
}
.join-section {
    display: flex;
    gap: 30px;
    align-items: center;
    background: var(--glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 30px 36px;
    backdrop-filter: blur(16px);
}
.qr-box { border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.qr-box canvas, .qr-box img { display: block; }
.join-details { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.label { font-size: .85rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.room-code {
    font-family: var(--font-display);
    font-size: 4rem;
    letter-spacing: 8px;
    background: linear-gradient(135deg, var(--accent), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.join-url {
    font-size: .95rem;
    color: var(--accent);
    word-break: break-all;
    font-weight: 700;
}

/* --- Players --- */
.players-section { flex: 1; min-width: 280px; }
.players-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.player-counter {
    background: var(--secondary);
    color: #fff;
    font-weight: 800;
    font-size: .85rem;
    padding: 2px 10px;
    border-radius: 99px;
}
.players-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}
.player-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: popIn .45s ease both;
}
.player-bubble .p-av {
    font-size: 2.8rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--glass);
    border: 2px solid var(--card-border);
}
.player-bubble .p-nm {
    font-size: .85rem;
    font-weight: 700;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-bubble.master .p-av { border-color: var(--warning); box-shadow: 0 0 14px rgba(255,170,0,.35); }
.player-bubble.master .p-nm::after { content: ' 👑'; }
.player-bubble.disconnected { opacity: .35; filter: grayscale(.6); }
.player-bubble.disconnected .p-nm::after { content: ' 📡'; }
.waiting-text { color: var(--text-dim); margin-top: 18px; animation: float 3s ease-in-out infinite; font-weight: 600; }

/* --- Writing Screen (Host) --- */
.top-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}
.round-pill {
    background: var(--glass);
    border: 1px solid var(--card-border);
    padding: 8px 22px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 1.1rem;
}
.emojis-display {
    display: flex;
    gap: 24px;
    margin: 20px 0 28px;
    flex-wrap: wrap;
    justify-content: center;
}
.emoji-char {
    font-size: clamp(5rem, 10vw, 9rem);
    animation: bounceIn .65s cubic-bezier(.68,-.55,.265,1.55) both;
    filter: drop-shadow(0 6px 20px rgba(0,0,0,.3));
    cursor: default;
}
.emoji-char:nth-child(1) { animation-delay: .1s }
.emoji-char:nth-child(2) { animation-delay: .28s }
.emoji-char:nth-child(3) { animation-delay: .46s }
.emoji-char:nth-child(4) { animation-delay: .64s }
.emoji-char:nth-child(5) { animation-delay: .82s }

.phase-prompt {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 30px;
}

/* Timer Circle */
.timer-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(0,212,255,.1);
    border: 5px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2.6rem;
    margin-bottom: 18px;
    transition: border-color .4s, background .4s, color .4s;
}
.timer-circle.small { width: 70px; height: 70px; font-size: 1.6rem; border-width: 4px; }
.timer-circle.warning { border-color: var(--warning); background: rgba(255,170,0,.12); color: var(--warning); }
.timer-circle.danger  { border-color: var(--danger); background: rgba(255,71,87,.12); color: var(--danger); animation: timerPulse 1s ease infinite; }

.submission-counter {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dim);
}

/* --- Voting Screen (Host) --- */
.emojis-reminder {
    display: flex;
    gap: 10px;
    font-size: 2rem;
}
.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 24px 0;
}
.answer-card {
    background: var(--glass);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 22px;
    text-align: left;
    animation: fadeInUp .5s ease both;
    transition: transform .2s, box-shadow .2s;
}
.answer-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.answer-card .a-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.answer-card .a-avatar { font-size: 2rem; }
.answer-card .a-name   { font-weight: 800; font-size: 1rem; }
.answer-card .a-text   {
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.5;
    color: #e0e0ff;
}

/* --- Results (Host) --- */
.results-title {
    font-family: var(--font-display);
    font-size: 2.4rem;
    margin-bottom: 8px;
    animation: fadeInDown .5s ease both;
}
.podium-wrapper {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 18px;
    margin: 32px 0 40px;
    flex-wrap: wrap;
}
.podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: clamp(180px, 22vw, 260px);
    animation: slideUp .7s ease both;
}
.podium-slot.place-1 { order: 2; }
.podium-slot.place-2 { order: 1; }
.podium-slot.place-3 { order: 3; }
.podium-slot .medal   { font-size: 2.4rem; margin-bottom: 6px; }
.podium-slot .p-avatar { font-size: 2.6rem; margin-bottom: 4px; }
.podium-slot .p-name   { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.podium-slot .p-answer { font-style: italic; font-size: .95rem; color: #ccc; margin-bottom: 8px; max-height: 60px; overflow: hidden; text-overflow: ellipsis; }
.podium-slot .p-votes  { font-weight: 700; font-size: .9rem; color: var(--accent); }
.podium-bar {
    width: 100%;
    border-radius: 14px 14px 0 0;
    margin-top: 8px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    animation: slideUp .8s ease both;
}
.place-1 .podium-bar { height: 160px; background: linear-gradient(180deg, #ffd700 0%, #ffaa00 100%); animation-delay: .4s; }
.place-2 .podium-bar { height: 115px; background: linear-gradient(180deg, #c0c0c0 0%, #909090 100%); animation-delay: .15s; }
.place-3 .podium-bar { height: 80px;  background: linear-gradient(180deg, #cd7f32 0%, #a0622e 100%); animation-delay: .0s; }

/* --- Scoreboard (Host) --- */
.scoreboard {
    width: 100%;
    max-width: 700px;
    margin-top: 10px;
}
.scoreboard-label {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 14px;
    text-align: left;
}
.score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    animation: slideInLeft .45s ease both;
}
.score-row .s-rank   { width: 32px; font-weight: 800; color: var(--text-dim); text-align: right; }
.score-row .s-avatar { font-size: 1.6rem; }
.score-row .s-name   { width: 120px; font-weight: 700; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-bar-wrap {
    flex: 1;
    height: 30px;
    background: rgba(255,255,255,.06);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}
.score-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    animation: fillBar .8s ease both;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    min-width: 40px;
}
.score-bar-fill .s-pts {
    font-weight: 800;
    font-size: .85rem;
    white-space: nowrap;
}
.score-bar-fill .s-delta {
    color: var(--success);
    font-size: .75rem;
    margin-left: 5px;
    font-weight: 700;
}

/* --- Final (Host) --- */
.final-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    background: linear-gradient(135deg, #ffd700, #ffaa00, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: trophy 1s ease both;
    margin-bottom: 24px;
}
.winner-spotlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    animation: scaleIn .7s ease both;
    animation-delay: .3s;
}
.winner-spotlight .w-avatar { font-size: 5rem; }
.winner-spotlight .w-name   {
    font-family: var(--font-display);
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.winner-spotlight .w-score {
    font-size: 1.2rem;
    color: var(--warning);
    font-weight: 800;
}
.best-answer-card {
    background: var(--glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px 32px;
    max-width: 600px;
    margin-bottom: 30px;
    backdrop-filter: blur(12px);
    animation: fadeInUp .6s ease both;
    animation-delay: .6s;
}
.best-answer-card .ba-label { font-size: .85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--warning); font-weight: 700; margin-bottom: 10px; }
.best-answer-card .ba-emojis { font-size: 1.6rem; margin-bottom: 8px; }
.best-answer-card .ba-text  { font-size: 1.2rem; font-style: italic; line-height: 1.5; margin-bottom: 8px; }
.best-answer-card .ba-author { font-weight: 700; color: var(--text-dim); }

/* ======================================================================
   PLAYER PAGE
   ====================================================================== */
.player-page {
    background: radial-gradient(ellipse at top, var(--bg2), var(--bg) 70%);
}
.player-page .screen {
    padding: 24px 20px;
    justify-content: flex-start;
    padding-top: 50px;
}

/* --- Leave button --- */
.btn-leave {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100;
    background: rgba(255,71,87,.15);
    border: 1px solid rgba(255,71,87,.35);
    color: var(--danger);
    font-size: .8rem;
    font-weight: 700;
    font-family: var(--font-body);
    padding: 7px 14px;
    border-radius: 99px;
    cursor: pointer;
    transition: all .2s;
}
.btn-leave:hover { background: rgba(255,71,87,.3); }

/* --- Toast --- */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: var(--danger);
    color: #fff;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    z-index: 9999;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 6px 24px rgba(255,71,87,.4);
    max-width: 90vw;
    text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); color: #0a0a2e; box-shadow: 0 6px 24px rgba(0,255,136,.3); }

/* --- Join Screen --- */
.p-logo { font-size: 4rem; margin-bottom: 4px; animation: bounceIn .7s ease both; }
.p-title {
    font-family: var(--font-display);
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 28px;
}
#join-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.input-field {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--card-border);
    background: var(--glass);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-body);
    text-align: center;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
    text-transform: uppercase;
}
.input-field::placeholder { color: var(--text-dim); text-transform: none; }
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,212,255,.15); }
#player-name { text-transform: none; }
.field-label { font-size: .85rem; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; text-align: left; }

/* Avatar picker */
.avatar-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 4px;
}
.avatar-btn {
    font-size: 1.8rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--glass);
    cursor: pointer;
    transition: transform .2s, border-color .2s, box-shadow .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-btn:hover { transform: scale(1.12); }
.avatar-btn.selected {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(0,212,255,.35);
    transform: scale(1.12);
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 800;
    font-family: var(--font-body);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, opacity .2s;
    color: #fff;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 20px rgba(255,107,157,.35);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 28px rgba(255,107,157,.5); }
.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--success));
    color: #0a0a2e;
    box-shadow: 0 4px 20px rgba(0,212,255,.3);
}
.btn-accent:hover:not(:disabled) { box-shadow: 0 6px 28px rgba(0,212,255,.5); }
.btn-join { margin-top: 8px; }
.btn-start { margin-top: 16px; width: 100%; font-size: 1.25rem; padding: 16px; }
.btn-next  { width: 100%; margin-top: 16px; font-size: 1.15rem; padding: 15px; }

/* --- Player Lobby --- */
.p-welcome {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    margin-bottom: 16px;
    animation: fadeInDown .5s ease both;
}
.p-my-avatar { font-size: 2.4rem; }
.master-badge {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a0a2e;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    margin-bottom: 16px;
    animation: bounceIn .6s ease both;
}
.p-waiting {
    color: var(--text-dim);
    font-weight: 600;
    animation: float 3s ease-in-out infinite;
    margin-bottom: 20px;
}

/* Rounds picker */
.rounds-picker {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 6px;
}
.round-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
    background: var(--glass);
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all .2s;
}
.round-btn:hover { border-color: var(--accent); }
.round-btn.active {
    border-color: var(--accent);
    background: rgba(0,212,255,.18);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(0,212,255,.25);
}

/* --- Player Writing --- */
.p-emojis {
    display: flex;
    gap: 12px;
    font-size: 3rem;
    margin-bottom: 14px;
    flex-wrap: wrap;
    justify-content: center;
}
.p-emojis .emoji-char {
    font-size: 3rem;
}
.timer-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: rgba(255,255,255,.08);
    border-radius: 99px;
    margin-bottom: 18px;
    overflow: hidden;
}
.timer-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transition: width .9s linear, background .4s;
    width: 100%;
}
.timer-fill.warning { background: linear-gradient(90deg, var(--warning), #ff8800); }
.timer-fill.danger  { background: linear-gradient(90deg, var(--danger), #ff2222); }

.answer-textarea {
    width: 100%;
    max-width: 400px;
    min-height: 100px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--card-border);
    background: var(--glass);
    color: var(--text);
    font-size: 1.05rem;
    font-family: var(--font-body);
    resize: vertical;
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}
.answer-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255,107,157,.12); }
.char-counter {
    font-size: .8rem;
    color: var(--text-dim);
    margin: 4px 0 12px;
    font-weight: 600;
}
.status-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
    animation: bounceIn .5s ease both;
    margin-top: 16px;
}
.check-icon { font-size: 2rem; }
.waiting-counter { font-size: .9rem; color: var(--text-dim); font-weight: 600; }

/* --- Player Voting --- */
.p-section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 14px;
}
.vote-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 420px;
}
.vote-card {
    background: var(--glass);
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all .25s;
    animation: fadeInUp .4s ease both;
}
.vote-card:hover { border-color: rgba(255,255,255,.2); }
.vote-card.selected {
    border-color: var(--accent);
    background: rgba(0,212,255,.1);
    box-shadow: 0 0 18px rgba(0,212,255,.2);
}
.vote-card .vc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.vote-card .vc-avatar  { font-size: 1.5rem; }
.vote-card .vc-name    { font-weight: 700; font-size: .9rem; color: var(--text-dim); }
.vote-card .vc-text    { font-size: 1.05rem; line-height: 1.4; }

/* --- Player Results --- */
.p-results-list {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}
.p-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    animation: fadeInUp .4s ease both;
}
.p-result-row .pr-rank { font-family: var(--font-display); font-size: 1.3rem; width: 36px; text-align: center; }
.p-result-row .pr-av   { font-size: 1.6rem; }
.p-result-row .pr-info { flex: 1; text-align: left; }
.p-result-row .pr-name { font-weight: 700; font-size: .95rem; }
.p-result-row .pr-text { font-size: .8rem; color: var(--text-dim); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.p-result-row .pr-score { font-weight: 800; color: var(--accent); font-size: 1.1rem; }

/* --- Player Final --- */
#p-final-content {
    width: 100%;
    max-width: 420px;
    text-align: center;
}
#p-final-content .pf-winner { font-size: 3rem; margin-bottom: 4px; }
#p-final-content .pf-name   { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 4px; }
#p-final-content .pf-score  { color: var(--warning); font-weight: 800; margin-bottom: 18px; }
#p-final-content .pf-best   { background: var(--glass); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 18px; }
#p-final-content .pf-best-label { font-size: .8rem; text-transform: uppercase; color: var(--warning); font-weight: 700; margin-bottom: 6px; }
#p-final-content .pf-best-text  { font-style: italic; line-height: 1.4; }
#p-final-content .pf-board       { text-align: left; }
.pf-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--card-border); font-weight: 600; align-items: center; }
.pf-row .pf-r { width: 24px; color: var(--text-dim); }
.pf-row .pf-a { font-size: 1.3rem; }
.pf-row .pf-n { flex: 1; }
.pf-row .pf-s { color: var(--accent); font-weight: 800; }

/* ======================================================================
   DECODER MODE STYLES
   ====================================================================== */

/* --- Category pill --- */
.decoder-category-pill {
    display: inline-block;
    background: linear-gradient(135deg, rgba(196,77,255,.2), rgba(0,212,255,.2));
    border: 1px solid rgba(196,77,255,.3);
    padding: 6px 18px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 1rem;
    margin: 8px 0;
    animation: fadeIn .4s ease both;
}

/* --- Clue giver spotlight (host) --- */
.decoder-clue-giver-spotlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 20px 0;
    animation: scaleIn .6s ease both;
}
.decoder-clue-giver-spotlight .dcg-avatar { font-size: 4rem; }
.decoder-clue-giver-spotlight .dcg-name  { font-family: var(--font-display); font-size: 1.8rem; }
.decoder-clue-giver-spotlight .dcg-label { color: var(--text-dim); font-weight: 600; font-size: 1rem; }

/* --- Correct guess feed (host + player) --- */
.decoder-correct-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
    max-width: 500px;
}
.dc-feed-entry {
    background: rgba(0,255,136,.1);
    border: 1px solid rgba(0,255,136,.25);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dc-feed-avatar { font-size: 1.3rem; }

/* --- Decoder results (host) --- */
.decoder-reveal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    background: var(--glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px 32px;
    animation: fadeInUp .5s ease both;
}
.decoder-reveal .dr-category { font-size: .9rem; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.decoder-reveal .dr-emojis   { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.decoder-reveal .dr-answer   {
    font-family: var(--font-display);
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--warning), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.decoder-clue-giver-result {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,170,0,.1);
    border: 1px solid rgba(255,170,0,.25);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    margin: 12px 0;
    animation: fadeInUp .4s ease both;
}
.decoder-guessers-list {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.dcr-guesser-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    animation: fadeInUp .4s ease both;
}
.dcr-medal  { font-size: 1.3rem; width: 30px; text-align: center; }
.dcr-avatar { font-size: 1.5rem; }
.dcr-name   { flex: 1; font-weight: 700; }
.dcr-label  { color: var(--text-dim); font-size: .85rem; font-weight: 600; }
.dcr-pts    { font-weight: 800; color: var(--success); }

/* --- Player: title card (clue giver) --- */
.decoder-title-card {
    background: linear-gradient(135deg, rgba(255,170,0,.12), rgba(255,107,157,.12));
    border: 2px solid rgba(255,170,0,.3);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 14px;
    animation: bounceIn .6s ease both;
}
.decoder-title-card .dtc-category { font-size: .85rem; color: var(--text-dim); font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }
.decoder-title-card .dtc-title    { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 6px; }
.decoder-title-card .dtc-hint     { font-size: .9rem; color: var(--text-dim); font-weight: 600; }

/* --- Player: emoji composer --- */
.decoder-emoji-composer {
    width: 100%;
    max-width: 420px;
}
.dec-selected {
    min-height: 56px;
    background: var(--glass);
    border: 2px dashed var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    transition: border-color .25s;
}
.dec-selected:has(.dec-selected-emoji) {
    border-style: solid;
    border-color: var(--accent);
}
.dec-placeholder { color: var(--text-dim); font-size: .9rem; font-weight: 600; }
.dec-selected-emoji {
    font-size: 2rem;
    cursor: pointer;
    transition: transform .15s;
    animation: popIn .3s ease both;
}
.dec-selected-emoji:hover { transform: scale(1.2); }

/* emoji-picker-element dark theme */
.dec-emoji-picker-el {
    width: 100%;
    --background: rgba(0,0,0,.15);
    --border-color: var(--card-border);
    --input-border-color: var(--card-border);
    --indicator-color: var(--accent);
    --category-font-color: var(--text-dim);
    --input-font-color: var(--text-main);
    --input-placeholder-color: var(--text-dim);
    --emoji-size: 1.6rem;
    --num-columns: 8;
    --border-radius: var(--radius-sm);
    --input-border-radius: var(--radius-sm);
    --input-padding: 8px 12px;
    max-height: 260px;
    border-radius: var(--radius-sm);
}

/* --- Decoder loading spinner --- */
.decoder-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    text-align: center;
    animation: fadeInUp .5s ease both;
}
.decoder-loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255,255,255,.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.decoder-loading-text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text-main);
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
.decoder-clue-giver-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 24px;
}

/* --- Player: waiting for clue giver --- */
.decoder-waiting-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    animation: fadeInUp .5s ease both;
    width: 100%;
    max-width: 320px;
}
.decoder-waiting-card .dw-avatar { font-size: 3rem; }
.decoder-waiting-card .dw-name   { font-family: var(--font-display); font-size: 1.3rem; }
.decoder-waiting-card .dw-label  { color: var(--text-dim); font-weight: 600; }

/* --- Player: guess input --- */
.decoder-guess-input-wrap {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 420px;
    margin: 14px 0 8px;
}
.decoder-guess-input-wrap .input-field { flex: 1; margin: 0; }

.decoder-guess-feedback {
    min-height: 28px;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    transition: color .3s;
}
.decoder-guess-feedback.correct { color: var(--success); animation: bounceIn .4s ease; }
.decoder-guess-feedback.wrong   { color: var(--danger); animation: shake .4s ease; }

.decoder-guess-history {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    max-width: 420px;
    max-height: 120px;
    overflow-y: auto;
}
.gh-entry {
    font-size: .85rem;
    color: var(--text-dim);
    padding: 4px 10px;
    background: rgba(255,255,255,.03);
    border-radius: 6px;
    text-decoration: line-through;
    opacity: .6;
}

/* ======================================================================
   RESPONSIVE
   ====================================================================== */
@media (max-width: 768px) {
    .host-page .screen { padding: 20px; }
    .lobby-content { gap: 30px; }
    .join-section { flex-direction: column; padding: 20px; }
    .room-code { font-size: 2.8rem; }
    .emojis-display { gap: 14px; }
    .emoji-char { font-size: 4rem !important; }
    .answers-grid { grid-template-columns: 1fr; }
    .podium-slot { width: 140px; }
    .place-1 .podium-bar { height: 120px; }
    .place-2 .podium-bar { height: 85px; }
    .place-3 .podium-bar { height: 60px; }
}
