:root {
    color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #e9f8fc; overflow-x: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.game-bg {
    background:
        radial-gradient(circle at 10% 0%, rgba(255,255,255,.95), rgba(255,255,255,0) 34%),
        radial-gradient(circle at 95% 20%, rgba(127,209,237,.35), rgba(127,209,237,0) 30%),
        linear-gradient(135deg, #f6fdff 0%, #e6f6fb 48%, #fefcf8 100%);
}
.game-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: .16;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
    pointer-events: none;
}

.orb { position: absolute; border-radius: 999px; filter: blur(2px); opacity: .45; animation: floatOrb 9s ease-in-out infinite; }
.orb-a { width: 340px; height: 340px; background: rgba(98, 204, 239, .28); top: -120px; right: -80px; }
.orb-b { width: 260px; height: 260px; background: rgba(255, 200, 87, .18); bottom: -80px; left: -70px; animation-delay: -3s; }
.orb-c { width: 180px; height: 180px; background: rgba(255, 111, 125, .12); top: 42%; left: 6%; animation-delay: -6s; }
@keyframes floatOrb { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(18px,-20px,0) scale(1.04); } }

.game-panel {
    border: 1px solid rgba(255,255,255,.88);
    background: rgba(255,255,255,.72);
    box-shadow: 0 22px 60px rgba(17,80,120,.14), inset 0 1px 0 rgba(255,255,255,.85);
    backdrop-filter: blur(18px);
}

.plaid-strip {
    background-color: #d9f0f8;
    background-image:
        linear-gradient(90deg, transparent 0 22%, rgba(58,161,207,.38) 22% 31%, transparent 31% 53%, rgba(58,161,207,.26) 53% 61%, transparent 61% 100%),
        linear-gradient(0deg, transparent 0 32%, rgba(11,111,164,.9) 32% 43%, transparent 43% 100%);
}

.logo-spark { display: grid; place-items: center; position: relative; border: 1px solid rgba(255,255,255,.9); }
.logo-spark::before, .logo-spark::after { content: ''; position: absolute; border: 2px solid #1179b5; border-radius: 999px; opacity: .35; }
.logo-spark::before { width: 42px; height: 42px; }
.logo-spark::after { width: 56px; height: 56px; border-style: dashed; animation: spinSlow 18s linear infinite; }
.logo-spark span { position: relative; z-index: 1; font-size: 34px; color: #1179b5; animation: sparklePulse 2.6s ease-in-out infinite; }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes sparklePulse { 0%,100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.18) rotate(8deg); } }

.feature-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.65); padding: 9px 12px; border-radius: 999px; box-shadow: 0 8px 22px rgba(17,80,120,.08); backdrop-filter: blur(12px); }
.feature-pill svg { width: 17px; height: 17px; color: #1179b5; }

.action-card { min-height: 132px; display: flex; align-items: center; gap: 13px; border: 1px solid rgba(17,121,181,.10); background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(235,248,253,.75)); padding: 18px; border-radius: 26px; box-shadow: 0 10px 30px rgba(16,93,131,.08); transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.action-card:hover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(16,93,131,.14); border-color: rgba(17,121,181,.22); }
.action-icon { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; border-radius: 16px; box-shadow: 0 7px 16px rgba(17,121,181,.13); }
.action-icon svg { width: 22px; height: 22px; }

.primary-btn, .secondary-btn, .icon-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 16px; font-weight: 900; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease; }
.primary-btn { background: linear-gradient(135deg, #1179b5, #0c6599); color: white; padding: 12px 18px; box-shadow: 0 10px 22px rgba(17,121,181,.22); }
.primary-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 15px 28px rgba(17,121,181,.28); }
.secondary-btn { background: rgba(255,255,255,.76); color: #123044; border: 1px solid rgba(255,255,255,.9); padding: 11px 16px; box-shadow: 0 8px 20px rgba(17,80,120,.08); backdrop-filter: blur(12px); }
.secondary-btn:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.danger-btn { border-color: #fecdd3; background: #fff1f2; color: #be123c; }
.danger-btn:hover:not(:disabled) { background: #ffe4e6; }
.icon-btn { width: 44px; height: 44px; justify-content: center; background: rgba(255,255,255,.74); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 8px 20px rgba(17,80,120,.08); }
.icon-btn:hover { background: white; transform: translateY(-1px); }
.primary-btn:disabled, .secondary-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.primary-btn svg, .secondary-btn svg, .icon-btn svg { width: 19px; height: 19px; }

.modal-card { border: 0; box-shadow: 0 35px 100px rgba(6,35,52,.32); }
.modal-card[open] { animation: modalIn .22s cubic-bezier(.2,.8,.2,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.field-label { display: grid; gap: 8px; font-size: 14px; font-weight: 900; color: #334155; }
.game-input { width: 100%; border: 1px solid #d7e5eb; border-radius: 17px; background: #fafdff; padding: 13px 15px; font-size: 16px; font-weight: 800; color: #123044; outline: none; transition: border .18s, box-shadow .18s, background .18s; }
.game-input:focus { border-color: #7fd1ed; background: white; box-shadow: 0 0 0 4px rgba(127,209,237,.22); }
.number-control { display: grid; grid-template-columns: 44px 1fr 44px; overflow: hidden; border: 1px solid #d7e5eb; border-radius: 17px; background: #fafdff; }
.number-control button { display: grid; place-items: center; color: #1179b5; transition: background .18s; }
.number-control button:hover { background: #eaf8fd; }
.number-control input { width: 100%; border: 0; border-inline: 1px solid #d7e5eb; background: transparent; padding: 12px 4px; text-align: center; font-weight: 900; outline: none; appearance: textfield; }
.number-control input::-webkit-inner-spin-button, .number-control input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.number-control svg { width: 18px; height: 18px; }

.room-card { border: 1px solid rgba(17,121,181,.10); background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(243,251,254,.76)); padding: 18px; border-radius: 26px; box-shadow: 0 10px 28px rgba(17,80,120,.07); transition: transform .2s ease, box-shadow .2s ease; animation: cardIn .35s both; }
.room-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(17,80,120,.12); }
.stat-mini { display: grid; gap: 1px; border-radius: 15px; background: #f3fbfe; padding: 10px 7px; text-align: center; }
.stat-mini strong { font-family: 'Fredoka', sans-serif; font-size: 17px; }
.stat-mini span { font-size: 10px; font-weight: 900; color: #718096; text-transform: uppercase; letter-spacing: .04em; }

.avatar { display: grid; place-items: center; border-radius: 999px; color: white; font-weight: 900; box-shadow: inset 0 0 0 2px rgba(255,255,255,.45); }
.player-card { display: flex; align-items: center; gap: 12px; border: 1px solid rgba(17,121,181,.10); background: rgba(255,255,255,.78); border-radius: 20px; padding: 12px 14px; box-shadow: 0 8px 20px rgba(17,80,120,.06); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 18px; background: #f4fbfe; padding: 13px 15px; }
.setting-row span { display: inline-flex; align-items: center; gap: 9px; font-weight: 900; color: #64748b; }
.setting-row svg { width: 18px; height: 18px; color: #1179b5; }
.setting-row strong { font-family: 'Fredoka', sans-serif; font-size: 20px; }

.waiting-dots { display: flex; align-items: center; gap: 7px; padding: 13px; }
.waiting-dots span { width: 9px; height: 9px; border-radius: 999px; background: #1179b5; animation: dotBounce 1.15s infinite ease-in-out; }
.waiting-dots span:nth-child(2) { animation-delay: .12s; }
.waiting-dots span:nth-child(3) { animation-delay: .24s; }
@keyframes dotBounce { 0%,60%,100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-7px); opacity: 1; } }

.question-card { position: relative; margin: 0 auto; width: min(100%, 760px); min-height: min(68vh, 720px); border-radius: 44px; padding: 10px; background: linear-gradient(145deg, #dff4fb, #cfeaf4); box-shadow: 0 28px 75px rgba(11,75,112,.20), 0 0 0 1px rgba(255,255,255,.75); overflow: hidden; }
.question-card::before { content: ''; position: absolute; inset: 0; opacity: .35; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E"); pointer-events: none; }
.question-card-inner { position: relative; z-index: 1; min-height: inherit; display: flex; flex-direction: column; align-items: center; padding: 34px 36px 30px; }
.question-border { position: absolute; inset: 12px; border: 2px solid rgba(18,48,68,.86); border-radius: 34px; pointer-events: none; }
.question-kicker { font-family: 'Fredoka', sans-serif; font-size: 15px; font-weight: 600; letter-spacing: .08em; }
.question-sparkle { position: relative; width: 155px; height: 155px; margin-top: 25px; display: grid; place-items: center; color: #123044; }
.question-sparkle::before, .question-sparkle::after { content: ''; position: absolute; width: 105px; height: 105px; border: 3px solid currentColor; border-radius: 999px; opacity: .85; clip-path: polygon(0 0, 100% 0, 100% 36%, 77% 36%, 77% 64%, 100% 64%, 100% 100%, 0 100%, 0 64%, 23% 64%, 23% 36%, 0 36%); }
.question-sparkle::after { border-style: dotted; transform: rotate(35deg) scale(1.13); opacity: .55; animation: spinSlow 16s linear infinite; }
.spark-big { font-size: 76px; line-height: 1; animation: sparklePulse 2.8s ease-in-out infinite; }
.spark-a, .spark-b { position: absolute; font-size: 29px; }
.spark-a { right: 6px; top: 20px; }
.spark-b { left: 11px; bottom: 14px; }
.question-text { max-width: 650px; margin-top: 8px; text-align: center; font-family: 'Fredoka', sans-serif; font-size: clamp(26px, 4vw, 40px); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.answer-area { width: min(100%, 560px); margin-top: auto; padding-top: 28px; }
.answer-input { width: 100%; border: 2px solid rgba(18,48,68,.18); border-radius: 20px; background: rgba(255,255,255,.78); padding: 16px 64px 16px 17px; font-size: 17px; font-weight: 900; color: #123044; outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 20px rgba(17,80,120,.08); transition: border .2s, box-shadow .2s, transform .2s; }
.answer-input:focus { border-color: #1179b5; box-shadow: 0 0 0 5px rgba(17,121,181,.12), 0 10px 24px rgba(17,80,120,.10); transform: translateY(-1px); }
.answer-submit { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); display: grid; width: 45px; height: 45px; place-items: center; border-radius: 15px; background: #1179b5; color: white; box-shadow: 0 8px 18px rgba(17,121,181,.22); transition: transform .18s, background .18s; }
.answer-submit:hover { background: #0d699f; transform: translateY(-50%) scale(1.04); }
.answered-state { margin-top: auto; width: min(100%, 560px); align-items: center; gap: 14px; border-radius: 23px; background: rgba(255,255,255,.70); padding: 17px 18px; box-shadow: 0 8px 20px rgba(17,80,120,.08); }
.answered-check { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 16px; background: #dcfce7; color: #16a34a; }

.timer-ring { --progress: 1; position: relative; width: 148px; height: 148px; border-radius: 50%; background: conic-gradient(#1179b5 calc(var(--progress) * 1turn), rgba(17,121,181,.10) 0); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(17,121,181,.08); }
.timer-ring::before { content: ''; position: absolute; inset: 8px; border-radius: inherit; background: rgba(255,255,255,.94); box-shadow: inset 0 0 0 1px rgba(17,121,181,.08); }
.timer-core { position: relative; z-index: 1; display: grid; place-items: center; }
.timer-core span { line-height: .95; }
.timer-core small { margin-top: 4px; }
.timer-ring.urgent { animation: timerPulse .7s infinite alternate; }
.timer-ring.urgent { background: conic-gradient(#ff6f7d calc(var(--progress) * 1turn), rgba(255,111,125,.10) 0); }
@keyframes timerPulse { to { transform: scale(1.035); box-shadow: 0 0 0 10px rgba(255,111,125,.08); } }

.side-player { display: flex; align-items: center; gap: 9px; border-radius: 16px; padding: 8px; transition: background .2s; }
.side-player.answered { background: #ecfdf5; }
.side-player .avatar { width: 34px; height: 34px; font-size: 12px; }

.reveal-panel { margin: 18px auto 0; width: min(100%, 760px); border: 1px solid rgba(255,255,255,.9); border-radius: 34px; background: rgba(255,255,255,.82); padding: 25px; text-align: center; box-shadow: 0 20px 55px rgba(17,80,120,.14); backdrop-filter: blur(18px); animation: revealIn .46s cubic-bezier(.2,.9,.2,1) both; }
@keyframes revealIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.result-good, .result-strike { display: inline-flex; align-items: center; gap: 8px; border-radius: 18px; padding: 10px 14px; font-weight: 900; }
.result-good { background: #dcfce7; color: #166534; }
.result-strike { background: #ffe4e6; color: #be123c; }
.answer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 17px; background: #f8fbfd; padding: 10px 12px; text-align: left; }
.answer-row.majority { background: #e7f8ef; box-shadow: inset 0 0 0 1px #bbf7d0; }

.score-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto auto; align-items: center; gap: 11px; border-radius: 19px; background: #f7fbfd; padding: 11px 13px; }
.score-row.is-me { box-shadow: inset 0 0 0 2px rgba(17,121,181,.22); background: #eef9fd; }
.rank-badge { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 11px; background: white; font-family: 'Fredoka', sans-serif; font-weight: 700; box-shadow: 0 4px 10px rgba(17,80,120,.08); }
.rank-badge.top { background: linear-gradient(145deg, #ffd76a, #f5b93b); color: #fff; }
.strike-dots { display: flex; gap: 3px; }
.strike-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff6f7d; box-shadow: 0 0 0 3px rgba(255,111,125,.10); }

.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { display: flex; align-items: flex-start; gap: 10px; border: 1px solid rgba(255,255,255,.9); border-radius: 19px; background: rgba(255,255,255,.94); padding: 13px 14px; box-shadow: 0 18px 45px rgba(17,80,120,.18); backdrop-filter: blur(16px); animation: toastIn .24s cubic-bezier(.2,.8,.2,1) both; }
.toast.success .toast-icon { background: #dcfce7; color: #16a34a; }
.toast.error .toast-icon { background: #ffe4e6; color: #e11d48; }
.toast.info .toast-icon { background: #e0f2fe; color: #0284c7; }
.toast-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 12px; }
.toast-icon svg { width: 17px; height: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(15px); } to { opacity: 1; transform: none; } }

.animate-enter { animation: enter .55s cubic-bezier(.2,.8,.2,1) both; }
.animate-enter-delayed { animation: enter .55s .12s cubic-bezier(.2,.8,.2,1) both; }
.game-card-enter { animation: gameCardIn .55s cubic-bezier(.2,.9,.2,1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes gameCardIn { from { opacity: 0; transform: translateY(22px) rotateX(5deg) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 1023px) {
    .question-card { min-height: 620px; }
}
@media (max-width: 640px) {
    .question-card { min-height: 590px; border-radius: 34px; }
    .question-card-inner { padding: 27px 24px 23px; }
    .question-border { border-radius: 27px; }
    .question-sparkle { width: 125px; height: 125px; margin-top: 18px; }
    .spark-big { font-size: 62px; }
    .question-text { margin-top: 2px; }
    .timer-ring { width: 124px; height: 124px; }
}
