:root {
  --bg: #0e1014;
  --surface: #161920;
  --surface-2: #1d212a;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --faint: #6b7385;
  --accent: #e8c23a;
  --accent-ink: #1a1408;
  --link: #8ab4ff;
  --learned: #3fb96a;
  --learning: #e0a93a;
  --cube-body: #0b0c10;
  --sticker-x: #3a3f4b;
  --radius: 10px;
  --tabbar: 0px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dfe3ea;
    --text: #151821; --muted: #5a6376; --faint: #8a93a5; --accent: #b8862a; --accent-ink: #fff; --link: #2b62d9;
    --cube-body: #23262d; --sticker-x: #c5c9d2;
    --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
    color-scheme: light;
  }
}
:root[data-theme="light"] {   /* the settings menu's Light, whatever the system says */
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dfe3ea;
  --text: #151821; --muted: #5a6376; --faint: #8a93a5; --accent: #b8862a; --accent-ink: #fff; --link: #2b62d9;
  --cube-body: #23262d; --sticker-x: #c5c9d2;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  color-scheme: light;
}

/* a colour per variation of a trigger (inverse, reverse, lefty…), used wherever a variation is named or marked */
:root { --f-inv: #b48cff; --f-rev: #4fc3f7; --f-sub: #f6a96b; --f-l: #5bd0a0; --f-linv: #c3e88d; --f-lrev: #2fb5a3; }
.f-inv { --fc: var(--f-inv); } .f-rev { --fc: var(--f-rev); } .f-sub { --fc: var(--f-sub); }
.f-l { --fc: var(--f-l); } .f-linv { --fc: var(--f-linv); } .f-lrev { --fc: var(--f-lrev); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: none; }   /* no underlines: plain links brighten, cards and rows tint */
a:not([class]):hover { color: color-mix(in srgb, var(--link) 65%, var(--text)); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; margin-top: 1.4em; }
h3 { font-size: 15px; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 4px; padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); font-size: 15px; white-space: nowrap; margin-right: 16px; }
.brand:hover { text-decoration: none; }
.brand-cube { display: grid; grid-template-columns: repeat(3, 6px); gap: 1.5px; padding: 2px; background: #111; border-radius: 4px; }
.brand-cube i { display: block; width: 6px; height: 6px; border-radius: 1px; background: #e8c23a; }
.brand-cube i:nth-child(7) { background: #3fb96a; } .brand-cube i:nth-child(9) { background: #f0605a; } .brand-cube i:nth-child(3) { background: #2f6fe4; }
.nav { display: contents; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; order: 1; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); }
.search { position: relative; flex: 0 1 380px; margin-left: auto; order: 2; }
.top-left { display: contents; }
/* desktop: logo and tabs on the left, search in the middle of the page, settings on the right; the side columns are
   equal (1fr) so the search sits centred until the tabs need more room than their half */
@media (min-width: 761px) {
  .topbar { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(260px, 640px) minmax(max-content, 1fr); gap: 16px; }
  .top-left { display: flex; align-items: center; gap: 4px; grid-column: 1; }
  .search { grid-column: 2; margin-left: 0; }
  .settings-btn { grid-column: 3; justify-self: end; margin-left: 0; }
}
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--faint); stroke-width: 2; }
.search input[type=search] { width: 100%; padding: 8px 12px 8px 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; outline: none; }
.search input:focus { border-color: var(--accent); }
.settings-btn { order: 3; flex: none; width: 36px; height: 36px; margin-left: 6px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.settings-btn:hover, .settings-btn[aria-expanded="true"] { color: var(--text); border-color: var(--faint); }
.settings-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-menu { position: absolute; top: calc(100% + 6px); right: 16px; z-index: 60; padding: 12px 14px; display: grid; gap: 10px; min-width: 300px; box-shadow: var(--shadow); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13.5px; }
.set-head { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.sr { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 7px; color: var(--text); }
.sr:hover, .sr.sel { background: var(--surface-2); text-decoration: none; }
.sr svg { flex: none; }
.sr .sr-sub { font-size: 12px; color: var(--muted); }
.sr-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 8px 8px 2px; }

main { padding: 24px 28px 60px; max-width: 1400px; margin: 0 auto; }
main.full { max-width: none; padding: 0; }

/* ---------- generic ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); max-width: 760px; }
.set-tabs { display: flex; align-items: flex-end; gap: 4px; margin: 0 0 12px; padding: 0; border-bottom: 2px solid var(--accent); font-size: 15px; flex-wrap: wrap; }
.set-tab { padding: 8px 18px; border-radius: 10px 10px 0 0; background: var(--surface-2); color: var(--muted); font-weight: 600; text-decoration: none; border: 1px solid var(--border); border-bottom: 0; }
.set-tab:hover { color: var(--text); text-decoration: none; }
.set-tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); padding: 10px 22px; font-size: 17px; }
.set-learned { margin-left: 12px; padding-bottom: 8px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.pad { padding: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button, .seg a { border: 0; background: var(--surface-2); padding: 5px 11px; cursor: pointer; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.seg button + button, .seg a + a { border-left: 1px solid var(--border); }
.seg button.on, .seg a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; }
input[type=text], input[type=search], select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
select { -webkit-appearance: none; appearance: none; padding-right: 30px; line-height: 1.3; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%239aa3b2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; cursor: pointer; }
.chip:hover { border-color: var(--faint); text-decoration: none; }
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.chip .count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on .count { color: var(--accent); }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); }
.pill { font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
/* the plain copy of a page the server sends (for search engines, and anyone without scripts); the app draws over it */
html.js .ssr { display: none; }
.ssr { max-width: 760px; line-height: 1.6; }
.ssr nav { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.ssr td, .ssr th { padding: 2px 12px 2px 0; text-align: left; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.bar { height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--learned); border-radius: 4px; }
.bar > i.learning { background: var(--learning); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); padding: 9px 16px; border-radius: 9px; box-shadow: var(--shadow); z-index: 100; white-space: pre-line; }

/* progress caps (learned / learning) */
.cap { display: inline-flex; vertical-align: middle; line-height: 0; }
.cap svg { width: 17px; height: 17px; }
.cap path { fill: currentColor; stroke: currentColor; stroke-width: 1.1; stroke-linejoin: round; }
.cap path.tassel { fill: none; stroke-width: 1.6; stroke-linecap: round; }
.cap.st-learned { color: var(--learned); }
.cap.st-learning { color: var(--learning); }
.cap.st-none { color: var(--muted); opacity: .45; }
.cap.st-none path { fill: none; stroke-width: 1.5; }
.status-pick { position: relative; display: inline-flex; }
.sp-btn { display: grid; place-items: center; width: 32px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; padding: 0; }
.sp-btn:hover { border-color: var(--faint); }
.sp-btn .cap svg { width: 19px; height: 19px; }
.sp-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; display: grid; gap: 2px; padding: 4px; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.sp-menu button { display: flex; align-items: center; gap: 9px; padding: 6px 9px; border: 0; border-radius: 7px; background: none; color: var(--text); cursor: pointer; font-size: 13px; text-align: left; }
.sp-menu button:hover { background: var(--surface-2); }
.sp-menu button.on { background: var(--surface-2); font-weight: 600; }
.sp-menu .cap.st-none { opacity: .7; }

/* ---------- cube pictures ---------- */
.cube-ll, .cube-iso { display: block; }
.pic-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 8px; }
.pic-btn:hover { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- home ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 30px; }
.tile { padding: 16px 14px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); text-align: center; transition: border-color .12s, transform .12s; position: relative; }
.tile:hover { border-color: var(--faint); text-decoration: none; transform: translateY(-1px); }
.tile .tile-name { font-weight: 600; font-size: 15px; }
.tile .tile-sub { color: var(--muted); font-size: 12.5px; }
.tile .tile-count { position: absolute; top: 10px; right: 10px; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); font-variant-numeric: tabular-nums; }
.tile .tile-count.done { border-color: var(--learned); color: var(--learned); }
.tile.soon { opacity: .55; }
.page-head h1 .tagline { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 10px; letter-spacing: 0; }
.section-title { margin: 26px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.home-foot { margin: 36px 0 8px; text-align: center; font-size: 13px; }
.home-foot { color: var(--faint); }
.home-foot a { color: var(--muted); text-decoration: none; }
.home-foot a .ico { vertical-align: -3px; margin-right: 4px; }
.home-foot a:hover { color: var(--text); }
.home-foot .ico, .btn.support .ico { width: 15px; height: 15px; }
.tile-ico { width: 64px; height: 64px; display: grid; place-items: center; color: var(--muted); }
.tile-ico svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- set page ---------- */
.set-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; position: sticky; top: 53px; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 10px 0; margin-top: -6px; }
.set-tools .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.set-tools #q { width: 300px; max-width: 100%; }
.head-star { font-size: 19px; }
.odds { margin-left: auto; font-size: 12px; font-family: var(--mono); color: var(--faint); padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; cursor: help; }
.badge.same { text-decoration: none; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.badge.same .faint { font-weight: 400; }
.group-head { margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.group-head h2 { margin: 0; }
.group-head .faint { font-size: 13px; }
.case { margin-bottom: 14px; scroll-margin-top: 120px; }
/* a case starts compact (picture, name, status, its default way); clicking it opens the full card */
.case.compact { margin-bottom: 0; cursor: pointer; }
/* compact cards sit several to a row; group headings and opened cards take the full width */
#cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; align-items: start; }
#cases > .group-head, #cases > .case:not(.compact), #cases > .empty { grid-column: 1 / -1; }
#cases > .case:not(.compact) { margin-bottom: 4px; }
.case.compact:hover { border-color: var(--faint); }
.case-compact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px 14px; }
.case-compact .pic { display: block; line-height: 0; }
.cc-alg { margin-top: 4px; }
.cc-alg .alg-text { font-size: 14px; }
.cc-alg .trig-line { margin: 4px 0 0; }
.cc-open, .case-close { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.cc-open svg, .case-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.case-close svg { transform: rotate(180deg); }
.case.compact:hover .cc-open, .case-close:hover { color: var(--text); border-color: var(--faint); }
.case.hit { outline: 2px solid var(--accent); }
.case-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 16px; padding: 14px 16px; align-items: center; }
.case-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.case-title h3 { margin: 0; font-size: 17px; }
.case-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.case-notes { margin-top: 6px; font-size: 13px; color: var(--muted); }
.setup-box { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); text-align: center; cursor: pointer; min-width: 150px; }
.setup-box:hover { border-color: var(--accent); }
.setup-box .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.setup-box .mono { display: block; font-size: 13px; }
.slot-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.slot-tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.slot-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.algs { padding: 6px 10px 10px; }
.alg { border-top: 1px solid var(--border); padding: 8px 6px; }
.alg:first-child { border-top: 0; }
.alg-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alg-toggle { background: none; border: 0; cursor: pointer; color: var(--faint); width: 22px; height: 22px; display: grid; place-items: center; padding: 0; flex: none; }
.alg-toggle:hover { color: var(--text); }
.alg-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.alg.open .alg-toggle svg { transform: rotate(180deg); }
.alg-text { font-family: var(--mono); font-size: 14.5px; font-weight: 600; letter-spacing: .02em; }
.alg-text .ch { padding: 1px 3px; border-radius: 4px; }
.alg-text .ch.plain { color: var(--muted); font-weight: 500; }
.alg-text .ch[data-trigger] { background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); cursor: pointer; }
.alg-text .ch.hl, .trig.hl { box-shadow: 0 0 0 1.5px var(--c, var(--accent)); }   /* a chunk and its pill, lit together */
.alg-text .ch.hl { background: color-mix(in srgb, var(--c, var(--accent)) 30%, transparent); }
.alg-pills { display: flex; gap: 5px; margin-left: auto; align-items: center; }
.alg-star { background: none; border: 0; cursor: pointer; font-size: 17px; color: var(--faint); padding: 0 4px; line-height: 1; }
.alg-star.on, .alg-star:hover { color: var(--accent); }
.trig-line { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 0 32px; }
.trig-line:empty { display: none; }
.trig { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 9px; border-radius: 999px; font-family: var(--mono); font-size: 12px; color: var(--text);
  background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 40%, transparent); }
.trig small { font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif; font-size: 11px; color: var(--muted); }
.trig small i { font-style: normal; color: var(--fc, var(--faint)); }
.trig.plain { background: transparent; border-style: dashed; color: var(--muted); }
a.trig:hover { text-decoration: none; border-color: var(--c, var(--accent)); }
.alg-body { margin: 10px 0 4px 32px; display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 16px; align-items: start; }
.alg-body .player-box { min-height: 200px; }
.alg-meta { font-size: 13px; display: grid; gap: 6px; }
.alg-meta .k { color: var(--muted); margin-right: 6px; }
.more-algs { margin: 8px 0 0 32px; }
twisty-player { width: 100%; height: 280px; display: block; }
.player-clip { position: relative; max-width: 420px; height: 196px; overflow: hidden; }   /* twisty's view is ~196px tall; its own bar sits below and is cut off */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow: auto; padding: 16px; }
.modal .player-clip { max-width: none; }   /* the player draws at a fixed ~256px no matter the box: keep 280 */
.modal-alg { margin-top: 10px; }
.modal-alg .trig-line { margin-left: 0; }
.player-loading { padding: 40px; text-align: center; }

/* trigger colours: the common ones get their own hue so you recognise them across algs */
.t-sx, .t-lsx { --c: #f0605a; } .t-sh, .t-lsh { --c: #3fb6e8; } .t-j, .t-lj { --c: #e9c350; } .t-ax, .t-lax { --c: #f29a4a; }
.t-tt { --c: #f07ab3; } .t-c { --c: #b48cff; } .t-sn, .t-lsn { --c: #3fb96a; } .t-ase, .t-lase { --c: #36c2c6; }
.t-in, .t-lin { --c: #8ab4ff; } .t-ex, .t-lex { --c: #5bd0a0; } .t-n, .t-ln { --c: #c9a8ff; } .t-su { --c: #7fcf8a; } .t-un { --c: #9fd67a; }
.t-to { --c: #ffb86b; } .t-po { --c: #ffd27a; } .t-sxh { --c: #ff8aa8; } .t-sl { --c: #6fc7ff; } .t-rt { --c: #d6a0ff; } .t-tprm { --c: #ffd54a; }
.t-zi, .t-za, .t-ii, .t-aa { --c: #a3b3c8; }

/* ---------- triggers page / explorer ---------- */
.trig-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.trig-table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 53px; background: var(--bg); }
.trig-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.trig-table tr:hover td { background: var(--surface); }
.trig-table .mono { font-size: 12.5px; }
.trig-group td { padding-top: 18px; font-weight: 700; color: var(--accent); border-bottom: 0; }
.levels { display: grid; gap: 6px; margin: 14px 0 20px; }
.level { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 8px 12px; align-items: baseline; }
.level b { color: var(--accent); }

.explorer { padding: 20px 0 40px; position: relative; }
.trail { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; margin: 0 0 16px 4px; }
.trail a { color: var(--muted); }
.trail a.cur, .trail .cur { color: var(--text); font-weight: 600; }
.recent { position: relative; }
.recent-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; display: grid; min-width: 220px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.recent-menu a { padding: 6px 10px; border-radius: 7px; color: var(--text); white-space: nowrap; }
.recent-menu a:hover { background: var(--surface-2); text-decoration: none; }
.recent-menu a .faint { display: inline-block; width: 52px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.xwires { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; }
.xwires path { fill: none; stroke-width: 2; opacity: .55; }
.xcols { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(300px, 380px) minmax(260px, 1.2fr); gap: 48px; align-items: start; }
.xcol { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.xcol.mid { position: sticky; top: 70px; }
.xcol-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.xgroup { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 8px 0 -2px; }
.xset { margin-top: 6px; }
/* a filing tab: the set's name sits on top of its panel of cards; closed, only the tab shows */
.xtab { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; user-select: none; position: relative; z-index: 1;
  padding: 7px 16px 8px; margin-bottom: -1px; font-weight: 600; font-size: 13px; color: var(--muted);
  background: var(--surface-2, var(--surface)); border: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.xtab::-webkit-details-marker { display: none; }
.xtab::after { content: "▸"; font-size: 10px; color: var(--faint); transition: transform .15s; }
.xtab:hover { color: var(--text); }
.xtab-n { font-size: 11px; font-weight: 500; color: var(--faint); background: var(--bg); border-radius: 999px; padding: 1px 7px; }
.xset[open] > .xtab { color: var(--text); background: var(--surface); border-bottom-color: var(--surface); }
.xset[open] > .xtab::after { transform: rotate(90deg); }
.xset:not([open]) > .xtab { border-radius: 10px; margin-bottom: 0; }
.xpanel { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 0 10px 10px 10px; }
.xpanel .xcard { background: var(--bg); }
.xnone { padding: 14px 0; color: var(--faint); }
.xcard { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--k, var(--accent)); border-radius: 10px; padding: 9px 12px; display: flex; gap: 10px; align-items: center; }
.xcard:hover { border-color: var(--faint); border-left-color: var(--k, var(--accent)); background: color-mix(in srgb, var(--k, var(--accent)) 8%, var(--surface)); }
.xcard-title { font-weight: 600; color: var(--text); }
.xcard .xsub { font-size: 12px; color: var(--muted); }
.xmoves { color: var(--faint); }
.xsibs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.xsibs .xcard { padding: 6px 9px; gap: 8px; border-left-width: 2px; }
.xsibs .xcard-title { font-size: 13px; }
.xsibs .xcard .xsub { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xmoves .xhit { --hc: var(--fc, var(--c, var(--accent))); color: var(--text); font-weight: 600; background: color-mix(in srgb, var(--hc) 30%, transparent);
  border-radius: 4px; padding: 0 3px; }
.fword { color: var(--fc, var(--faint)); font-weight: 600; }
.xplayer { margin-top: 30px; padding: 12px; }   /* a wire runs down to it from the card */
.xcol-title.with-tools { display: flex; align-items: center; gap: 6px; }
.xsub-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 6px 0 -2px; }
a.badge:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.xsets-btn { width: 26px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; padding: 0; display: grid; place-items: center; }
.xsets-btn:hover { color: var(--text); border-color: var(--faint); }
.xsets-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.xfilter-btn { color: var(--fc, var(--c, var(--accent))); border-color: color-mix(in srgb, var(--fc, var(--c, var(--accent))) 60%, transparent); }
.xfilter-btn:hover { color: var(--fc, var(--c, var(--accent))); background: color-mix(in srgb, var(--fc, var(--c, var(--accent))) 14%, transparent); }
.xfilter-btn svg path:first-child { fill: currentColor; fill-opacity: .25; }
.xfilter-btn svg .x { stroke-width: 2.4; }
.xplayer .player-clip { max-width: none; }
.xalg[data-way] { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding: 8px; border: 1px solid transparent; }
.xalg[data-way]:hover { border-color: var(--border); }
.xalg[data-way].on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.xstar { color: var(--accent); font-size: 15px; line-height: 1; }
.fdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--fc, var(--c, var(--accent))); vertical-align: 0; }
.trig-table tr[class^="f-"] td:first-child { box-shadow: inset 3px 0 0 var(--fc); }
.xvar-pick { cursor: pointer; border-radius: 6px; }
.trig-table tr.xvar-pick:hover td { background: color-mix(in srgb, var(--fc, var(--accent)) 10%, transparent); }
.trig-table tr.xvar-pick.on td { background: color-mix(in srgb, var(--fc, var(--accent)) 20%, transparent); }   /* what the viewer plays */
.xfocus .mono.xvar-pick { padding: 2px 6px; margin-left: -6px !important; }
.xfocus .mono.xvar-pick.on { background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); }
.xcard .cube-ll, .xcard .cube-iso { flex: none; }
.xfocus { padding: 16px 18px; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--shadow); }
.xfocus h2 { margin: 8px 0 6px; font-size: 20px; }
.xfocus .trig-line { margin-left: 0; }
.xfocus-pic { display: flex; justify-content: center; margin: 6px 0 10px; }
.xalg { padding: 8px 0; border-top: 1px solid var(--border); }
.xalg:first-child { border-top: 0; }
.xalg .trig-line { margin-left: 0; }

/* ---------- tree (cytoscape) ---------- */
.graph-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: calc(100vh - 53px); }
.graph-main { position: relative; overflow: hidden; }
#graph-canvas { position: absolute; inset: 0; }
.graph-toolbar { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; pointer-events: none; }
.graph-toolbar > * { pointer-events: auto; }
.graph-toolbar > select, .graph-toolbar > input, .graph-toolbar > .seg, .graph-toolbar > .btn, .graph-toolbar > label.card { height: 34px; box-sizing: border-box; font-size: 13px; }
.graph-toolbar > .seg button { height: 100%; }
.graph-toolbar > label.card { display: inline-flex; align-items: center; padding: 5px 10px; gap: 6px; }
.graph-side { border-left: 1px solid var(--border); overflow-y: auto; padding: 18px; background: var(--surface); }
.graph-side h3 { margin-top: 18px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.graph-side .trig-line { margin-left: 0; }
.legend { display: grid; gap: 7px; font-size: 13px; }
.lg-node { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.sheet-handle { display: none; }
.side-case-head { display: flex; gap: 6px; align-items: center; margin: 8px 0 4px; }
.icon-btn { width: 32px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); border-color: var(--faint); }
.icon-btn .ico { width: 17px; height: 17px; }
.side-groups-head { display: flex; align-items: center; gap: 6px; }
#g-side .legend a.row { color: var(--text); border-radius: 6px; padding: 2px 4px; margin: 0 -4px; }
#g-side .legend a.row:hover { background: var(--surface-2); }
.side-group { border-top: 1px solid var(--border); padding: 8px 0; }
.side-group > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::before { content: "▸"; font-size: 10px; color: var(--faint); transition: transform .15s; }
.side-group[open] > summary::before { transform: rotate(90deg); }
.side-group > summary .faint { font-weight: 400; }
.side-group .legend { margin: 8px 0 2px 18px; }
.side-set-groups { margin: 6px 0 0 18px; }
/* where a step leads, in the tree's side panel (N124, N125) */
.side-next { margin: 12px 0 6px; display: grid; gap: 6px; font-size: 13px; }
.side-next .k { color: var(--muted); margin-right: 8px; }
.side-next .side-step + .side-step::before { content: " · "; color: var(--faint); }
.legend .row .cap { margin-left: 2px; } .legend .row .cap svg { width: 14px; height: 14px; }
.row-star, .lg-star { color: var(--accent); font-size: 12px; }
/* the tree's legend rows that filter it (N114), and the toolbar chip naming the filter */
.legend .lg-filter { all: unset; display: flex; align-items: center; gap: 8px; padding: 3px 6px; margin: 0 -6px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.legend .lg-filter:hover { background: var(--surface-2); }
.legend .lg-filter.on { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.legend .lg-filter:focus-visible { outline: 2px solid var(--accent); }
.lg-node.lg-none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.filter-chip { gap: 8px; padding: 6px 8px 6px 12px; font-size: 13px; border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.filter-chip button { all: unset; cursor: pointer; color: var(--muted); padding: 0 2px; }
.filter-chip button:hover { color: var(--text); }
.lg-star { width: 12px; text-align: center; }
.side-set-groups .side-group { padding: 6px 0; }
.side-set-groups .side-group > summary { font-weight: 500; font-size: 13.5px; }
.side-case-head .pic-btn { flex: none; }
.side-ways { display: grid; gap: 6px; }
.side-alg { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.side-alg:hover { border-color: var(--faint); }
.side-alg.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.side-alg .trig-line { margin-left: 30px; }
.way-no { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); }
.side-alg.on .way-no { background: var(--accent); color: var(--bg); }
.way-star { flex: none; border: 0; background: none; color: var(--faint); font-size: 16px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.way-star:hover, .way-star.on { color: var(--accent); }
.side-player { margin-top: 10px; }
.side-player .player-clip { max-width: none; }
.trig small { margin-left: 2px; }

/* ---------- trainers ---------- */
.trainer { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.tr-side { display: grid; gap: 14px; position: sticky; top: 70px; }
.tr-side h3 { margin: 0 0 8px; }
.tr-opts label { display: flex; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; }
.colour-picks { display: flex; gap: 6px; }
.colour-pick { width: 34px; height: 34px; border-radius: 7px; border: 2px solid var(--border); cursor: pointer; position: relative; }
.colour-pick.on { border-color: var(--text); }
.colour-pick.on::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #000; font-weight: 700; mix-blend-mode: difference; filter: invert(1); }
.case-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 50vh; overflow: auto; padding: 2px; }
.case-pick { border: 2px solid var(--border); border-radius: 8px; padding: 5px 3px 3px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.case-pick.on { border-color: var(--accent); color: var(--text); }
.case-pick .cube-ll, .case-pick .cube-iso { pointer-events: none; }
.tr-main { display: grid; gap: 16px; }
.tr-display { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
/* the trainer's 3D cube, its hidden faces floating behind it (N129, N138): cut above twisty's bar */
.tr-cube .player-clip.tr-clip { width: 340px; height: 188px; max-width: 100%; }
.tr-cube .tr-clip twisty-player { width: 340px !important; height: 420px !important; }
.tr-time { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; font-style: italic; letter-spacing: -.02em; }
.tr-time.ok { color: var(--learned); } .tr-time.bad { color: #f0605a; }
.tr-answers { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tr-answer { border: 1px solid var(--border); border-radius: 8px; padding: 5px 4px 3px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); min-width: 70px; }
.tr-answer:hover { border-color: var(--accent); }
.tr-answer.right { border-color: var(--learned); background: color-mix(in srgb, var(--learned) 14%, transparent); }
.tr-answer.wrong { border-color: #f0605a; background: color-mix(in srgb, #f0605a 14%, transparent); }
.tr-answer:disabled { cursor: default; }
.tr-answer.text { min-width: 0; padding: 6px 12px; font-family: var(--mono); font-size: 13px; color: var(--text); }
.tr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tr-table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tr-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tr-table td.num, .tr-table th.num { text-align: right; }
.tr-reveal { text-align: center; }
.tr-hint { color: var(--muted); font-size: 13px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); }

/* ---------- tooltip ---------- */
.tip { position: fixed; z-index: 300; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px;
  font-size: 13px; line-height: 1.45; color: var(--text); pointer-events: none; max-width: 320px; }
.tip-title { font-weight: 700; margin-bottom: 4px; color: var(--accent); }
.tip-body { font-size: 13px; color: var(--text); max-width: 300px; line-height: 1.45; }
.tip-moves .tmv { padding: 0 2px; border-radius: 3px; transition: background .12s; }
.tip-mark { font-size: 11px; font-weight: 600; margin-left: 6px; } .tip-mark.st-learned { color: var(--learned); } .tip-mark.st-learning { color: var(--learning); }
/* moves in their trigger chunks' colours (chunkMoves): hover cards and the Explorer's similar algs */
.tch { padding: 1px 2px; border-radius: 4px; }
.tch.named { background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent); color: var(--text); }
.tch.plain { color: var(--muted); }
.tch .run { color: var(--text); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.trig-line.names { margin: 6px 0 0; }
.trig-line.names .trig { cursor: inherit; }
.tip-moves .tmv.now { background: var(--accent); color: var(--accent-ink); }   /* the move the hover card's cube is turning */
.tip-player { width: 180px; height: 172px; overflow: hidden; margin: 4px auto -6px; pointer-events: none; }   /* cut above twisty's own bar */
.tip-player twisty-player { width: 180px; height: 260px; }
.pill[data-tip] { cursor: help; }
.tip-form { margin-left: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fc, var(--muted)); }

/* ---------- progress ---------- */
.prog-sets { display: grid; gap: 12px; }
.prog-set { padding: 14px 16px; display: grid; gap: 8px; }
.prog-set .row b { font-size: 15px; }
.prog-cases { display: flex; gap: 4px; flex-wrap: wrap; }
.prog-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); display: block; }
.prog-dot.learned { background: var(--learned); border-color: var(--learned); }
.prog-dot.learning { background: var(--learning); border-color: var(--learning); }

/* ---------- views ---------- */
.view { display: contents; }
body.routing::before { content: ""; position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 200;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: routing 0.9s linear infinite; }
@keyframes routing { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- responsive ---------- */
.nav-ico { display: none; }
@media (max-width: 1100px) {
  .graph-page { display: block; height: calc(100dvh - 52px - var(--tabbar)); }
  .graph-main { height: 100%; }
  .graph-toolbar { flex-wrap: nowrap; overflow-x: auto; top: 8px; left: 8px; right: 8px; padding-bottom: 4px; scrollbar-width: none; }
  .graph-toolbar > * { flex: none; }
  .graph-side { position: fixed; left: 0; right: 0; bottom: var(--tabbar); z-index: 40; max-height: 58dvh; padding: 0 16px 16px; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.35); transform: translateY(calc(100% - 46px)); transition: transform .22s ease; overflow-y: auto; }
  .graph-side.open { transform: none; }
  .graph-side.peek { transform: translateY(calc(100% - 118px)); }
  .graph-side.peek .sheet-handle { height: 34px; }
  .graph-side.peek h2 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheet-handle { display: block; position: sticky; top: 0; width: 100%; height: 46px; border: 0; background: var(--surface); cursor: pointer; z-index: 2; }
  .sheet-handle::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--faint); margin: 0 auto; }
  .xcols { grid-template-columns: 1fr; gap: 16px; }
  .xwires { display: none; }
  .xcol.mid { position: static; order: -1; }
  .trainer { grid-template-columns: 1fr; }
  .tr-side { position: static; }
  .alg-body { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --tabbar: calc(58px + env(safe-area-inset-bottom)); }
  body { font-size: 15px; }
  input[type=text], input[type=search], select, .search input { font-size: 16px; }
  main { padding: 14px 14px calc(var(--tabbar) + 24px); }
  main.full { padding: 0; }
  h1 { font-size: 22px; }
  .topbar { gap: 10px; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); backdrop-filter: none; background: var(--bg); }
  .brand { font-size: 0; gap: 0; margin-right: 0; }
  .search { flex: 1; margin-left: 0; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: var(--tabbar); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; }
  .nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; border-radius: 0; padding: 6px 0; }
  .nav a.active { background: none; color: var(--accent); }
  .nav-ico { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .set-tools { top: 52px; }
  .case-head { grid-template-columns: auto minmax(0, 1fr); }
  .case-head .setup-box { grid-column: 1 / -1; }
  .trig-line { margin-left: 0; }
  .alg-body, .more-algs { margin-left: 0; }
  .toast { bottom: calc(var(--tabbar) + 14px); }
  .tr-time { font-size: 36px; }
}

/* ---------- notes for Claude (press ~) ---------- */
html.note-picking, html.note-picking * { cursor: crosshair !important; }
.note-outline { position: fixed; z-index: 9998; pointer-events: none; border: 2px dashed var(--accent); border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); display: none; transition: all .06s; }
.note-ring { position: fixed; z-index: 9998; pointer-events: none; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px solid var(--accent); border-radius: 50%; display: none; }
.note-hint { position: fixed; z-index: 9999; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--accent); color: var(--text); padding: 7px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); white-space: nowrap; }
.note-hint button { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 2px 4px; }
.note-box { grid-template-columns: minmax(0, 1fr); position: fixed; z-index: 9999; background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; display: grid; gap: 8px; }
.note-box-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.note-box-target { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.note-box textarea { min-height: 70px; font-size: 14px; width: 100%; resize: vertical; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.note-box.drop { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); }
.note-link { display: grid; gap: 6px; min-width: 0; }
.note-link-last { justify-self: start; display: inline-flex; gap: 6px; align-items: baseline; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.note-link-last:hover { color: var(--text); border-color: var(--faint); }
.note-link-last.on { border-style: solid; border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.note-parent { font-size: 12.5px; padding: 4px 8px; width: 100%; min-width: 0; }
.note-atts { display: flex; gap: 6px; flex-wrap: wrap; }
.note-atts:empty { display: none; }
.note-att { position: relative; display: inline-block; }
.note-att img { height: 64px; max-width: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.note-card .note-att img { height: 110px; max-width: 220px; }
.note-att button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: #f0605a; color: #fff; font-size: 12px; line-height: 18px; padding: 0; cursor: pointer; }
.note-card .note-atts { margin-top: 8px; }
@media (max-width: 760px) { .note-keys { display: none; } .note-hint { bottom: calc(var(--tabbar) + 12px); } .set-tools { position: static; } }
.note-box-foot { display: flex; gap: 6px; align-items: center; font-size: 11.5px; }
.note-card { padding: 12px 14px; margin-bottom: 10px; }
.note-card.done { opacity: .85; }
.note-target { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.note-text { margin-top: 4px; font-size: 15px; white-space: pre-wrap; }
.note-finding { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.note-ctx { font-size: 11.5px; white-space: pre-wrap; margin: 6px 0 0; color: var(--muted); }

/* quick search palette (⌘K) */
.palette-wrap { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.palette { width: min(680px, 100%); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.palette input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 17px; padding: 14px 16px; background: transparent; }
.palette input:focus { border-color: var(--border); }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 10px 4px; }
.palette-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none !important; }
.palette-row.sel { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.palette-icon { width: 44px; text-align: center; flex: none; font-size: 16px; color: var(--muted); display: grid; place-items: center; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.palette-acts button { display: grid; place-items: center; color: var(--muted); }
.palette-acts button:hover { color: var(--text); }
.palette-acts .ico { width: 16px; height: 16px; }
.note-clip .ico, .note-link-last .ico { width: 15px; height: 15px; }
.trig-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--accent)); }
.palette-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.palette-acts { display: flex; gap: 4px; opacity: 0; }
.palette-row.sel .palette-acts, .palette-row:hover .palette-acts { opacity: 1; }
.palette-acts button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; width: 30px; height: 28px; cursor: pointer; }
.palette-empty { padding: 20px; text-align: center; }
.palette-foot { font-size: 11.5px; padding: 8px 14px; border-top: 1px solid var(--border); }
@media (max-width: 700px) { .palette-wrap { padding: 0; align-items: stretch; } .palette { max-height: none; height: 100%; border-radius: 0; } .palette-foot { display: none; } .palette-acts { opacity: 1; } }

/* the move strip under a 3D player: the move being turned lights up, with its trigger chunk */
.move-bar { display: flex; align-items: center; gap: 6px; margin-top: 8px; max-width: 420px; }
.move-strip { flex: 0 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.mv-btn { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 17px; line-height: 1; padding: 0; display: grid; place-items: center; }
.mv-btn:hover { border-color: var(--accent); }
.mv-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mv-btn svg .fill { fill: currentColor; stroke-width: 1.4; }
.mv-btn.on, .mv-btn.mv-home.now { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mv-chunk { display: inline-flex; gap: 2px; padding: 2px 4px; border-radius: 6px; border: 1px solid transparent; background: color-mix(in srgb, var(--c, var(--faint)) 12%, transparent); transition: border-color .15s; }
.mv-chunk.plain { background: transparent; border-style: dashed; border-color: var(--border); color: var(--muted); }
.mv-chunk.now { border-color: var(--c, var(--accent)); }
.mv { padding: 1px 4px; border-radius: 4px; transition: background .12s, transform .12s; }
.mv.now { background: var(--accent); color: var(--accent-ink); transform: scale(1.12); }
.mv { cursor: pointer; }   /* click a move: the cube turns to it */
.mv:not(.now):hover { background: var(--surface-2); color: var(--text); }
.trig.now { box-shadow: 0 0 0 2px var(--c, var(--accent)); }
.modal .move-bar, .xplayer .move-bar, .side-player .move-bar { max-width: none; }

/* our own player controls */
.modal .player-clip { max-width: none; }
