:root {
  --bg: #faf6ef;
  --surface: #fffdf8;
  --ink: #33302b;
  --muted: #6e675d;
  --border: #e4dccb;
  --border-strong: #d3c8b2;
  --accent: #276a5c;
  --accent-soft: #e7f0ec;
  --accent-ink: #ffffff;
  --danger: #9c3b22;
  --focus: #276a5c;
  --dot: #276a5c;
  --dot-empty: #e4dccb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(60, 50, 20, 0.08);
}

[data-theme="high-contrast"] {
  --bg: #000000;
  --surface: #000000;
  --ink: #ffffff;
  --muted: #f0f0f0;
  --border: #ffffff;
  --border-strong: #ffffff;
  --accent: #ffd23f;
  --accent-soft: #000000;
  --accent-ink: #000000;
  --danger: #ffffff;
  --focus: #ffd23f;
  --dot: #ffd23f;
  --dot-empty: #000000;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.masthead {
  border-bottom: 2px solid var(--border);
  background: var(--surface);
}

.masthead-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.25rem;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.6rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 30rem;
}

h2 {
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 1.25rem 0;
}

.muted {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--accent-ink);
}

.btn-small {
  min-height: 2.4rem;
  font-size: 0.9rem;
  padding: 0.25rem 0.8rem;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.energy-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.energy-buttons button {
  flex: 1 1 8.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.6rem;
  min-height: 3.6rem;
  border-radius: 10px;
  border: 2px solid var(--border-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.energy-buttons button:hover {
  background: var(--accent-soft);
}

.energy-buttons button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.spoon-label {
  font-weight: 400;
  font-size: 0.85rem;
}

.spent-line {
  margin: 0.9rem 0 0;
}

.picker .btn-primary {
  width: 100%;
  font-size: 1.05rem;
}

.picked-card {
  margin-top: 1rem;
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 1rem;
  background: var(--accent-soft);
}

.picked-kicker {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  color: var(--muted);
}

.picked-title {
  margin: 0.3rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.picked-cost {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
}

.add-form label {
  font-weight: 600;
  font-size: 0.95rem;
}

.add-form input[type="text"] {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}

.add-controls {
  display: flex;
  gap: 0.6rem;
}

.hint {
  margin: 0;
  font-size: 0.85rem;
}

.cost-picker {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.9rem 0.9rem;
}

.cost-picker legend {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 0.35rem;
}

.cost-picker label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 1rem;
  font-weight: 400;
  cursor: pointer;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.task:last-child {
  border-bottom: none;
}

.task-main {
  min-width: 0;
}

.task-title {
  font-weight: 600;
}

.task-title.is-done {
  color: var(--muted);
  font-weight: 400;
}

.task-note {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.task-side {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cost-dots {
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.95rem;
}

.done-badge {
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  white-space: nowrap;
}

.group-heading {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.empty-line {
  color: var(--muted);
  margin: 0.4rem 0;
}

.archived {
  margin-top: 1rem;
}

.archived summary {
  cursor: pointer;
  font-weight: 600;
}

.win-stats {
  margin: 0.5rem 0 0.75rem;
}

.win-week {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.win-all {
  margin: 0.2rem 0 0;
}

.day-strip {
  list-style: none;
  display: flex;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.day-dot {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid var(--dot);
  background: transparent;
}

.day-dot.is-filled {
  background: var(--dot);
}

.legend {
  font-size: 0.85rem;
  margin: 0.6rem 0 0;
}

.settings form {
  min-width: 18rem;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.95rem;
}

.toggle-row input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  accent-color: var(--accent);
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-actions .btn {
  justify-content: flex-start;
  width: 100%;
}

.settings .action-row {
  margin-top: 1.2rem;
}

dialog {
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 1.25rem;
  max-width: 24rem;
  width: calc(100% - 2rem);
}

dialog::backdrop {
  background: rgba(20, 16, 8, 0.55);
}

[data-theme="high-contrast"] dialog::backdrop {
  background: rgba(0, 0, 0, 0.92);
}

.foot {
  padding-bottom: 2rem;
}

.foot p {
  margin: 0.3rem 0;
  font-size: 0.95rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
