:root {
  color-scheme: dark;
  --bg-0: #130f19;
  --bg-1: #271a2f;
  --panel: rgba(18, 17, 28, 0.82);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #fff7fb;
  --muted: #d8c7d6;
  --pink: #ff6b7a;
  --cyan: #74e8ff;
  --gold: #ffd36c;
  --sludge: #677087;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 107, 122, 0.28), transparent 34%),
    radial-gradient(circle at right, rgba(116, 232, 255, 0.18), transparent 28%),
    linear-gradient(155deg, var(--bg-0), var(--bg-1));
}

.shell {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.hero,
.stats,
.panel,
.board-section,
.actions,
.support-strip,
.result {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px;
}

.eyebrow,
.subtitle,
.message,
.stats span,
.rule-card p,
.support-strip a,
.board-head p,
.result-label {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 0.98;
}

.subtitle {
  margin-top: 12px;
  max-width: 40rem;
  line-height: 1.6;
}

.hub-link,
button,
.support-strip a {
  border-radius: 999px;
  text-decoration: none;
}

.hub-link {
  flex: 0 0 auto;
  padding: 12px 18px;
  color: #1a1020;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #ff9d63);
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
}

.stats div {
  padding: 12px 10px;
  text-align: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.stats span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.stats strong {
  display: block;
  margin-top: 5px;
  font-size: 1.45rem;
}

.panel {
  margin-top: 16px;
  padding: 16px;
}

.message {
  line-height: 1.55;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-chip span,
.item {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.legend-chip.protein span,
.item-protein {
  background: radial-gradient(circle at 30% 30%, #fff5f8, var(--pink) 58%, #802c45);
}

.legend-chip.foam span,
.item-foam {
  background: radial-gradient(circle at 30% 30%, #fff, var(--cyan) 58%, #23606b);
}

.legend-chip.junk span,
.item-junk {
  background: radial-gradient(circle at 30% 30%, #cfd5e4, var(--sludge) 58%, #2a2d39);
}

.board-section {
  margin-top: 16px;
  padding: 18px;
}

.board-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.board-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.board-head p {
  margin-top: 8px;
}

.rule-card {
  width: min(320px, 100%);
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rule-card strong {
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}

.board {
  position: relative;
  min-height: 620px;
  margin-top: 16px;
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  background-size: 48px 48px, 48px 48px, auto;
}

.board::after {
  content: "";
  position: absolute;
  inset: auto -12% -28% auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 122, 0.22), transparent 68%);
  filter: blur(14px);
}

.chamber {
  position: absolute;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(18,20,28,0.92));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
  z-index: 1;
}

.chamber::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.chamber-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.chamber-head strong {
  font-size: 0.95rem;
}

.chamber-role {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  background: rgba(0, 0, 0, 0.24);
}

.role-goal {
  color: var(--gold);
}

.role-drain {
  color: var(--cyan);
}

.item-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26);
}

.item-empty {
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.pin {
  position: absolute;
  z-index: 2;
  min-width: 88px;
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, rgba(255, 107, 122, 0.92), rgba(126, 98, 255, 0.9));
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.24);
}

.pin.open {
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.12);
  box-shadow: none;
}

.pin small {
  display: block;
  margin-top: 2px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.flow-line {
  position: absolute;
  z-index: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(116, 232, 255, 0.18), rgba(255, 211, 108, 0.22));
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
}

button {
  appearance: none;
  min-height: 50px;
  border: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.06);
}

button.primary {
  color: #180f18;
  background: linear-gradient(135deg, var(--gold), #ff8b74);
}

button.ghost {
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.support-strip {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px;
}

.support-strip a {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
}

.result {
  margin-top: 16px;
  padding: 18px;
  text-align: center;
}

.result strong {
  display: block;
  margin: 8px 0;
  font-size: clamp(2rem, 8vw, 3.6rem);
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .board-head {
    flex-direction: column;
  }

  .rule-card {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px 12px 28px;
  }

  .hero {
    flex-direction: column;
  }

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

  .board {
    min-height: 760px;
  }

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

  .actions .primary {
    grid-column: 1 / -1;
  }
}
