:root {
  color-scheme: light;
  --bg: #f4f8f5;
  --ink: #173d3a;
  --muted: #5e7773;
  --brand: #23615b;
  --brand-dark: #17433f;
  --purple: #6a2c91;
  --gold: #f3b545;
  --surface: #ffffff;
  --line: #d9e7e2;
  --soft: #e9f4ef;
  --danger: #8a4731;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

body.dark-mode {
  color-scheme: dark;
  --bg: #101817;
  --ink: #edf7f3;
  --muted: #a9c3bd;
  --brand: #6bd0a6;
  --brand-dark: #9be8c7;
  --purple: #c695f1;
  --gold: #ffd166;
  --surface: #172321;
  --line: #2f4944;
  --soft: #20342f;
  --danger: #ffb39e;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.app-shell.big-text {
  font-size: 1.18rem;
}

.app-header {
  display: grid;
  grid-template-columns: 122px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 8px 0 14px;
}

.brand-logo {
  width: 122px;
  height: 122px;
  object-fit: contain;
}

.token-logo {
  border-radius: 22px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 2rem;
}

.eyebrow,
.section-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

h2 {
  margin-bottom: 6px;
  font-size: 1.22rem;
}

h3 {
  margin: 18px 0 8px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.tab,
.pill-button,
.small-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.tab {
  padding: 9px 7px;
  background: #e4efeb;
  color: var(--brand);
  font-size: 0.86rem;
}

.tab.active {
  background: var(--brand);
  color: #fff;
}

.pill-button,
.small-button {
  padding: 10px 14px;
  background: #e0eee9;
  color: var(--brand);
}

.primary-button {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
}

.secondary-button {
  background: #e8efed;
  color: var(--brand);
  padding: 12px 16px;
}

.ghost {
  background: #f3ece7;
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel,
.panel,
.learn-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.hero-panel {
  border-color: #bee2d3;
  background: linear-gradient(180deg, #ffffff 0%, #eaf6ef 100%);
}

body.dark-mode .hero-panel {
  border-color: #31584f;
  background: linear-gradient(180deg, #172321 0%, #13201d 100%);
}

.board-top {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 11px;
}

body.dark-mode .field input,
body.dark-mode .field select,
body.dark-mode .field textarea {
  background: #111b19;
}

.field.compact input,
.field.compact select {
  padding: 10px;
}

.wide {
  grid-column: 1 / -1;
}

.reward-card {
  text-align: center;
}

.image-frame {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #fff7df;
}

body.dark-mode .image-frame {
  background: #2d2440;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reward-visual {
  width: 112px;
  height: 112px;
  margin: 8px auto 10px;
  color: var(--purple);
  font-size: 3rem;
}

.token-board {
  display: grid;
  gap: 9px;
  margin: 16px 0;
}

.token {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 2px dashed #bad8d1;
  border-radius: 8px;
  background: #f8fbfa;
  color: #9fb8b2;
  font-size: 1.65rem;
  font-weight: 900;
  transition: transform 160ms ease;
}

body.dark-mode .token {
  background: #111b19;
  color: #76948e;
}

.token.filled {
  border-style: solid;
  border-color: var(--gold);
  background: #fff3cf;
  color: #d48500;
  transform: scale(1.03);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.choice-grid,
.list-stack {
  display: grid;
  gap: 9px;
}

.choice,
.list-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
}

body.dark-mode .choice,
body.dark-mode .list-item {
  background: #111b19;
}

.choice.active,
.list-item.active {
  border-color: var(--brand);
  background: var(--soft);
}

.thumb {
  width: 52px;
  height: 52px;
  font-size: 1.55rem;
}

.item-title {
  margin: 0;
  font-weight: 800;
}

.item-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.delete-button {
  min-width: 42px;
  min-height: 42px;
  border-radius: 8px;
  background: #f5e7e1;
  color: var(--danger);
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.history-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.danger-button {
  background: #f5e7e1;
  color: var(--danger);
}

.stat {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
  text-align: center;
}

.stat strong {
  color: var(--brand);
  font-size: 1.6rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.history-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.history-list li {
  margin-bottom: 9px;
  line-height: 1.35;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  color: var(--ink);
  font-weight: 800;
}

.switch-row input {
  width: 24px;
  height: 24px;
}

.learn-panel {
  line-height: 1.55;
}

.learn-logo {
  display: block;
  width: 150px;
  margin: 0 auto 14px;
}

.learn-panel p,
.learn-panel li {
  color: var(--muted);
}

.professional-note {
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.app-footer {
  padding: 8px 4px 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 4;
  display: none;
  max-width: 500px;
  margin: auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-align: center;
}

.toast.show {
  display: block;
}

.celebration {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 3;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  animation: fall 1.7s ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(620deg);
    opacity: 0;
  }
}

@media (max-width: 680px) {
  .app-header {
    grid-template-columns: 96px 1fr auto;
  }

  .brand-logo {
    width: 96px;
    height: 96px;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .board-top,
  .history-controls,
  .form-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@media (max-width: 440px) {
  .app-shell {
    padding: 12px;
  }

  .app-header {
    gap: 9px;
  }

  .brand-copy h1 {
    font-size: 1.55rem;
  }

  .choice,
  .list-item {
    grid-template-columns: 46px 1fr auto;
  }

  .thumb {
    width: 46px;
    height: 46px;
  }
}
