:root {
  --bg: #efe6da;
  --bg-2: #e7dccb;
  --card: #fffcf8;
  --ink: #1b1612;
  --muted: #5c5148;
  --line: #e3d5c6;
  --copper: #9a4318;
  --copper-soft: #f6dccb;
  --copper-ink: #6e3014;
  --bar: #ead4c4;
  --btn: #1b1612;
  --btn-ink: #f7f1ea;
  --danger: #8d2b2b;
  --bad-bg: #fde8e4;
  --shadow: 0 1px 0 rgba(28, 22, 18, 0.04), 0 10px 28px rgba(28, 22, 18, 0.05);
  color-scheme: light;
  font-family: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100e0c;
    --bg-2: #1a1613;
    --card: #1c1815;
    --ink: #f6efe6;
    --muted: #c4b4a6;
    --line: #342c25;
    --copper: #f0a36a;
    --copper-soft: #3a2a20;
    --copper-ink: #f6d2b4;
    --bar: #3d322a;
    --btn: #f6efe6;
    --btn-ink: #1b1612;
    --danger: #ffb4b0;
    --bad-bg: #3a2220;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1200px 420px at 10% -10%, var(--bg-2), transparent 60%),
    var(--bg);
}
body::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--copper), #e7c4a8 42%, transparent);
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--copper-soft); color: var(--ink); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 3;
}
.skip:focus { top: 12px; }

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.logo a {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 36px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
  color: inherit;
  text-decoration: none;
}
.logo span { color: var(--copper); font-style: italic; font-weight: 500; }
.lede { margin-top: 6px; color: var(--muted); }

.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--btn);
  color: var(--btn-ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.danger { color: var(--danger); border-color: var(--line); background: transparent; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--copper-soft);
  color: var(--copper-ink);
  border-radius: 14px;
  padding: 10px 12px 10px 16px;
  margin-bottom: 12px;
}
.banner[hidden] { display: none; }

.status {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.status:empty { display: none; }
.status[data-bad="1"] {
  color: var(--danger);
  background: var(--bad-bg);
  border-radius: 12px;
  padding: 10px 12px;
}

.composer { display: flex; flex-direction: column; gap: 14px; }
.identity {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 12px;
}
.board {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin-top: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
h2 {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}
.hint, .note, footer p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.note { margin-top: 14px; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 0 12px;
  font-size: 16px;
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
}
.identity label, .form label { margin-top: 0; min-width: 0; }

.form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.7fr) auto;
  gap: 10px;
  align-items: end;
}
.form-title { grid-column: 1 / -1; margin-bottom: 0; }
.form label { margin-top: 0; }
.form .btn { margin-bottom: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.stat-k {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.stat-n {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 10px 0 8px;
}
.stat-n.small { font-size: 26px; line-height: 1.15; overflow-wrap: anywhere; }
.stat-s { color: var(--muted); font-size: 13px; }

.chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  height: 120px;
  margin-top: 16px;
}
.chart span {
  display: block;
  height: calc(var(--p) * 1%);
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: var(--bar);
}
.chart span[data-now="1"] { background: var(--copper); }
.chart-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.links { list-style: none; margin: 0; padding: 0; }
.empty { color: var(--muted); }
.empty[hidden] { display: none; }
.empty p { margin-bottom: 12px; }
.link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.link:first-child { border-top: 0; padding-top: 4px; }
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1;
  padding: 7px 8px;
  margin-top: 3px;
  height: fit-content;
  color: var(--copper-ink);
  background: var(--copper-soft);
  border-radius: 999px;
}
.link-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.link-top strong { overflow-wrap: anywhere; }
.count { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.meter {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--copper);
  border-radius: inherit;
}
.host { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 22px;
}
footer p { max-width: 62ch; }

#page, #leave, #bad { display: none; }
html[data-view="page"] #desk,
html[data-view="leave"] #desk,
html[data-view="bad"] #desk { display: none; }
html[data-view="page"] #page,
html[data-view="leave"] #leave,
html[data-view="bad"] #bad { display: block; }

.sheet {
  width: min(440px, calc(100% - 32px));
  margin: 10vh auto 48px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper);
  font-weight: 700;
  margin-bottom: 10px;
}
.sheet h1 {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 40px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.tagline { margin: 10px 0 18px; color: var(--muted); font-size: 17px; line-height: 1.4; }
.page-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  justify-content: center;
  padding: 12px 14px;
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: inherit;
  text-decoration: none;
}
.page-link small { color: var(--muted); overflow-wrap: anywhere; }
.page-link:hover { border-color: var(--copper); }
.url {
  margin: 12px 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.sheet .acts { margin-top: 18px; }
#leave-go[hidden] { display: none; }

@media (max-width: 860px) {
  .board, .identity { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr 1fr; }
  .form-title, .form label:first-of-type, .form .btn { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  footer { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .wrap { width: min(1080px, calc(100% - 24px)); padding-top: 16px; }
  .top, .banner { flex-direction: column; align-items: stretch; }
  .logo a { font-size: 34px; }
  .form { grid-template-columns: 1fr; }
  .sheet { margin-top: 24px; }
  .sheet h1 { font-size: 34px; }
  .actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  .meter i { transition: none; }
}
