:root {
  --ink: #f2efe6;
  --dim: #9aa693;
  --red: #d8352a;
  --green: #7fae3e;
  --plate: rgba(10, 18, 9, .82);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #061006; color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; touch-action: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#hud {
  position: fixed; top: 0; left: 0; right: 0;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-variant-numeric: tabular-nums; pointer-events: none; z-index: 5;
  text-shadow: 0 2px 10px rgba(0,0,0,.9);
}
#hud[hidden] { display: none; }
.hud-l { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.hud-c { font-size: 22px; letter-spacing: 2px; }
.hud-r { font-size: 19px; font-weight: 700; color: #ffd34a; min-width: 68px; text-align: right; }
.hud-r.pulse { animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }

.screen {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(20,40,16,.6), rgba(3,8,3,.94));
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.screen[hidden] { display: none; }
.plate {
  width: min(440px, 100%); background: var(--plate);
  border: 1px solid rgba(160,190,140,.16); border-radius: 22px;
  padding: 26px 22px 22px; text-align: center;
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
}
.plate.wide { width: min(560px, 100%); }
h1 { margin: 0 0 2px; font-size: 46px; letter-spacing: -.04em; font-weight: 900; line-height: .95; }
h1 span { display: block; color: var(--red); }
h2 { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.sub { margin: 0 0 16px; color: var(--dim); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.teaser { height: 150px; border-radius: 14px; overflow: hidden; margin: 0 0 16px; background: #0f1a0d; }
.teaser img { width: 100%; height: 100%; object-fit: cover; opacity: .95; }
.rules { font-size: 14px; line-height: 1.6; color: #d6dcce; margin: 0 0 20px; }
.rules b { color: var(--ink); }
button { font: inherit; cursor: pointer; }
.big {
  width: 100%; padding: 15px; border: 0; border-radius: 14px;
  background: var(--red); color: #fff; font-size: 19px; font-weight: 800;
  letter-spacing: .01em; box-shadow: 0 8px 0 #8d1d16;
  transition: transform .06s, box-shadow .06s;
}
.big:active { transform: translateY(4px); box-shadow: 0 4px 0 #8d1d16; }
.big.ghost { background: transparent; border: 1px solid rgba(200,220,180,.3); box-shadow: none; color: var(--ink); }
.row { display: flex; gap: 18px; justify-content: center; margin-top: 14px; }
.link { background: none; border: 0; color: var(--dim); font-size: 14px; text-decoration: underline; padding: 4px; }
.muted { text-decoration: none; }
.tiny { font-size: 11.5px; color: #6f7a68; margin: 14px 0 0; min-height: 14px; }

.bigtime { font-size: 58px; font-weight: 900; letter-spacing: -.045em; font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.statrow { display: flex; justify-content: space-around; margin: 0 0 16px; }
.statrow div { display: flex; flex-direction: column; }
.statrow b { font-size: 22px; font-weight: 800; }
.statrow span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.strip { font-size: 17px; line-height: 1.5; word-break: break-all; margin: 0 0 18px; min-height: 26px; }
#name-wrap { margin: 0 0 14px; }
#name {
  width: 100%; padding: 12px; border-radius: 12px; text-align: center; font: inherit;
  background: rgba(255,255,255,.07); border: 1px solid rgba(200,220,180,.25); color: var(--ink);
}
ol { list-style: none; margin: 0 0 18px; padding: 0; max-height: 50vh; overflow-y: auto; text-align: left; }
ol li { display: flex; gap: 12px; padding: 9px 10px; border-radius: 9px; font-variant-numeric: tabular-nums; }
ol li:nth-child(odd) { background: rgba(255,255,255,.04); }
ol li.me { background: rgba(216,53,42,.24); outline: 1px solid rgba(216,53,42,.5); }
ol li .r { width: 30px; color: var(--dim); text-align: right; }
ol li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol li .t { font-weight: 800; }

#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: rgba(12,20,10,.95); border: 1px solid rgba(180,210,160,.25);
  padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 30;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
