:root,
[data-theme="light"] {
  --bg: #f3eee6;
  --surface: #fffaf3;
  --ink: #1c1712;
  --muted: #5e564c;
  --line: #d9cfc0;
  --accent: #7a1f38;
  --accent-ink: #fffaf3;
  --good: #215c3a;
  --warn: #8a4b12;
  --bad: #8a2430;
  --shadow: 0 10px 30px rgba(28, 23, 18, 0.08);
}

[data-theme="dark"] {
  --bg: #161310;
  --surface: #221c18;
  --ink: #f4efe7;
  --muted: #b3a89a;
  --line: #3a322c;
  --accent: #e39aab;
  --accent-ink: #1c1712;
  --good: #8fd0a6;
  --warn: #efc48a;
  --bad: #f0a0aa;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

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

.section-head h2 {
  margin-bottom: 0;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.section-actions .btn {
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

main {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  margin: 12px 0 6px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.watch p,
.card p,
.hint,
.meta {
  overflow-wrap: anywhere;
}

.hint,
.status p {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
}

.error {
  color: var(--bad);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.btn,
.theme-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  width: 100%;
}

.btn.danger {
  width: 100%;
}

.theme-toggle {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.status + .hint {
  margin-top: 12px;
  margin-bottom: 0;
}

.status {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-row p {
  margin: 0;
}

.status .run-timer {
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status[data-state="challenge"] {
  border-color: var(--warn);
}

.stack,
.finds {
  display: grid;
  gap: 12px;
}

.watch,
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg);
}

.watch {
  padding: 12px;
}

#watches.stack,
#excluded.stack {
  gap: 8px;
}

#watches .watch,
#excluded .watch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 10px;
}

#watches .watch-main,
#excluded .watch-main {
  flex: 1 1 180px;
  min-width: 0;
}

#watches .watch h3,
#watches .watch .meta,
#excluded .watch h3,
#excluded .watch .meta {
  margin: 0;
}

#watches .watch .meta,
#excluded .watch .meta {
  font-size: 0.82rem;
}

#watches .watch .actions,
#excluded .watch .actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

#watches .watch .actions .btn,
#excluded .watch .actions .btn {
  width: auto;
  min-width: 0;
  min-height: 32px;
  padding: 4px 12px;
}

.watch h3,
.card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.meta,
.watch p,
.card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

.actions {
  display: grid;
  gap: 8px;
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--line);
  display: block;
}

.card .body {
  padding: 12px;
}

.badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.new {
  background: var(--good);
  color: var(--bg);
}

.badge.sold_out,
.badge.gone {
  background: var(--bad);
  color: var(--bg);
}

.badge.in_stock {
  background: var(--line);
}

.empty {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

@media (min-width: 720px) {
  .watch .actions,
  .card .actions {
    grid-template-columns: 1fr 1fr;
  }

  .card .actions .btn.primary {
    grid-column: 1 / -1;
  }

  .finds {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}
