/* Warm, flat, print-like. One accent colour, no gradients, no shadows. */
:root {
  --paper: #f6f1e7;
  --ink: #1d1a16;
  --muted: #6d665a;
  --line: #d9d0c0;
  --card: #fffdf8;
  --accent: #1f3a2e;
  --accent-ink: #f4efe6;
  --yes: #2f6b46;
  --yes-soft: #dfeadf;
  --online: #8a5a12;
  --online-soft: #f3e4c6;
  --no: #8b3a2f;
  --no-soft: #f1dcd6;
  --radius: 10px;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17150f;
    --ink: #eee8dc;
    --muted: #a39a89;
    --line: #3a352c;
    --card: #211e17;
    --accent: #c9d9c9;
    --accent-ink: #17150f;
    --yes: #9fd3ac;
    --yes-soft: #24382b;
    --online: #e6b96b;
    --online-soft: #3d2e14;
    --no: #e8998c;
    --no-soft: #3f2420;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--sans);
  padding-bottom: env(safe-area-inset-bottom);
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}
h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 12px 0 8px;
}
h1 { font-size: 30px; }
h2 { font-size: 20px; margin-top: 32px; }
p { margin: 8px 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 15px; }
.empty { color: var(--muted); padding: 24px 0; }
.narrow { max-width: 380px; margin: 40px auto 0; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 15px; margin-top: 8px; }
.back:hover { color: var(--ink); }

/* header */
.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 640px; margin: 0 auto; padding: 14px 16px 6px;
}
.brand { font-family: var(--serif); font-weight: 700; font-size: 20px; text-decoration: none; }
.who { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--muted); margin: 0; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
input, textarea {
  font: inherit; color: inherit;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 48px;
  width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent);
}
.error {
  background: var(--no-soft); color: var(--no);
  border-radius: var(--radius); padding: 10px 14px; margin: 0;
}

button, .button {
  font: inherit; font-weight: 600; color: inherit;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
button:active { transform: translateY(1px); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.secondary { border-style: dashed; color: var(--muted); }
.link { background: none; border: none; padding: 0; min-height: 0; color: var(--muted); text-decoration: underline; font-weight: 500; }
.danger { color: var(--no); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* slot editor */
.slots { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.slots legend { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.slot-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 6px; align-items: center; }
.slot-row input[type=time] { width: 7.2em; padding-left: 8px; padding-right: 8px; }
.dash { color: var(--muted); }
.icon { padding: 0; width: 44px; min-height: 44px; font-size: 22px; line-height: 1; color: var(--muted); }
@media (max-width: 420px) {
  .slot-row { grid-template-columns: 1fr 1fr auto 1fr auto; }
  .slot-row input[type=date] { grid-column: 1 / -1; }
  .slot-row input[type=time] { width: 100%; }
}

/* proposal list */
.cards { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card strong { font-size: 18px; }
.past .card { opacity: .7; }

/* proposal detail */
.slots-list { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.slot {
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px;
}
.slot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.when { display: flex; flex-direction: column; }
.when strong { font-size: 18px; }
.when span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tally { display: flex; gap: 4px; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.tally .n { padding: 2px 9px; border-radius: 999px; }
.tally .either { background: var(--yes-soft); color: var(--yes); }
.tally .online { background: var(--online-soft); color: var(--online); }
.tally .no { background: var(--no-soft); color: var(--no); }

.choice { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 6px; margin: 0; }
.opt { padding: 10px 6px; font-size: 15px; min-height: 48px; line-height: 1.2; }
.opt.on.either { background: var(--yes-soft); color: var(--yes); border-color: var(--yes); }
.opt.on.online { background: var(--online-soft); color: var(--online); border-color: var(--online); }
.opt.on.no { background: var(--no-soft); color: var(--no); border-color: var(--no); }
.opt:disabled { opacity: .6; }

.people { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.p { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.p.either { background: var(--yes-soft); color: var(--yes); }
.p.online { background: var(--online-soft); color: var(--online); }
.p.no { background: var(--no-soft); color: var(--no); text-decoration: line-through; }

/* ranked matrix */
.matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; }
.matrix th, .matrix td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.matrix thead th:first-child { text-align: left; }
.matrix thead th { font-weight: 600; color: var(--muted); font-size: 13px; vertical-align: bottom; }
.matrix th.player { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
.matrix tbody th {
  text-align: left; position: sticky; left: 0; background: var(--paper);
  display: flex; flex-direction: column; line-height: 1.2; font-weight: 600;
}
.matrix tbody th small { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.matrix td.c { font-weight: 700; min-width: 44px; }
.matrix td.either { color: var(--yes); background: var(--yes-soft); }
.matrix td.online { color: var(--online); background: var(--online-soft); }
.matrix td.no { color: var(--no); background: var(--no-soft); }
.matrix td.none { color: var(--muted); }
.legend { font-size: 13px; }

.danger-zone { margin-top: 40px; text-align: center; }
