:root {
  color-scheme: dark;
  font-family: system-ui, "Malgun Gothic", sans-serif;
  background: #10100f;
  color: #f4efe5;
  --panel: #191917;
  --line: #3e392e;
  --muted: #beb6a7;
  --gold: #eac77e;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { width: min(1100px, calc(100% - 40px)); margin-inline: auto; }
.top { border-bottom: 1px solid var(--line); background: #151513; padding: 15px 0; }
.bar, .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar { justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: .12em; color: var(--gold); }
.seal { display: grid; place-items: center; width: 34px; aspect-ratio: 1; border: 1px solid #755f36; border-radius: 9px; }
.intro { padding-block: clamp(28px, 6vw, 76px) 28px; }
.intro h1 { font-size: clamp(2rem, 6vw, 3.75rem); letter-spacing: -.055em; margin: 6px 0 10px; }
p { line-height: 1.55; margin: 0 0 8px; color: var(--muted); }
#date, #percent { color: var(--gold); font-weight: 650; }
.layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: clamp(14px, 3vw, 25px); }
h2 { margin: 0 0 14px; font-size: 1.25rem; overflow-wrap: anywhere; }
.heading { margin-bottom: 18px; }
.bar h2 { margin: 0; }
button, select, input { font: inherit; }
button, select, input:not([type="checkbox"]) {
  background: #24231f; color: inherit; border: 1px solid var(--line);
  border-radius: 8px; min-height: 42px; padding: 8px 12px; font-size: .9rem;
}
button { cursor: pointer; }
button:hover:not(:disabled), button[aria-current="true"] { border-color: var(--gold); color: var(--gold); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button.primary { background: var(--gold); border-color: var(--gold); color: #211708; font-weight: 750; }
button.primary:hover:not(:disabled) { background: #ffe0a0; color: #211708; }
.wide, #characters button { width: 100%; }
#characters button { margin-bottom: 8px; text-align: left; overflow-wrap: anywhere; }
#characters button[aria-current="true"] { background: #30281b; }
progress { width: 100%; height: 9px; appearance: none; display: block; margin: 10px 0 22px; border: 0; border-radius: 8px; overflow: hidden; background: #343027; }
progress::-webkit-progress-bar { background: #343027; }
progress::-webkit-progress-value { background: var(--gold); }
progress::-moz-progress-bar { background: var(--gold); }
.actions { padding-top: 14px; border-top: 1px solid var(--line); }
.actions label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.actions select { max-width: min(42vw, 200px); }
ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.row { padding: 10px 12px; background: #20201d; border: 1px solid #3a362d; border-radius: 9px; }
.row label { display: flex; flex: 1 1 145px; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.row input { accent-color: var(--gold); width: 20px; height: 20px; flex: none; }
.row strong { display: block; overflow-wrap: anywhere; }
.row small { color: var(--muted); overflow-wrap: anywhere; }
.row input:checked + span strong { text-decoration: line-through; color: var(--muted); }
.row button { padding-inline: 8px; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; border: 1px dashed var(--line); border-radius: 9px; }
footer { display: flex; justify-content: space-between; gap: 8px; margin: 22px 0 10px; color: var(--muted); font-size: .85rem; }
#status { min-height: 1.6em; }
dialog { width: min(460px, calc(100% - 32px)); max-height: 90vh; border: 1px solid #78633e; border-radius: 14px; background: var(--panel); color: inherit; padding: 22px; }
dialog::backdrop { background: #000b; }
#fields { display: grid; gap: 12px; margin-block: 18px; }
#fields label { display: grid; gap: 6px; }
#fields input, #fields select { width: 100%; }
.dialog-actions { justify-content: flex-end; }
.danger { color: #f4b4a7; }
@media (max-width: 700px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  #characters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  #characters button { width: auto; max-width: 100%; margin: 0; }
}
@media (max-width: 400px) {
  .wrap { width: calc(100% - 24px); }
  .row .tools { margin-left: 30px; }
}
