:root {
  --bg: #f3f0e8;
  --ink: #1c1915;
  --muted: #6d665e;
  --card: #fffcf7;
  --line: #e3dcd2;
  --accent: #0f6e56;
  --accent-ink: #f7fffb;
  --bull: #0f6e56;
  --bear: #9f2d2d;
  --danger-bg: #f8e8e4;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --ink: #f4f0e8;
    --muted: #a39c92;
    --card: #1e1c19;
    --line: #34302b;
    --accent: #3dd6a5;
    --accent-ink: #10241c;
    --bull: #3dd6a5;
    --bear: #ff8f8f;
    --danger-bg: #3a2220;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
}

a { color: inherit; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 650;
  letter-spacing: -0.03em;
  text-decoration: none;
  font-size: 1.05rem;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 80px;
}

h1, h2 {
  font-weight: 640;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}

h1 { font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem); }
h2 { font-size: 1.25rem; }

.lede, .muted { color: var(--muted); }
.lede { margin: 8px 0 0; max-width: 42rem; }

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

.narrow { max-width: 420px; margin: 8vh auto 0; }

.stack, .dates { display: grid; gap: 14px; margin-top: 20px; }
.dates { grid-template-columns: 1fr 1fr auto; align-items: end; }

label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-color: var(--accent);
}

button {
  font: inherit;
  font-weight: 620;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

button.text {
  color: var(--muted);
  background: transparent;
  padding: 8px 0;
  font-weight: 500;
}

.error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--bear);
}

.track {
  height: 8px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin-top: 14px;
}

.track span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
}

.section-head { margin: 36px 0 16px; }
.section-head p { margin: 6px 0 0; }

.patterns {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.patterns a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}

.patterns a:hover { border-color: var(--accent); }

.patterns strong {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.back { margin: 0 0 12px; }
.back a { color: var(--muted); }

.filter { max-width: 240px; margin-bottom: 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

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

.card img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.card-meta { padding: 12px 14px 14px; }
.card-meta h2 { font-size: 1rem; }
.card-meta p { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }

.pill {
  display: inline-block;
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 650;
  margin-right: 6px;
}

.pill.bull { color: var(--bull); background: color-mix(in srgb, var(--bull) 14%, transparent); }
.pill.bear { color: var(--bear); background: color-mix(in srgb, var(--bear) 14%, transparent); }

@media (max-width: 720px) {
  .dates { grid-template-columns: 1fr; }
  .top, main { width: min(1120px, calc(100% - 24px)); }
  .top { width: auto; padding: 16px; }
}
