html,
body {
  margin: 0;
  padding: 0;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
  font-family: "Segoe UI", system-ui, sans-serif;
}

body[data-mode="popup"] {
  width: 288px;
  height: 512px;
  overflow: hidden;
}

body[data-mode="tab"] {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 700px at 50% 40%, #1a242c 0%, #0b0f14 62%, #07090c 100%);
}

.stage {
  position: relative;
  width: 288px;
  height: 512px;
  overflow: hidden;
}

body[data-mode="tab"] .stage {
  width: min(100vw, calc(100dvh * 288 / 512));
  height: min(100dvh, calc(100vw * 512 / 288));
  max-width: 432px;
  max-height: 768px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.55),
    0 0 0 3px #2a2118,
    0 0 0 7px #c4a574;
  border-radius: 4px;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: pointer;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ui {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
  background: rgba(8, 14, 22, 0.22);
}

.ui[hidden],
.sheet[hidden],
[hidden] {
  display: none !important;
}

.sheet {
  flex: 0 1 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
  border-radius: 10px;
  background: #f4ead0;
  box-shadow: 0 0 0 3px #c44a20, 0 6px 0 #3c3414;
  color: #3c3414;
  overflow: auto;
  max-height: 100%;
}

.sheet[hidden] {
  display: none !important;
}

.brand {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  align-self: center;
  border-radius: 8px;
  box-shadow: 0 0 0 2px #3c3414;
}

h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.lede,
.hello {
  margin: 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.35;
}

.hello {
  font-size: 13px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tabs button,
.go,
.ghost,
.mode {
  font: inherit;
  cursor: pointer;
  border: 0;
}

.tabs button {
  height: 28px;
  border-radius: 6px;
  background: #ded4a6;
  color: #3c3414;
  font-weight: 700;
  font-size: 12px;
}

.tabs button.on {
  background: #5cb83a;
  color: #fff;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input {
  height: 32px;
  border: 2px solid #3c3414;
  border-radius: 6px;
  padding: 0 8px;
  font: 14px/1 "Segoe UI", system-ui, sans-serif;
  background: #fffaf0;
  color: #1b140c;
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}

.err {
  margin: 0;
  color: #b42318;
  font-size: 11px;
  min-height: 14px;
}

.go,
#auth-go,
#hub-play {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #5cb83a;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 3px 0 #2f6e1c;
}

#pane-play,
#pane-board,
#pane-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ghost {
  height: 28px;
  background: transparent;
  color: #7a4a28;
  font-size: 12px;
  font-weight: 700;
}

.modes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 1px 8px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff8e4;
  box-shadow: inset 0 0 0 2px #c8bc8e;
  color: #3c3414;
}

.mode.on {
  background: #5cb83a;
  color: #fff;
  box-shadow: inset 0 0 0 2px #2f6e1c;
}

.mode-title {
  font-weight: 800;
  font-size: 13px;
}

.mode-sub {
  grid-column: 1;
  font-size: 10px;
  opacity: 0.85;
}

.mode-best {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 10px;
  text-transform: uppercase;
}

.mode-best b {
  display: block;
  font-size: 16px;
  text-align: right;
}

.live-line {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a8a8a;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.dot.on {
  background: #3dcc5a;
}

.dot.off {
  background: #c45a3a;
}

.hub-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}

.hub-tabs button {
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: #ded4a6;
  color: #3c3414;
  font: 700 11px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.hub-tabs button.on {
  background: #5cb83a;
  color: #fff;
}

.badge {
  display: inline-block;
  min-width: 14px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 8px;
  background: #e23;
  color: #fff;
  font-size: 9px;
  line-height: 14px;
}

.board-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.board-filters button {
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: #fff8e4;
  color: #3c3414;
  font: 700 9px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.board-filters button.on {
  background: #3c3414;
  color: #fff8e4;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.board li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff8e4;
  font-size: 12px;
}

.board li.me {
  background: #5cb83a;
  color: #fff;
}

.board .rank {
  font-weight: 800;
  font-size: 11px;
}

.board .who {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board .pts {
  font-weight: 800;
}

.online {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
}

.online span {
  font-size: 10px;
  font-weight: 700;
  background: #fff8e4;
  border-radius: 99px;
  padding: 3px 7px;
}

.online span.busy {
  background: #5cb83a;
  color: #fff;
}

.chat-log {
  height: 150px;
  overflow: auto;
  background: #fff8e4;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  -webkit-user-select: text;
  user-select: text;
}

.chat-log .row .nm {
  font-weight: 800;
  margin-right: 4px;
}

.chat-log .sys {
  opacity: 0.7;
  font-style: italic;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.chat-form input {
  height: 28px;
  font-size: 12px;
}

.chat-form button {
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #5cb83a;
  color: #fff;
  font: 800 11px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.empty-note {
  margin: 8px 0 0;
  font-size: 11px;
  text-align: center;
  opacity: 0.75;
}

.desk {
  display: contents;
}

body[data-mode="tab"] {
  padding: 16px;
  box-sizing: border-box;
}

body[data-mode="tab"] .desk {
  display: flex;
  gap: 16px;
  align-items: stretch;
  width: min(1080px, 100%);
  height: min(760px, 100dvh - 32px);
}

body[data-mode="tab"] .stage {
  flex: 0 0 auto;
  height: 100%;
  width: auto;
  aspect-ratio: 288 / 512;
  max-width: 428px;
}

.arena {
  display: none;
}

body[data-mode="tab"] .arena {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 300px;
  background: #f4ead0;
  color: #3c3414;
  border-radius: 12px;
  box-shadow: 0 0 0 3px #c44a20, 0 8px 0 #3c3414;
  overflow: hidden;
}

.arena-head,
.arena-head.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
}

.whoami {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.whoami strong {
  display: block;
  font-size: 14px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e07020;
  box-shadow: inset 0 0 0 2px #fff8e4, 0 0 0 2px #3c3414;
  flex: 0 0 auto;
}

.icon-btn {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: #3c3414;
  color: #fff8e4;
  font: 700 11px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.arena-body {
  flex: 1;
  overflow: auto;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.arena-body h2,
.settings h2 {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.arena-play {
  padding: 8px 10px 10px;
  border-top: 2px solid #c8bc8e;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modes.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.modes.row .mode {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
}

.modes.row .mode-best {
  grid-column: auto;
  grid-row: auto;
  font-size: 9px;
}

.podiums {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.podium {
  background: #fff8e4;
  border-radius: 8px;
  padding: 6px;
  min-height: 72px;
}

.podium h3 {
  margin: 0 0 4px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.top3 {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.top3 li {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
}

.top3 li.gold { color: #b8860b; }
.top3 li.silver { color: #5c5c5c; }
.top3 li.bronze { color: #9a5a28; }

.board.tall {
  max-height: none;
  flex: 1;
}

.board li {
  grid-template-columns: 22px 22px 1fr auto;
}

.board .av {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.chat-log.room {
  height: 120px;
  min-height: 90px;
}

.settings {
  padding: 8px 10px 10px;
  overflow: auto;
}

.set-label {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swatches button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #3c3414;
  cursor: pointer;
}

.swatches button.on {
  outline: 2px solid #5cb83a;
  outline-offset: 1px;
}

body[data-mode="popup"] .podiums {
  grid-template-columns: 1fr 1fr 1fr;
}

body[data-mode="popup"] .board {
  max-height: 160px;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.row-actions .ghost {
  flex: 1;
}

body[data-mode="tab"][data-screen="auth"] .arena {
  display: none;
}

body[data-mode="tab"][data-screen="auth"] .desk {
  justify-content: center;
}

body.options {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px 48px;
  box-sizing: border-box;
  background:
    radial-gradient(1200px 700px at 50% 40%, #1a242c 0%, #0b0f14 62%, #07090c 100%);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #3c3414;
  -webkit-user-select: text;
  user-select: text;
}

.opt-card {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px 18px;
  border-radius: 12px;
  background: #f4ead0;
  box-shadow: 0 0 0 3px #c44a20, 0 8px 0 #3c3414;
}

.opt-card h1 {
  font-size: 22px;
}

.opt-card h2 {
  margin: 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.opt-card p,
.opt-card li {
  font-size: 13px;
  line-height: 1.45;
}

.opt-card ul,
.opt-card ol {
  margin: 0;
  padding-left: 18px;
}

.opt-card code {
  font-size: 12px;
  background: #fff8e4;
  padding: 1px 5px;
  border-radius: 4px;
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.check input {
  width: 16px;
  height: 16px;
}

.hint {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

.opt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.opt-actions .go {
  width: auto;
  padding: 0 16px;
}

.opt-actions .ghost,
a.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  text-decoration: none;
}

.status {
  min-height: 16px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.status.ok {
  color: #2f6e1c;
}

.status.err {
  color: #b42318;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body[data-mode="popup"] {
  position: relative;
}

.layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(8, 14, 22, 0.72);
  box-sizing: border-box;
}

body[data-mode="tab"] .layer {
  position: fixed;
}

.gate-card,
.ad-card {
  width: min(100%, 280px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px 12px;
  border-radius: 10px;
  background: #f4ead0;
  box-shadow: 0 0 0 3px #c44a20, 0 6px 0 #3c3414;
  color: #3c3414;
}

body[data-mode="tab"] .gate-card,
body[data-mode="tab"] .ad-card {
  width: min(100%, 360px);
}

.ad-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #1a140c;
}

.ad-card img,
.ad-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  background: #1a140c;
}

.ad-timer {
  position: absolute;
  right: 8px;
  top: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: 800 13px/28px "Segoe UI", system-ui, sans-serif;
  text-align: center;
}

.go:disabled,
.ghost:disabled {
  opacity: 0.45;
  cursor: default;
}

.ad-card h2 {
  margin: 0;
  font-size: 16px;
}

.ad-kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.ad-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c8bc8e;
  cursor: pointer;
}

.ad-dots button.on {
  background: #5cb83a;
}

a.go {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

.pass-line {
  margin-left: 6px;
}

#gate-price {
  text-align: center;
}



.privacy-consent {
  flex-direction: row;
  align-items: flex-start;
  gap: 7px;
  font-size: 9px;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.privacy-consent input[type="checkbox"] {
  width: 15px;
  min-width: 15px;
  height: 15px;
  margin: 1px 0 0;
  padding: 0;
}
.privacy-consent a { color: inherit; }
