:root {
  color-scheme: light dark;
  --paper: #f5f1e8;
  --paper-strong: #fffaf0;
  --ink: #1f2a2e;
  --muted: #66736f;
  --line: rgba(31, 42, 46, 0.14);
  --line-strong: rgba(31, 42, 46, 0.24);
  --navy: #233348;
  --navy-soft: #2e465d;
  --accent: #7b5d35;
  --accent-soft: #e8d8bc;
  --green: #28735c;
  --danger: #a54538;
  --shadow: 0 24px 70px rgba(31, 42, 46, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(232, 216, 188, 0.72), transparent 34rem),
    linear-gradient(145deg, var(--paper), #e9efe9 100%);
  color: var(--ink);
  min-height: 100vh;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.hero {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 240, 0.68);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff7ea;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.audit-badge,
.game-chip,
.duration,
.timer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
  white-space: nowrap;
}

.audit-badge {
  min-height: 32px;
  padding: 0 12px;
}

.audit-badge.ready {
  border-color: rgba(40, 115, 92, 0.24);
  color: var(--green);
  background: rgba(40, 115, 92, 0.08);
}

.audit-badge.closed {
  border-color: rgba(165, 69, 56, 0.24);
  color: var(--danger);
  background: rgba(165, 69, 56, 0.08);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  padding: clamp(28px, 5vw, 62px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 5.3vw, 5.1rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
  text-wrap: balance;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff7ea;
  text-decoration: none;
  font-weight: 760;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(35, 51, 72, 0.18);
  transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(35, 51, 72, 0.22);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.54);
  color: var(--navy);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.microcopy {
  color: var(--muted);
  font-size: 0.9rem;
}

.ledger-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.32)),
    repeating-linear-gradient(0deg, transparent 0, transparent 35px, rgba(31, 42, 46, 0.04) 36px);
  padding: 22px;
}

.ledger-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.quota {
  display: flex;
  gap: 10px;
  margin: 26px 0 18px;
}

.quota-dot {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.48);
  position: relative;
  overflow: hidden;
}

.quota-dot.available {
  background: linear-gradient(145deg, rgba(40, 115, 92, 0.24), rgba(255, 255, 255, 0.48));
  border-color: rgba(40, 115, 92, 0.28);
}

.quota-dot.used {
  background: repeating-linear-gradient(135deg, rgba(31, 42, 46, 0.07) 0 5px, rgba(255, 255, 255, 0.5) 5px 10px);
}

.quota-dot.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: sheen 1.2s infinite;
}

@keyframes sheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.quota-text {
  color: var(--ink);
  font-weight: 760;
}

.mini-ledger {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
}

.mini-ledger div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mini-ledger dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-ledger dd {
  margin: 0;
  font-weight: 760;
  text-align: right;
}

.principles,
.game-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.principles article,
.game-card,
.policy-note,
.workbench {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 240, 0.64);
  backdrop-filter: blur(14px);
}

.principles article {
  padding: 22px;
}

.principle-icon {
  display: inline-flex;
  margin-bottom: 34px;
  color: var(--accent);
  font-weight: 850;
  letter-spacing: 0.12em;
}

.principles h2 {
  margin-bottom: 10px;
  font-size: 1.06rem;
}

.principles p,
.game-card p,
.section-heading p,
.policy-note p,
.game-meta {
  color: var(--muted);
  line-height: 1.8;
}

.games-section {
  margin-top: 56px;
}

.section-heading {
  max-width: 760px;
}

.section-heading h2,
.policy-note h2,
.workbench h2 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  letter-spacing: -0.04em;
}

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

.game-card {
  display: flex;
  flex-direction: column;
  min-height: 310px;
  padding: 24px;
}

.game-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 36px;
}

.game-chip,
.duration {
  min-height: 30px;
  padding: 0 11px;
}

.game-card h3 {
  margin-bottom: 10px;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.game-card .button {
  margin-top: auto;
  align-self: flex-start;
}

.workbench {
  margin-top: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.workbench[hidden] {
  display: none;
}

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

.timer-pill {
  width: 64px;
  height: 64px;
  background: var(--navy);
  color: #fff7ea;
  border: 0;
  font-size: 1.2rem;
}

.timer-pill.warn {
  background: var(--danger);
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.game-status {
  min-height: 28px;
  color: var(--navy);
  font-weight: 760;
  margin-bottom: 16px;
}

.game-mount {
  min-height: 220px;
}

.mines-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  gap: 8px;
  max-width: 460px;
}

.mine-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--navy);
  font-weight: 850;
  font-size: 1rem;
  cursor: pointer;
}

.mine-cell.revealed {
  background: rgba(35, 51, 72, 0.07);
  box-shadow: inset 0 0 0 1px rgba(31, 42, 46, 0.04);
  cursor: default;
}

.mine-cell.flagged {
  background: rgba(123, 93, 53, 0.12);
}

.mine-cell.mine {
  background: rgba(165, 69, 56, 0.14);
  color: var(--danger);
}

.solitaire-layout {
  display: grid;
  gap: 18px;
}

.card-row,
.pile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.play-card,
.pile {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.play-card {
  width: 70px;
  height: 92px;
  display: grid;
  place-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--navy);
  font-weight: 850;
}

.play-card small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.play-card.selected {
  outline: 3px solid rgba(40, 115, 92, 0.24);
  background: rgba(40, 115, 92, 0.12);
}

.pile {
  min-width: 180px;
  min-height: 142px;
  padding: 14px;
  cursor: pointer;
}

.pile-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.pile-total {
  margin-top: 8px;
  font-size: 1.75rem;
  font-weight: 850;
  color: var(--navy);
}

.pile-cards {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.9rem;
}

.pile.complete {
  border-color: rgba(40, 115, 92, 0.28);
  background: rgba(40, 115, 92, 0.09);
}

.policy-note {
  margin-top: 28px;
  padding: 24px;
}

.quiz-dialog {
  width: min(620px, calc(100% - 28px));
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.quiz-dialog::backdrop {
  background: rgba(31, 42, 46, 0.38);
  backdrop-filter: blur(6px);
}

.quiz-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.3rem;
}

.quiz-choices {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.choice-button {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  line-height: 1.5;
}

.choice-button:hover:not(:disabled) {
  background: rgba(40, 115, 92, 0.08);
}

.choice-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.quiz-feedback {
  min-height: 28px;
  color: var(--danger);
  font-weight: 750;
  margin-top: 14px;
}

.end-card {
  max-width: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  background: rgba(255, 255, 255, 0.6);
}

.end-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.end-card p {
  color: var(--muted);
  line-height: 1.8;
}

.end-actions {
  margin-top: 18px;
}

@media (max-width: 860px) {
  .hero-grid,
  .principles,
  .game-list {
    grid-template-columns: 1fr;
  }

  .ledger-card {
    max-width: 100%;
  }

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

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero-grid,
  .workbench,
  .policy-note,
  .game-card,
  .principles article,
  .quiz-panel {
    padding: 18px;
  }

  .quota-dot {
    width: 42px;
    height: 42px;
  }

  .mines-grid {
    grid-template-columns: repeat(6, minmax(36px, 1fr));
    gap: 6px;
  }

  .mine-cell {
    border-radius: 10px;
  }

  .play-card {
    width: 58px;
    height: 78px;
  }

  .pile {
    min-width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12191a;
    --paper-strong: #1b2425;
    --ink: #edf0ea;
    --muted: #aab4ac;
    --line: rgba(237, 240, 234, 0.12);
    --line-strong: rgba(237, 240, 234, 0.2);
    --navy: #d6c7a3;
    --navy-soft: #c9ba99;
    --accent: #dbc18c;
    --accent-soft: #3f3525;
    --green: #75c9a8;
    --danger: #f08f7f;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(89, 75, 47, 0.5), transparent 34rem),
      linear-gradient(145deg, var(--paper), #18211f 100%);
  }

  .brand-mark,
  .button,
  .timer-pill {
    color: #172021;
  }

  .hero,
  .principles article,
  .game-card,
  .policy-note,
  .workbench,
  .ledger-card {
    background: rgba(27, 36, 37, 0.68);
  }

  .button.ghost,
  .audit-badge,
  .game-chip,
  .duration,
  .play-card,
  .pile,
  .choice-button,
  .mine-cell,
  .icon-button,
  .end-card {
    background: rgba(255, 255, 255, 0.06);
  }
}
