:root {
  color-scheme: dark;
  font: 15px/1.45 "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  color: #edf4fb;
  background: #070d14;
  --surface: #0a1621;
  --inset: #050c13;
  --control: #101c29;
  --line: #283646;
  --control-line: #43566b;
  --muted: #a9bfd4;
  --accent: #e0be45;
  --accent-line: #d8b95e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button, select, input, summary { font: inherit; }
button, select, input {
  min-height: 34px; padding: 6px 10px; border: 1px solid var(--control-line); border-radius: 1px;
  background: var(--control); color: inherit;
}
button, summary, select { cursor: pointer; }
button:hover:not(:disabled), summary:hover { background: #172a3d; border-color: #60778e; }
button:disabled { color: var(--muted); opacity: .65; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary, .primary:hover:not(:disabled) { background: var(--accent); color: #151006; border-color: var(--accent-line); font-weight: 700; }
.primary:hover:not(:disabled) { background: #f6d15f; }
.primary:disabled { background: var(--control); color: var(--muted); border-color: var(--line); }
.site-header { border-bottom: 1px solid var(--line); background: #0b1723; }
.header-inner {
  max-width: 1840px; margin: auto; padding: 0 clamp(16px, 2vw, 36px);
  min-height: 48px; display: flex; align-items: center; gap: clamp(22px, 4vw, 58px);
}
.brand { color: var(--accent); font-size: 16px; font-weight: 800; white-space: nowrap; }
nav, .account-actions { display: flex; align-items: center; gap: 18px; font-size: 13px; }
nav a { color: var(--muted); }
nav a:hover, .account-actions a:hover { color: var(--accent); }
nav [aria-current] { color: var(--accent); font-weight: 700; box-shadow: inset 0 -2px var(--accent); padding: 15px 2px 13px; }
.account-actions { margin-left: auto; }
.account-actions :empty { display: none; }
main {
  max-width: 1840px; height: calc(100dvh - 49px); min-height: 630px;
  margin: auto; padding: 16px clamp(16px, 2vw, 36px); display: flex; flex-direction: column; gap: 12px;
}
.workspace-heading, .workspace-actions, .board-toolbar, .board-filters, .board-actions, .pool-title,
.selection-heading, .selection-actions, .dialog-actions { display: flex; align-items: center; gap: 8px; }
.workspace-heading { justify-content: space-between; gap: 20px; }
.workspace-actions { flex-shrink: 0; flex-wrap: wrap; }
h1 { margin: 0; font-size: clamp(23px, 1.9vw, 30px); line-height: 1.2; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
#status { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
#status[data-kind="dirty"] { color: var(--accent); }
.file-menu { position: relative; z-index: 3; }
.file-menu summary { list-style: none; background: var(--control); border: 1px solid var(--control-line); border-radius: 1px; padding: 6px 10px; }
.file-menu summary::-webkit-details-marker { display: none; }
.file-menu summary::after { content: " ▾"; color: var(--muted); }
.file-options {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 192px; padding: 5px;
  background: var(--surface); border: 1px solid var(--control-line); border-radius: 2px; box-shadow: 0 8px 24px #0008;
}
.file-options button { display: block; width: 100%; text-align: left; background: transparent; border-color: transparent; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(310px, 32%, 488px); flex: 1; min-height: 0; gap: 10px; }
.board, .champion-browser {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 2px; overflow: hidden;
}
.board-toolbar { background: #0b1723; flex-wrap: wrap; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.board-filters { margin-left: 7px; flex-wrap: wrap; }
.board-filters label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.board-filters select { font-size: 13px; padding: 4px 7px; }
.board-actions { margin-left: auto; gap: 4px; }
.board-actions button { font-size: 13px; }
#undo, #redo { font-size: 20px; line-height: 1; width: 34px; padding: 0; }
#rows { overflow-y: auto; flex: 1; scrollbar-gutter: stable; scrollbar-color: #526980 var(--inset); background: var(--inset); }
.tier-row { position: relative; display: flex; min-height: 76px; border-bottom: 1px solid var(--line); background: #07111b; }
.tier-row:nth-child(even) { background: #091420; }
.tier-row.active { background: #101e2d; }
.tier-row[data-tier-dragging] { opacity: .6; }
.tier-row[data-tier-drop]::after { content: ""; position: absolute; inset-inline: 0; height: 3px; background: var(--accent); pointer-events: none; z-index: 1; }
.tier-row[data-tier-drop="before"]::after { top: 0; }
.tier-row[data-tier-drop="after"]::after { bottom: 0; }
.tier-heading { width: 100px; flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 24px; }
.tier-label {
  border: 0; border-radius: 0; width: 100%; min-width: 0;
  font-size: 24px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere;
}
.tier-label:hover:not(:disabled) { filter: brightness(1.13); }
.tier-label, .tier-handle { cursor: grab; touch-action: none; user-select: none; }
.tier-label:active, .tier-handle:active { cursor: grabbing; }
.tier-handle { border: 1px solid var(--line); border-block: 0; border-radius: 0; padding: 0; background: var(--control); color: var(--muted); font-size: 17px; }
.tier-handle:hover:not(:disabled) { color: var(--accent); }
.tier-handle:focus-visible { outline-offset: -3px; }
.tier-label.custom-name { font-size: 14px; }
.tier-label:focus-visible { outline-offset: -4px; }
.tier-items { display: flex; flex-wrap: wrap; align-content: center; gap: 5px; padding: 5px 9px; flex: 1; min-width: 0; }
.tier-items:empty::before { content: "—"; color: #777a80; align-self: center; }
.tier-items.drop-ready { background: #e0be4524; box-shadow: inset 0 0 0 1px var(--accent); }
.row-actions { align-self: center; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 3px; }
.tier-count { color: var(--muted); font-size: 12px; min-width: 2ch; text-align: right; }
.row-select { font-size: 12px; min-width: 49px; background: transparent; }
.row-select[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: #e0be451a; }
#tierHelp { margin: 0; padding: 9px 13px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.pool-head { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.pool-title { justify-content: space-between; }
#poolCount { color: var(--muted); font-size: 12px; }
#search { width: 100%; border-color: #60778e; background: var(--inset); font-size: 14px; }
.lane-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.lane-filters button { min-width: 45px; min-height: 30px; padding: 4px 8px; font-size: 12px; font-weight: 700; }
.lane-filters button[aria-pressed="true"] { background: var(--accent); color: #151006; border-color: var(--accent); }
#activeTier { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
#pool {
  --card-width: 68px;
  display: grid; grid-template-columns: repeat(auto-fill,minmax(var(--card-width),1fr)); grid-auto-rows: max-content;
  gap: 7px; overflow: auto; flex: 1; min-height: 72px; align-content: start; padding: 10px; scrollbar-gutter: stable; scrollbar-color: #526980 var(--inset);
}
.champion {
  display: grid; align-self: start; position: relative; padding: 0; overflow: hidden; min-width: 0; width: 100%;
  border: 2px solid #283646; border-radius: 1px; background: var(--inset); font-size: 12px;
}
.champion img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #152331; }
.champion span { display: block; white-space: nowrap; overflow: hidden; padding: 2px 3px; text-overflow: ellipsis; }
.champion .role-badge {
  position: absolute; top: 3px; right: 3px; padding: 0 3px; border-radius: 3px;
  background: #07111beb; color: #edf4fb; font-size: 10px; font-weight: 700;
}
.champion .assignment-summary {
  position: absolute; left: 0; right: 0; bottom: 19px; padding: 1px 3px;
  background: #07111beb; font-size: 10px; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.champion > span:first-of-type {
  position: absolute; inset: auto 0 0; min-height: 19px; padding: 2px 3px;
  background: #030a12e8; color: #fff; text-align: center;
}
.tier-items .champion { width: 60px; font-size: 10px; }
.tier-items .champion .role-badge { font-size: 9px; }
.champion.selected-champion { outline: 2px solid var(--accent); outline-offset: -2px; }
.champion:hover:not(:disabled) { border-color: var(--accent); }
#poolEmpty { margin: 0; padding: 16px; color: var(--muted); font-size: 13px; }
#selection { padding: 8px 12px; background: #0b1723; border-bottom: 1px solid var(--line); }
.selection-heading { justify-content: space-between; }
#selectionClose { min-height: 24px; padding: 0 8px; }
.selection-actions { flex-wrap: wrap; margin-top: 4px; }
.selection-actions button { min-height: 28px; padding: 3px 6px; font-size: 12px; }
dialog { width: min(440px, calc(100% - 32px)); background: var(--surface); color: inherit; border: 1px solid #60778e; border-radius: 2px; padding: 22px; }
dialog::backdrop { background: #08090cc7; }
form { display: grid; gap: 14px; }
form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
form input, form select { color: #edf4fb; }
.tier-settings-fields { display: grid; grid-template-columns: minmax(0,1fr) 60px; gap: 12px; }
#rowColor { width: 100%; height: 36px; padding: 4px; }
.dialog-actions { justify-content: flex-end; flex-wrap: wrap; }
.row-management { justify-content: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.danger { color: #ffc2bf; }
.preset-section { margin: 14px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.preset-section h3 { font-size: 14px; margin: 0 0 8px; }
#presetStatus, #presetLogin { color: var(--muted); font-size: 12px; }
.preset-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.preset-public, .preset-fields .dialog-actions { grid-column: 1 / -1; }
.preset-shared-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
@media (max-width: 1100px) {
  .header-inner, main { padding-inline: 18px; }
  .editor-layout { gap: 10px; }
  .tier-heading { width: 78px; }
}
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 8px 18px; padding-block: 8px; }
  nav [aria-current] { padding-block: 5px; }
  main { height: auto; }
  .workspace-actions { flex-shrink: 1; }
  .workspace-heading { align-items: start; flex-wrap: wrap; }
  .editor-layout { grid-template-columns: 1fr; }
  #rows { max-height: 550px; }
  #pool { max-height: 350px; }
}
