/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Sorting Sounds. The shared look lives in /core/static/core.css. */

.dot.gr { background: var(--green); }
.hint kbd { font-size: 9px; padding: 0 4px; color: var(--muted); }
.lesson-wide p { color: #c3cbe0; max-width: 900px; }

/* ------------------------------------------------------------ sidebar */
.alg-select { width: 100%; font-size: 14px; padding: 8px 10px; }
.alg-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.badge {
  font: 11px var(--mono); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); background: var(--bg2); white-space: nowrap;
}
.badge.good { color: var(--green); border-color: rgba(61, 220, 151, .4); }
.badge.bad { color: var(--pink); border-color: rgba(255, 92, 138, .4); }
.badge.o { color: var(--yellow); border-color: rgba(255, 201, 60, .4); }
.seed-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.seed-row .sub { margin: 0; }
.seed-row b { color: var(--text); font-family: var(--mono); }
#style button { padding: 5px 2px; font-size: 11px; }
.sound-note { margin: 0; }
#bSoundSide { min-width: 120px; }
#bSoundSide.on { border-color: var(--yellow); color: var(--yellow); }

/* ------------------------------------------------------------ Sort tab */
#view-main.active { display: grid; grid-template-columns: 1fr 300px; gap: 14px; overflow: hidden; }
.stage canvas { cursor: pointer; }
.hud-top {
  position: absolute; top: 14px; left: 18px; pointer-events: none; text-align: left;
}
#hudName { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--yellow); text-shadow: 0 2px 12px #000; }
.hud-sub { font: 12px var(--mono); color: var(--muted); margin-top: 2px; }
.hud-caption {
  position: absolute; top: 38%; left: 0; right: 0; text-align: center; pointer-events: none;
  font-size: 34px; font-weight: 800; opacity: 0; transition: opacity .5s; text-shadow: 0 2px 18px #000;
}
.hud-caption.on { opacity: 1; }
.hud-caption em { font-style: normal; color: var(--yellow); }
.hud-caption > span { display: inline-block; background: rgba(8, 11, 20, .78); border: 1px solid var(--line); border-radius: 18px; padding: 14px 28px 16px; backdrop-filter: blur(4px); }
.hud-caption small { display: block; font: 600 15px var(--mono); color: var(--muted); margin-top: 6px; }
.hud-status {
  position: absolute; bottom: 60px; left: 0; right: 0; text-align: center; pointer-events: none;
  font: 600 13px var(--mono); color: var(--muted); text-shadow: 0 1px 8px #000;
}
.hud-status.done { color: var(--green); }
.hud-status.bad { color: var(--pink); }

.live {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; overflow-y: auto; scrollbar-width: thin;
}
.live h3 { font-size: 13px; margin: 14px 0 6px; }
.live h3:first-child { margin-top: 2px; }
.live h3 + .sub { margin-top: 2px; }
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ctr { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; min-width: 0; }
.ctr span { display: block; font-size: 10px; line-height: 1.25; color: var(--muted); }
.ctr b { font: 800 18px var(--mono); color: var(--text); }
.ctr.y b { color: var(--yellow); }
.ctr.p b { color: var(--pink); }
.ctr.b b { color: var(--blue); }
.ref-line { font-size: 11px; margin: 6px 0 0; }
.ref-line b { color: var(--text); font-family: var(--mono); font-weight: 600; }
canvas.inv { width: 100%; height: 110px; display: block; }
#infoName { color: var(--yellow); font-size: 15px; }
.info-desc { color: #c3cbe0; font-size: 12.5px; margin: 6px 0 8px; }
table.big-o { width: 100%; border-collapse: collapse; font-size: 12px; }
table.big-o td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.big-o td:first-child { color: var(--muted); }
table.big-o td:last-child { text-align: right; font-family: var(--mono); }
.yes { color: var(--green); }
.no { color: var(--pink); }

/* ------------------------------------------------------------ Race tab */
.race-presets { margin-top: 10px; }
.race-presets button { flex: none; padding: 4px 9px; }
.race-go { font-size: 16px; padding: 0 22px; height: 48px; border-radius: 14px; min-width: 170px; }
.race-go.playing { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 0 24px rgba(255, 92, 138, .45); }
.race-btns { justify-content: center; margin: 10px 0 6px; }
.race-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lanes.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lane { min-width: 0; }
.lane {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px;
  transition: border-color .3s;
}
.lane.done { border-color: rgba(61, 220, 151, .5); }
.lane.listen { box-shadow: inset 0 0 0 1px rgba(255, 201, 60, .35); }
.lane-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.lane-head select { flex: 1; min-width: 0; padding: 4px 6px; }
.lane-head .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lane-rank { font-size: 18px; min-width: 24px; text-align: center; }
.lane-x { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.lane-x:hover { color: var(--pink); }
.lane canvas { width: 100%; height: 150px; display: block; border-radius: 8px; background: var(--bg2); }
.lane-stats { font: 11px var(--mono); color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; gap: 6px; }
.lane-stats b { color: var(--text); }
.leader { margin: 0; }
table.board { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
table.board th { color: var(--muted); font-weight: 600; text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.board th:nth-child(2), table.board td:nth-child(2) { text-align: left; }
table.board td { padding: 6px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--line); }
table.board td:nth-child(2) { font-family: var(--sans); }
table.board td.hl { color: var(--yellow); font-weight: 700; }
table.board tr.done td:first-child { font-size: 16px; }
.race-note { margin-top: 12px; }

/* ------------------------------------------------------------ Complexity tab */
#costInput button, #costMetric button { font-size: 11px; padding: 5px 3px; }
#costPresets { margin-top: 10px; }
.cost-grid { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); }
canvas.cost-chart { width: 100%; height: 470px; display: block; cursor: crosshair; }
table.cost-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.cost-table th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 600; padding: 5px 6px; text-align: right; }
table.cost-table th:first-child, table.cost-table td:first-child { text-align: left; }
table.cost-table td { padding: 5px 6px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--line); }
table.cost-table td:first-child { font-family: var(--sans); white-space: nowrap; }
table.cost-table tr { cursor: pointer; }
table.cost-table tr:hover td { background: rgba(255, 201, 60, .07); }
table.cost-table tr.off td { opacity: .35; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.cost-grid .table-wrap { max-height: 470px; overflow: auto; scrollbar-width: thin; }
.growth-2 { color: var(--pink); }
.growth-1 { color: var(--green); }

/* ------------------------------------------------------------ Code tab */
.code-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
.code-panel { margin: 0; }
.code-panel select { max-width: 240px; }
.code { font: 14px/1.75 var(--mono); background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 0; margin: 10px 0; overflow-x: auto; }
.ln { display: grid; grid-template-columns: 30px 64px 1fr; align-items: center; padding: 0 12px 0 0; white-space: pre; transition: background .12s; }
.ln .no { color: var(--dim); text-align: right; padding-right: 10px; font-size: 11px; }
.ln .hits { position: relative; height: 18px; margin-right: 10px; font-size: 10px; color: var(--muted); text-align: right; padding-right: 4px; line-height: 18px; }
.ln .hits i { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 3px; background: rgba(79, 140, 255, .35); max-width: 100%; }
.ln .hits span { position: relative; }
.ln code { font: inherit; color: #c3cbe0; }
.ln.cur { background: rgba(255, 201, 60, .14); box-shadow: inset 3px 0 0 var(--yellow); }
.ln.cur code { color: var(--yellow); }
.ln .cm { color: var(--dim); }
.code-side .panel { margin-bottom: 14px; }
.code-stage { padding: 12px; }
canvas.code-canvas { width: 100%; height: 300px; display: block; border-radius: 10px; background: radial-gradient(circle at 50% 45%, #0f1628 0%, #070a12 75%); }
.code-btns { margin-top: 10px; flex-wrap: wrap; }
.code-info { grid-template-columns: 1fr 1fr; }
table.watch { width: 100%; border-collapse: collapse; font: 13px var(--mono); margin-top: 8px; }
table.watch td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.watch td:first-child { color: var(--blue); width: 40%; }
table.watch td:last-child { text-align: right; color: var(--text); }
table.watch tr.chg td:last-child { color: var(--yellow); }
.evlog { margin: 8px 0 0; padding-left: 0; list-style: none; font: 12px/1.5 var(--mono); color: var(--muted); }
.evlog li { padding: 2px 6px; border-radius: 6px; }
.evlog li:first-child { color: var(--text); background: rgba(255, 201, 60, .1); }
.evlog li.cmp::before { content: "● "; color: var(--yellow); }
.evlog li.mv::before { content: "● "; color: var(--pink); }
.evlog li.mk::before { content: "● "; color: var(--blue); }
.evlog li.ok::before { content: "● "; color: var(--green); }

/* ------------------------------------------------------------ Search tab */
.search-readout { display: flex; gap: 24px; justify-content: center; }
canvas.search-canvas { width: 100%; height: 300px; display: block; cursor: pointer; }
.search-msg { min-height: 20px; margin-bottom: 0; }
.search-msg b { color: var(--yellow); }
canvas.game-line { width: 100%; height: 86px; display: block; margin-top: 6px; }
.game-q { font-size: 26px; font-weight: 800; text-align: center; margin: 6px 0 4px; min-height: 36px; }
.game-q em { font-style: normal; color: var(--yellow); }
.game-q small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.game-q.long { font-size: 15px; font-weight: 600; }
.game-btns { flex-wrap: wrap; margin-top: 6px; }
.game-input {
  width: 110px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  font: 700 16px var(--mono);
}
.game-input:focus { outline: none; border-color: var(--yellow); }
.game-log { margin: 10px 0 0; padding-left: 22px; font: 12px/1.6 var(--mono); color: var(--muted); max-height: 160px; overflow-y: auto; }
.game-log li::marker { color: var(--dim); }
table.log-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; }
table.log-table th { color: var(--muted); font-weight: 600; text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--line); }
table.log-table th:first-child, table.log-table td:first-child { text-align: left; }
table.log-table td { padding: 5px 8px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--line); }
table.log-table td.good { color: var(--green); font-weight: 700; }
table.log-table td.bad { color: var(--pink); }

/* ------------------------------------------------------------ Stability tab */
.hand { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.pc {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 34px; height: 46px; border-radius: 6px; background: #eef1f7; color: #1a1f2e;
  font: 800 15px/1 var(--sans); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); flex: none; position: relative;
}
.pc i { font-style: normal; font-size: 15px; line-height: 1; margin-top: 2px; }
.pc.red { color: #d62b55; }
.pc.moved { outline: 3px solid var(--pink); outline-offset: 1px; }
.pc sub { position: absolute; right: 3px; bottom: 2px; font: 600 8px var(--mono); color: #8a96b3; }
.st-rows { display: grid; gap: 6px; margin-top: 10px; }
.st-row { display: grid; grid-template-columns: 210px auto 1fr; gap: 14px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.st-row .nm { font-weight: 600; font-size: 13px; }
.st-row .nm small { display: block; font-weight: 400; font-size: 11px; }
.st-row .cards { display: flex; gap: 3px; flex-wrap: wrap; }
.st-row .cards .pc { width: 28px; height: 38px; font-size: 13px; }
.st-row .cards .pc i { font-size: 12px; }
.st-row .verdict { font-size: 12px; color: var(--muted); }
.st-row .verdict b.yes { color: var(--green); }
.st-row .verdict b.no { color: var(--pink); }
.two-key { display: grid; gap: 8px; margin-top: 12px; }
.two-key .tk { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; }
.two-key .tk span { font-size: 12px; color: var(--muted); }
.two-key .tk .cards { display: flex; gap: 3px; flex-wrap: wrap; }
.two-key .tk .pc { width: 28px; height: 38px; font-size: 13px; }
.two-key .tk .pc i { font-size: 12px; }
.two-key .res { font-size: 13px; font-weight: 600; margin-top: 4px; }
table.props { width: 100%; border-collapse: collapse; font-size: 12px; }
table.props th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-weight: 600; padding: 5px 6px; text-align: center; }
table.props td { padding: 5px 6px; text-align: center; font-family: var(--mono); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.props th:first-child, table.props td:first-child { text-align: left; font-family: var(--sans); }
#view-stable .table-wrap { max-height: 460px; overflow: auto; scrollbar-width: thin; }

/* ------------------------------------------------------------ Lower bound tab */
canvas.tree { width: 100%; height: 470px; display: block; cursor: pointer; }
.tree-legend { margin: 0; }
.tree-legend .dash { width: 18px; height: 0; border-top: 2px dashed var(--muted); display: inline-block; margin-right: -8px; }
table.bound-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.bound-table th { color: var(--muted); font-weight: 600; padding: 5px 6px; text-align: right; border-bottom: 1px solid var(--line); }
table.bound-table td { padding: 5px 6px; text-align: right; font-family: var(--mono); border-bottom: 1px solid var(--line); }
table.bound-table td small { display: block; color: var(--dim); font-size: 10px; }
table.bound-table td.lb { color: var(--yellow); font-weight: 700; }

/* ------------------------------------------------------------ small screens */
@media (max-width: 1400px) {
  .race-layout { grid-template-columns: 1fr; }
  .lanes.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  #view-main.active { grid-template-columns: 1fr; grid-template-rows: minmax(420px, 1fr) auto; overflow-y: auto; }
  .live { overflow: visible; }
  .code-layout, .code-info, .cost-grid { grid-template-columns: 1fr; }
  .st-row { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 860px) {
  #view-main.active { grid-template-rows: 60vh auto; }
  .lanes, .lanes.three { grid-template-columns: 1fr; }
  .hud-caption { font-size: 24px; }
}

/* ------------------------------------------------------------ refinements (override the blocks above) */
.game-btns[hidden] { display: none; }
.lab-sliders > .field-row:first-child .field { margin-top: 0; }
#quickSpeed button { white-space: nowrap; }
#costPresets button, #racePresets button { flex: none; padding: 4px 9px; }
table.board td:nth-child(2) { white-space: nowrap; font-size: 12px; }
#cSmall.accent { background: var(--yellow); color: #1a1405; border-color: var(--yellow); font-weight: 600; }
.st-rows { grid-template-columns: repeat(auto-fill, minmax(540px, 1fr)); }
.st-row { grid-template-columns: 170px auto 1fr; }
.pc { justify-content: flex-start; padding-top: 5px; }
.pc b { font-weight: 800; line-height: 1; }
.pc sub { right: 2px; bottom: 1px; }
.st-row .cards .pc, .two-key .tk .pc { width: 30px; height: 44px; }
.st-row .cards .pc i, .two-key .tk .pc i { font-size: 13px; margin-top: 3px; }
table.board td:first-child small { font: 11px var(--mono); color: var(--muted); }
.live-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 12px; }
.live-legend .lg { display: flex; align-items: center; gap: 6px; }
.live-legend .dot { margin-right: 0; flex: none; }
.seg button { white-space: nowrap; }
.stage-ctrl .show { white-space: nowrap; }
@media (max-width: 1440px) { .stage-credit { display: none; } }
#costInput, #costMetric { flex-wrap: wrap; }
.cost-grid { grid-template-columns: minmax(0, 1.4fr) minmax(400px, 1fr); }
.ln { grid-template-columns: 30px 50px 1fr; }
.race-listen { text-align: left; margin-top: 8px; }
.race-listen select { width: 100%; }
#bAlg { width: 100%; }
@media (max-width: 1440px) {
  .code-layout { grid-template-columns: 1fr; }
}
table.cost-table { font-size: 11.5px; }
table.cost-table th, table.cost-table td { padding: 4px 5px; }
table.cost-table td:first-child { white-space: normal; }
.st-rows { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.st-row { grid-template-columns: minmax(150px, 1fr) auto; }
.st-row .cards { flex-wrap: nowrap; }
.st-row .verdict { margin-top: 3px; }
.race-layout { grid-template-columns: minmax(0, 1fr) 420px; }
table.board { font-size: 11.5px; }
table.board td:nth-child(2) { white-space: normal; font-size: 11.5px; }
table.board th { white-space: nowrap; }
