:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter Variable", Inter, system-ui, sans-serif;
  --t-title: 15px;
  --t-body: 14px;
  --t-label: 13px;
  --t-meta: 12px;
  --t-micro: 11px;
  --w-regular: 400;
  --w-medium: 500;
  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --l-surface: #ffffff;
  --l-1: #1a1a1a;
  --l-2: rgba(0, 0, 0, 0.62);
  --l-3: rgba(0, 0, 0, 0.44);
  --l-hair: #e9e9e7;
  --amber: #f0912f;
  --blue: #2f6dff;
  --board: #f6f6f4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--board);
  color: var(--l-1);
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: var(--w-regular);
  letter-spacing: normal;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font-family: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.board {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 72px 24px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(100%, 720px);
}

.pair {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: min(100%, 1031px);
}

.island {
  display: flex;
  flex-direction: column;
  background: var(--l-surface);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 26px rgba(17, 17, 17, 0.07);
  padding: 16px;
  opacity: 0;
  transform: translateY(18px);
}

.island.in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.island-main {
  flex: 3 1 0;
  min-width: 0;
}

.island-main.in {
  transition-delay: 0.08s;
}

.island-side {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.hd {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 22px;
  margin-bottom: 12px;
}

.hd h1 {
  margin: 0;
  font-size: var(--t-title);
  font-weight: var(--w-medium);
  line-height: 1.3;
  color: var(--l-1);
}

.brand {
  width: 14px;
  height: 14px;
  display: block;
}

.ghost {
  margin-left: auto;
  color: var(--l-3);
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.ghost:hover {
  color: var(--l-2);
}

.pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  background: #efefed;
  color: var(--l-2);
}

.lede {
  margin: 0 0 16px;
  font-size: var(--t-body);
  color: var(--l-2);
}

.games {
  display: flex;
  flex-direction: column;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--l-2);
}

.game-row:hover,
.game-row:focus-visible {
  background: #f4f4f2;
  color: var(--l-1);
}

.game-row + .game-row {
  border-top: 1px solid var(--l-hair);
  border-radius: 0;
}

.game-row:first-child {
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

.game-row:last-child {
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}

.game-row:only-child {
  border-radius: var(--r-sm);
}

.game-kicker {
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--l-3);
  min-width: 4.5em;
}

.game-row:hover .game-kicker,
.game-row:focus-visible .game-kicker {
  color: var(--l-2);
}

.game-copy {
  flex: 1;
  min-width: 0;
  font-size: var(--t-label);
}

.hint {
  margin: 16px 0 0;
  font-size: var(--t-meta);
  color: var(--l-3);
}

.hint.ok {
  color: var(--l-2);
}

.hint.bad {
  color: #b42318;
}

.status-line {
  font-size: var(--t-meta);
  color: var(--l-3);
}

.status-line.ok {
  color: var(--l-2);
}

.status-line.bad {
  color: #b42318;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--l-1);
  color: #fff;
  font-size: var(--t-meta);
  font-weight: var(--w-medium);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  cursor: pointer;
}

.btn:disabled {
  background: #d8d8d6;
  color: #8a8a88;
  cursor: default;
}

.prompt {
  flex: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #f4f4f2;
  border-radius: var(--r-sm);
  font-size: var(--t-label);
  color: var(--l-1);
}

.log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.chat {
  flex: none;
  min-height: 0;
  overflow: visible;
}

.chat-rule {
  margin: 8px 0;
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--l-3);
  text-align: center;
  animation: rise-in 0.62s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.msg {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 2px;
  border-top: 1px solid var(--l-hair);
  animation: rise-in 0.62s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chat > :nth-child(1) {
  animation-delay: 0.04s;
}
.chat > :nth-child(2) {
  animation-delay: 0.11s;
}
.chat > :nth-child(3) {
  animation-delay: 0.18s;
}
.chat > :nth-child(4) {
  animation-delay: 0.25s;
}
.chat > :nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.mark {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.5;
}

.msg.on .mark,
.mark.lit {
  filter: none;
  opacity: 1;
}

.mark-fallback {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.28);
  flex: none;
  margin-top: 2px;
}

.msg-name {
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  color: var(--l-2);
  margin-bottom: 2px;
}

.msg.on .msg-name {
  color: var(--l-1);
}

.msg-text {
  font-size: var(--t-label);
  color: var(--l-2);
}

.msg-text.thinking {
  color: var(--l-3);
}

.msg-verdict {
  display: inline-block;
  margin-top: 6px;
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--l-3);
}

.msg-verdict.right {
  color: #166534;
}

.msg-verdict.wrong {
  color: #991b1b;
}

.scoreboard {
  flex: none;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--l-hair);
}

.score-hd {
  font-size: var(--t-micro);
  font-weight: var(--w-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--l-3);
  margin-bottom: 4px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: var(--t-meta);
  font-weight: var(--w-medium);
  color: var(--l-1);
}

.score-row .mark {
  margin-top: 0;
}

.score-name {
  flex: 1;
}

.score-n {
  font-size: var(--t-title);
  font-variant-numeric: tabular-nums;
}

.plate,
.stage {
  transition:
    opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.plate.dim,
.stage.dim {
  opacity: 0;
  transform: translateY(10px);
}

.plate {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #ebebeb;
}

.cap {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 7px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
  font-size: var(--t-meta);
  font-weight: var(--w-medium);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 800px) {
  .pair {
    flex-direction: column;
  }

  .island-side {
    height: auto !important;
    max-height: min(56dvh, 420px);
  }

  .board {
    padding: 32px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .island {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .plate,
  .stage {
    transition: none;
  }

  .plate.dim,
  .stage.dim {
    opacity: 1;
    transform: none;
  }

  .chat-rule,
  .msg {
    animation: none;
  }
}
