/* All sizes are design pixels on a 1080 × 1920 canvas. */

@font-face {
  font-family: 'Montserrat';
  src: url('../assets/fonts/montserrat-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: block;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../assets/fonts/montserrat-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-display: block;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
                 U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
                 U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
                 U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --blue:      #0a6ec4;
  --blue-dark: #07508f;
  --cyan:      #17a8dc;
  --lime:      #a6d93a;
  --ink:       #06335c;
  --white:     #fff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #041f38;
  font-family: 'Montserrat', sans-serif;
  color: var(--white);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
body.no-cursor, body.no-cursor * { cursor: none !important; }

#stage {
  position: fixed; left: 50%; top: 50%;
  width: 1080px; height: 1920px;
  transform-origin: 0 0;
  overflow: hidden;
  background: linear-gradient(180deg, #0b7bd4 0%, var(--blue) 55%, var(--blue-dark) 100%);
}
.swirls { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.screen { position: absolute; inset: 0; }
img { -webkit-user-drag: none; }

/* ── shared ─────────────────────────────────────────────────────── */

.title {
  position: absolute; left: 0; width: 100%;
  text-align: center; font-weight: 900; font-style: italic; line-height: 1;
  text-shadow: 0 8px 0 rgba(0,0,0,.22);
}
.title span { display: block; color: var(--lime); }

.logo {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 32px; padding: 14px 20px; object-fit: contain;
}

.btn {
  position: absolute; border: 0; cursor: pointer;
  font-family: inherit; font-weight: 900; color: var(--white);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; text-align: center;
}
.btn:active { filter: brightness(.86); }
.btn:disabled { opacity: .4; }
.btn--main {
  left: 190px; width: 700px; height: 140px; border-radius: 70px;
  background: var(--lime); color: var(--ink); font-size: 56px; letter-spacing: 2px;
  box-shadow: 0 12px 0 #6f9a17;
}
.btn--main:active { transform: translateY(6px); box-shadow: 0 6px 0 #6f9a17; }
.btn--ghost {
  border: 4px solid rgba(255,255,255,.7); border-radius: 50px;
  background: rgba(3,45,82,.55); font-size: 32px; height: 100px;
}

/* ── leaderboard ────────────────────────────────────────────────── */

#admin-corner, #admin-back-corner { position: absolute; left: 0; top: 0; width: 150px; height: 150px; z-index: 5; }

.logo--home { top: 40px; width: 300px; height: 250px; }
.title--home { top: 320px; font-size: 104px; }
.title--home span { font-size: 80px; }
#board-heading { position: absolute; top: 545px; width: 100%; text-align: center; font-size: 56px; font-weight: 800; letter-spacing: 6px; }

#board { position: absolute; left: 70px; top: 640px; width: 940px; list-style: none; }
#board li {
  display: flex; align-items: center; height: 96px; margin-bottom: 10px;
  padding: 0 36px; border-radius: 24px; background: rgba(3,45,82,.55);
  font-size: 44px; font-weight: 700;
}
#board li .rank  { width: 100px; color: var(--lime); font-weight: 900; }
#board li .name  { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#board li .score { font-weight: 900; margin-left: 20px; }
#board li.you { background: var(--white); color: var(--ink); }
#board li.you .rank { color: var(--blue); }
#board li.apart { margin-top: 24px; }
#board-empty { position: absolute; top: 880px; width: 100%; text-align: center; font-size: 42px; font-weight: 600; opacity: .85; }

#btn-new { top: 1710px; }

/* ── details ────────────────────────────────────────────────────── */

.btn--corner { left: 40px; top: 40px; width: 220px; }
.title--reg { top: 180px; font-size: 76px; }
.field-label { position: absolute; left: 0; width: 100%; text-align: center; font-size: 34px; font-weight: 800; letter-spacing: 3px; }
.field {
  position: absolute; left: 110px; width: 860px; height: 140px; border-radius: 70px;
  background: var(--white); color: var(--ink); border: 8px solid transparent;
  display: flex; align-items: center; justify-content: center; padding: 0 56px;
  font-size: 56px; font-weight: 700; white-space: pre; overflow: hidden; cursor: pointer;
}
.field:empty::before { content: attr(data-ph); color: #9ab0c4; }
.field.is-active { border-color: var(--lime); }
.field.is-active::after { content: ''; width: 5px; height: 64px; background: var(--blue); margin-left: 6px; animation: blink 1s steps(1) infinite; }
.field.is-active:empty::before { order: 2; margin-left: 6px; }
@keyframes blink { 50% { opacity: 0; } }

#reg-msg { position: absolute; top: 925px; width: 100%; text-align: center; font-size: 36px; font-weight: 700; color: #ffe45c; }
#btn-start { top: 1020px; }

.kb {
  position: absolute; left: 0; bottom: 0; width: 1080px; height: 640px;
  padding: 30px 14px; background: #052c50; border-top: 6px solid var(--lime); z-index: 3;
}
.kb-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.key {
  width: 94px; height: 130px; border: 0; border-radius: 16px;
  background: var(--white); color: var(--ink);
  font-family: inherit; font-size: 48px; font-weight: 800; cursor: pointer;
  touch-action: none;
}
.key.is-down { background: var(--lime); }
.key--wide  { width: 180px; font-size: 36px; }
.key--space { width: 620px; font-size: 36px; }
.key--go    { background: var(--lime); }
.kb--num .key { width: 300px; font-size: 62px; }

/* ── the six balls ──────────────────────────────────────────────── */

#game-player { position: absolute; top: 70px; width: 100%; padding: 0 60px; text-align: center; font-size: 60px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#game-total-wrap { position: absolute; top: 170px; width: 100%; text-align: center; font-size: 46px; font-weight: 800; letter-spacing: 3px; }
#game-total { display: inline-block; min-width: 200px; margin-left: 20px; font-size: 130px; font-weight: 900; color: var(--lime); vertical-align: middle; }

#balls { position: absolute; left: 45px; top: 360px; width: 990px; display: flex; justify-content: space-between; list-style: none; }
#balls li { width: 145px; text-align: center; }
#balls .ball { width: 145px; height: 145px; animation: pop .4s backwards; }
#balls li:nth-child(2) .ball { animation-delay: .06s; }
#balls li:nth-child(3) .ball { animation-delay: .12s; }
#balls li:nth-child(4) .ball { animation-delay: .18s; }
#balls li:nth-child(5) .ball { animation-delay: .24s; }
#balls li:nth-child(6) .ball { animation-delay: .30s; }
@keyframes pop { from { transform: scale(0); } }
#balls li.is-now .ball { box-shadow: 0 0 0 10px var(--white); }
#balls li.is-done .ball { background: var(--white); }
#balls li.is-done .ball::before, #balls li.is-done .ball::after { display: none; }
#balls .ball span { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 64px; font-weight: 900; color: var(--ink); }

.ball {
  position: relative; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #f8ffa8 0%, #d7f23a 40%, #9cc20e 100%);
}
.ball::before, .ball::after {
  content: ''; position: absolute; top: -5%; width: 70%; height: 110%;
  border: 4px solid rgba(255,255,255,.85); border-radius: 50%;
}
.ball::before { left: -45%; }
.ball::after  { right: -45%; }

#drop { position: absolute; left: 0; top: 570px; width: 1080px; height: 520px; }
.ball--big { position: absolute !important; left: 380px; top: 160px; width: 320px; height: 320px; }
.ball--big::before, .ball--big::after { border-width: 9px; }
.ball--big.is-falling { animation: fall .75s both; }
@keyframes fall {
  0%   { transform: translateY(-720px) rotate(-200deg); animation-timing-function: cubic-bezier(.5,0,1,1); }
  55%  { transform: translateY(0) rotate(0);            animation-timing-function: cubic-bezier(0,0,.5,1); }
  75%  { transform: translateY(-90px) rotate(18deg);    animation-timing-function: cubic-bezier(.5,0,1,1); }
  100% { transform: translateY(0) rotate(25deg); }
}
#shadow { position: absolute; left: 390px; top: 470px; width: 300px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.22); z-index: -1; }

#ball-caption { position: absolute; top: 1105px; width: 100%; text-align: center; font-size: 58px; font-weight: 900; font-style: italic; }
#ask { position: absolute; top: 1190px; width: 100%; text-align: center; font-size: 36px; font-weight: 800; letter-spacing: 4px; color: var(--lime); }

#runs { position: absolute; left: 70px; top: 1260px; width: 940px; display: flex; flex-wrap: wrap; gap: 36px; }
.run {
  width: 452px; height: 200px; border: 0; border-radius: 40px; cursor: pointer;
  background: var(--white); color: var(--ink);
  font-family: inherit; font-size: 108px; font-weight: 900;
  box-shadow: 0 12px 0 rgba(0,0,0,.25);
}
.run:active { background: var(--lime); transform: translateY(6px); box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.run:disabled { opacity: .45; }

#btn-undo   { left: 70px;  top: 1770px; width: 452px; }
#btn-cancel { left: 558px; top: 1770px; width: 452px; }

/* ── final score ────────────────────────────────────────────────── */

.logo--result { top: 80px; width: 340px; height: 290px; }
#res-name { position: absolute; top: 450px; width: 100%; padding: 0 60px; text-align: center; font-size: 64px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-label { position: absolute; top: 580px; width: 100%; text-align: center; font-size: 70px; font-weight: 900; font-style: italic; color: var(--lime); }
#res-score { position: absolute; top: 670px; width: 100%; text-align: center; font-size: 360px; font-weight: 900; line-height: 1.1; text-shadow: 0 14px 0 rgba(0,0,0,.22); animation: pop .5s; }
#res-balls { position: absolute; left: 45px; top: 1140px; width: 990px; display: flex; justify-content: center; gap: 24px; list-style: none; }
#res-balls li { width: 140px; height: 140px; border-radius: 50%; background: var(--white); color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: 58px; font-weight: 900; }
#btn-board { top: 1430px; }
#btn-fix { left: 340px; top: 1630px; width: 400px; }

/* ── operator ───────────────────────────────────────────────────── */

#scr-admin { background: #052c50; }
.admin-title { position: absolute; top: 60px; width: 100%; text-align: center; font-size: 62px; font-weight: 900; }
#adm-pending { position: absolute; top: 150px; width: 100%; text-align: center; font-size: 28px; color: #ffe45c; }
.adm-label { position: absolute; left: 70px; font-size: 32px; font-weight: 800; color: var(--lime); letter-spacing: 3px; }
.adm-row { position: absolute; left: 70px; width: 940px; height: 100px; display: flex; gap: 36px; }
.adm-row .btn { position: static; width: 452px; }
.adm-row .btn.is-on { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.adm-row .btn.is-armed { background: #c62828; border-color: #ff8a80; }
#adm-today { position: absolute; left: 70px; top: 500px; font-size: 150px; font-weight: 900; }
#adm-days { position: absolute; left: 70px; top: 710px; width: 940px; height: 660px; overflow: hidden; }
#adm-days div { display: flex; justify-content: space-between; padding: 14px 24px; font-size: 34px; font-weight: 600; border-bottom: 2px solid rgba(255,255,255,.15); }
#adm-msg { position: absolute; top: 1570px; width: 100%; padding: 0 60px; text-align: center; font-size: 30px; color: #ffe45c; }
#adm-back { top: 1710px; }
