/*
 * Arcane Spire in the browser.
 *
 * The colours and measurements are the ones the iOS and Android builds use, so
 * the three look like one game. Everything on the board is sized off a single
 * `--card-width` that the layout works out for the window it is given.
 */

:root {
  --night-deep: #0f0a08;
  --night-mid: #241710;
  --gold: #f5cc6b;
  --ember: #ffa13d;
  --parchment: #f7f2e5;
  --stone: #382c21;
  --arcane: #9e70ff;
  --text-primary: #f7f0e0;
  --text-secondary: #c2ae91;
  --ink-red: #b8212e;

  /* The chain's tube. */
  --combo: #61db5c;
  --combo-deep: #22732e;
  --combo-surface: #b8faa9;

  --card-width: 80px;
  --card-height: 112px;
  --card-corner: 5px;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--night-deep);
  color: var(--text-primary);
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/*
 * The table: dark oak, lit by a torch above it.
 *
 * The same five layers `TableBackgroundView` stacks on iOS, in the order CSS
 * wants them — topmost first. The wood is a tiled CC0 material; the light and
 * the shadows around the edge are drawn on top of it.
 */
.app {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--night-deep);
  background-image:
    /* A last press of shadow into the corners. */
    linear-gradient(to bottom, rgba(15, 10, 8, 0.7), transparent 50%, rgba(15, 10, 8, 0.8)),
    /* Everything away from the light falls into the dark. */
    radial-gradient(
      ellipse at 50% 28%,
      transparent 14%,
      rgba(15, 10, 8, 0.55) 45%,
      rgba(15, 10, 8, 0.92) 72%
    ),
    /* Warm light falling on the middle of the table. */
    radial-gradient(
      ellipse at 50% 28%,
      rgba(255, 161, 61, 0.3) 0%,
      rgba(255, 161, 61, 0.06) 30%,
      transparent 55%
    ),
    /* The wood sits at 85 per cent over the night, which is what darkens it. */
    linear-gradient(rgba(15, 10, 8, 0.15), rgba(15, 10, 8, 0.15)),
    url('assets/table-wood.jpg');
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
  background-size: cover, cover, cover, cover, 512px 512px;
  background-blend-mode: multiply, normal, screen, normal, normal;
}

.noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

/* Screens */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/*
 * The menus are built for a phone held upright: one column, full width, every
 * row big enough for a thumb. On a wide screen the column simply centres rather
 * than stretching into something that reads like a spreadsheet.
 */
.screen--menu {
  align-items: center;
  justify-content: safe center;
  gap: 1rem;
  padding: clamp(1.25rem, 5vh, 2.5rem) 1.25rem;
  text-align: center;
}

.screen--centred {
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
}

.screen--panel {
  gap: 0.75rem;
  padding: clamp(1rem, 3vw, 1.6rem);
  max-width: 62rem;
  margin: 0 auto;
  width: 100%;
}

.screen--game {
  overflow: hidden;
}

/* The wordmark */

.crest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.crest__mark {
  font-size: clamp(2rem, 9vw, 2.8rem);
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(255, 161, 61, 0.55));
}

.crest__title {
  display: flex;
  flex-direction: column;
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.42rem;
  line-height: 1.02;
  /* The tracking pushes the block right; this pulls it back onto centre. */
  text-indent: 0.42rem;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(158, 112, 255, 0.45);
}

.title h1 {
  font-size: clamp(2rem, 7vw, 2.9rem);
  font-weight: 800;
  letter-spacing: 0.5rem;
  line-height: 1.05;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(158, 112, 255, 0.5);
}

/* Menus */

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(24rem, 100%);
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  border: 1px solid rgba(245, 204, 107, 0.16);
  border-radius: 16px;
  background: linear-gradient(rgba(56, 44, 33, 0.85), rgba(36, 23, 16, 0.85));
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    filter 0.12s ease;
}

.menu-row:hover:not(:disabled) {
  filter: brightness(1.12);
  border-color: rgba(245, 204, 107, 0.4);
}

.menu-row:active:not(:disabled) {
  transform: scale(0.985);
}

.menu-row:disabled {
  opacity: 0.5;
  cursor: default;
}

/* The one thing the screen is really offering. */
.menu-row--primary {
  border-color: rgba(245, 204, 107, 0.75);
  background: linear-gradient(rgba(245, 204, 107, 0.22), rgba(245, 204, 107, 0.08));
  box-shadow: 0 0 26px rgba(245, 204, 107, 0.18);
}

.menu-row--primary .menu-row__title {
  color: var(--gold);
}

.menu-row__icon {
  font-size: 1.35rem;
  width: 2rem;
  text-align: center;
  flex: 0 0 auto;
}

.menu-row__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.menu-row__title {
  font-size: 1.02rem;
  font-weight: 700;
}

.menu-row__detail {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.menu-row__badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(15, 10, 8, 0.6);
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

.menu-row__chevron {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1;
}

/* Who you are, under the menu */

.menu-footer {
  width: min(24rem, 100%);
}

.who {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.5rem;
  cursor: pointer;
}

.who:hover {
  background: rgba(56, 44, 33, 0.4);
}

.who__name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--gold);
}

.who__notes {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* The first launch */

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  width: min(24rem, 100%);
}

.welcome input[type='text'] {
  width: 100%;
  text-align: center;
  font-size: 1.1rem;
}

.welcome .pill {
  width: 100%;
}

/* Turn the device */

.rotate-host {
  position: absolute;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.rotate-host > * {
  pointer-events: auto;
}

.rotate-mark {
  font-size: 3rem;
  line-height: 1;
  animation: rotate-hint 2.2s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%,
  40% {
    rotate: 0deg;
  }
  70%,
  100% {
    rotate: 90deg;
  }
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 34rem;
}

.headline {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
}

.subhead {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.note {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.note--error {
  color: var(--ember);
}

.note--arcane {
  color: var(--gold);
}

/* Rows and buttons */

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.row--spread {
  justify-content: space-between;
}

.row--buttons {
  justify-content: center;
  padding-top: 0.4rem;
}

.row--notes {
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.row--modes {
  align-items: stretch;
  justify-content: center;
}

.row--stats {
  gap: 1.2rem;
}

.pill {
  border: 0;
  border-radius: 999px;
  background: var(--stone);
  color: var(--text-primary);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
}

.pill:hover:not(:disabled) {
  filter: brightness(1.15);
}

.pill:active:not(:disabled) {
  transform: scale(0.94);
}

.pill:disabled {
  opacity: 0.45;
  cursor: default;
}

.pill--primary {
  background: var(--gold);
  color: var(--night-deep);
}

.icon-button {
  border: 0;
  border-radius: 999px;
  background: rgba(56, 44, 33, 0.7);
  color: var(--gold);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.icon-button:active {
  transform: scale(0.92);
}

input[type='text'] {
  border: 1.5px solid var(--arcane);
  border-radius: 12px;
  background: rgba(15, 10, 8, 0.6);
  color: var(--text-primary);
  font: inherit;
  padding: 0.65rem 0.9rem;
  min-width: 12rem;
}

/* The mode picker */

.mode-card {
  width: 15rem;
  border: 1.2px solid rgba(245, 204, 107, 0.45);
  border-radius: 16px;
  background: rgba(56, 44, 33, 0.8);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mode-card:hover:not(:disabled) {
  filter: brightness(1.12);
}

.mode-card--locked {
  border-color: rgba(158, 112, 255, 0.15);
  background: rgba(56, 44, 33, 0.6);
  opacity: 0.7;
  cursor: default;
}

.mode-card h3 {
  font-size: 1.15rem;
  color: var(--gold);
}

.mode-card__tagline {
  font-size: 0.8rem;
  color: var(--text-primary);
}

.mode-card__detail,
.mode-card__rounds {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* The status bar */

.hud {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem clamp(0.7rem, 2vw, 1.2rem);
  flex: 0 0 auto;
}

.hud__spacer {
  flex: 1 1 auto;
}

.badge {
  border-radius: 999px;
  background: var(--gold);
  color: var(--night-deep);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

.stat {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.stat__title {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.stat__value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat__value--gold {
  color: var(--gold);
}

.stat__value--ember {
  color: var(--ember);
}

.clock {
  border-radius: 999px;
  background: rgba(247, 242, 229, 0.9);
  color: var(--ink-red);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.15rem 0.6rem;
}

/* The board */

.board-host {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.board {
  position: absolute;
  inset: 0;
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.layer--over {
  z-index: 60;
}

.layer > * {
  position: absolute;
  top: 0;
  left: 0;
}

.card {
  width: var(--card-width);
  height: var(--card-height);
  /* Centred on its spot by layout, not by transform — see `place()`. */
  margin-left: calc(var(--card-width) / -2);
  margin-top: calc(var(--card-height) / -2);
  border: 0;
  border-radius: var(--card-corner);
  background-color: var(--parchment);
  background-size: cover;
  background-position: center;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 calc(var(--card-width) * 0.03) calc(var(--card-width) * 0.06) rgba(0, 0, 0, 0.55);
  /* Only the deal moves a card with a transition; everything faster is driven
     frame by frame, where a transition would only fight the model. */
  transition:
    transform 0.34s cubic-bezier(0.2, 1.3, 0.4, 1),
    opacity 0.34s ease;
}

.card:disabled {
  cursor: default;
}

.card--undealt {
  opacity: 0;
}

.card--refused {
  transition: none;
  translate: var(--shake, 0) 0;
}

.card--hint {
  outline: calc(var(--card-width) * 0.035) solid var(--gold);
  outline-offset: calc(var(--card-width) * -0.035);
  box-shadow: 0 0 calc(var(--card-width) * 0.2) rgba(245, 204, 107, 0.75);
}

.card--waste {
  outline: calc(var(--card-width) * 0.035) solid var(--arcane);
  outline-offset: calc(var(--card-width) * -0.035);
  box-shadow: 0 0 calc(var(--card-width) * 0.16) rgba(158, 112, 255, 0.8);
}

/* The gold ring says the pile was earned by a chain, so the caption that used
   to sit on top of it is not needed. */
.card--chain {
  outline: calc(var(--card-width) * 0.035) solid var(--gold);
  outline-offset: calc(var(--card-width) * -0.035);
  box-shadow: 0 0 calc(var(--card-width) * 0.16) rgba(245, 204, 107, 0.7);
}

.card--flying,
.tally-card {
  transition: none;
  pointer-events: none;
}

.card--arriving {
  animation: arrive 0.28s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes arrive {
  from {
    scale: 0.75;
    opacity: 0.4;
  }
}

.chains {
  position: absolute;
  inset: 0;
  border-radius: var(--card-corner);
  background:
    repeating-linear-gradient(
      24deg,
      rgba(194, 174, 145, 0.85) 0 6px,
      transparent 6px 14px
    ),
    repeating-linear-gradient(
      -24deg,
      rgba(194, 174, 145, 0.85) 0 6px,
      transparent 6px 14px
    ),
    rgba(15, 10, 8, 0.55);
  animation: chain-drop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes chain-drop {
  from {
    opacity: 0;
    scale: 1.25;
  }
}

/* The towers a cleared spire left behind */

.trophy {
  width: var(--trophy-size);
  height: calc(var(--trophy-size) * 1.55);
  margin-left: calc(var(--trophy-size) / -2);
  margin-top: calc(var(--trophy-size) * -0.775);
  background: linear-gradient(to bottom, var(--parchment), var(--gold), var(--ember));
  clip-path: polygon(
    50% 0%,
    93% 30%,
    93% 46%,
    81% 46%,
    81% 100%,
    19% 100%,
    19% 46%,
    7% 46%,
    7% 30%
  );
  animation:
    tower-rise 0.62s cubic-bezier(0.2, 1.5, 0.4, 1) both,
    tower-glow 1.9s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px rgba(255, 161, 61, 0.55));
}

@keyframes tower-rise {
  from {
    opacity: 0;
    scale: 0.4;
  }
}

@keyframes tower-glow {
  to {
    filter: drop-shadow(0 0 18px rgba(255, 161, 61, 0.95));
  }
}

/* The chain's tube */

.vial {
  width: calc(var(--card-width) * 0.34);
  height: calc(var(--card-height) * 0.62);
  margin-left: calc(var(--card-width) * -0.17);
  margin-top: calc(var(--card-height) * -0.31);
  border: 2px solid rgba(245, 204, 107, 0.55);
  border-radius: calc(var(--card-width) * 0.12);
  background: rgba(15, 10, 8, 0.75);
  overflow: visible;
  display: grid;
  place-items: center;
}

.vial--running {
  box-shadow: 0 0 calc(var(--card-width) * 0.4) rgba(97, 219, 92, 0.45);
}

.vial__liquid {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  border-radius: calc(var(--card-width) * 0.08);
  /* The surface catches the light, which is what sells it as liquid. */
  background: linear-gradient(
    to bottom,
    var(--combo-surface) 0 18%,
    var(--combo) 18% 60%,
    var(--combo-deep) 100%
  );
}

.vial__count {
  position: relative;
  font-size: calc(var(--card-width) * 0.19);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px var(--night-deep);
}

.vial__label {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  translate: -50% 0;
  font-size: calc(var(--card-width) * 0.1);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: rgba(15, 10, 8, 0.88);
  border-radius: 999px;
  padding: 1px 5px;
  white-space: nowrap;
}

.vial--running .vial__label {
  color: var(--combo);
}

/* The draw pile's counter */

.stock-badge {
  z-index: 70;
  translate: 0 calc(var(--card-height) * 0.5 + var(--card-width) * 0.02);
  border: 1px solid rgba(245, 204, 107, 0.5);
  border-radius: 999px;
  background: rgba(15, 10, 8, 0.85);
  color: var(--text-primary);
  font-size: calc(var(--card-width) * 0.2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.1em 0.5em;
  pointer-events: none;
}

.tally-points {
  z-index: 65;
  color: var(--gold);
  font-size: calc(var(--card-width) * 0.34);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px var(--night-deep);
  white-space: nowrap;
  pointer-events: none;
}

/* Floating scores and the burst when a chain's piles go away */

.gain {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.gain--card {
  color: var(--gold);
  text-shadow: 0 0 6px var(--night-deep);
}

.gain--gem {
  color: var(--arcane);
  text-shadow: 0 0 6px var(--night-deep);
}

.gain--penalty {
  color: var(--parchment);
  background: var(--ink-red);
  border: 1px solid rgba(247, 242, 229, 0.85);
  border-radius: 999px;
  padding: 0.1em 0.45em;
  box-shadow: 0 0 14px rgba(184, 33, 46, 0.9);
}

.pile-pop {
  width: calc(var(--card-width) * 2);
  height: calc(var(--card-width) * 2);
  margin-left: calc(var(--card-width) * -1);
  margin-top: calc(var(--card-width) * -1);
  pointer-events: none;
  background: radial-gradient(
    circle,
    transparent calc(var(--burst) * 40% + 8%),
    var(--gold) calc(var(--burst) * 40% + 8%),
    var(--gold) calc(var(--burst) * 40% + 11%),
    transparent calc(var(--burst) * 40% + 11%)
  );
  opacity: calc(1 - var(--burst));
}

/* Panels */

.panel-host,
.duel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 80;
}

.panel-host > *,
.duel-overlay > * {
  pointer-events: auto;
}

.backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.68);
  overflow: auto;
  padding: 1rem;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: 1.5px solid rgba(245, 204, 107, 0.45);
  border-radius: 22px;
  background: var(--night-mid);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  padding: 1.25rem 2.1rem;
  max-width: min(30rem, 92vw);
  animation: panel-in 0.25s cubic-bezier(0.2, 1.2, 0.4, 1);
}

@keyframes panel-in {
  from {
    scale: 0.92;
    opacity: 0;
  }
}

.panel__title {
  font-size: 1.6rem;
  color: var(--gold);
}

.panel__subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.panel__record {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.panel__record--new {
  color: var(--ember);
  font-weight: 700;
}

.breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: min(20rem, 80vw);
  padding: 0.4rem 0;
}

.score-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.score-line--bold {
  font-size: 0.85rem;
}

.score-line--bold .score-line__title {
  color: var(--text-primary);
}

.score-line__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score-line--bold .score-line__value {
  font-size: 1.2rem;
}

.score-line__value--gold {
  color: var(--gold);
}

.score-line__value--ember {
  color: var(--ember);
}

.divider {
  height: 1px;
  background: rgba(245, 204, 107, 0.35);
  margin: 0.3rem 0;
}

.round-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 7px;
  background: rgba(56, 44, 33, 0.4);
  padding: 0.25rem 0.45rem;
  font-variant-numeric: tabular-nums;
}

.chip--cleared {
  background: rgba(56, 44, 33, 0.9);
}

.chip__round {
  font-size: 0.55rem;
  color: var(--text-secondary);
}

.chip__score {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.chip--cleared .chip__score {
  color: var(--gold);
}

/* Lists: leaderboards, friends, standings */

.board-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  min-width: min(22rem, 80vw);
}

.board-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 9px;
  background: rgba(56, 44, 33, 0.4);
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}

.board-row--own {
  background: rgba(245, 204, 107, 0.16);
  color: var(--gold);
}

.board-row__rank {
  min-width: 1.8rem;
}

.board-row__name {
  flex: 1 1 auto;
  font-weight: 600;
}

.board-row__detail {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.board-row__score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

.tab--active {
  background: rgba(245, 204, 107, 0.18);
  color: var(--gold);
  font-weight: 700;
}

.stat-tile {
  display: flex;
  flex-direction: column;
}

.stat-tile__title {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.stat-tile__value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Options */

.setting {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  border-radius: 14px;
  background: rgba(56, 44, 33, 0.45);
  padding: 0.6rem 1rem;
}

.setting__icon {
  font-size: 1.1rem;
}

.setting__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.setting__title {
  font-size: 0.9rem;
}

.setting__detail {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.setting__slider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.setting__value {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
}

input[type='range'] {
  accent-color: var(--gold);
  width: min(12rem, 40vw);
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle__track {
  display: block;
  width: 3rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--stone);
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle__track::after {
  content: '';
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--text-secondary);
  transition: translate 0.15s ease;
}

.toggle input:checked + .toggle__track {
  background: var(--gold);
}

.toggle input:checked + .toggle__track::after {
  translate: 1.35rem 0;
  background: var(--night-deep);
}

/* The rules */

.rules {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rule {
  display: flex;
  gap: 0.7rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.rule__icon {
  width: 1.3rem;
  flex: 0 0 auto;
}

/* The duel */

.duel-lobby {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.duel-lobby__half {
  flex: 1 1 18rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}

.room-code {
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--gold);
}

.opponent-strip {
  position: absolute;
  top: 3.2rem;
  right: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid rgba(158, 112, 255, 0.5);
  border-radius: 10px;
  background: rgba(15, 10, 8, 0.82);
  overflow: hidden;
  font-size: 0.72rem;
}

.strip-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.6rem;
}

.strip-row--own {
  background: rgba(245, 204, 107, 0.16);
  color: var(--gold);
}

.strip-row__name {
  min-width: 5rem;
  font-weight: 600;
}

.strip-row__score,
.strip-row__cards {
  font-variant-numeric: tabular-nums;
}

.strip-row__cards {
  min-width: 1.6rem;
  text-align: right;
  color: var(--text-secondary);
}

.spectate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.spectate__name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
}

.progress {
  width: min(18rem, 70vw);
  height: 0.5rem;
  border-radius: 999px;
  background: rgba(56, 44, 33, 0.8);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: var(--gold);
  transition: width 0.3s ease;
}

/* Nobody should watch the board rebuild itself if they asked not to. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
