:root {
  --bg: #0b0c0e; --panel: #1d1f23; --panel-hover: #2a2d33; --line: #2e3138;
  --text: #eceef1; --muted: #9aa0a9; --accent: #36cde4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; }
p { margin: 0 0 8px; }
.muted, .sub { color: var(--muted); font-size: 13px; }
.sub { display: block; }

.site-header { background: var(--panel); padding: 14px 20px; display: flex; gap: 6px 16px; align-items: baseline; flex-wrap: wrap; }
.site-header h1 { font-size: 20px; margin: 0; }
.site-header p { margin: 0; color: var(--muted); font-size: 13px; }

.page { max-width: 1100px; margin: 0 auto; padding: 14px 16px 30px; }

.search { position: relative; display: flex; align-items: center; background: var(--panel); border-radius: 8px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: inherit; font-size: 16px; padding: 14px 18px; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.search button { background: none; border: 0; border-left: 1px solid var(--line); color: var(--muted); font: inherit; padding: 6px 16px; cursor: pointer; }
.search button:hover { color: var(--text); }
.results { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; max-height: min(420px, 60vh); overflow-y: auto;
  list-style: none; margin: 0; padding: 4px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .6); }
.results li { padding: 9px 18px; }
.results li[data-id] { cursor: pointer; }
.results li[data-id]:hover, .results li.active { background: var(--panel-hover); }
.results li.added, .results li.note { color: var(--muted); }
.results .sub { font-size: 12px; }

.stage { margin: 10px 0 0; }
.view { position: relative; }
.view .tag { position: absolute; left: 4px; top: 6px; color: #5d636d; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; pointer-events: none; }
.view svg { display: block; width: 100%; cursor: grab; touch-action: none; user-select: none; }
.view svg.dragging { cursor: grabbing; }
#view-top { height: 30vh; min-height: 190px; }
#view-side { height: 23vh; min-height: 150px; }

.controls { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: center; margin: 8px auto 6px; padding: 8px 14px;
  background: var(--panel); border-radius: 8px; width: fit-content; max-width: 100%; font-size: 14px; }
.controls label { display: inline-flex; align-items: center; gap: 6px; }
.controls select, .controls button { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font: inherit; }
.controls button { cursor: pointer; padding: 5px 14px; }
.controls button:hover { background: var(--panel-hover); }
.check { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.status { text-align: center; min-height: 20px; }

.selected { list-style: none; margin: 10px 0 0; padding: 0; background: var(--panel); border-radius: 8px; overflow: hidden; }
.selected li { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 10px; border-top: 1px solid var(--bg); }
.selected li:first-child { border-top: 0; }
.swatch { flex: none; width: 22px; height: 44px; border-radius: 4px; }
.who { flex: 1; min-width: 0; }
.who .name { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.selected button { flex: none; background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.selected button:hover { color: var(--text); background: var(--panel-hover); }

.table { margin-top: 18px; overflow-x: auto; }
.table table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 8px 12px; text-align: center; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-weight: 600; min-width: 120px; }
.table tbody th { text-align: left; font-weight: 400; white-space: nowrap; }
.table p { margin-top: 8px; }

.site-footer { max-width: 1100px; margin: 0 auto; padding: 14px 16px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

@media (max-width: 640px) {
  .size { font-size: 13px; }
  #view-top { height: 26vh; }
  #view-side { height: 20vh; }
}
