:root {
  color-scheme: light dark;
  --bg: #faf8f5;
  --surface: #ffffff;
  --border: #e2ddd4;
  --text: #2a2620;
  --text-muted: #756e60;
  --accent: #c9622a;
  --accent-text: #ffffff;
  --need: #b3401f;
  --need-bg: #fdeee7;
  --have: #4b7a3e;
  --have-bg: #eef6ea;
  --both-need-bg: #fff2cc;
  --both-need-border: #d9a919;
  --toss-bg: #f1efe9;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17;
    --surface: #262320;
    --border: #3a3630;
    --text: #ece7de;
    --text-muted: #a89e8d;
    --accent: #e08048;
    --accent-text: #1c1a17;
    --need: #e2795a;
    --need-bg: #3a2620;
    --have: #8fc178;
    --have-bg: #22301d;
    --both-need-bg: #3d3416;
    --both-need-border: #b8901f;
    --toss-bg: #2c2924;
  }
}

:root[data-theme="dark"] {
  --bg: #1c1a17;
  --surface: #262320;
  --border: #3a3630;
  --text: #ece7de;
  --text-muted: #a89e8d;
  --accent: #e08048;
  --accent-text: #1c1a17;
  --need: #e2795a;
  --need-bg: #3a2620;
  --have: #8fc178;
  --have-bg: #22301d;
  --both-need-bg: #3d3416;
  --both-need-border: #b8901f;
  --toss-bg: #2c2924;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px 32px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

header {
  padding: 20px 0 8px;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
}

footer {
  max-width: 640px;
  margin: 24px auto 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

footer a { color: var(--text-muted); }

.loading, .error, .empty {
  color: var(--text-muted);
  padding: 24px 0;
}

.error { color: var(--need); }

nav.mode-switch {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

nav.mode-switch button {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

nav.mode-switch button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

select {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.card.both-need {
  background: var(--both-need-bg);
  border-color: var(--both-need-border);
}

.card.toss {
  background: var(--toss-bg);
}

.card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.card-title h3 {
  margin: 0;
  font-size: 1.05rem;
}

.card-title .count {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.card-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 10px;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.copy-preview {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow-x: auto;
}

.copy-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn.copied {
  background: var(--have);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.stats-row strong {
  color: var(--text);
}

.meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 14px;
}
