/* Same palette as the preview artifact: Cinzel titles, Inter body, purple accent. Square corners. */
:root {
  --bg: #eef1f2; --panel: #ffffff; --fg: #1c2529; --muted: #5a6a70;
  --line: #d2dbde; --accent: #6b3fa0; --accent-ink: #ffffff; --tier: #a8780f; --stage: #2a2f35;
  --hover: rgba(107, 63, 160, .07); --sel: rgba(107, 63, 160, .14);
  --display: 'Cinzel', Georgia, serif; --body: 'Inter', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121619; --panel: #1a2024; --fg: #e3eaed; --muted: #93a3a9; --line: #2b353a;
  --accent: #b48ae6; --accent-ink: #121619; --tier: #ebc243; --stage: #0d1013;
  --hover: rgba(180, 138, 230, .08); --sel: rgba(180, 138, 230, .16); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #121619; --panel: #1a2024; --fg: #e3eaed; --muted: #93a3a9; --line: #2b353a;
  --accent: #b48ae6; --accent-ink: #121619; --tier: #ebc243; --stage: #0d1013;
  --hover: rgba(180, 138, 230, .08); --sel: rgba(180, 138, 230, .16); color-scheme: dark }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 14px/1.55 var(--body); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, select, input { font: inherit; color: inherit; accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* Sidebar: search, type tabs, filters, scrolling list */
.side { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 20px 0 0 16px;
  border-right: 1px solid var(--line); background: var(--panel); }
.side > * { margin-right: 16px; }
.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pack { font-family: var(--display); font-size: 13px; letter-spacing: .12em; white-space: nowrap; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }

.search { position: relative; display: block; }
.search input { width: 100%; padding: 9px 34px 9px 10px; border: 1px solid var(--line); background: var(--bg); border-radius: 0; }
.search input:focus { border-color: var(--accent); outline: none; }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 600 11px var(--body);
  color: var(--muted); border: 1px solid var(--line); padding: 0 6px; pointer-events: none; }
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }

.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 6px 8px;
  cursor: pointer; color: var(--muted); font-weight: 500; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .n { font-size: 11px; margin-left: 3px; opacity: .7; font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 10px; }
.filters label { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
select { padding: 6px 8px; border: 1px solid var(--line); background: var(--bg); border-radius: 0; min-width: 0; }

.list { list-style: none; margin: 0 !important; padding: 0 0 16px; overflow-y: auto; flex: 1; min-height: 0; }
.list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 6px 16px 6px 8px; cursor: pointer; border-left: 3px solid transparent; }
.list li:hover { background: var(--hover); }
.list li[aria-selected="true"] { background: var(--sel); border-left-color: var(--accent); }
.thumb { width: 44px; height: 44px; background: var(--stage); display: block; }
.thumb img { width: 100%; height: 100%; display: block; }
.li-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub b { font-weight: 600; }
.empty { color: var(--muted); padding: 8px 0; margin-top: 0; }
mark { background: none; color: var(--accent); font-weight: 700; }

/* Main: header, stage, controls, notes */
.main { overflow-y: auto; padding: 24px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.main > * { width: 100%; max-width: 920px; margin: 0 auto; }
.head { display: grid; gap: 2px; }
.tierline { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--tier); font-weight: 600; min-height: 1.5em; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 5vw, 42px); margin: 0; letter-spacing: .04em; line-height: 1.15; }
.lore { color: var(--muted); font-style: italic; margin: 4px 0 0; max-width: 65ch; }

.stage { position: relative; background: var(--stage); height: clamp(280px, 60vh, 640px); overflow: hidden;
  touch-action: none; cursor: grab; user-select: none; }
.stage.dragging { cursor: grabbing; }
.stage[data-bg="slot"] { background: #8b8b8b; }
.stage[data-bg="grass"] { background: linear-gradient(#8fc1f0 0 62%, #6aa84f 62% 100%); }
.stage[data-bg="light"] { background: #e9ecee; }
canvas { display: block; width: 100%; height: 100%; }
.hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: #9fb0b6; pointer-events: none; }
.stage[data-bg="light"] .hint, .stage[data-bg="grass"] .hint { color: #3c4a50; }

.controls { display: grid; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); padding: 0; margin: 0; background: var(--panel); width: fit-content; max-width: 100%; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-right: 1px solid var(--line); font-weight: 500; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -4px; }
.seg label:hover input:not(:checked) + span { background: var(--hover); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.row > label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.range input { width: 140px; }
.range output { font-variant-numeric: tabular-nums; min-width: 4ch; color: var(--fg); }
.check { cursor: pointer; color: var(--fg) !important; }
button { background: var(--panel); border: 1px solid var(--line); padding: 7px 14px; cursor: pointer; font-weight: 500; border-radius: 0; }
button:hover { border-color: var(--accent); color: var(--accent); }

.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.notes:empty { display: none; }
.note h2 { font-family: var(--display); font-size: 17px; margin: 0 0 4px; font-weight: 500; }
.note p { margin: 0; color: var(--muted); }
.note .sk { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 600; }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; height: auto; }
  .stage { height: clamp(260px, 75vw, 420px); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding-top: 16px; }
  .list { max-height: 34vh; flex: none; }
  .main { overflow: visible; padding: 16px 16px 32px; }
  .seg span { padding: 7px 10px; }
}
