:root {
  color-scheme: dark;
  --bg: #141210;
  --card: #221f1b;
  --field: #181612;
  --line: #3c352c;
  --ink: #f4efe6;
  --muted: #a89b8c;
  --brass: #e2a84a;
  --brass-2: #a8752e;
  --on-brass: #1a1206;
  --hover: #2e2923;
  --good: #8fbf8a;
  --bad: #e08b73;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --clock: clamp(2.15rem, 4vw, 2.85rem);
  --small: 0.84rem;
  --tiny: 0.75rem;
  --radius: 16px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #efe8dc;
    --card: #fffaf3;
    --field: #f7f1e7;
    --line: #ddd3c3;
    --ink: #211c16;
    --muted: #5e564c;
    --brass: #8d5a16;
    --brass-2: #c9852a;
    --on-brass: #fffaf3;
    --hover: #f3eadc;
    --good: #2f7d46;
    --bad: #a33b2b;
    --shadow: 0 10px 28px rgba(70, 48, 20, 0.08);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(900px 420px at 0% -10%, color-mix(in oklab, var(--brass) 22%, transparent), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, color-mix(in oklab, var(--brass-2) 18%, transparent), transparent 50%),
    var(--bg);
}

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

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

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--brass);
  color: var(--on-brass);
  padding: 6px 10px;
  border-radius: 8px;
  z-index: 30;
}
.skip:focus { top: 12px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 28px 0 18px;
}

.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mark { width: 40px; height: 40px; flex: none; color: #1c1916; }
.mark-dim { fill: #3a342c; }
.mark-paper { fill: #f4efe6; }

h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--small);
  max-width: 42ch;
}

.actions { display: flex; gap: 8px; align-items: center; }
.adder { position: relative; }

.btn {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn.primary {
  background: var(--brass);
  color: var(--on-brass);
  border-color: transparent;
  font-weight: 650;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.tiny { padding: 0.38rem 0.7rem; border-radius: 10px; }

.add-menu {
  position: absolute;
  z-index: 12;
  right: 0;
  top: calc(100% + 8px);
  margin: 0;
  padding: 6px;
  list-style: none;
  width: min(280px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 1px;
  cursor: pointer;
}
.menu-item:hover { background: var(--hover); }
.menu-item:focus-visible {
  background: color-mix(in oklab, var(--brass) 18%, var(--card));
}
.menu-name { font-weight: 650; }
.menu-blurb { color: var(--muted); font-size: var(--tiny); }

.bench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 8px;
}
@media (min-width: 740px) {
  .bench { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1060px) {
  .bench { grid-template-columns: 1fr 1fr 1fr; }
  .widget[data-span="wide"] { grid-column: span 2; }
}

.widget {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.widget::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brass), transparent 75%);
}

.widget-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 8px;
}
.widget-bar h2 {
  flex: 1;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.grip,
.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
}
.grip { cursor: grab; touch-action: none; padding: 0; }
.grip:active { cursor: grabbing; }
.icon-btn { font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0; }
.grip:hover,
.icon-btn:hover { background: var(--hover); color: var(--ink); }

.clock-time,
.wx-temp {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}
.clock-time { font-size: var(--clock); }
.clock-date { margin: 6px 0 0; }
.clock-zone,
.wx-place,
.wx-cond,
.wx-range,
.muted {
  color: var(--muted);
  font-size: var(--small);
}
.clock-zone { margin: 2px 0 12px; }
.wx-place { margin: 0; }
.wx-temp { font-size: clamp(2rem, 4vw, 2.6rem); margin: 2px 0; }
.wx-cond,
.wx-range { margin: 0; }
.wx-range { margin-bottom: 10px; }

.todo-list,
.link-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 2px;
}
.todo-list li,
.link-list li { display: flex; align-items: center; gap: 4px; min-width: 0; }
.todo {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 0;
}
.todo input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--brass);
  flex: none;
}
.todo span,
.link-list a,
.note { overflow-wrap: anywhere; }
.todo.done span { color: var(--muted); text-decoration: line-through; }
.link-list a {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  text-underline-offset: 3px;
  padding: 4px 0;
}
.link-list a:hover { color: var(--brass); }

input,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
  min-height: 7.5rem;
  line-height: 1.45;
}
.note { display: block; }

.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; width: auto; }
.row .btn { flex: none; }

.link-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.link-form input[type="text"] { grid-column: 1 / -1; }
.form-error {
  color: var(--bad);
  font-size: var(--tiny);
  margin: 6px 0 0;
}
.link-form .form-error { grid-column: 1 / -1; margin: 0; }

.empty { grid-column: 1 / -1; padding: 28px 4px 36px; }
.empty-title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin: 0 0 6px;
}
.empty p { margin: 0 0 14px; color: var(--muted); max-width: 42ch; }

.foot {
  color: var(--muted);
  font-size: var(--small);
  padding: 18px 0 36px;
}
.noscript { color: var(--muted); }

.widget.is-placeholder { opacity: 0.35; }
.widget.is-target { outline: 2px dashed var(--brass); outline-offset: 3px; }
.drag-clone {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  margin: 0;
  opacity: 0.94;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  transform: rotate(-1.25deg);
}

@media (prefers-reduced-motion: reduce) {
  .drag-clone { transform: none; }
  .btn.primary:hover { filter: none; }
}

@media (max-width: 560px) {
  .top { padding-top: 20px; align-items: stretch; }
  .actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .adder > .btn,
  .actions > .btn {
    width: 100%;
    white-space: nowrap;
  }
}
