:root {
  color-scheme: dark;
  --bg: #111311;
  --panel: #1b1d1a;
  --panel-strong: #242720;
  --line: #383c32;
  --text: #f5f1e8;
  --muted: #b8b0a2;
  --green: #70c17b;
  --yellow: #f1c765;
  --red: #e76f61;
  --blue: #7fb0d6;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(112, 193, 123, 0.18), transparent 30rem),
    linear-gradient(135deg, #111311 0%, #1b1a16 52%, #151812 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 84px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 0.95;
  letter-spacing: 0;
}

.players-panel {
  display: grid;
  gap: 12px;
  margin: 20px 0 24px;
  padding: 16px;
  background: rgba(27, 29, 26, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.players-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
}

.player-chip.active {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(241, 199, 101, 0.14);
}

.chip-remove {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #34372f;
  color: var(--muted);
  line-height: 20px;
}

.player-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #10120f;
  color: var(--text);
}

.player-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(112, 193, 123, 0.14);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.game-card,
.game-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 29, 26, 0.92);
  box-shadow: var(--shadow);
}

.game-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 280px;
  padding: 18px;
  text-align: left;
  color: inherit;
}

.game-card:hover,
.game-card:focus-visible {
  border-color: var(--green);
  outline: none;
  transform: translateY(-2px);
}

.game-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: #10120f;
  font-size: 28px;
}

.game-card h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.game-card p {
  margin-bottom: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--yellow);
  font-size: 14px;
  font-weight: 700;
}

.game-view {
  padding: 18px;
}

.game-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.game-head h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.game-head p,
.rule-text,
.log-list {
  color: var(--muted);
  line-height: 1.7;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121410;
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  display: block;
  overflow-wrap: anywhere;
  font-size: 24px;
  font-weight: 800;
}

.action-row,
.number-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(42px, 1fr));
}

.primary-button,
.ghost-button,
.icon-button,
.number-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  background: var(--green);
  color: #0d130d;
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

.icon-button {
  width: 36px;
  background: var(--green);
  color: #0d130d;
  font-size: 22px;
}

.number-button {
  background: #10120f;
  border: 1px solid var(--line);
  color: var(--text);
}

.number-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.result-banner {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(231, 111, 97, 0.55);
  border-radius: 8px;
  background: rgba(231, 111, 97, 0.12);
  color: #ffd7d2;
  font-weight: 800;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.choice-button {
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10120f;
  color: var(--text);
  text-align: left;
}

.log-list {
  max-height: 180px;
  overflow: auto;
  margin: 16px 0 0;
  padding-left: 20px;
}

@media (max-width: 840px) {
  .game-grid,
  .status-board {
    grid-template-columns: 1fr;
  }

  .number-grid {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

  .game-head,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
