:root {
  color-scheme: light dark;
  --paper: #f8f7f4;
  --surface: #fffefa;
  --text: #282b27;
  --muted: #71766e;
  --line: #dddfd7;
  --hover: #eeefe8;
  --accent: #426351;
  --accent-text: #fffefa;
  --danger: #a13b32;
  --danger-bg: #f6e9e5;
  --shadow: #20282018;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--paper);
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191a19;
    --surface: #212320;
    --text: #e6e8df;
    --muted: #9ba195;
    --line: #363a33;
    --hover: #2a2e27;
    --accent: #aec7b3;
    --accent-text: #19271d;
    --danger: #f0a498;
    --danger-bg: #382522;
    --shadow: #00000035;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; border: 1px solid var(--line); border-radius: 6px; background: transparent; padding: 10px 15px; min-height: 44px; }
button:hover { background: var(--hover); }
button:disabled { cursor: default; opacity: .35; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input { min-width: 0; width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 13px 14px; min-height: 48px; }
input::placeholder { color: var(--muted); opacity: 1; }
label { display: block; font-size: .875rem; margin-bottom: 9px; }
h1 { font-size: 2.65rem; font-weight: 550; letter-spacing: -.055em; line-height: 1.15; margin: 0; }
h2 { font-size: 1.35rem; font-weight: 550; letter-spacing: -.025em; margin: 0 0 15px; }
p { line-height: 1.6; }
.shell { max-width: 752px; margin: 0 auto; padding: 0 32px 110px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 28px; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 25px; }
.nav-button { border: 0; border-radius: 0; border-bottom: 2px solid transparent; padding: 17px 0; color: var(--muted); font-size: .875rem; }
.nav-button[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.nav-button:hover { color: var(--text); background: transparent; }
.text-button { border: 0; padding: 8px; font-size: .875rem; color: var(--muted); }
.text-button:hover { color: var(--text); }
.heading-block { margin-top: 61px; margin-bottom: 30px; }
.intro { color: var(--muted); margin: 12px 0 0; font-size: .9375rem; }
.add-form { position: relative; margin-bottom: 30px; }
.add-form input { padding: 17px 62px 17px 18px; border-radius: 7px; }
.add-button { position: absolute; top: 6px; right: 6px; width: 44px; padding: 10px; border: 0; color: var(--accent); }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: block; flex-shrink: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.items { list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: 6px; align-items: center; min-height: 76px; border-bottom: 1px solid var(--line); position: relative; }
.item:first-child { border-top: 1px solid var(--line); }
.rank { width: 29px; flex-shrink: 0; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; text-align: center; }
.item:first-child .rank { color: var(--accent); }
.item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.5; padding: 19px 9px 19px 1px; }
.item:first-child .item-name { font-weight: 550; }
.item-actions { display: flex; gap: 0; flex-shrink: 0; }
.icon-button { display: grid; place-items: center; min-height: 44px; width: 36px; padding: 8px; border: 0; color: var(--muted); }
.icon-button:hover { color: var(--text); }
.drag-handle { width: 26px; padding: 3px; touch-action: none; cursor: grab; }
.drag-handle:active { cursor: grabbing; }
.dragging { background: var(--hover); box-shadow: 0 5px 15px var(--shadow); z-index: 1; }
body.is-dragging { user-select: none; cursor: grabbing; }
.empty-state { padding: 49px 0 62px; text-align: center; border-block: 1px solid var(--line); }
.empty-state p { margin: 0; }
.empty-state p + p { color: var(--muted); font-size: .875rem; margin-top: 7px; }
.list-help { font-size: .75rem; color: var(--muted); margin-top: 22px; line-height: 1.7; }
.removed-item { padding: 10px 0; gap: 12px; }
.removed-copy { flex: 1; min-width: 0; }
.removed-copy .item-name { padding: 0; font-weight: 400; }
.removed-date { font-size: .75rem; color: var(--muted); margin: 4px 0 0; line-height: 1.5; }
.restore-button { display: flex; gap: 6px; align-items: center; border: 0; font-size: .8125rem; color: var(--accent); padding: 10px 6px; }
.restore-button .icon { width: 17px; height: 17px; }
.edit-form { display: flex; flex: 1; min-width: 0; gap: 8px; align-items: center; padding: 12px 0; flex-wrap: wrap; }
.edit-form input { flex: 1 1 150px; }
.edit-form button { padding: 10px; font-size: .875rem; }
.primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.primary:hover { opacity: .9; background: var(--accent); }
.login-view { width: 100%; max-width: 350px; padding-top: min(22vh, 170px); margin: 0 auto; }
.wordmark { display: flex; flex-direction: column; gap: 6px; margin-bottom: 32px; }
.wordmark span { width: 30px; height: 2px; background: var(--accent); }
.wordmark span:nth-child(2) { width: 21px; }
.wordmark span:nth-child(3) { width: 12px; }
.login-view form { margin-top: 35px; }
.login-submit { margin-top: 16px; width: 100%; display: flex; justify-content: space-between; }
.login-note { font-size: .75rem; margin-top: 30px; color: var(--muted); }
.loading { color: var(--muted); padding-top: 160px; text-align: center; font-size: .875rem; }
.error-message { margin-top: 24px; padding: 15px 17px; border-left: 2px solid var(--danger); background: var(--danger-bg); border-radius: 0 5px 5px 0; }
.error-message p { font-size: .875rem; margin: 0; }
.error-message .text-button { color: var(--text); padding-left: 0; padding-right: 18px; }
.notice { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; display: flex; align-items: center; gap: 16px; background: var(--text); color: var(--paper); border-radius: 7px; box-shadow: 0 5px 20px var(--shadow); padding: 5px 8px 5px 18px; font-size: .875rem; z-index: 5; }
.notice span { overflow-wrap: anywhere; }
.notice .text-button { color: inherit; text-decoration: underline; text-underline-offset: 4px; }
.notice button:hover { background: #88888830; }
.notice-close { border: 0; color: inherit; font-size: 1.25rem; padding: 5px 10px; }
.draft-recovery { margin-bottom: 24px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; }
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; max-width: min(440px, calc(100% - 32px)); width: 100%; }
dialog::backdrop { background: #00000060; }
dialog p { font-size: .9375rem; overflow-wrap: anywhere; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.dialog-actions button { font-size: .875rem; }
.danger-button { color: var(--danger); border-color: var(--danger); }
.danger-button:hover { background: var(--danger-bg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (hover: hover) and (pointer: fine) {
  .item-actions { opacity: 0; }
  .item:hover .item-actions, .item:focus-within .item-actions { opacity: 1; }
}
@media (max-width: 540px) {
  .shell { padding-inline: 20px; }
  .topbar { padding-top: 14px; }
  .heading-block { margin-top: 43px; margin-bottom: 26px; }
  h1 { font-size: 2.25rem; }
  .topbar nav { gap: 22px; }
  .item { flex-wrap: wrap; gap: 3px; padding-top: 7px; }
  .rank { width: 25px; }
  .item-name { padding-block: 13px; }
  .item-actions { margin-left: auto; }
  .icon-button { width: 44px; }
  .drag-handle { width: 30px; min-height: 48px; }
  .item > .item-name { flex-basis: calc(100% - 67px); }
  .item-actions { margin-bottom: 4px; }
  .removed-item { flex-wrap: nowrap; padding-block: 15px; gap: 10px; }
  .removed-item .item-actions { margin: 0; }
  .removed-item .item-name { padding: 0; }
  .list-help { max-width: 265px; }
  .edit-form { flex-basis: calc(100% - 68px); }
  .edit-form input { flex-basis: 100%; }
  .notice { bottom: 16px; gap: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .item-actions { transition: background-color 120ms ease, opacity 120ms ease; }
}
