:root {
  --bg-0: #160f1f;
  --bg-1: #231534;
  --panel: rgba(24, 17, 36, 0.88);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --text: #f7f4ff;
  --muted: #d3c8e6;
  --accent: #ff725e;
  --accent-2: #ffd166;
  --red: #ff6b6b;
  --blue: #58b5ff;
  --green: #63e6be;
  --yellow: #ffd43b;
  --purple: #c084fc;
  --shadow: 0 24px 60px rgba(6, 4, 12, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 114, 94, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(88, 181, 255, 0.22), transparent 30%),
    linear-gradient(180deg, var(--bg-0), #0f0b16 72%);
}

.shell {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.hero,
.stats,
.panel,
.board-section,
.legend-section,
.actions,
.support-strip,
.result {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(255, 114, 94, 0.18), rgba(88, 181, 255, 0.08)),
    var(--panel);
}

.eyebrow,
.label,
.stats span,
.result-label {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-2);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
  margin-top: 8px;
}

.subtitle {
  max-width: 34rem;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hub-link,
.support-strip a,
.card-link,
button {
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.hub-link,
.support-strip a {
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

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

.stats div,
.goal-card,
.legend-chip {
  background: var(--panel-soft);
  border-radius: 18px;
  padding: 12px;
}

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

.panel,
.board-section,
.legend-section,
.result {
  padding: 18px;
  margin-bottom: 14px;
}

.message {
  min-height: 48px;
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.goal-card strong {
  display: block;
  margin: 8px 0 6px;
}

.goal-card p,
.section-head p,
.legend-chip span {
  color: var(--muted);
  line-height: 1.5;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 1.25rem;
}

.board-wrap {
  display: flex;
  justify-content: center;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 520px);
}

.cell {
  position: relative;
  aspect-ratio: 1;
}

.cell-btn {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    #181225;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.cell-btn:hover:not(:disabled),
button:hover:not(:disabled),
.hub-link:hover,
.support-strip a:hover {
  transform: translateY(-1px);
}

.cell-btn:disabled {
  cursor: default;
  opacity: 1;
}

.cell.active .cell-btn {
  outline: 2px solid var(--accent-2);
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.14);
}

.cell-node .cell-btn {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.cell-path-red .cell-btn { background: linear-gradient(180deg, rgba(255, 107, 107, 0.44), rgba(255, 107, 107, 0.2)), #24141b; }
.cell-path-blue .cell-btn { background: linear-gradient(180deg, rgba(88, 181, 255, 0.44), rgba(88, 181, 255, 0.2)), #131c28; }
.cell-path-green .cell-btn { background: linear-gradient(180deg, rgba(99, 230, 190, 0.44), rgba(99, 230, 190, 0.2)), #13241d; }
.cell-path-yellow .cell-btn { background: linear-gradient(180deg, rgba(255, 212, 59, 0.44), rgba(255, 212, 59, 0.2)), #2a2410; }

.node-badge,
.path-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 700;
}

.node-badge {
  border-radius: 18px;
  font-size: 0.9rem;
}

.path-badge {
  font-size: 1.2rem;
}

.node-red { background: rgba(255, 107, 107, 0.78); }
.node-blue { background: rgba(88, 181, 255, 0.78); }
.node-green { background: rgba(99, 230, 190, 0.78); }
.node-yellow { background: rgba(255, 212, 59, 0.78); color: #2a2200; }

.legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.legend-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-chip.active {
  border-color: rgba(255, 209, 102, 0.8);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.12);
}

.legend-chip strong {
  display: block;
  margin-bottom: 6px;
}

.legend-red strong { color: var(--red); }
.legend-blue strong { color: var(--blue); }
.legend-green strong { color: var(--green); }
.legend-yellow strong { color: var(--yellow); }

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

button {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
}

.primary {
  background: linear-gradient(135deg, var(--accent), #ff8f57);
  color: #250d0b;
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
}

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

.result {
  text-align: center;
}

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

@media (max-width: 720px) {
  .hero,
  .section-head,
  .support-strip {
    flex-direction: column;
  }

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

  .board {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .shell {
    width: min(100% - 14px, 100%);
    padding-top: 12px;
  }

  .hero,
  .panel,
  .board-section,
  .legend-section,
  .result {
    padding: 14px;
    border-radius: 20px;
  }

  .stats,
  .actions {
    gap: 8px;
    padding: 10px;
  }

  .stats strong {
    font-size: 1rem;
  }

  button {
    min-height: 48px;
    font-size: 0.9rem;
  }
}
