:root {
  --blue: #267cdf; --blue-ink: #1560cf; --blue-deep: #0b3f9e; --cyan: #2fd3ff; --navy: #0c1f47; --soft: rgba(12, 31, 71, .64); --line: rgba(12, 31, 71, .1);
  --card: rgba(255, 255, 255, .93); --gold: #ffb020; --red: #e5354b; --green: #19a862; --shadow: 0 14px 36px rgba(13, 50, 120, .2); --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e4f4ff; font: 15px/1.45 var(--sans); color: var(--navy); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
input { font: inherit; color: inherit; padding: 12px 16px; border: 2px solid var(--line); border-radius: 14px; background: #fff; min-width: 0; user-select: text; -webkit-user-select: text; }
h1 span, h2 span { color: var(--blue); }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.screen.dim { background: rgba(228, 244, 255, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.screen.side { place-items: center start; padding-left: max(20px, 5vw); pointer-events: none; }
.screen.side .panel { pointer-events: auto; }
#sHome { place-items: center start; padding-left: max(20px, 6vw); background: linear-gradient(90deg, rgba(11, 63, 158, .94), rgba(21, 96, 207, .78) 36%, rgba(38, 124, 223, 0) 66%); }
.hero .logo { display: block; width: 190px; margin-bottom: 18px; }
.hero h1, .hero p { color: #fff; }
.hero h1 span { color: var(--cyan); }
.hero { width: min(520px, 100%); }
.hero > small { font-weight: 800; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--blue-ink); }
.hero h1 { margin: 2px 0 8px; font-size: clamp(52px, 8vw, 92px); font-weight: 900; letter-spacing: -.04em; line-height: .95; }
.hero p { margin: 0 0 22px; max-width: 40ch; font-size: 17px; opacity: .9; }
.me { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 14px; padding: 10px 18px 10px 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); text-align: left; }
.me img { flex: none; width: 52px; height: 52px; margin: -4px 0; border-radius: 50%; background: #dcebff; object-fit: cover; }
.me span { flex: 1; min-width: 0; }
.me small { display: block; font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.me b { display: block; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me em { font-style: normal; font-weight: 700; font-size: 13px; color: var(--blue-ink); }
.menu { display: flex; flex-direction: column; gap: 10px; }
.cta { display: block; width: 100%; padding: 16px 24px; border-radius: 22px; background: linear-gradient(135deg, #2a80e2, #1560cf 55%, #0b3f9e); box-shadow: 0 12px 26px rgba(21, 96, 207, .4); font-weight: 800; font-size: 20px; color: #fff; text-align: left; transition: transform .12s; }
.cta small { display: block; margin-top: 2px; font-weight: 500; font-size: 13.5px; color: rgba(255, 255, 255, .85); }
.cta { border: 2px solid rgba(255, 255, 255, .35); }
.cta.alt { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.cta.alt small { color: var(--soft); }
.cta.small { width: auto; padding: 13px 28px; border-radius: 999px; font-size: 16px; text-align: center; }
.cta:hover { transform: translateY(-2px); }
.cta:disabled { background: #dbe5f3; box-shadow: none; color: var(--soft); cursor: default; transform: none; }
.ghost { padding: 12px 20px; border-radius: 999px; background: var(--card); box-shadow: 0 4px 14px rgba(13, 50, 120, .12); font-weight: 700; font-size: 14.5px; color: var(--blue-ink); }
.ghost:hover { background: #fff; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; margin-top: 18px; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.panel { display: flex; flex-direction: column; gap: 12px; width: min(380px, 100%); max-height: calc(100vh - 40px); padding: 26px; border-radius: 28px; background: var(--card); box-shadow: 0 24px 60px rgba(13, 50, 120, .28); overflow-y: auto; }
.panel.wide { width: min(880px, 100%); }
.panel h2 { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.panel h2 em { font-style: normal; color: var(--blue); }
.panel h3 { margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.panel h3 small { font-weight: 600; color: var(--soft); }
.panel label { margin-top: 6px; font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.kicker { font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-ink); }
.note { margin: 0; color: var(--soft); }
.avatars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.avatars button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px 16px; border-radius: 22px; background: #f1f6fd; border: 3px solid transparent; }
.avatars button:hover, .avatars button.on { border-color: var(--blue); background: #fff; box-shadow: 0 10px 24px rgba(38, 124, 223, .25); }
.avatars img { width: 100%; max-width: 150px; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(180deg, #cfe6ff, #eaf4ff); }
.avatars b { margin-top: 8px; font-size: 19px; font-weight: 800; }
.avatars small { font-size: 12.5px; color: var(--soft); text-align: center; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.people button { padding: 10px 14px; border-radius: 14px; background: #f1f6fd; text-align: left; }
.people button:hover, .people button.on { background: var(--blue); color: #fff; }
.people b { display: block; font-weight: 700; font-size: 14.5px; }
.people small { display: block; font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#whoOther { flex: 1; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line), inset -5px -7px 10px rgba(4, 30, 90, .25), inset 4px 5px 8px rgba(255, 255, 255, .5); }
.swatches button.on { box-shadow: 0 0 0 3px var(--blue), inset -5px -7px 10px rgba(4, 30, 90, .25), inset 4px 5px 8px rgba(255, 255, 255, .5); }
.tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.track { --c: var(--blue); display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; border-radius: 20px; background: #f1f6fd; border: 3px solid transparent; text-align: left; }
.track.on { border-color: var(--c); background: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 26%, transparent); }
.track canvas { width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; background: color-mix(in srgb, var(--c) 9%, #fff); }
.track b { font-size: 18px; font-weight: 800; }
.track small { font-size: 13px; color: var(--soft); }
.track em { font-style: normal; font-weight: 700; font-size: 12.5px; color: color-mix(in srgb, var(--c) 80%, #0c1f47); }
.tracks.compact .track canvas { display: none; }
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seg span { margin-right: 4px; font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.seg button { padding: 9px 16px; border-radius: 999px; background: #f1f6fd; font-weight: 700; font-size: 14px; color: var(--blue-ink); }
.seg button.on { background: var(--blue); color: #fff; }
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.players div { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: #f1f6fd; font-weight: 700; }
.players img { width: 34px; height: 34px; border-radius: 50%; background: #dcebff; }
.players em { font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-ink); }
.table { display: flex; flex-direction: column; gap: 6px; }
.table .r { display: grid; grid-template-columns: 34px 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 14px; border-radius: 14px; background: #f1f6fd; font-variant-numeric: tabular-nums; }
.table .r.mine { background: var(--blue); color: #fff; }
.table .r b { font-weight: 800; }
.table .r img { width: 30px; height: 30px; border-radius: 50%; background: #dcebff; }
.table .r span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.table .r em { font-style: normal; font-weight: 700; }
.table .r small { min-width: 78px; text-align: right; opacity: .7; }
.table .empty { padding: 14px; color: var(--soft); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
#sResults { place-items: center; background: linear-gradient(180deg, rgba(228, 244, 255, 0), rgba(228, 244, 255, .55)); }

/* ---------- hud ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hcard { position: absolute; padding: 10px 18px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.hplace { left: 18px; top: 18px; display: flex; align-items: baseline; gap: 4px; padding: 6px 20px 8px 8px; }
.hplace img { align-self: center; width: 74px; height: 74px; margin-right: 8px; border-radius: 50%; background: linear-gradient(180deg, #cfe6ff, #eaf4ff); }
.hplace b { font-size: 64px; font-weight: 900; letter-spacing: -.04em; line-height: 1; color: var(--blue); }
.hplace span { font-weight: 800; font-size: 20px; color: var(--soft); }
.hplace i { font-style: normal; }
.hlap { left: 50%; top: 18px; transform: translateX(-50%); display: flex; align-items: baseline; gap: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hlap small { font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.hlap b { font-size: 22px; font-weight: 900; }
.hlap span { font-size: 22px; font-weight: 800; color: var(--blue-ink); }
.hlap em { font-style: normal; font-weight: 700; font-size: 13px; color: var(--soft); }
.hmap { right: 18px; top: 18px; padding: 8px; background: rgba(255, 255, 255, .78); }
.hmap canvas { display: block; width: 180px; height: 180px; }
.hitem { position: absolute; left: 18px; bottom: 18px; display: flex; align-items: center; gap: 12px; }
.slot { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow), inset 0 0 0 5px #fff, inset 0 0 0 8px rgba(38, 124, 223, .25); font-size: 46px; line-height: 1; }
.slot.has { box-shadow: var(--shadow), inset 0 0 0 5px #fff, inset 0 0 0 9px var(--blue); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.itext b { display: block; font-weight: 800; font-size: 17px; color: #fff; text-shadow: 0 2px 8px rgba(12, 31, 71, .55); }
.itext small { display: block; font-weight: 600; font-size: 13px; color: #fff; text-shadow: 0 1px 6px rgba(12, 31, 71, .6); }
.htok { left: 126px; bottom: 122px; display: flex; align-items: center; gap: 7px; padding: 7px 16px 7px 9px; }
.htok b { font-size: 20px; font-weight: 900; }
.htok span { font-weight: 700; font-size: 13px; color: var(--soft); }
.ball { display: inline-block; width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff 0 12%, #6fb4ff 30%, var(--blue) 62%, var(--blue-deep)); }
.hspeed { position: absolute; right: 22px; bottom: 18px; text-align: right; color: #fff; text-shadow: 0 3px 12px rgba(12, 31, 71, .55); }
.hspeed b { font-size: 68px; font-weight: 900; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.hspeed span { margin-left: 6px; font-weight: 800; font-size: 18px; }
.charge { width: 210px; height: 12px; margin: 8px 0 0 auto; border-radius: 999px; background: rgba(255, 255, 255, .5); overflow: hidden; box-shadow: 0 3px 10px rgba(12, 31, 71, .25); }
.charge i { display: block; height: 100%; width: 0; border-radius: 999px; background: #fff; }
.hkeys { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 9px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 600; font-size: 13px; white-space: nowrap; transition: opacity .6s; }
.hkeys.off { opacity: 0; }
kbd { display: inline-block; margin: 0 3px 0 8px; padding: 2px 8px; border-radius: 7px; background: var(--navy); font: 700 12px var(--sans); color: #fff; }
#count { position: fixed; left: 50%; top: 42%; z-index: 12; transform: translate(-50%, -50%); font-size: min(34vw, 240px); font-weight: 900; letter-spacing: -.05em; line-height: 1; color: #fff; text-shadow: 0 10px 0 var(--blue-ink), 0 22px 50px rgba(12, 31, 71, .45); pointer-events: none; opacity: 0; }
#count.pop { animation: count .9s ease-out forwards; }
@keyframes count { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.85); } }
#wrong { position: fixed; left: 50%; top: 30%; z-index: 12; transform: translateX(-50%); padding: 12px 26px; border-radius: 999px; background: var(--red); font-weight: 800; font-size: 20px; color: #fff; box-shadow: var(--shadow); }
#toast { position: fixed; left: 50%; top: 104px; z-index: 30; transform: translate(-50%, -20px); padding: 12px 26px; border-radius: 999px; background: var(--navy); box-shadow: 0 14px 34px rgba(12, 31, 71, .4); font-weight: 800; font-size: 17px; color: #fff; opacity: 0; transition: opacity .25s, transform .3s; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .tracks, .cols { grid-template-columns: 1fr; }
  .avatars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .track canvas { display: none; }
  .hmap canvas { width: 110px; height: 110px; }
  .hplace b { font-size: 44px; }
  .hkeys { display: none; }
  .hspeed b { font-size: 44px; }
  .charge { width: 140px; }
}
