* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #46178f; color: #fff; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
input, textarea { font: inherit; }

.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 22px 18px 110px; text-align: center; }
.screen.mid { justify-content: center; }
.logo { font-size: 2rem; font-weight: 900; letter-spacing: -.5px; }
.sub { opacity: .88; font-size: 1.05rem; line-height: 1.4; max-width: 34em; }
.small { opacity: .75; font-size: .92rem; }
.card { background: #fff; color: #222; border-radius: 14px; padding: 18px; width: min(94vw, 440px); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 6px 0 rgba(0,0,0,.2); text-align: center; }
.card h2 { font-size: 1.15rem; }
.card input, .card textarea { font-size: 1.2rem; padding: 13px; border: 3px solid #ddd; border-radius: 10px; width: 100%; text-align: center; color: #222; background: #fff; }
.card textarea { text-align: left; min-height: 150px; resize: vertical; font-size: 1.1rem; line-height: 1.4; }
.card input:focus, .card textarea:focus { outline: none; border-color: #46178f; }
.card input.code { text-transform: uppercase; letter-spacing: .4em; font-weight: 900; }
.btn { background: #222; color: #fff; padding: 14px 22px; font-weight: 800; font-size: 1.1rem; border-radius: 10px; box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.light { background: #fff; color: #46178f; }
.btn.ghost { background: transparent; box-shadow: none; text-decoration: underline; font-weight: 600; padding: 8px; }
.btn.ghost.dark { color: #46178f; }
.err { color: #ffd0d6; font-weight: 700; min-height: 1.2em; }
.card .err { color: #c0102a; }
.info { background: rgba(255,255,255,.16); padding: 8px 14px; border-radius: 10px; font-weight: 600; }
.banner { position: fixed; top: 0; left: 0; right: 0; background: #e21b3c; text-align: center; padding: 6px; font-weight: 700; z-index: 20; }

.codebox { background: #fff; color: #46178f; border-radius: 16px; padding: 6px 26px; font-weight: 900; letter-spacing: .25em; font-size: 3.4rem; }
.codebox.tv { font-size: clamp(4rem, 12vw, 8rem); padding: 10px 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 900px; }
.chip { background: rgba(255,255,255,.18); padding: 6px 14px; border-radius: 30px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.chip.off { opacity: .45; }
.chip.ok { background: #2b9348; }
.chip button { background: none; opacity: .65; padding: 0 2px; }
.chip.tv { font-size: 1.4rem; padding: 8px 18px; }
.stepper { display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: 1.2rem; }
.stepper button { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: #46178f; font-size: 1.5rem; font-weight: 900; }

.quote { background: #fff; color: #222; border-radius: 16px; padding: 20px 20px; width: min(94vw, 640px); font-size: 1.3rem; font-weight: 700; line-height: 1.4; text-align: left; box-shadow: 0 6px 0 rgba(0,0,0,.2); white-space: pre-wrap; word-break: break-word; }
.quote.tv { width: min(92vw, 1100px); font-size: clamp(1.8rem, 4vw, 3.2rem); padding: 34px 40px; }
.quote::before { content: '«\00a0'; color: #46178f; } .quote::after { content: '\00a0»'; color: #46178f; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(94vw, 640px); }
.names button { background: #fff; color: #222; border-radius: 12px; padding: 16px 8px; font-weight: 800; font-size: 1.1rem; box-shadow: 0 4px 0 rgba(0,0,0,.25); word-break: break-word; }
.names button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.names button.sel { background: #2a6fdb; color: #fff; }
.progress { height: 10px; background: rgba(255,255,255,.25); border-radius: 5px; overflow: hidden; width: min(94vw, 640px); }
.progress i { display: block; height: 100%; background: #fff; transition: width .3s; }
.progress.tv { width: min(80vw, 900px); height: 16px; }

.big { font-size: 2.4rem; font-weight: 900; line-height: 1.1; }
.big.tv { font-size: clamp(2.6rem, 6vw, 5rem); }
.pts { font-size: 1.6rem; font-weight: 900; background: rgba(0,0,0,.25); padding: 6px 18px; border-radius: 30px; }
.result { width: min(94vw, 640px); border-radius: 14px; padding: 14px; font-weight: 800; font-size: 1.25rem; }
.result.good { background: #2b9348; } .result.bad { background: #e0344c; } .result.meh { background: rgba(255,255,255,.18); } .result.fool { background: #d99a00; }
.pop { animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.bars { display: flex; flex-direction: column; gap: 6px; width: min(94vw, 640px); }
.bars.tv { width: min(88vw, 900px); gap: 10px; }
.bar { display: flex; align-items: center; gap: 10px; font-weight: 700; text-align: left; }
.bar .nm { width: 7.5em; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .tr { flex: 1; background: rgba(255,255,255,.15); border-radius: 6px; height: 22px; overflow: hidden; }
.bar .tr i { display: block; height: 100%; background: rgba(255,255,255,.5); border-radius: 6px; }
.bar.win .tr i { background: #d99a00; }
.bars.tv .bar { font-size: 1.5rem; } .bars.tv .bar .tr { height: 32px; }

.board { display: flex; flex-direction: column; gap: 8px; width: min(94vw, 640px); }
.board.tv { width: min(90vw, 900px); }
.row { display: flex; align-items: center; gap: 12px; background: #fff; color: #222; padding: 10px 16px; border-radius: 12px; font-size: 1.15rem; font-weight: 800; }
.board.tv .row { font-size: 1.7rem; padding: 14px 22px; }
.row.me { outline: 4px solid #d99a00; }
.row .rk { width: 2.2ch; color: #46178f; }
.row .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.row .gain { color: #2b9348; font-size: .9em; }
.row .sc { font-variant-numeric: tabular-nums; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; height: 36vh; min-height: 230px; width: min(94vw, 700px); }
.pod { flex: 1; max-width: 220px; border-radius: 12px 12px 0 0; display: flex; flex-direction: column; align-items: center; padding: 12px 6px 0; font-weight: 900; animation: rise .9s ease-out backwards; }
.pod .medal { font-size: 2.6rem; } .pod .nm { font-size: 1.3rem; word-break: break-word; } .pod .sc { font-size: 1rem; opacity: .9; }
.pod.p1 { height: 100%; background: #d99a00; animation-delay: 1.2s; } .pod.p2 { height: 72%; background: #8a94a6; animation-delay: .6s; } .pod.p3 { height: 52%; background: #a8693a; animation-delay: 0s; }
.podium.tv .pod .nm { font-size: 2rem; } .podium.tv .pod .sc { font-size: 1.4rem; } .podium.tv { width: min(92vw, 1000px); min-height: 300px; }
@keyframes rise { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }

.orgbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(20,5,45,.92); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 10; }
.orgbar .btn { width: min(94vw, 440px); background: #d99a00; color: #1b0a33; }
.orgbar .btn:disabled { background: #888; }
.orgbar .hint { font-size: .85rem; opacity: .85; }
.orgbar .tag { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }

.tvwrap { min-height: 100vh; padding: 28px 40px 40px; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.tvwrap .top { align-self: stretch; display: flex; justify-content: space-between; font-weight: 800; font-size: 1.3rem; opacity: .9; }

.quote.tv.sm { font-size: clamp(1.3rem, 2.4vw, 2rem); padding: 18px 28px; }
.cols { display: flex; gap: 36px; width: min(96vw, 1240px); align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.cols > div { flex: 1 1 420px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.cols .big.tv { font-size: clamp(2.4rem, 5vw, 4rem); }
.cols .bars.tv, .cols .board.tv { width: 100%; }
.cols .bars.tv .bar { font-size: 1.25rem; } .cols .bars.tv .bar .tr { height: 26px; }
.cols .board.tv .row { font-size: 1.35rem; padding: 10px 18px; }
.foot { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.foot .btn.ghost { font-size: .8rem; opacity: .6; font-weight: 500; }
