/* Controller Forever's look: charcoal/navy panels, gold and bronze edges,
   magenta for the active tab (as in CF's All Keybinds window). */
:root {
  --canvas: #0b0e14;
  --panel: #141823;
  --panel2: #1c2130;
  --raised: #232a3b;
  --gold: #f2bd47;
  --gold-dim: #b88a2e;
  --bronze: #80613a;
  --text: #f2ece1;
  --muted: #a9b1c1;
  --pink: #e0569a;
  --pink-soft: rgba(224, 86, 154, 0.18);
  --ok: #78cb9e;
  --warn: #f1c76b;
  --err: #ee8585;
  --radius: 6px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0; color: var(--text); background: radial-gradient(1200px 600px at 50% -200px, #1a2236 0%, var(--canvas) 70%);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
main { max-width: 1440px; margin: 0 auto; padding: 0 16px 48px; }
h1, h2, h3 { line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.7rem; margin: 18px 0 8px; }
h2 { font-size: 1.2rem; color: var(--gold); }
code, pre, textarea { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* top bar and class tabs */
/* Masthead: a full-width band like Talents Forever's, with CF's logo and
   the name in a carved gold serif. */
.masthead {
  background: linear-gradient(180deg, #161c2a 0%, #0d1018 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  margin-bottom: 12px;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 14px; max-width: 1440px; margin: 0 auto; position: relative; }
/* the gold line under the name: as wide as the content, not the window */
.top::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px;
  background: #4a3a1c; box-shadow: 0 1px 0 rgba(242, 189, 71, 0.18);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand:hover { text-decoration: none; }
.brand .sub { display: none; } /* the old "Setups" word, until a server still running older page code restarts */
.brand img { width: 54px; height: 54px; filter: drop-shadow(0 0 8px rgba(242, 189, 71, 0.35)); }
.brand span {
  font-family: "Cinzel", "Trajan Pro", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 2.1rem; font-weight: 700; letter-spacing: 0.06em; line-height: 1;
  background: linear-gradient(180deg, #fff1c2 0%, #f2bd47 48%, #a8761f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.85)) drop-shadow(0 0 10px rgba(242, 189, 71, 0.22));
}
.pastebtn, button, .chip {
  font: inherit; color: var(--text); background: linear-gradient(#262d3f, #1a1f2d); border: 1px solid var(--bronze);
  border-radius: var(--radius); padding: 7px 14px; cursor: pointer;
}
button.primary, .pastebtn { border-color: var(--gold); color: var(--gold); }
button:hover, .pastebtn:hover { border-color: var(--gold); text-decoration: none; }
button:disabled { opacity: 0.6; cursor: default; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #0f131c; border: 1px solid #343c52; border-radius: var(--radius); padding: 8px 10px;
}
.classtabs { display: flex; gap: 4px; overflow-x: auto; padding: 6px 16px; max-width: 1440px; margin: 0 auto 6px; scrollbar-width: thin; }
.classtabs a {
  /* even shares of the row, edge to edge like the content below; never
     narrower than the class name (narrow phones scroll the row) */
  flex: 1 1 0; min-width: max-content; text-align: center;
  padding: 6px 12px; border: 1px solid #2c3346; border-bottom: 3px solid var(--cc); border-radius: var(--radius) var(--radius) 0 0;
  background: var(--panel); color: var(--cc); font-weight: 600;
}
.classtabs a.on { background: var(--raised); border-color: var(--cc); }
footer { max-width: 1440px; margin: 0 auto; padding: 24px 16px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid #222838; }

/* The All Keybinds window */
.kb {
  margin: 14px 0; background: linear-gradient(180deg, #121624, #0d1019); border: 2px solid var(--gold-dim);
  border-radius: 10px; box-shadow: inset 0 0 0 1px #3a2c16, 0 10px 30px rgba(0, 0, 0, 0.45); padding: 10px 12px 12px;
}
.kb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid #3a3020; padding-bottom: 8px; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.crumbs .logo { width: 24px; height: 24px; }
.crumbs b { color: var(--text); font-weight: 500; }
.crumbs .hl { color: var(--pink); }
.crumbs .sep { color: #59607a; }
.kb-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.glyphs { display: flex; gap: 4px; }
.chip { padding: 3px 10px; font-size: 0.85rem; border-color: #3a4258; color: var(--muted); }
.chip.on { border-color: var(--gold); color: var(--gold); }
.level label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.level input[type="range"] { width: 140px; padding: 0; accent-color: var(--gold); }
.level output { min-width: 2ch; color: var(--text); }
.kb-pages { margin-top: 8px; border: 1px solid var(--pink); border-radius: var(--radius); padding: 4px 6px; background: rgba(10, 12, 20, 0.6); }
.kb-row { display: grid; grid-template-columns: 150px repeat(5, minmax(0, 1fr)); gap: 4px; align-items: center; padding: 2px 0; }
.rowname { color: var(--muted); font-size: 0.82rem; }
.ptab {
  display: flex; justify-content: space-between; gap: 6px; padding: 2px 10px; font-size: 0.85rem; color: var(--text);
  background: linear-gradient(#1a2030, #141927); border: 1px solid #2d3448; border-radius: 3px;
}
.ptab .n { color: var(--muted); }
.ptab.zero { color: #808aa0; }
.ptab.on { border-color: var(--gold); background: linear-gradient(#4b3a1b, #2c2312); color: var(--gold); }
.ptab:hover { text-decoration: none; border-color: var(--gold-dim); }
.kb-forms { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.fcard {
  position: relative; flex: 1 1 160px; max-width: 280px; min-height: 58px; display: flex; align-items: flex-end; justify-content: center;
  background: #161a28; border: 1px solid #2d3448; border-radius: 4px; padding: 18px 10px 6px; color: var(--text);
}
.fcard .n { position: absolute; top: 4px; left: 8px; font-size: 0.75rem; color: var(--muted); }
.fcard .active { position: absolute; top: 4px; right: 8px; font-size: 0.75rem; color: var(--ok); }
.fcard .fname { color: var(--text); }
.fcard.on { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); }
.fcard.on .fname { color: var(--pink); }
.fcard:hover { text-decoration: none; border-color: var(--gold-dim); }
.kb-main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(220px, 30%, 300px); gap: 12px; margin-top: 10px; }
/* a narrow window (beside the side pane, or on a tablet): the controller takes the full width, its panel goes under it */
.kb { container-type: inline-size; }
@container (max-width: 820px) {
  .kb .kb-main { grid-template-columns: minmax(0, 1fr); }
  .kb .kb-detail { min-height: 0; }
}
/* tiles size to the controller picture, not the window (the side pane takes width) */
.kb-padwrap { min-width: 0; container-type: inline-size; }
.pad {
  position: relative; width: 100%; aspect-ratio: 1024 / 580;
  background: url("/cf/AllKeybinds/KB_Body.png") top center / 100% auto no-repeat, radial-gradient(closest-side, #172036, transparent);
}
.slot {
  --s: clamp(20px, 6.1cqw, 54px); /* CF's picture spaces LT and LB ~6% of its width apart */
  position: absolute; transform: translate(-50%, -50%); width: var(--s); display: flex; flex-direction: column; align-items: center;
  color: var(--text); text-decoration: none;
}
.slot:hover { text-decoration: none; }
.tile {
  width: var(--s); height: var(--s); display: grid; place-items: center; border-radius: 6px; border: 2px solid #4d4231;
  background: #10131d; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); object-fit: cover;
}
.tile.text { font-size: clamp(7px, 1.5cqw, 11px); line-height: 1.05; text-align: center; padding: 2px; color: #e6dcc6; background: linear-gradient(#2b3247, #171c2a); overflow: hidden; }
.tile.empty { border: 2px dashed #6a3a59; background: rgba(40, 20, 40, 0.45); }
.tile.cleared { border: 2px dashed var(--err); color: var(--err); font-size: 1.2rem; }
.tile.big { --s: 56px; }
.state-own .tile { border-color: var(--bronze); }
.state-inherited .tile { opacity: 0.45; filter: grayscale(0.6); }
.slot.dim .tile { opacity: 0.25; filter: grayscale(1); }
.slot.selected .tile, .slot:focus-visible .tile { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(242, 189, 71, 0.55); }
.slot:hover .tile { border-color: var(--gold-dim); }
.glyph { display: flex; align-items: center; gap: 2px; margin-top: 2px; font-size: clamp(8px, 1.6cqw, 12px); color: var(--muted); white-space: nowrap; }
.glyph img { width: clamp(11px, 2.4cqw, 18px); height: auto; }
.lp {
  position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--pink); color: #fff;
  font-size: 9px; display: grid; place-items: center; border: 1px solid #fff4;
}
.extras { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; margin-top: 8px; padding: 8px; border-top: 1px solid #2a3144; }
.extras .rowname { width: 100%; }
.extras .slot { position: relative; transform: none; }
.hint { color: var(--gold); text-align: center; font-size: 0.85rem; margin: 6px 0 0; }
.kb-detail {
  background: linear-gradient(#171b29, #10131c); border: 2px solid var(--gold-dim); border-radius: 6px; padding: 12px; min-height: 260px;
}
.detail-empty p { margin-top: 0; }
.detail-head { display: flex; gap: 10px; align-items: center; }
.detail-head h3 { margin: 0; color: var(--gold); font-size: 1.15rem; }
.rank { color: var(--muted); font-size: 0.9rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 10px 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.macro { white-space: pre-wrap; word-break: break-all; font-size: 0.78rem; background: #0b0e15; border: 1px solid #2a3144; padding: 6px; border-radius: 4px; }
.longpress h4 { margin: 8px 0 4px; color: var(--pink); }
.longpress .tile { --s: 36px; }
.kb-sets { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.stab { flex: 1 1 140px; text-align: center; padding: 8px; background: #161a28; border: 1px solid #2d3448; border-radius: 4px; color: var(--text); }
.stab .n { color: var(--muted); font-size: 0.8rem; }
.stab.on { border-color: var(--pink); color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); }
.stab:hover { text-decoration: none; }
.bindlist { margin: 12px 0; }
.bindlist summary { cursor: pointer; color: var(--gold); }
.bindlist table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 6px; }
.bindlist th, .bindlist td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #222838; vertical-align: top; }
.bindlist th { color: var(--muted); font-weight: 500; }
.unplaced { color: var(--muted); }

/* ---------------------------------------------------------------------
   Workspace: one page shape after Talents Forever's planner. Secondary
   things are thin horizontal strips; only the All Keybinds window and the
   side list are panels.
   --------------------------------------------------------------------- */
.ws { margin-top: 2px; }
.tag { font-size: 0.78rem; padding: 0 7px; border-radius: 99px; background: var(--raised); color: var(--muted); border: 1px solid #343c52; }
a.tag:hover { color: var(--text); text-decoration: none; border-color: var(--gold-dim); }
.count { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.warn, .warn-inline { color: var(--warn); }
.warn-inline { font-size: 0.8rem; border: 1px solid var(--warn); border-radius: 4px; padding: 0 4px; }
.empty { color: var(--muted); padding: 16px 0; }

/* the slim toolbar above the main pane */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px;
  background: linear-gradient(#171c29, #121622); border: 1px solid #2a3144; border-radius: var(--radius);
}
.tb-paste { display: flex; gap: 6px; flex: 1 1 360px; min-width: 0; }
.tb-paste input { flex: 1 1 auto; min-width: 0; padding: 5px 10px; font-size: 0.88rem; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.tb-paste input::placeholder { font-family: "Segoe UI", system-ui, sans-serif; }
.tb-paste button, .tbtn, .abtn { padding: 4px 12px; font-size: 0.88rem; line-height: 1.4; }
.tb-view { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.glyphs { display: flex; gap: 4px; }
.chip { padding: 2px 10px; font-size: 0.82rem; border-color: #3a4258; color: var(--muted); border-radius: 99px; }
.chip.on { border-color: var(--gold); color: var(--gold); }
.chip:hover { text-decoration: none; }
.level label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.88rem; margin: 0; }
.level input[type="range"] { width: 130px; padding: 0; accent-color: var(--gold); border: 0; background: none; }
.level output { min-width: 2ch; color: var(--text); }
.tbtn, .abtn {
  display: inline-block; font: inherit; font-size: 0.88rem; color: var(--text); background: linear-gradient(#262d3f, #1a1f2d);
  border: 1px solid var(--bronze); border-radius: var(--radius); cursor: pointer; white-space: nowrap;
}
.tbtn:hover, .abtn:hover { border-color: var(--gold); text-decoration: none; }
.abtn.primary { border-color: var(--gold); color: var(--gold); }
.abtn.on { background: linear-gradient(#4b3a1b, #2c2312); color: var(--gold); border-color: var(--gold); }
.errstrip { margin: 6px 0 0; padding: 5px 10px; color: var(--err); background: rgba(238, 133, 133, 0.08); border: 1px solid rgba(238, 133, 133, 0.4); border-radius: var(--radius); font-size: 0.9rem; }

/* main pane + side pane */
.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; margin-top: 10px; align-items: start; }
.ws-main { min-width: 0; }
.titlestrip { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 0 2px; }
.titlestrip h1 { font-size: 1.25rem; margin: 0; }
.titlestrip h1 a { color: var(--text); }
.titlestrip .meta { color: var(--muted); font-size: 0.9rem; }
.titlestrip .cls { color: var(--cc); font-weight: 600; }
.titlestrip .tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ws-main .kb { margin: 6px 0 0; }
.kb-hint { color: var(--gold); font-size: 0.9rem; }

/* the thin action bar under the main pane, and the strips it opens */
.actionbar {
  display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 6px; padding: 5px 8px;
  background: linear-gradient(#1b2030, #141826); border: 1px solid var(--gold-dim); border-radius: var(--radius);
}
.actionbar form { display: flex; align-items: center; gap: 6px; margin: 0; }
.ab-note { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.strip {
  display: none; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 4px; padding: 6px 8px;
  background: #121623; border: 1px solid #2a3144; border-left: 3px solid var(--gold-dim); border-radius: var(--radius);
}
.strip.open, .strip:target { display: flex; }
.strip input, .strip select { padding: 4px 8px; font-size: 0.88rem; }
#code input { flex: 1 1 320px; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.8rem; }
#code .muted { flex: 1 1 260px; font-size: 0.82rem; }
.savestrip label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; margin: 0; white-space: nowrap; }
.savestrip .f-title { flex: 2 1 240px; }
.savestrip .f-tags, .savestrip .f-notes { flex: 1 1 170px; }
.savestrip .f-tree { flex: 0 1 auto; }
.savestrip label input { flex: 1 1 auto; min-width: 0; }
.savestrip select { width: auto; }
.savestrip .muted, .savestrip .err { flex: 1 1 100%; font-size: 0.8rem; margin: 0; }
.savestrip .err { color: var(--err); }
/* Discord and CurseForge cards under the action bar (after TF's partner panes):
   eyebrow, icon tile, headline + line, pill button; a coloured accent edge. */
.promos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.promo {
  --ac: var(--gold); position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-width: 0;
  color: var(--text); border: 1px solid color-mix(in srgb, var(--ac) 45%, #2a3144); border-left: 3px solid var(--ac);
  border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--ac) 22%, transparent), transparent 60%), linear-gradient(180deg, #161b28, #0f131c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 4px 14px color-mix(in srgb, var(--ac) 14%, transparent);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.promo:hover, .promo:focus-visible {
  text-decoration: none; border-color: var(--ac);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ac) 40%, transparent), 0 6px 20px color-mix(in srgb, var(--ac) 28%, transparent);
}
.promo-discord { --ac: #5865f2; }
.promo-curse { --ac: #f16436; }
.pr-ico {
  flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 8px;
  background: color-mix(in srgb, var(--ac) 18%, #0b0e14); border: 1px solid color-mix(in srgb, var(--ac) 55%, transparent);
}
.pr-ico img { width: 36px; height: 36px; }
.pr-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pr-eyebrow { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: color-mix(in srgb, var(--ac) 75%, #fff); }
.pr-head { font-weight: 700; font-size: 0.98rem; line-height: 1.2; }
.pr-text { font-size: 0.8rem; color: var(--muted); }
.pr-btn {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; white-space: nowrap;
  color: #fff; background: var(--ac); box-shadow: 0 2px 8px color-mix(in srgb, var(--ac) 45%, transparent);
}
.pr-short { display: none; }
@media (max-width: 1180px) { .promos { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .promos { gap: 8px; }
  .promo { gap: 10px; padding: 8px 10px; }
  .pr-ico { width: 38px; height: 38px; }
  .pr-ico img { width: 30px; height: 30px; }
  .pr-eyebrow { font-size: 0.62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pr-head { font-size: 0.9rem; }
  .pr-text { display: none; }
  .pr-btn { padding: 5px 12px; font-size: 0.8rem; }
  .pr-long { display: none; }
  .pr-short { display: inline; }
}

/* the macro icon picker: thin rows inside the save strip */
.picker { flex: 1 1 100%; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid #2a3144; padding-top: 6px; }
.pk-head { color: var(--gold); font-size: 0.85rem; font-weight: 600; }
.pk-head .muted { color: var(--muted); font-weight: 400; margin-left: 6px; }
.picker .pk-head .muted { flex: none; }
.pk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 3px 0; min-width: 0; }
.pk-cur { width: 32px; height: 32px; border: 1px solid var(--gold-dim); border-radius: 4px; background: #0b0e14; }
.pk-where { font-size: 0.85rem; color: var(--muted); min-width: 0; }
.pk-where b { color: var(--text); font-weight: 600; margin-left: 4px; }
.savestrip .pk-q { flex: 1 1 200px; max-width: 320px; }
.pk-clear { padding: 3px 10px; font-size: 0.8rem; }
.pk-results { flex: 1 1 100%; width: 100%; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.savestrip { min-width: 0; max-width: 100%; }
.pk-results:empty { display: none; }
.pk-results .muted { flex: none; }
.pk-ico { flex: 0 0 auto; padding: 1px; border: 1px solid #2c3346; border-radius: 4px; background: #0b0e14; line-height: 0; }
.pk-ico img, .pk-sprite { display: block; width: 32px; height: 32px; border-radius: 3px; }
/* icons drawn from the sprite sheets: catalog.ts iconStyle sets image, size and position inline */
.sprite { background-color: #0b0e14; }
.pk-ico:hover, .pk-ico:focus-visible { border-color: var(--gold-dim); }
.pk-ico.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

/* collapsed rows below */
.ws-below { margin-top: 8px; display: grid; gap: 4px; }
.rowbar { background: #121623; border: 1px solid #2a3144; border-radius: var(--radius); padding: 0 8px; }
.rowbar > summary { cursor: pointer; color: var(--gold); padding: 5px 0; font-size: 0.9rem; list-style-position: inside; }
.rowbar > summary .n { color: var(--muted); margin-left: 4px; }
.rowbar[open] > summary { border-bottom: 1px solid #222838; }
.rowbar.notes p { white-space: pre-wrap; margin: 6px 0 8px; color: #dcd6cb; max-width: 80ch; }
.bindlist { margin: 0; }
.unplaced ul { margin: 6px 0 8px; }

/* side pane: the class's setups, compact rows */
.side {
  background: linear-gradient(#151a27, #10131d); border: 1px solid #2a3144; border-radius: 8px; padding: 8px;
  display: grid; gap: 6px; position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: hidden; grid-template-rows: auto auto auto minmax(0, 1fr);
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-head h2 { margin: 0; font-size: 0.95rem; color: var(--cc); }
.seg { display: inline-flex; border: 1px solid #343c52; border-radius: 99px; overflow: hidden; flex: 0 0 auto; }
.seg a { padding: 1px 10px; font-size: 0.78rem; color: var(--muted); }
.seg a.on { background: var(--pink-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--pink); border-radius: 99px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.side-search input { padding: 4px 8px; font-size: 0.85rem; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.srow {
  display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 5px 8px; color: var(--text);
  background: #161a28; border: 1px solid #262d40; border-left: 3px solid var(--cc); border-radius: 4px;
}
.srow:hover { border-color: var(--gold-dim); border-left-color: var(--cc); text-decoration: none; }
.srow.on { border-color: var(--pink); border-left-color: var(--pink); background: linear-gradient(90deg, var(--pink-soft), #161a28 70%); }
.srow .rank { grid-row: span 2; align-self: center; color: var(--gold); font-weight: 600; font-size: 0.85rem; }
.srow .stitle { font-weight: 600; font-size: 0.9rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .smeta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.8rem; }
.srow .sstats { white-space: nowrap; }
.side-empty { color: var(--muted); font-size: 0.88rem; margin: 4px 2px; }

@media (max-width: 1100px) {
  .ws-grid { grid-template-columns: minmax(0, 1fr) 250px; }
}
@media (max-width: 900px) {
  .ws-grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; grid-template-rows: none; }
  .side-list { display: flex; overflow-x: auto; overflow-y: hidden; gap: 6px; padding-bottom: 4px; }
  .side-list li { flex: 0 0 210px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: 0 0 auto; }
  .tb-paste { flex-basis: 100%; }
}
@media (max-width: 860px) {
  .kb-main { grid-template-columns: 1fr; }
  .kb-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kb-row .rowname { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .top { padding: 12px 12px 10px; }
  .top::after { left: 12px; right: 12px; }
  .brand { gap: 10px; }
  .brand img { width: 40px; height: 40px; }
  .brand span { font-size: 1.45rem; letter-spacing: 0.04em; }
  .kb { padding: 8px 6px; }
  .kb-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glyph span { display: none; }
  .fcard { flex-basis: 120px; }
  /* toolbar on two lines: the paste box, then labels + level (Copy link is in the action bar) */
  .toolbar > .tbtn { display: none; }
  .tb-view { flex-wrap: nowrap; gap: 8px; width: 100%; justify-content: space-between; }
  .glyphs .chip { padding: 1px 7px; font-size: 0.75rem; }
  .level label { gap: 4px; font-size: 0.8rem; }
  .level input[type="range"] { width: 72px; }
  .ab-note { margin-left: 0; flex-basis: 100%; }
  .titlestrip h1 { font-size: 1.1rem; }
  .bindlist table { font-size: 0.8rem; }
  .bindlist { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
