:root {
  color-scheme: light;
  --bg: #0b1220;
  --card: #101a30;
  --card2: #0e1730;
  --text: #e8ecff;
  --muted: #a7b0d8;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: rgba(0, 0, 0, 0.40);
  --accent: #7c5cff;
  --good: #2ee59d;
  --bad: #ff5c7c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 500px at 50% 0%, rgba(124, 92, 255, 0.24), transparent 60%),
              radial-gradient(900px 500px at 20% 10%, rgba(46, 229, 157, 0.12), transparent 55%),
              var(--bg);
  color: var(--text);
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(11, 18, 32, 0.72);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.brand__title {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 34px;
  text-align: left;
  line-height: 1;
}
.brand__title:focus-visible {
  outline: 2px solid rgba(46, 229, 157, 0.75);
  outline-offset: 4px;
}
.brand__stack{
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(360px, 1fr);
  grid-template-areas: "hero game";
  align-items: center;
  gap: 18px;
}
.brand__hero{
  grid-area: hero;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  min-width: 0;
}
.brand__figure{
  position: relative;
  flex: 0 0 128px;
  height: 86px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #f7f9fc;
  box-shadow: 0 14px 28px rgba(0,0,0,0.26), inset 0 0 0 1px rgba(255,255,255,0.32);
}
.brand__figure::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11,18,32,0.10), transparent 32%, rgba(11,18,32,0.14));
  pointer-events: none;
}
.brand__img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 48%;
  transform: scale(1.08);
}
.brand__identity{
  display: grid;
  gap: 9px;
  min-width: 0;
}
.brand__actions{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.playerBadge{
  min-width: 0;
  max-width: 190px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.14);
}
.playerBadge__label{
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}
.playerBadge__name{
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand__gamebtn{
  grid-area: game;
  justify-self: stretch;
}
@media (max-width: 760px) {
  .brand__stack{
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "game";
    gap: 6px;
  }

  .brand__gamebtn{
    justify-self: stretch;
    text-align: center;
  }
  .brand__title{ font-size: 30px; }
  .brand__figure{ flex-basis: 104px; height: 72px; }
  .playerBadge{ max-width: min(100%, 220px); }
}
@media (max-width: 480px) {
  .brand__hero{
    align-items: flex-start;
  }
  .brand__figure{
    flex-basis: 92px;
    height: 66px;
  }
  .brand__title{
    font-size: 28px;
  }
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 980px) {
  .grid3 { grid-template-columns: 1fr 1fr 1fr; }
}

.hint {
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
}
.hint__text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.toggles {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}
.toggle input { transform: translateY(1px); }

.viewer__toggles{
  width: min(1100px, 100%);
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.leaderboard {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: rgba(16, 26, 48, 0.32);
}
.leaderboard__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.leaderboard__title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}
.leaderboard__tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  background: rgba(0,0,0,0.14);
}
.leaderboard__tab {
  border: 0;
  border-radius: 7px;
  padding: 6px 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}
.leaderboard__tab.is-active {
  background: rgba(46, 229, 157, 0.18);
  color: var(--text);
}
.leaderboard__filter {
  display: inline-grid;
  grid-template-columns: auto minmax(120px, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.leaderboard__select {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #122033;
  color: var(--text);
  font-weight: 800;
  padding: 0 10px;
  color-scheme: dark;
  text-transform: none;
  letter-spacing: 0;
}
.leaderboard__select option {
  background: #122033;
  color: #f4f7fb;
}
.leaderboard__summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.leaderboard__tablewrap {
  overflow-x: auto;
}
.leaderboard__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.leaderboard__table th,
.leaderboard__table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  text-align: left;
  white-space: nowrap;
}
.leaderboard__table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.leaderboard__table td:last-child,
.leaderboard__table th:last-child {
  text-align: right;
}
.leaderboard__current {
  background: rgba(46, 229, 157, 0.14);
  color: var(--text);
}
@media (max-width: 640px) {
  .leaderboard__top {
    display: grid;
    gap: 4px;
  }
}

.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}
.input:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18);
}

.select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}
.select:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18);
}

.range {
  width: 100%;
}

.range--big {
  height: 44px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.range--big:focus { outline: none; }
.range--big::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.12);
}
.range--big::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(124, 92, 255, 0.95);
  border: 2px solid rgba(255,255,255,0.75);
  margin-top: -9px;
  box-shadow: 0 10px 18px rgba(0,0,0,0.35);
}
.range--big::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.12);
}
.range--big::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(124, 92, 255, 0.95);
  border: 2px solid rgba(255,255,255,0.75);
  box-shadow: 0 10px 18px rgba(0,0,0,0.35);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.btn:hover { background: rgba(255, 255, 255, 0.10); }
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  border-color: rgba(124, 92, 255, 0.55);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.24), rgba(124, 92, 255, 0.14));
}
.btn--ghost {
  background: transparent;
}
.btn--scores{
  flex: 0 0 auto;
  min-height: 38px;
  border-color: rgba(255, 198, 88, 0.58);
  background: linear-gradient(180deg, rgba(255, 198, 88, 0.24), rgba(205, 119, 36, 0.14));
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn--scores:hover{
  background: linear-gradient(180deg, rgba(255, 198, 88, 0.34), rgba(205, 119, 36, 0.20));
}

.btn--game{
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn--game:hover{
  filter: brightness(1.05);
}

.tile {
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.12);
  box-shadow: 0 14px 30px rgba(0,0,0,0.22);
}

.gameTile{
  width: 100%;
  max-width: none;
  border-color: rgba(46, 229, 157, 0.45);
  background: linear-gradient(180deg, rgba(46, 229, 157, 0.22), rgba(46, 229, 157, 0.10));
  padding: 8px;
  border-radius: 12px;
}
.gameTile__setup{
  display: grid;
  gap: 8px;
}
.gameLength{
  display: grid;
  grid-template-columns: auto repeat(3, minmax(44px, 1fr));
  align-items: center;
  gap: 6px;
}
.gameLength__label{
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gameLength__choice{
  min-width: 0;
}
.gameLength__choice input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.gameLength__choice span{
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.12);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
.gameLength__choice input:checked + span{
  border-color: rgba(46, 229, 157, 0.60);
  background: rgba(46, 229, 157, 0.22);
}
.gameLobe,
.gameIncidence{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.gameLobe__label,
.gameIncidence__label{
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gameLobe__select,
.gameIncidence__select{
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #122033;
  color: var(--text);
  font-weight: 800;
  padding: 0 10px;
  color-scheme: dark;
}
.gameLobe__select option,
.gameIncidence__select option{
  background: #122033;
  color: #f4f7fb;
}
.gameTile__buttons{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.gameTile__button{
  width: 100%;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.20);
  padding: 14px 16px 14px 20px;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: 0.06em;
  min-height: 62px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  box-shadow: 0 14px 28px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.18);
}
.gameTile__button:first-child{
  border-color: rgba(47, 233, 160, 0.95);
  background: linear-gradient(180deg, #159b71, #0b5f51);
}
.gameTile__button:nth-child(2){
  border-color: rgba(255, 198, 88, 0.95);
  background: linear-gradient(180deg, #d97725, #8f4218);
}
.gameTile__button::before{
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: rgba(255,255,255,0.72);
}
.gameTile__button::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.16), transparent 46%);
  pointer-events: none;
}
.gameTile__button:hover:not(:disabled){
  transform: translateY(-2px);
  filter: brightness(1.08) saturate(1.08);
  box-shadow: 0 18px 32px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.22);
}
.gameTile__panel{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 0;
}
.gameTile--idle .gameTile__panel{ display:none; }
.gameTile--active .gameTile__setup{ display:none; }

/* score/status moved into the Game tile */

.main {
  max-width: 1100px;
  margin: 18px auto 48px;
  padding: 0 18px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  box-shadow: 0 24px 60px var(--shadow);
  overflow: hidden;
}

.card__top {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr);
  gap: 10px 18px;
  align-items: start;
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 26, 48, 0.45);
}

.gamepanel__title {
  flex: 0 0 auto;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 13px;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
}
.gamepanel__grid {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(52px, auto) minmax(180px, 1fr) repeat(3, minmax(58px, auto));
  gap: 6px;
}
.gamepanel__item {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.12);
}
.gamepanel__label {
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 2px;
}
.gamepanel__value {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.1;
}
.gamepanel__item--span{
  grid-column: auto;
}
.gamepanel__value--small{
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.25;
  word-break: break-word;
}
@media (max-width: 760px) {
  .gameTile__panel{
    display: grid;
    gap: 8px;
  }

  .gamepanel__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gamepanel__item--span{
    grid-column: 1 / -1;
  }
}
.prompt { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.prompt__label { color: var(--muted); font-size: 12px; }
.prompt__value {
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.feedback {
  min-height: 38px;
  max-height: 38px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.feedback--good { color: var(--good); }
.feedback--bad { color: var(--bad); }
@media (max-width: 760px) {
  .card__top {
    grid-template-columns: 1fr;
    min-height: 116px;
  }
}

.board {
  padding: 16px;
  display: grid;
  place-items: center;
  background: radial-gradient(700px 320px at 50% 20%, rgba(255,255,255,0.08), transparent 60%),
              rgba(0,0,0,0.08);
}
.board--leaderboard .tri,
.board--leaderboard .viewer__legend,
.board--leaderboard .choices,
.board--leaderboard .viewer__toggles {
  display: none;
}
.board--leaderboard .leaderboard {
  width: min(760px, 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16, 26, 48, 0.55);
}

.tri {
  width: min(1100px, 100%);
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 980px) {
  .tri { grid-template-columns: 1fr 1fr 1fr; }
  .tri.tri--single { grid-template-columns: minmax(0, 1fr); max-width: min(520px, 100%); }
}
.tri__pane { display: grid; gap: 8px; }
.tri__pane[hidden] { display: none; }
.tri__title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.01em;
  padding-left: 4px;
}
.tri__controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
@media (max-width: 480px) {
  .tri__controls {
    grid-template-columns: 1fr;
  }
  .tri__controls .pill { justify-self: start; }
}

.viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.viewer__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.corner {
  position: absolute;
  top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: -0.01em;
  pointer-events: none;
}
.corner--tl { left: 10px; }
.corner--tr { right: 10px; }
.corner--tc { left: 50%; transform: translateX(-50%); }
.corner--br { top: auto; right: 10px; bottom: 10px; }
.viewer__legend {
  width: min(1100px, 100%);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.choices {
  width: min(760px, 100%);
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(16, 26, 48, 0.58);
}
.choices[hidden] {
  display: none;
}
.choices__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.choices__prompt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.choices__timer {
  min-width: 64px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.choices__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.choiceBtn {
  min-height: 52px;
  text-align: left;
  line-height: 1.2;
  white-space: normal;
}
.choiceBtn:disabled {
  opacity: 1;
  cursor: default;
}
.choiceBtn--correct {
  border-color: rgba(46, 229, 157, 0.70);
  background: rgba(46, 229, 157, 0.18);
  color: var(--text);
}
.choiceBtn--wrong {
  border-color: rgba(255, 92, 124, 0.70);
  background: rgba(255, 92, 124, 0.14);
  color: var(--text);
}
@media (max-width: 760px) {
  .gameTile__buttons,
  .choices__grid {
    grid-template-columns: 1fr;
  }
  .choices__top {
    align-items: flex-start;
  }
}

.card__bottom {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: rgba(16, 26, 48, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
}
.tips { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 12px; }
.footerOrg {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(100%, 360px);
  max-width: 620px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: right;
}
.footerOrg__logo {
  flex: 0 0 auto;
  width: 46px;
  max-height: 34px;
  object-fit: contain;
}
.footerOrg__text {
  max-width: 440px;
}
.copyright {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
@media (max-width: 760px) {
  .footerOrg {
    justify-content: flex-start;
    text-align: left;
  }
}
