/* Nitronedge Live — phone UI (mobile-first) */
html, body { height: 100%; overscroll-behavior: none; }
body { position: fixed; inset: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
input { user-select: text; -webkit-user-select: text; }

#app {
  position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ── top bar ── */
.top {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: rgba(17, 21, 25, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); flex: none;
}
.top .mk { height: 26px; width: auto; }
.top .who { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.top .who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.top .av { font-size: 22px; }
.top .pts { font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; background: var(--panel-2); border-radius: 99px; padding: 4px 12px; }
.top .pts:empty { display: none; }
.top .pts small { font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 4px; }

/* ── screens ── */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 18px 16px; animation: fade .25s both; }
.screen.center { align-items: center; justify-content: center; text-align: center; gap: 10px; }
.screen h2 { margin: 6px 0 2px; font-size: clamp(24px, 7vw, 34px); line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
.muted { color: var(--muted); margin: 4px 0; line-height: 1.45; }
.small { font-size: 13px; }
.emoji-xl { font-size: 76px; line-height: 1; filter: drop-shadow(0 8px 20px rgba(0,0,0,.4)); }
.btn.big { width: 100%; font-size: 19px; padding: 16px; }

/* ── join ── */
.join { justify-content: center; align-items: center; gap: 14px; overflow-y: auto; }
.join .logo { width: min(78vw, 330px); height: auto; }
.join .tag { margin: -4px 0 6px; letter-spacing: .32em; font-size: 12px; font-weight: 800; color: var(--amber); }
.join .note { background: rgba(242,101,34,.15); border: 1px solid rgba(242,101,34,.4); padding: 10px 14px; border-radius: 12px; font-weight: 700; margin: 0; }
.card {
  width: min(100%, 420px); background: rgba(255,255,255,.07); border: 1px solid var(--line);
  border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.card label { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card input {
  width: 100%; font-size: 22px; font-weight: 800; text-align: center; padding: 14px; border-radius: 14px;
  background: #fff; color: #14181d; border: 3px solid transparent; outline: none;
}
.card input:focus { border-color: var(--amber); }
#pin { font-size: 34px; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.pin-chip { align-self: center; font-size: 13px; color: var(--muted); background: var(--panel); padding: 6px 12px; border-radius: 99px; }
.pin-chip b { color: var(--text); letter-spacing: .12em; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avatars button { font-size: 26px; aspect-ratio: 1; border-radius: 12px; background: var(--panel); transition: transform .15s, background .15s; }
.avatars button.on { background: var(--grad); transform: scale(1.1); box-shadow: 0 0 0 3px rgba(247,148,29,.35); }
.hint { font-size: 13px; color: var(--muted); text-align: center; max-width: 320px; }

/* ── lobby ── */
.big-av { font-size: 96px; animation: pop .6s cubic-bezier(.2,1.4,.4,1) both, float 3s 0.6s ease-in-out infinite; }
.up-next { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 20px; margin-top: 10px; }
.up-next small { color: var(--amber); font-weight: 800; letter-spacing: .15em; text-transform: uppercase; font-size: 11px; }
.up-next b { font-size: 19px; }
.up-next span { color: var(--muted); font-size: 14px; }
.waiting { margin-top: 12px; font-weight: 700; color: var(--muted); }
.waiting i { font-style: normal; animation: fade 1s infinite alternate; }
.waiting i:nth-child(2) { animation-delay: .3s; } .waiting i:nth-child(3) { animation-delay: .6s; }
.mini { font-size: 14px; color: var(--muted); }
.loader { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--panel-2); border-top-color: var(--orange); animation: spin .8s linear infinite; }

/* ── intro ── */
.qnum { font-weight: 900; font-size: 18px; color: var(--amber); letter-spacing: .04em; }
.qnum span { color: var(--muted); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.badge { background: var(--panel-2); border-radius: 99px; padding: 6px 12px; font-weight: 800; font-size: 14px; }
.badge.dbl { background: var(--grad); color: #1b0f06; animation: pulse 1s ease-in-out infinite; }
.qtext { font-size: clamp(22px, 6.4vw, 30px) !important; max-width: 560px; }
.ring { position: relative; width: 108px; height: 108px; margin-top: 12px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .trk { stroke: var(--panel-2); }
.ring .prog { stroke: var(--orange); stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 0; transition: stroke-dashoffset .1s linear; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; font-weight: 900; }

/* ── answering ── */
.answer { padding: 0; gap: 0; }
.timer { height: 8px; background: var(--panel); flex: none; }
.timer i { display: block; height: 100%; background: var(--grad); transform-origin: left; transition: transform .1s linear; }
.timer i.hurry { background: var(--bad); animation: pulse .5s infinite; }
.q-mini { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px 8px; flex: none; }
.q-mini b { flex: none; min-width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-size: 20px; font-variant-numeric: tabular-nums; }
.q-mini p { margin: 0; font-weight: 700; font-size: 16px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.tiles { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 12px 14px; }
.tiles.n2 { grid-template-columns: 1fr; }
.tiles.n3 .tile:last-child { grid-column: 1 / -1; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--c); border-radius: 20px; padding: 14px 10px; min-height: 0;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.22), 0 6px 16px rgba(0,0,0,.25);
  transition: transform .1s, filter .2s; animation: pop .45s cubic-bezier(.2,1.4,.4,1) both;
}
.tile:active { transform: scale(.96); }
.tile .shape { width: 38px; height: 38px; }
.tile .t { font-weight: 800; font-size: clamp(15px, 4.4vw, 20px); line-height: 1.25; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile.chosen { transform: scale(1.03); }
.tf-ic { font-size: 48px; font-weight: 900; line-height: 1; color: #fff; }
.tiles.tf .t { font-size: 26px; }

.type-form, .slider-form { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
.type-form input {
  width: 100%; font-size: 22px; font-weight: 800; padding: 18px; border-radius: 16px; text-align: center;
  background: #fff; color: #14181d; border: 3px solid transparent; outline: none;
}
.type-form input:focus { border-color: var(--amber); }
.slider-form { align-items: stretch; text-align: center; }
.slider-form output { font-size: clamp(54px, 18vw, 84px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.slider-form .unit { color: var(--muted); font-weight: 800; margin-top: -8px; }
.slider-form input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 99px; background: var(--grad); outline: none; margin: 14px 0 0; }
.slider-form input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.4), 0 0 0 6px rgba(242,101,34,.35); }
.slider-form input[type=range]::-moz-range-thumb { width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: 14px; }
.nudge { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nudge .btn { font-size: 26px; padding: 10px; }

/* ── locked in ── */
.orbit { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.orbit span { font-size: 64px; animation: float 2s ease-in-out infinite; }
.orbit i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--orange); animation: spin 1.4s linear infinite; }
.orbit i:nth-child(2) { inset: 14px; border-top-color: var(--amber); animation-duration: 1.9s; animation-direction: reverse; }
.orbit i:nth-child(3) { inset: 28px; border-top-color: var(--peach); animation-duration: 2.6s; }
.you-said { margin: 0; font-size: 17px; }

/* ── results ── */
.result.good { background: radial-gradient(circle at 50% 30%, rgba(25,179,107,.55), rgba(25,179,107,.12) 60%, transparent 80%); }
.result.bad { background: radial-gradient(circle at 50% 30%, rgba(229,72,77,.5), rgba(229,72,77,.1) 60%, transparent 80%); }
.burst { width: 110px; height: 110px; border-radius: 50%; background: var(--good); display: grid; place-items: center; box-shadow: 0 0 0 12px rgba(25,179,107,.25), 0 0 0 26px rgba(25,179,107,.12); }
.burst.x { background: var(--bad); box-shadow: 0 0 0 12px rgba(229,72,77,.25), 0 0 0 26px rgba(229,72,77,.12); }
.burst svg { width: 64px; height: 64px; }
.burst path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .5s .2s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.plus { font-size: 54px; font-weight: 900; font-variant-numeric: tabular-nums; }
.streak { background: var(--panel-2); border-radius: 99px; padding: 8px 16px; font-weight: 800; }
.answer-was { font-size: 18px; margin: 4px 0; }
.rankline { background: rgba(0,0,0,.28); border-radius: 14px; padding: 10px 16px; margin-top: 10px; font-size: 16px; }

.place { font-size: clamp(72px, 26vw, 120px); font-weight: 900; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.move { font-weight: 900; padding: 6px 14px; border-radius: 99px; }
.move.up { background: rgba(25,179,107,.2); color: #4be09b; }
.move.down { background: rgba(229,72,77,.2); color: #ff8a8d; }
.score-big { font-size: 22px; color: var(--muted); }
.score-big b { color: var(--text); font-size: 32px; font-variant-numeric: tabular-nums; }
.final.winner .emoji-xl { font-size: 110px; animation: pop .6s cubic-bezier(.2,1.4,.4,1) both, float 2.5s .6s ease-in-out infinite; }

.stat-row { display: flex; gap: 12px; }
.stat-row div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 18px; display: flex; flex-direction: column; }
.stat-row b { font-size: 26px; font-variant-numeric: tabular-nums; }
.stat-row small { color: var(--muted); font-size: 12px; }
.top3 { list-style: none; padding: 0; margin: 6px 0; width: min(100%, 360px); display: flex; flex-direction: column; gap: 6px; }
.top3 li { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 12px; padding: 8px 12px; text-align: left; }
.top3 li b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* short / landscape phones */
@media (max-height: 560px) {
  .emoji-xl { font-size: 52px; }
  .big-av { font-size: 60px; }
  .tile .shape { width: 26px; height: 26px; }
  .tile { gap: 4px; padding: 8px; }
  .orbit { width: 100px; height: 100px; } .orbit span { font-size: 40px; }
  .ring { width: 80px; height: 80px; } .ring b { font-size: 30px; }
}
@media (min-width: 700px) {
  .tiles { padding: 14px 24px 24px; gap: 14px; }
}
