:root {
  --bg: #f2f4f6; --panel: #ffffff; --panel-2: #e9edf1; --line: #d3dae1; --fg: #161c24; --muted: #5b6773;
  --accent: #1d6a86; --accent-fg: #ffffff; --green: #2e7d4f; --green-bg: #e3f3e8; --amber: #a35f00; --amber-bg: #fdf0d9; --bad: #b4271f;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif; --mono: Consolas, "Cascadia Mono", "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161b; --panel: #181f26; --panel-2: #222b34; --line: #34404b; --fg: #e5ebf1; --muted: #98a5b2;
    --accent: #5db1d1; --accent-fg: #0e1a21; --green: #6fcf97; --green-bg: #15291e; --amber: #f0b64b; --amber-bg: #2e2412; --bad: #f08c84;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--sans); }
button, input, select, textarea { font: inherit; color: var(--fg); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 16px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
a { color: var(--accent); }
.hidden { display: none; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 18px; min-height: 52px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .spacer { flex: 1; }
.topbar select { max-width: 280px; }
.user { color: var(--muted); font-size: 13px; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100% - 52px); }
@media (max-width: 900px) { .shell { grid-template-columns: minmax(0, 1fr); } .rail { border-right: 0; border-bottom: 1px solid var(--line); } }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; }
.bosslist { display: flex; flex-direction: column; gap: 2px; }
.bossbtn { display: grid; grid-template-columns: 12px 1fr; gap: 0 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; }
.bossbtn:hover { background: var(--panel-2); }
.bossbtn.active { background: var(--panel-2); border-color: var(--accent); }
.bossbtn .name { font-weight: 600; }
.bossbtn .sub { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.bossbtn .sub.amber { color: var(--amber); font-weight: 600; }
.bossbtn .sub.green { color: var(--green); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); grid-row: 1 / span 2; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.railfoot { margin-top: auto; display: flex; gap: 14px; font-size: 12.5px; padding: 6px 4px; }
.railfoot a { color: var(--muted); }
main { padding: 20px 24px 60px; display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 1200px; }
.bosshead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tag { padding: 2px 10px; border-radius: 999px; background: var(--panel-2); font-size: 13px; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 4px 12px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--fg); }
.btn:hover { filter: brightness(1.05); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.small { padding: 3px 9px; font-size: 13px; font-weight: 500; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--panel-2); }
.btn.danger { color: var(--bad); }
input[type=text], input[type=number], select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; min-width: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; min-height: 70px; font-family: var(--mono); font-size: 12px; resize: vertical; }
.note { color: var(--muted); font-size: 13.5px; }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }

.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.drop.big { padding: 40px 28px; align-items: center; text-align: center; background: var(--panel); }
.drop.big textarea { max-width: 640px; min-height: 110px; }
.drop.over { border-color: var(--accent); background: var(--panel-2); }
.drop-title { font-size: 16px; font-weight: 600; }
.drop.big .drop-title { font-size: 22px; }

.banner { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--panel); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.banner ul { margin: 6px 0 0; padding-left: 20px; font-size: 13.5px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }

.light { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-radius: 10px; border: 1px solid var(--line); }
.light.green { background: var(--green-bg); border-color: var(--green); }
.light.amber { background: var(--amber-bg); border-color: var(--amber); }
.light-title { font-size: 20px; font-weight: 700; }
.light.green .light-title { color: var(--green); }
.light.amber .light-title { color: var(--amber); }
.light .note { color: var(--fg); opacity: 0.8; }

.question { background: var(--panel); border: 2px solid var(--amber); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; outline: none; }
.qcount { font-size: 13px; font-weight: 600; color: var(--amber); text-transform: uppercase; letter-spacing: 0.05em; }
.qtext { font-size: 18px; line-height: 1.4; }
.answers { display: flex; flex-wrap: wrap; gap: 10px; }
.answer { display: inline-flex; align-items: center; gap: 10px; min-width: 180px; padding: 12px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; text-align: left; font-size: 16px; }
.answer:hover { border-color: var(--accent); }
.answer .key { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); background: var(--panel); flex: none; }
.answer .aname { font-weight: 600; }
.answer .ahint { color: var(--muted); font-size: 13px; }
.other { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search { width: 320px; max-width: 100%; }

.timeline h3 { font-size: 17px; }
.tl { display: flex; flex-direction: column; overflow-x: auto; }
.tl-row { display: grid; grid-template-columns: 200px minmax(520px, 1fr); align-items: stretch; }
.tl-body { position: relative; display: flex; flex-direction: column; }
.tl-lines { position: absolute; top: 0; bottom: 0; left: 200px; right: 0; pointer-events: none; }
.stage-line { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--accent); opacity: 0.5; }
.tl-axis .tl-track { height: 44px; border-bottom: 1px solid var(--line); }
.tick { position: absolute; bottom: 2px; transform: translateX(-50%); font: 11px var(--mono); color: var(--muted); }
.tick:first-child { transform: none; }
.stage-flag { position: absolute; top: 2px; transform: translateX(-2px); border: 0; background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.tl-track { position: relative; min-height: 30px; cursor: pointer; }
.lane { border-bottom: 1px solid var(--line); }
.lane:hover { background: var(--panel-2); }
.lane.selected { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.lane.open { background: var(--amber-bg); }
.lane.asked .tl-label .lname { color: var(--amber); }
.tl-label { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; padding: 5px 10px 5px 4px; cursor: pointer; min-width: 0; }
.swatch { width: 4px; align-self: stretch; border-radius: 2px; background: var(--lane); flex: none; }
.lane.open .swatch { background: var(--amber); }
.lname { font-weight: 600; font-size: 14px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsub { font-weight: 400; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.lane.open .lsub { color: var(--amber); font-weight: 600; }
.seg-bar { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 4px; background: var(--lane); opacity: 0.28; min-width: 2px; }
.seg-bar.learned { opacity: 0.18; background: repeating-linear-gradient(90deg, var(--lane) 0 6px, transparent 6px 10px); }
.seg-bar.manual { opacity: 0.35; background: repeating-linear-gradient(45deg, var(--lane) 0 4px, transparent 4px 8px); }
.seg-end { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--lane); border: 2px solid var(--panel); }
.lane.open .seg-bar, .lane.open .seg-end { background: var(--amber); }
.seg-end.manual { border-radius: 2px; }

.pulls summary { font-weight: 600; color: var(--fg); font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }

.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,0.12); transform: translateX(100%); transition: transform 0.15s; z-index: 8; overflow-y: auto; }
.panel.show { transform: none; }
.panel-head { display: flex; justify-content: flex-end; padding: 8px 10px 0; }
.panel-body { padding: 4px 20px 30px; display: flex; flex-direction: column; gap: 14px; }
.panel-title { font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .field-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field select, .field input { width: 100%; }
select.ability { font-size: 16px; font-weight: 600; padding: 9px 10px; border: 2px solid var(--accent); }
.saw { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.saw p { margin: 0; font-size: 14px; }
.saw.focus { border: 2px solid var(--accent); border-radius: 8px; padding: 10px 12px; }
.sentence { line-height: 2.4; font-size: 15px; }
.sentence input, .sentence select { margin: 0 2px; }
.extras { border-top: 1px solid var(--line); padding-top: 10px; }
.extras[open] { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.manual { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 7px; font-size: 14px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); color: #fff; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 10; overflow: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; width: min(620px, 100%); display: flex; flex-direction: column; gap: 12px; }
.signin { max-width: 420px; margin: 80px auto; }
@media (prefers-reduced-motion: reduce) { .toast, .panel { transition: none; } }
th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.ok { color: var(--green); }
.bad { color: var(--bad); }
.lane.asked { box-shadow: inset 0 0 0 2px var(--amber); }
@media (min-width: 1300px) { body.panel-open .shell { margin-right: min(420px, 100%); } }
.stage-flag.right { transform: translateX(-100%); }
.tick.right { transform: translateX(-100%); }
.tl-track { margin-right: 8px; }
@media (max-width: 900px) {
  .rail { padding: 8px 10px; }
  .bosslist { flex-direction: row; overflow-x: auto; gap: 6px; }
  .bossbtn { width: auto; flex: none; }
  .railfoot { display: none; }
  main { padding: 16px 16px 60px; }
  .tl-row { grid-template-columns: 130px minmax(520px, 1fr); }
  .tl-lines { left: 130px; }
  .qtext { font-size: 16px; }
  .answer { min-width: 0; flex: 1 1 140px; }
}
body.saving .answer, body.saving .question .btn, body.saving .panel select, body.saving .panel .btn { opacity: 0.6; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 14px; font-weight: 600; }
.chip:hover { border-color: var(--accent); }
.chip .ahint { color: var(--muted); font-weight: 400; font-size: 12px; }
.people { position: relative; }
.people-stack { display: flex; align-items: center; border: 0; background: transparent; padding: 2px; cursor: pointer; border-radius: 999px; }
.people-stack .avatar + .avatar { margin-left: -8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: hsl(var(--hue, 200) 45% 42%); border: 2px solid var(--panel); flex: none; }
.avatar.more { background: var(--panel-2); color: var(--fg); }
.avatar.tiny { width: 18px; height: 18px; font-size: 9px; border-width: 1px; }
.people-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); z-index: 9; }
.people.open .people-menu { display: flex; flex-direction: column; gap: 2px; }
.people-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; font-size: 14px; white-space: nowrap; }
.bossbtn .here { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 13.5px; text-align: left; }
.choice button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.swatch-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.manual.editing { flex-direction: column; align-items: stretch; border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; }
.light.green .light-title { font-size: 22px; }
input[list]::-webkit-calendar-picker-indicator { display: none !important; }
.pulls summary { font-size: 15px; }
.pull-list { display: flex; flex-direction: column; margin-top: 6px; }
.pull { display: grid; grid-template-columns: 140px 60px 1fr auto; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); min-height: 44px; }
.pull-name { font-weight: 600; }
.tag.kill { background: var(--green-bg); color: var(--green); }
.tag.wipe { background: var(--amber-bg); color: var(--amber); }
.confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.btn.danger-solid { background: var(--bad); color: #fff; border-color: transparent; }
.danger-zone { display: flex; justify-content: flex-end; padding-top: 8px; }
@media (max-width: 600px) { .pull { grid-template-columns: 1fr auto; } .pull .note { grid-column: 1 / -1; } }
.pull .confirm { grid-column: 1 / -1; justify-content: flex-end; }
.pull .note { white-space: nowrap; }
.pull { grid-template-columns: 130px 60px 90px minmax(140px, 1fr) minmax(110px, auto) auto; }
.pull-who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .pull { grid-template-columns: 1fr auto auto; } .pull .note, .pull-who { grid-column: auto; } }
.pull .tag { justify-self: start; min-width: 54px; text-align: center; }
.btn .dot { width: 8px; height: 8px; margin-right: 7px; }
.pub-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; }
.light.slim { padding: 10px 14px; }
