:root {
  color-scheme: dark;
  --bg: #181b3d;
  --ink: #13152d;
  --panel: #282d57;
  --line: #444b79;
  --text: #fff7e6;
  --muted: #c4c9e6;
  --mint: #a4f3d9;
  --yellow: #ffde75;
  --peach: #ffbdad;
  --lavender: #d3c4ff;
  --danger: #ffc0c5;
  font: 16px system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 48% 0%, #2f3568, var(--bg) 42rem);
  color: var(--text);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
h1, h2, p { margin: 0; }
header { background: #191c3e; border-bottom: 2px solid #11142e; }
.topbar-inner {
  width: min(100%, 74rem);
  min-height: 4.25rem;
  margin-inline: auto;
  padding: .5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: max-content;
  font-size: 1.12rem;
  font-weight: 900;
  letter-spacing: -.025em;
}
.brand-icon, .team-icon, .section-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.45rem;
  height: 2.45rem;
  border: 2px solid var(--ink);
  border-radius: .82rem;
  background: var(--mint);
  color: var(--ink);
  font-size: 1.34rem;
  font-weight: 900;
  box-shadow: 0 2px 0 var(--ink);
}
.brand-icon { transform: rotate(-7deg); }
.brand-icon img { display: block; width: 2rem; height: auto; }
.account { display: flex; align-items: center; gap: .6rem; min-width: 0; }
#account-name { display: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-label { color: var(--muted); font-size: .81rem; text-align: right; }
main { width: min(100%, 74rem); margin-inline: auto; padding: 1.25rem 1rem 0; }
.intro { display: grid; gap: .95rem; margin-bottom: 1rem; }
h1 {
  font-size: clamp(2rem, 8.6vw, 3.8rem);
  line-height: .98;
  letter-spacing: -.065em;
  font-weight: 950;
}
.intro p { margin-top: .5rem; color: var(--muted); line-height: 1.4; }
.team-total {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .72rem;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}
.team-icon {
  border-color: var(--ink);
  border-radius: 50%;
  color: #fff7dd;
  background: #5142a0;
  box-shadow: inset 0 0 0 2px #cbbaff, 0 2px 0 var(--ink);
  font-size: 1.45rem;
  line-height: 1;
  transform: rotate(-12deg);
}
.team-total > div { flex: 1; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.team-total .muted { font-size: .9rem; font-weight: 800; }
.team-score { display: flex; gap: .36rem; align-items: baseline; font-weight: 850; }
.team-score strong { font-size: 1.68rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.layout { display: grid; gap: 1rem; align-items: start; }
.layout > * { min-width: 0; }
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 1.28rem;
  box-shadow: 0 4px 0 var(--ink);
}
.arena {
  grid-area: arena;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: .7rem;
  border-color: #686eac;
  background: #303664;
}
.layout { grid-template-areas: "arena" "roulette" "daily" "board" "feed"; }
.guest .layout { grid-template-areas: "arena" "entry" "board" "roulette" "feed"; }
.arena-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .38rem .55rem;
  padding: .15rem .1rem;
}
.eyebrow { color: var(--muted); font-size: .875rem; font-weight: 750; }
.score { display: flex; align-items: baseline; gap: .26rem; margin-top: .18rem; white-space: nowrap; color: var(--muted); }
.score strong { color: var(--text); font-size: 2rem; line-height: 1; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.score span { font-size: .86rem; }
.status { max-width: 100%; text-align: right; margin-left: auto; }
.status-title {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .25rem;
  padding: .33rem .52rem;
  border: 1px solid var(--ink);
  border-radius: .57rem;
  background: var(--lavender);
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.22;
  box-shadow: 0 2px 0 var(--ink);
}
.status-title strong { font-weight: 850; overflow-wrap: anywhere; }
.status-next { color: var(--muted); font-size: .78rem; margin-top: .28rem; }
.dolphin-stage {
  position: relative;
  min-height: 10.5rem;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid var(--ink);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 2px 2px, #1357752a 1.5px, transparent 2px) 0 0 / 19px 19px,
    radial-gradient(ellipse at 48% 41%, #e1fcda, #9cf0d9 53%, #72d4d7 100%);
}
.dolphin-stage::before, .dolphin-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border: 3px solid #f6ffe272;
  border-radius: 50%;
  width: 78%;
  height: 22%;
  left: 11%;
  bottom: -7%;
  transform: rotate(-5deg);
}
.dolphin-stage::after {
  width: 119%;
  height: 34%;
  left: -9%;
  bottom: -14%;
  transform: rotate(4deg);
  border-color: #317c984f;
}
.dolphin {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: inherit;
  padding: .2rem .4rem 1.75rem;
  border: 0;
  background: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.dolphin:focus-visible { outline-color: var(--ink); outline-offset: -5px; border-radius: .9rem; }
.dolphin img {
  display: block;
  width: min(100%, 28rem);
  height: auto;
  pointer-events: none;
  user-select: none;
  transform: rotate(-4deg);
  transition: transform 160ms ease;
  filter: drop-shadow(0 5px 0 #20577528);
}
.dolphin:active img { transform: translateY(3px) rotate(0) scale(.93); }
@media (hover: hover) {
  .dolphin:hover:not(:active) img { transform: translateY(-3px) rotate(-6deg) scale(1.025); }
}
.dolphin[aria-disabled="true"] { cursor: default; }
.arena-message {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  max-width: calc(100% - 1rem);
  bottom: .48rem;
  left: 50%;
  transform: translateX(-50%);
  padding: .27rem .66rem;
  border: 2px solid var(--ink);
  border-radius: .65rem;
  box-shadow: 0 2px 0 var(--ink);
  background: var(--yellow);
  color: var(--ink);
  text-align: center;
  line-height: 1.15;
  font-size: .875rem;
  font-weight: 850;
  width: max-content;
}
.click-indicator {
  pointer-events: none;
  position: absolute;
  z-index: 2;
  top: 45%;
  left: 55%;
  padding: .23rem .52rem;
  border: 2px solid var(--ink);
  border-radius: .58rem;
  background: var(--yellow);
  color: var(--ink);
  font-size: 1.13rem;
  font-weight: 900;
  opacity: 0;
}
.click-indicator.pop { animation: rise .65s ease-out; }
@keyframes rise {
  0% { opacity: 1; transform: translate(-50%, 0) rotate(-7deg); }
  100% { opacity: 0; transform: translate(-50%, -68px) rotate(-12deg); }
}
.arena-bottom { padding: .15rem .1rem .26rem; }
.meter-label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; color: var(--muted); font-size: .875rem; margin-bottom: .38rem; }
.meter-label strong { color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
progress {
  display: block;
  appearance: none;
  width: 100%;
  height: .66rem;
  overflow: hidden;
  border: 1px solid #11142e;
  border-radius: 99px;
  background: #191d3e;
  color: var(--mint);
}
progress::-webkit-progress-bar { background: #191d3e; }
progress::-webkit-progress-value { background: var(--mint); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--mint); border-radius: 99px; }
#entry { grid-area: entry; }
#daily { grid-area: daily; }
.board { grid-area: board; }
#roulette { grid-area: roulette; }
.roulette-feed { grid-area: feed; }
.side-panel { padding: .85rem; }
h2 { font-size: 1.24rem; font-weight: 900; line-height: 1.18; letter-spacing: -.026em; }
.panel-heading { display: flex; align-items: center; gap: .62rem; }
.panel-heading .lemon { background: var(--yellow); }
.panel-heading .peach { background: var(--peach); }
.side-panel p, dialog p { color: var(--muted); line-height: 1.45; margin-top: .52rem; }
form { display: grid; gap: .43rem; margin-top: .8rem; }
label { display: block; font-size: .9rem; font-weight: 750; }
input {
  min-width: 0;
  width: 100%;
  min-height: 2.8rem;
  padding: .55rem .65rem;
  background: #1b2045;
  color: var(--text);
  border: 1px solid #7178ae;
  border-radius: .7rem;
}
input::placeholder { color: #b6bedf; }
input:read-only { color: var(--muted); }
#pin-field label { margin-bottom: .36rem; }
.primary, .quiet { min-height: 2.8rem; padding: .48rem .7rem; border: 2px solid var(--ink); border-radius: .72rem; font-weight: 850; box-shadow: 0 2px 0 var(--ink); }
.primary { color: var(--ink); background: var(--mint); }
.primary:hover { background: #c4ffe8; }
.primary:disabled { opacity: .6; }
.primary:active, .quiet:active { transform: translateY(2px); box-shadow: none; }
form .primary { margin-top: .2rem; }
.quiet { color: var(--text); background: #383f70; }
.quiet:hover { background: #495183; }
.change-name { color: var(--muted); border-color: transparent; background: transparent; box-shadow: none; }
.daily-count { color: var(--muted); margin: .46rem 0; }
.daily-count strong { font-size: 1.72rem; color: var(--yellow); line-height: 1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
#reset-time { font-size: .875rem; }
.player-count { margin-left: auto; color: var(--muted); font-size: .88rem; font-weight: 750; }
#leaderboard { padding: 0; margin: .65rem 0 0; list-style: none; }
#leaderboard li {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .48rem;
  min-height: 3.15rem;
  padding: .32rem .25rem;
  border-bottom: 1px solid #484e7a;
}
#leaderboard li:last-child { border-bottom-color: transparent; }
#leaderboard li.self { border-radius: .6rem; background: #373e6f; }
.place {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: .47rem;
  background: #20264d;
  color: var(--muted);
  font-size: .87rem;
  font-weight: 850;
}
#leaderboard li:first-child .place { background: var(--yellow); color: var(--ink); }
.player-name { overflow-wrap: anywhere; font-weight: 720; line-height: 1.2; }
.leader-title { display: block; margin-top: .14rem; color: var(--muted); font-size: .8rem; font-weight: 500; }
.player-score { color: var(--mint); font-weight: 850; white-space: nowrap; font-variant-numeric: tabular-nums; }
.roulette-stage { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .75rem; margin-top: .8rem; }
.wheel-frame { position: relative; width: clamp(5rem, 24vw, 8rem); aspect-ratio: 1; padding: .18rem; border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 0 3px 0 var(--ink); }
.wheel-frame::before { content: ''; position: absolute; z-index: 1; inset: -.35rem auto auto 50%; transform: translateX(-50%); border-inline: .5rem solid transparent; border-top: 1rem solid var(--ink); }
.roulette-wheel { width: 100%; height: 100%; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: conic-gradient(#db5b77 0deg 165.6deg, #24243f 165.6deg 331.2deg, #65d8ad 331.2deg 360deg); }
.roulette-wheel::after { content: ''; width: 24%; aspect-ratio: 1; background: var(--yellow); border: 2px solid var(--ink); border-radius: 50%; }
.roulette-stage p { margin: 0; font-size: .9rem; }
.roulette-stage .roulette-result { margin-top: .4rem; font-weight: 800; color: var(--mint); }
.roulette-stage .roulette-result[data-tone="loss"], .roulette-stage .roulette-result[data-tone="error"] { color: var(--danger); }
#roulette-controls { min-inline-size: 0; border: 0; margin: 0; padding: 0; }
#roulette-controls:disabled { opacity: .8; }
#roulette-controls legend { padding: 0; margin-bottom: .35rem; font-size: .9rem; font-weight: 750; }
.roulette-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .32rem; }
.roulette-choice { position: relative; }
.roulette-choice input { position: absolute; opacity: 0; width: 1px; min-height: 0; height: 1px; }
.roulette-choice span { display: grid; align-content: center; justify-items: center; min-height: 3.2rem; padding: .2rem .15rem; border: 2px solid transparent; border-radius: .62rem; color: #fff7e6; text-align: center; line-height: 1.15; cursor: pointer; }
.roulette-choice small { margin-top: .15rem; font-weight: 650; }
.roulette-choice[data-color="red"] span { background: #9c3457; }
.roulette-choice[data-color="black"] span { background: #1a1c35; }
.roulette-choice[data-color="zero"] span { background: #255f52; }
.roulette-choice input:checked + span { border-color: var(--yellow); }
.roulette-choice input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }
.roulette-choice input:disabled + span { cursor: default; }
.bet-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: .45rem; margin-top: .55rem; }
.bet-controls input { margin-top: .18rem; }
.bet-controls .primary { line-height: 1.2; }
#roulette-history { list-style: none; padding: 0; margin: .55rem 0 0; max-height: 20rem; overflow: auto; }
#roulette-history li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .4rem; padding: .43rem .15rem; border-bottom: 1px solid var(--line); }
#roulette-history li:last-child { border-bottom-color: transparent; }
.round-detail { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; }
.round-delta { color: var(--mint); white-space: nowrap; }
.round-delta.loss { color: var(--peach); }
footer { display: flex; align-items: baseline; gap: .45rem; color: var(--muted); font-size: .85rem; padding: 1.1rem .15rem 1.3rem; }
footer > span { color: var(--mint); }
.dot { padding-inline: .2rem; }
.feedback, .side-panel .feedback, dialog .feedback { color: var(--danger); font-size: .9rem; }
.global-feedback { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1.5rem); background: #352448; border: 1px solid #916b91; z-index: 3; border-radius: .7rem; padding: .5rem .7rem; }
dialog { background: var(--panel); color: var(--text); border: 2px solid #686eac; border-radius: 1.2rem; box-shadow: 0 5px 0 var(--ink); padding: 1rem; width: min(28rem, calc(100% - 1.5rem)); }
dialog::backdrop { background: #10122bde; }
dialog h2 { margin-top: .6rem; }
dialog output { display: block; text-align: center; background: #191d3e; border: 2px solid var(--ink); border-radius: .65rem; padding: .53rem; margin: .85rem 0; color: var(--yellow); font: 850 1.95rem ui-monospace, monospace; letter-spacing: .16em; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.dialog-actions .primary { flex: 1; }
@media (min-width: 34rem) {
  #account-name { display: inline; }
  .arena, .side-panel { padding: 1rem; }
}
@media (min-width: 52rem) {
  main { padding: 1.7rem 1.5rem 0; }
  .topbar-inner { padding-inline: 1.5rem; }
  .intro { grid-template-columns: minmax(0, 1fr) minmax(13rem, 18rem); align-items: end; margin-bottom: 1.3rem; }
  .layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    grid-template-areas: "arena daily" "arena board" "roulette board" "feed board";
    column-gap: 1.25rem;
  }
  .guest .layout { grid-template-areas: "arena entry" "arena board" "roulette board" "feed board"; }
  .arena-top { padding-inline: .3rem; }
  .side-panel { padding: 1rem 1.12rem; }
  .dolphin { padding: .6rem .65rem 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
