:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #666666;
  --accent: #ff6600;
  --border: #333333;

  /* Buttons come in three tiers, after http-nu's 2048 example:
     primary    solid accent, the one action that matters here
     secondary  a subdued slab that turns accent on hover
     tertiary   bare text, for actions repeated on every row */
  --primary: var(--accent);
  --primary-hover: #ff8533;
  --primary-press: #d95700;
  --on-primary: var(--bg-primary);
  --secondary: var(--bg-tertiary);
  --on-secondary: var(--text-primary);
  --tertiary: transparent;
  --on-tertiary: var(--text-muted);
  --button-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);

  --motion: 200ms ease;

  /* The time-travel bar: cross.stream's electric blue (http-nu's
     --color-accent-blue-stream) while in history, and 2048's deep body blue,
     calmer, while live. */
  --stream: #00d4ff;
  --stream-rest: #0077b6;

  /* Now while live: home. Forest green, with 2048's warm cream header color
     for the text. */
  --home: #2e6b45;
  --on-home: #f4d9a0;

  /* The kinds of change, on the history header. */
  --change-added: #4cc38a;
  --change-completed: var(--accent);
  --change-reopened: #f5c542;
  --change-deleted: #ef5350;
  --change-other: var(--text-muted);
}

* {
  box-sizing: border-box;
}

body {
  font-family: monospace;
  font-size: 1.1em;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 2em;
  line-height: 1.4;
}

main {
  max-width: 40em;
  margin: 0 auto;
}

h1 {
  color: var(--accent);
  font-size: 2.5em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.5em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

header {
  background: var(--bg-secondary);
  padding: 1.5em;
  margin-bottom: 1em;
  border: 2px solid var(--border);
}

header label {
  display: flex;
  align-items: center;
  height: 1.8em;
  margin-bottom: 1em;
  font-weight: bold;
}

header input[type="checkbox"] {
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.75em;
  accent-color: var(--accent);
}

header input[type="text"] {
  width: 100%;
  padding: 1em;
  font-size: 1em;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
  outline: none;
}

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

header input[type="text"]::placeholder {
  color: var(--text-muted);
}

.time-travel {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin-bottom: 1em;
  color: var(--text-secondary);
  font-size: 0.85em;
}

.time-travel input[type="range"] {
  flex: 1;
  accent-color: var(--stream);
}

/* Live (Now pressed): the bar rests in the calmer blue. */
.time-travel:has([aria-pressed="true"]) input[type="range"] {
  accent-color: var(--stream-rest);
}

.time-travel button[aria-pressed="true"] {
  background: var(--home);
  color: var(--on-home);
}

[data-kind="added"] { --kind: var(--change-added); }
[data-kind="completed"] { --kind: var(--change-completed); }
[data-kind="reopened"] { --kind: var(--change-reopened); }
[data-kind="deleted"] { --kind: var(--change-deleted); }
[data-kind="other"] { --kind: var(--change-other); }

.time-travel button {
  padding: 0.25em 0.75em;
}

/* Play and pause glyphs differ in width: keep the button's. */
.time-travel button.play {
  min-width: 3em;
}

/* A history header: which change, and what it did. The same heights as the
   toggle-all row and the text input it replaces, so the list doesn't move. */
header .past-title {
  height: 1.8em;
  line-height: 1.8em;
  text-align: left;
  margin: 0 0 1em 0;
  padding: 0;
  color: var(--text-primary);
}

header .past-title span {
  color: var(--text-muted);
  font-weight: normal;
}

header .past-note {
  margin: 0;
  padding: 1em;
  font-size: 1em;
  line-height: normal;
  border: 2px solid var(--border);
  border-left: 0.4em solid var(--kind);
  color: var(--text-primary);
  text-align: left;
  font-weight: normal;
}

/* Switching between live and history swaps the header's rows, and scrubbing
   adds and removes todos: each new one fades in. A row that stays, like the
   history header while scrubbing, just changes its text. */
header > *,
li {
  transition: opacity var(--motion), translate var(--motion);
}

@starting-style {
  header > *,
  li {
    opacity: 0;
    translate: 0 -0.3em;
  }
}

section {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  padding: 1em;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

li:last-child {
  border-bottom: none;
}

li[data-completed="true"] {
  opacity: 0.5;
}

/* A live row is a label around its checkbox; a history row is plain text,
   with a mark in the checkbox's place. Both are as tall as the Delete
   button, so a row is the same height either way. */
li > label,
li > span {
  display: flex;
  align-items: center;
  flex: 1;
  min-height: 1.95em;
}

li > label {
  cursor: pointer;
}

li .mark {
  width: 1.2em;
  margin: 0 0.75em 0 3px;
  text-align: center;
  color: var(--text-muted);
}

input[type="checkbox"] {
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.75em;
  accent-color: var(--accent);
}

/* A button is secondary unless it says otherwise. */
button {
  padding: 0.5em 1em;
  background: var(--secondary);
  color: var(--on-secondary);
  border: none;
  box-shadow: var(--button-shadow);
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  font-size: 0.9em;
  text-transform: uppercase;
  transition: background var(--motion), color var(--motion), translate 80ms, box-shadow 80ms;
}

button:hover {
  background: var(--primary);
  color: var(--on-primary);
}

button:active {
  translate: 0 2px;
  box-shadow: none;
}

/* A toggle that's on, like Now while live, is primary. */
button.primary,
button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

button.primary:hover {
  background: var(--primary-hover);
}

button.primary:active {
  background: var(--primary-press);
}

button.tertiary {
  background: var(--tertiary);
  color: var(--on-tertiary);
  box-shadow: none;
}

button.tertiary:hover {
  color: var(--primary);
}

/* Pressed or disabled, a click does nothing, so nothing moves. */
button[aria-pressed="true"],
button:disabled {
  cursor: default;
  translate: none;
  box-shadow: var(--button-shadow);
}

button:disabled {
  opacity: 0.3;
  background: var(--secondary);
  color: var(--on-secondary);
}

footer {
  padding: 1em;
  background: var(--bg-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

footer p {
  margin: 0;
  color: var(--text-secondary);
}

footer strong {
  color: var(--accent);
}

p {
  padding: 2em;
  text-align: center;
  color: var(--text-muted);
  margin: 0;
  font-weight: bold;
}

/* Card component */
.card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.card:hover {
  background: var(--bg-primary);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(0deg) scale(1.1);
  box-shadow:
    0 0 20px var(--accent),
    0 0 40px var(--accent),
    0 0 60px var(--accent);
  text-shadow: 0 0 10px var(--accent);
}

.card img {
  margin-bottom: 0.25em;
  object-fit: contain;
}

.card span {
  font-weight: bold;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bottom nav links */
nav a {
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--accent) !important;
}

/* Tracker-style metrics section */
.tracker-metrics {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--bg-tertiary);
  border: 2px outset var(--text-muted);
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 12px;
  font-weight: bold;
  margin-top: 1px;
}

.tracker-panel {
  flex: 1;
  background: var(--bg-primary);
  border: 2px inset var(--border);
  padding: 8px 4px;
  text-align: center;
}

.tracker-label {
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-weight: bold;
}

.tracker-value {
  color: var(--accent);
  font-size: 16px;
  font-weight: bold;
  background: var(--bg-primary);
  padding: 2px 4px;
  letter-spacing: 1px;
  font-family: "Courier New", monospace;
  border: 1px solid var(--border);
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  div[style*="padding: 2em"] {
    padding: 1em !important;
  }

  div a {
    transform: rotate(0deg) !important;
    margin: 0.2em !important;
  }

  .tracker-metrics {
    flex-direction: column;
    gap: 0.5em;
  }

  .tracker-panel {
    min-width: auto;
  }
}
