/* Shared tokens and board pieces (score, fouls, clock, senshu). */

:root {
  --ao: #1140d6;
  --ao-deep: #0b2c96;
  --aka: #d01a1a;
  --aka-deep: #931010;
  --gold: #e4b420;
  --white: #ffffff;
  --ink: #151515;
  --smoke: #2a2a2e;
  --ash: #8d8d95;
  --atoshi: #ff9a00;
  --zero: #ff2f2f;

  --font-display: 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--white);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- board layout: two halves, clock floating above the seam ---------- */

.board {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}

.side {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5vh 2vw 0;
  min-width: 0;
}

.side--ao {
  background: linear-gradient(180deg, var(--ao) 0%, var(--ao-deep) 100%);
}

.side--aka {
  background: linear-gradient(180deg, var(--aka) 0%, var(--aka-deep) 100%);
}

.side.is-winner {
  box-shadow: inset 0 0 0 clamp(4px, 0.6vw, 10px) var(--gold);
}

.side-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 7vw, 110px);
  line-height: 1;
  letter-spacing: 0.06em;
  margin: 0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.side-player {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(16px, 2.6vw, 40px);
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 1.2em;
}

.side-player[data-name] {
  color: var(--white);
  font-weight: 700;
}

.side-player.is-empty {
  visibility: hidden;
}

/* fouls: C1 C2 C3 HC H K with a dot that lights up cumulatively */

.chui-row {
  display: grid;
  grid-template-columns: repeat(6, auto);
  gap: clamp(6px, 1.2vw, 20px);
  margin-top: 1vh;
}

.chui {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.5vw, 24px);
  font-weight: 700;
}

.chui-dot {
  width: clamp(18px, 2.6vw, 42px);
  height: clamp(18px, 2.6vw, 42px);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  transition: background 120ms ease, transform 120ms ease;
}

.chui-dot.is-on {
  background: var(--white);
  border-color: var(--white);
  transform: scale(1.06);
  box-shadow: 0 0 0.5em rgba(255, 255, 255, 0.55);
}

.score {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
  margin-top: auto;
  margin-bottom: 4vh;
  text-shadow: 0 0.04em 0 rgba(0, 0, 0, 0.3);
}

.score.is-winner {
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* floating clock */

.clock {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  color: var(--ink);
  border: 6px solid var(--gold);
  border-radius: 0 0 40px 40px;
  border-top: 0;
  padding: 1vh 3vw 1.5vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6vh;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.08),
    0 16px 48px rgba(0, 0, 0, 0.45);
}

.timer {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.timer[data-phase='atoshi'] {
  color: var(--atoshi);
}

.timer[data-phase='zero'] {
  color: var(--zero);
}

/* senshu marker */

.senshu {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.15em 0.8em;
  border-radius: 999px 999px 0 0;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.08em;
}

.senshu-star {
  color: var(--gold);
  visibility: hidden;
}

.senshu-star.is-on {
  visibility: visible;
  filter: drop-shadow(0 0 0.25em rgba(228, 180, 32, 0.8));
}

.credits {
  height: 24px;
  line-height: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ash);
  background: #1c1c1f;
  border-top: 1px solid #2c2c31;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 16px;
}

@media (prefers-reduced-motion: reduce) {
  .score.is-winner {
    animation: none;
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.1em;
  }

  .chui-dot {
    transition: none;
  }
}

/* signed-in user chip (all pages except the display) */

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 13px var(--font-ui);
  color: var(--white);
}

.user-chip-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-out {
  font: 600 13px var(--font-ui);
  color: #d6d6dd;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  outline: 1px solid #55555e;
  outline-offset: -1px;
}

.user-chip-out:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.user-chip-out:focus-visible {
  outline: 2px solid var(--gold);
}

[hidden] {
  display: none !important;
}
