html, body { min-height: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
#app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: env(safe-area-inset-top) 16px calc(76px + env(safe-area-inset-bottom)); }
.small { font-size: 14px; }

.topbar { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.me { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 8px; min-height: 44px; max-width: 60%; }
.me .emo { font-size: 26px; line-height: 1; }
.me .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.score { margin-left: auto; color: var(--muted); font-size: 15px; }
.score b { color: var(--text); font-family: var(--head); font-weight: 600; font-size: 18px; }
.status { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--magenta); color: var(--ink); font-weight: 700; border-radius: 999px; padding: 4px 14px; font-size: 14px; z-index: 5; }
.status:empty { display: none; }

#view { flex: 1; display: flex; flex-direction: column; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px 0; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .14em; font-size: 13px; font-weight: 700; margin: 0; }
h1 { font-size: 28px; line-height: 1.15; }
.huge { font-size: 40px; }
.you-big { font-size: 84px; line-height: 1; }

.primary { background: var(--blue); color: var(--ink); border: 0; border-radius: 14px; font-weight: 700; font-size: 18px; padding: 14px 22px; min-height: 52px; }
.primary:disabled { opacity: .4; }
.primary.big { width: 100%; font-size: 20px; min-height: 58px; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 48px; color: var(--muted); width: 100%; }
.link { background: none; border: 0; color: var(--blue-soft); text-decoration: underline; padding: 8px; min-height: 40px; }

/* Join */
.join { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 24px; }
.join .logo { width: 200px; height: auto; margin: 8px auto 4px; display: block; }
.join h1, .join > p { text-align: center; margin: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emo-btn { aspect-ratio: 1; font-size: 26px; line-height: 1; background: var(--card); border: 2px solid transparent; border-radius: 12px; padding: 0; min-height: 40px; }
.emo-btn[aria-checked="true"] { border-color: var(--blue); background: #1d3a5c; box-shadow: 0 0 0 3px rgba(39,165,218,.25); }
.emo-btn:disabled { opacity: .18; }
@media (max-width: 360px) { .emoji-grid { grid-template-columns: repeat(6, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 15px; }
.field input { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 18px; color: var(--text); }

/* Question */
.question { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.qhead { display: flex; justify-content: space-between; color: var(--muted); font-weight: 500; }
.qhead #secs { font-family: var(--head); font-weight: 600; color: var(--text); }
.bar { height: 8px; background: var(--card); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--magenta), var(--blue)); border-radius: 99px; }
.qtext { font-family: var(--head); font-weight: 600; font-size: 21px; line-height: 1.3; margin: 4px 0; }
.answers { display: grid; gap: 10px; }
.ans { display: flex; align-items: center; gap: 14px; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px; min-height: 76px; font-size: 19px; font-weight: 500; }
.ans b { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line); font-family: var(--head); font-size: 20px; }
.ans:active:not(:disabled) { transform: scale(.98); }
.ans:disabled { opacity: .45; }
.ans.chosen, .ans.chosen:disabled { opacity: 1; border-color: var(--blue); background: #173452; }
.ans.chosen b { background: var(--blue); color: var(--ink); border-color: var(--blue); }
.lock { text-align: center; color: var(--blue-soft); font-weight: 500; }

/* Result */
.result .mark { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 64px; font-weight: 700; }
.result.good .mark { background: var(--blue); color: var(--ink); }
.result.bad .mark { background: var(--magenta); color: var(--ink); }
.result.none .mark { background: var(--card); color: var(--muted); }
.result .pts { font-family: var(--head); font-weight: 700; font-size: 44px; color: var(--blue); margin: 0; }

/* Standings */
.standings { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; }
.mine { display: flex; justify-content: space-between; align-items: baseline; background: var(--card); border-radius: 16px; padding: 18px 20px; font-family: var(--head); font-weight: 600; font-size: 22px; }
.mine .rank { font-size: 44px; color: var(--blue); }
.top { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.top li { display: grid; grid-template-columns: 30px 34px 1fr auto; align-items: center; gap: 8px; background: var(--panel); border-radius: 12px; padding: 10px 14px; }
.top li.me-row { outline: 2px solid var(--blue); }
.top .r { color: var(--muted); font-weight: 700; }
.top .e { font-size: 22px; }
.top .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .s { font-family: var(--head); font-weight: 600; }

/* Share */
.share { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 16px; }
.prompt { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.prompt.spot { border-color: var(--magenta); box-shadow: 0 0 0 2px rgba(207,93,164,.25); }
.prompt h2 { font-size: 19px; line-height: 1.3; }
.prompt .muted { margin: 0; }
.prompt textarea { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 17px; resize: vertical; }
.sent { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sent li { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--card); border-radius: 10px; padding: 6px 4px 6px 12px; font-size: 15px; }
.sent li span { overflow-wrap: anywhere; }

/* Tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(11,15,36,.94); border-top: 1px solid var(--line); backdrop-filter: blur(8px); justify-content: center; }
.tabs button { flex: 1; max-width: 260px; min-height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tabs button[aria-pressed="true"] { background: var(--blue); color: var(--ink); border-color: var(--blue); }
.badge { background: var(--magenta); color: var(--ink); border-radius: 99px; font-size: 13px; padding: 1px 8px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto; background: var(--text); color: var(--ink); border-radius: 14px; padding: 14px 16px; font-weight: 500; z-index: 10; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--card); border-top-color: var(--blue); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .ans:active:not(:disabled) { transform: none; } }

.logo-sm { width: 180px; height: auto; margin-bottom: 8px; }
