:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --border: #dcdcd6;
  --accent: #c2410c;
  --accent-text: #ffffff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1f1f1d;
    --text: #ececE8;
    --muted: #9a9a93;
    --border: #353532;
    --accent: #fb923c;
    --accent-text: #1c1c1a;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, sans-serif;
}
[hidden] { display: none !important; }

header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
h1 { margin: 0; font-size: 17px; }
nav { display: flex; }
nav a {
  padding: 14px 14px 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
nav a.active { color: var(--text); border-bottom-color: var(--accent); }
#countdown { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

button, select, textarea { font: inherit; color: inherit; }
button, select {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Page tab */
#tab-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
#versions { max-width: min(100%, 320px); }
#caption {
  flex: 1 1 200px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#frame { flex: 1; width: 100%; border: 0; background: #fff; }

/* Vote tab */
#tab-vote { flex: 1; overflow-y: auto; padding: 24px 16px 48px; }
.column { max-width: 640px; margin: 0 auto; }
#status { margin: 0 0 20px; color: var(--muted); }
form label { display: block; margin-bottom: 6px; font-weight: 600; }
textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}
.form-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
#form-note { flex: 1; color: var(--muted); font-size: 14px; }
#form-note.error { color: var(--accent); }
form button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

h2 { margin: 32px 0 8px; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#prompts { list-style: none; margin: 0; padding: 0; }
#prompts li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
#prompts p { flex: 1; min-width: 0; margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.vote { min-width: 60px; font-variant-numeric: tabular-nums; }
.vote[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.mine { margin-left: 8px; color: var(--muted); font-size: 13px; }
#empty { color: var(--muted); }
#vote-note { margin: 0 0 8px; color: var(--accent); font-size: 14px; }
#vote-note:empty { display: none; }
#rollback { border-color: var(--accent); color: var(--accent); }

footer {
  padding: 6px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
footer a { color: inherit; }
