
:root {
  --bg: #0c0e12;
  --panel: #14171d;
  --panel-2: #1b1f27;
  --line: #272c36;
  --text: #e7e9ee;
  --muted: #8b93a3;
  --accent: #39d353;
  --empty: #161b22;
  --l1: #0e4429;
  --l2: #006d32;
  --l3: #26a641;
  --l4: #39d353;
  --empty-we: #20262f; /* lighter than --empty for dark mode */
  --we1: #0d419d;
  --we2: #1158c7;
  --we3: #388bfd;
  --we4: #79c0ff;
}

[data-theme="light"] {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-2: #f0f1ec;
  --line: #e2e4dd;
  --text: #1c1f26;
  --muted: #6a7180;
  --accent: #216e39;
  --empty: #ebedf0;
  --l1: #9be9a8;
  --l2: #40c463;
  --l3: #30a14e;
  --l4: #216e39;
  --empty-we: #dde0e6; /* darker than --empty for light mode */
  --we1: #b6d4fe;
  --we2: #6cb1ff;
  --we3: #2188ff;
  --we4: #0969da;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(circle at 12% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 45%);
  min-height: 100vh;
  padding: 48px 24px 80px;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

h1 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: clamp(28px, 5vw, 46px);
  line-height: .95;
  margin: 0;
  letter-spacing: -.02em;
}

h1 .em {
  color: var(--accent);
  font-style: italic;
}

.sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 8px;
  max-width: 48ch;
  line-height: 1.5;
}

.theme-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}

.theme-btn:hover {
  border-color: var(--accent);
}

.theme-btn:active {
  transform: translateY(1px);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 28px;
}

.input-shell {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
}

.input-shell::before {
  content: "@";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 11px 12px 11px 30px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

input[type="text"]:focus {
  border-color: var(--accent);
}

.go {
  background: var(--accent);
  color: #08130b;
  border: none;
  border-radius: 9px;
  padding: 11px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}

[data-theme="light"] .go {
  color: #fff;
}

.go:hover {
  filter: brightness(1.08);
}

.go:active {
  transform: translateY(1px);
}

.go:disabled {
  opacity: .5;
  cursor: default;
}

.toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.toggle button {
  background: var(--bg);
  color: var(--muted);
  border: none;
  padding: 11px 13px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.toggle button.on {
  background: var(--panel-2);
  color: var(--text);
}

.toggle button + button {
  border-left: 1px solid var(--line);
}

#status {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 4px;
  min-height: 24px;
}

#status .err {
  color: #ff6b6b;
}

.year {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 14px;
  margin-bottom: 18px;
  animation: rise .4s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.year-head .lead {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.year-head .y {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.01em;
}

.year-head .t {
  color: var(--muted);
  font-size: 12px;
}

.year-head .t b {
  color: var(--text);
  font-weight: 700;
}

.dl {
  display: inline-flex;
  gap: 6px;
}

.dl button {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 10px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.dl button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

svg {
  display: block;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 11px;
  margin-top: 26px;
}

.legend .sw {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

#tip {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, -130%);
  transition: opacity .1s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

footer {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 36px;
  line-height: 1.6;
}

footer code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 5px;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color .15s, color .15s;
}

footer a:hover {
  border-bottom-color: var(--accent);
  color: var(--text);
}