:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #f8eddb;
  background: #1b182d;
  --surface: #272339;
  --field: #211d32;
  --raised: #312a44;
  --line: #504561;
  --edge: #745d7f;
  --muted: #c3b7cf;
  --gold: #ffce82;
  --light-gold: #ffe6b4;
  --accent-panel: #3b303e;
  --shadow: #141123;
  --alert: #ffada8;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; min-width: 300px; background: radial-gradient(ellipse at 60% 0, #2e253e, #1b182d 57%) }
h1, h2, p { margin: 0 }
h1 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em }
h2 { font-size: 20px }
small, .muted { color: var(--muted) }
button, input, select, textarea { font: inherit }
button, select, input, textarea { min-height: 40px; border: 1px solid var(--edge); border-radius: 2px }
button {
  padding: 8px 14px;
  color: var(--light-gold);
  background: var(--raised);
  box-shadow: inset 0 -2px var(--shadow);
  cursor: pointer;
  font-weight: 650;
}
button:hover:not(:disabled) { background: #44344e; border-color: #b98b85 }
button:disabled { opacity: .48; cursor: default }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px }
button.primary { background: var(--gold); color: #2b1b27; border-color: #ffe5a7; box-shadow: inset 0 -3px #be795a, 0 2px var(--shadow) }
button.primary:hover:not(:disabled) { background: var(--light-gold) }
button.danger { color: var(--alert) }
input, select, textarea { padding: 8px 10px; color: inherit; background: var(--field); min-width: 0 }
input::placeholder, textarea::placeholder { color: #a89ab9; opacity: 1 }
textarea { resize: vertical }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 650; min-width: 0 }
label.checkbox { display: flex; align-items: center; align-self: end; min-height: 40px }
input[type="checkbox"] { min-height: 0; width: 17px; height: 17px; accent-color: var(--gold) }
.login-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 16%, #46334d, #211d36 58%, #181629);
}
.login-screen::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: clamp(144px, 22vh, 224px);
  background: url("art/night-skyline.png") repeat-x bottom center / auto 100%;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: -1;
}
.login-card {
  width: min(100%, 408px);
  background: var(--surface);
  border: 2px solid var(--edge);
  padding: clamp(24px, 5vw, 38px);
  display: grid;
  gap: 16px;
  box-shadow: inset 0 3px #45364c, 0 5px var(--shadow), 0 24px 60px #130e23a0;
}
.login-card h1 { margin-bottom: -13px }
.login-card h1, .brand strong { color: var(--light-gold); text-shadow: 2px 2px #783e52 }
.symbol {
  display: block;
  width: 42px;
  aspect-ratio: 1;
  flex: none;
  background: url("art/market-sprites.png") no-repeat 0 0 / 800% 400%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px #e7805666);
}
.login-card .symbol { width: 50px; margin-inline-start: -4px }
.shell { min-height: 100vh; display: grid; grid-template-columns: 211px minmax(0, 1fr) }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  padding: 24px 15px 21px;
  border-inline-end: 2px solid #48394f;
  background: #211b32;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 2px 19px; border-bottom: 1px solid var(--line) }
.brand strong { font-size: 17px; font-weight: 800; letter-spacing: .06em }
.brand small { display: block; margin-top: 4px; font-size: 12px }
.sidebar nav { display: flex; flex-direction: column; gap: 6px }
.sidebar button { width: 100%; text-align: left; color: var(--muted); border: 1px solid transparent; background: transparent; box-shadow: none }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.sidebar nav a::before { content: ""; width: 6px; height: 6px; flex: none; background: #8f789d }
.sidebar nav a[aria-current="page"], .sidebar nav a:hover, .sidebar button:hover { background: var(--raised); border-color: var(--edge); color: var(--light-gold) }
.sidebar nav a[aria-current="page"] { border-inline-start: 3px solid var(--gold); padding-inline-start: 10px; box-shadow: inset 0 -2px var(--shadow) }
.sidebar nav a[aria-current="page"]::before { background: var(--gold) }
.account { border-top: 1px solid var(--line); padding-top: 14px; font-size: 13px }
.account span { display: block; padding-inline: 7px; margin-bottom: 6px }
.main { display: grid; align-content: start; gap: 20px; padding: clamp(18px, 3vw, 38px); min-width: 0 }
.page-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: -10px;
  padding: 10px 0 17px;
  border-bottom: 1px solid var(--line);
  background: #221d34;
  box-shadow: 0 3px #1b182d;
}
#view-actions { flex: none }
.page-head h1 { color: var(--light-gold); font-weight: 800; text-shadow: 2px 2px #5d384e }
.page-head p { color: var(--muted); margin-top: 6px; line-height: 1.55; font-size: 14px }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 12px }
.stat, .panel { border: 1px solid var(--edge); background: var(--surface); overflow: hidden; box-shadow: inset 0 2px #40334c, 0 3px var(--shadow) }
.stat { padding: 16px 18px; display: grid; gap: 6px }
.stat strong { font-size: 27px; color: var(--gold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere }
.stat small { font-size: 13px; display: flex; align-items: center; gap: 8px }
.stat small::before { content: ""; width: 5px; height: 5px; flex: none; background: #dba06c }
.review { display: grid; gap: 12px }
.review-head { display: grid; gap: 5px }
.review-head h2 { color: var(--light-gold); font-size: 18px }
.review-head p { font-size: 13px; line-height: 1.65; color: var(--muted) }
.review-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 12px }
.review-card { display: grid; align-content: start; justify-items: start; gap: 10px; padding: 14px; border: 1px solid var(--edge); border-inline-start: 3px solid #dba06c; background: var(--surface); box-shadow: 0 3px var(--shadow) }
.review-card strong, .review-card small { display: block; overflow-wrap: anywhere }
.review-card small { margin-top: 4px }
.review-signals { display: flex; flex-wrap: wrap; gap: 5px }
.review-card button { min-height: 34px; font-size: 13px; padding: 4px 10px }
@media (min-width: 980px) {
  .review-card:only-child { grid-template-columns: minmax(175px, 1fr) minmax(0, 2fr) auto; align-items: center }
}
.level-name .badge { margin-top: 5px }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 15px 17px; border-bottom: 1px solid var(--line) }
.filters:empty { display: none }
.filters button { align-self: end }
.table-wrap { overflow: auto; max-width: 100%; max-height: min(54vh, 560px); max-height: min(54dvh, 560px) }
.table-wrap:focus-visible { outline-offset: -2px }
table { border-collapse: separate; border-spacing: 0; width: 100%; text-align: left; font-size: 13px }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle }
th { position: sticky; top: 0; z-index: 1; color: #ebd4b9; background: var(--raised); font-weight: 700; white-space: nowrap }
td { min-width: max-content; overflow-wrap: anywhere; font-variant-numeric: tabular-nums }
td strong, td small { display: block }
td strong + small { margin-top: 4px }
td button { min-height: 32px; padding: 4px 9px; margin: 2px 5px 2px 0; white-space: nowrap }
tbody tr:nth-child(even) { background: #2a263d }
tbody tr:hover { background: #362d46 }
.num { font-variant-numeric: tabular-nums; white-space: nowrap }
.badge { display: inline-block; padding: 3px 7px; border: 1px solid #68546d; border-radius: 2px; background: #3b304b; color: #eddef4; font-size: 12px; white-space: nowrap }
.badge.warn { background: #52363e; color: #ffe0a0; border-color: #9e695f }
.pagination { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 9px; padding: 11px 15px }
.pagination span { font-size: 13px; color: var(--muted) }
.empty { padding: 30px 18px; text-align: center; color: var(--muted) }
.metric-notes { color: var(--muted); padding: 0 2px; font-size: 13px; line-height: 1.65 }
.metric-notes p { margin-top: 7px }
#notice { background: #253a33; color: #cbedda; border-inline-start: 3px solid #9ac8aa; padding: 11px 13px; font-size: 14px }
#notice.error, .error { color: var(--alert); background: #4a293b; border-inline-start: 3px solid #de8f94; padding: 10px 12px; font-size: 14px }
dialog { border: 2px solid var(--edge); background: var(--surface); color: inherit; width: min(930px, calc(100% - 24px)); max-height: 90vh; max-height: 90dvh; padding: 0; overflow: hidden; box-shadow: 0 5px var(--shadow), 0 20px 72px #140e25a0 }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto }
dialog::backdrop { background: #110e23cc }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--edge); background: var(--raised); color: var(--light-gold) }
.dialog-head h2 { min-width: 0; overflow-wrap: anywhere }
.dialog-head button { flex: none }
#dialog-body { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain }
.dialog-section { display: grid; gap: 14px; padding: 18px 20px }
#dialog-error { margin: 12px 20px 16px }
.dialog-form { display: grid; gap: 15px }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px }
.dialog-form fieldset { margin: 0; border: 1px solid var(--line); padding: 10px 13px; min-width: 0 }
.dialog-form legend { font-size: 13px; font-weight: 700 }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap }
.item-preview { padding: 14px; border: 1px solid #866469; background: var(--accent-panel); color: var(--light-gold); line-height: 1.65 }
.compact { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere }
.release-level-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -18px -20px 0;
  padding: 14px 20px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.release-level-tools .filters { padding-inline: 0; border: 0 }
.release-level-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px }
.release-level-summary small { display: block; margin-top: 4px }
.release-level-list .table-wrap { max-height: clamp(115px, calc(90vh - 270px), 560px); max-height: clamp(115px, calc(90dvh - 270px), 560px) }
.release-level-list td:nth-child(2), .release-level-list td:nth-child(4) { white-space: nowrap }
.release-board-details { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 24px }
.release-board-details figure, .release-board-details dl { margin: 0; min-width: 0 }
.release-board-details dt { margin-bottom: 5px; font-weight: 650; color: var(--light-gold) }
.release-board-details dd { margin: 0 0 16px; line-height: 1.6 }
.release-board { display: grid; gap: 3px; padding: 6px; background: var(--field); border: 1px solid var(--edge) }
.release-board-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px }
.release-board-row span { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid #75617f; background: var(--tile); color: var(--tile-ink, #fff4de); font-weight: 700 }
.release-board-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; font-size: 12px; color: var(--muted) }
.release-board-legend > span { display: inline-flex; align-items: center; gap: 4px }
.release-board-legend [data-tile] { width: 13px; height: 13px; background: var(--tile); border: 1px solid #75617f }
[data-tile="."] { --tile: #40364f }
[data-tile="#"] { --tile: #201b32 }
[data-tile="E"] { --tile: #8f4a55 }
[data-tile="X"] { --tile: #316756 }
[data-tile="P"] { --tile: #315878 }
[data-tile="Q"] { --tile: #dba264; --tile-ink: #2b1b27 }
@media (max-width: 520px) {
  .release-board-details { grid-template-columns: 1fr; gap: 16px }
  .release-board-details figure { max-width: 300px }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr }
  .sidebar { position: static; height: auto; padding: 12px; gap: 9px; grid-template-rows: auto auto; grid-template-columns: 1fr auto; border-inline-end: 0; border-bottom: 2px solid var(--line) }
  .brand { border: 0; padding-bottom: 0 }
  .brand .symbol { width: 36px }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap }
  .sidebar nav a { width: auto; padding: 6px 8px; min-height: 36px; font-size: 13px }
  .sidebar nav a::before { display: none }
  .sidebar nav a[aria-current="page"] { border-inline-start-width: 1px; padding-inline-start: 8px; border-bottom: 2px solid var(--gold) }
  .account { border: 0; padding: 0 }
  .account span { display: none }
  .page-head { align-items: start }
  .filters label { flex: 1 1 125px }
}
