/* ==========================================================================
   Holodori.Top — liquid glass
   Frosted translucent panels, aurora backdrop, pill-shaped controls.
   ========================================================================== */

@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-tight-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- ink (cool slate, one family) ---- */
  --ink: #0f1a2c;
  --ink-2: #33425f;
  --ink-3: #64748f;
  --ink-4: #93a1bb;

  /* ---- single accent: deep teal ---- */
  --accent: #0a7d9c;
  --accent-deep: #075d78;
  --accent-soft: rgba(10, 125, 156, 0.12);
  --accent-ring: rgba(10, 125, 156, 0.28);

  /* ---- semantic (micro text) ---- */
  --ok: #16795a;
  --ng: #b23a55;

  /* ---- data series ---- */
  --s-cute: #ef6a90;
  --s-happy: #e0a02c;
  --s-pure: #2fa877;

  /* ---- aurora backdrop ---- */
  --base: #e9f0fa;
  --aurora-1: rgba(126, 224, 255, 0.85);
  --aurora-2: rgba(168, 152, 255, 0.8);
  --aurora-3: rgba(255, 170, 210, 0.78);
  --aurora-4: rgba(150, 240, 208, 0.7);

  /* ---- glass ---- */
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-thin: rgba(255, 255, 255, 0.34);
  --glass-border: rgba(255, 255, 255, 0.62);
  --glass-line: rgba(15, 26, 44, 0.1);
  --glass-line-soft: rgba(15, 26, 44, 0.055);
  --glass-blur: blur(26px) saturate(180%);
  --glass-shadow: 0 20px 46px -22px rgba(28, 52, 104, 0.42),
    0 4px 14px -8px rgba(28, 52, 104, 0.24);
  --glass-shadow-sm: 0 10px 24px -14px rgba(28, 52, 104, 0.4);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42);

  /* ---- radius: round ---- */
  --r-pill: 999px;
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-xs: 9px;

  /* ---- type ---- */
  /* Latin/digits: Inter Tight (variable). CJK: OS のサンセリフへ確実に落とす。
     monospace を最後に置くと中国語環境で NSimSun（宋体）に落ちて字面が揃わないため、
     CJK フォントを明示し、generic な monospace は使わない。 */
  --font-cjk: "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP",
    "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font: "Inter Tight", var(--font-cjk);
  --num: "Inter Tight", ui-monospace, "Cascadia Mono", Consolas, var(--font-cjk);

  /* ---- weight scale ----
     CJK のシステムフォントは 400 / 700 しか持たないことが多い（Microsoft YaHei など）。
     中間ウェイトは合成太字になって字面が濁るので、文字は 400 と 700 の 2 段だけにする。
     数字（Inter Tight）だけは可変ウェイトを使ってよい。 */
  --w-regular: 400;
  --w-bold: 700;
  --w-num: 700;
  --w-num-display: 750;

  /* ---- metrics ---- */
  --rail: 208px;
  --masthead-h: 68px;
  --gap: clamp(12px, 1.6vw, 22px);
  --maxw: 1460px;

  /* ---- z ---- */
  --z-rail: 20;
  --z-masthead: 30;
  --z-boot: 60;
  --z-modal: 100;
}

/* 言語ごとに CJK フォントを切り替える（<html lang> は i18n が更新する） */
html:lang(ja) {
  --font-cjk: "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP",
    "MS PGothic", "Microsoft YaHei UI", sans-serif;
}
html:lang(zh-Hans) {
  --font-cjk: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans SC", "Source Han Sans SC", "Hiragino Sans GB", sans-serif;
}
html:lang(zh-Hant) {
  --font-cjk: "Microsoft JhengHei UI", "Microsoft JhengHei", "PingFang TC",
    "Noto Sans TC", "Source Han Sans TC", "Microsoft YaHei UI", sans-serif;
}

/* ==========================================================================
   reset
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--masthead-h) + 28px);
  background: var(--base);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-color: var(--base);
  background-image:
    radial-gradient(46rem 40rem at 4% -8%, var(--aurora-1), transparent 62%),
    radial-gradient(40rem 36rem at 96% -4%, var(--aurora-2), transparent 60%),
    radial-gradient(44rem 40rem at 88% 88%, var(--aurora-3), transparent 62%),
    radial-gradient(50rem 44rem at 6% 96%, var(--aurora-4), transparent 64%),
    linear-gradient(180deg, #eff5fd 0%, #e7eefb 50%, #eff4fc 100%);
  background-attachment: fixed;
}

/* fine grain so the glass does not look like flat gradient */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
}

button,
input,
select,
textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; background: none; border: 0; }
a { color: var(--accent-deep); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
p { margin: 0; }
dl, dd, dt, ol, ul { margin: 0; padding: 0; }
figure { margin: 0; }
li { list-style: none; }
table { border-collapse: collapse; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px; left: 10px;
  z-index: calc(var(--z-modal) + 10);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--glass-shadow);
  transform: translateY(-180%);
  transition: transform 0.22s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.skip-link:focus { transform: translateY(0); }

/* ==========================================================================
   glass primitives
   ========================================================================== */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-shadow);
}

/* browsers without backdrop-filter get a more opaque surface */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  :root {
    --glass: rgba(255, 255, 255, 0.86);
    --glass-strong: rgba(255, 255, 255, 0.94);
    --glass-thin: rgba(255, 255, 255, 0.7);
  }
}

.micro {
  display: block;
  font-family: var(--num);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   masthead — floating glass bar
   ========================================================================== */

.masthead {
  position: sticky;
  top: 10px;
  z-index: var(--z-masthead);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--masthead-h);
  max-width: var(--maxw);
  margin: 10px auto 0;
  padding: 10px 16px;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-shadow);
}

.masthead-brand { display: flex; align-items: center; gap: 11px; flex: none; }

.mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: linear-gradient(150deg, #17a5c4, #0a6f8f 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 6px rgba(0, 40, 60, 0.25),
    0 8px 18px -8px rgba(10, 111, 143, 0.8);
}

.brand-text { display: grid; gap: 1px; }
.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand-latin {
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.masthead-note {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 56ch;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.masthead-meta {
  display: flex;
  align-items: center;
  gap: 0;
  flex: none;
  margin-left: auto;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--glass-thin);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.masthead-meta > div {
  display: grid;
  gap: 0;
  padding: 0 10px;
  text-align: center;
  border-left: 1px solid var(--glass-line-soft);
}
.masthead-meta > div:first-child { border-left: 0; }
.masthead-meta dt {
  font-family: var(--num);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.masthead-meta dd {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  line-height: 1.3;
}

/* language switch — pill group */
.lang-switch {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--glass-thin);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.lang-btn {
  min-width: 32px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  font-family: var(--num);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease,
    transform 0.22s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.lang-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.55); }
.lang-btn:active { transform: scale(0.94); }
.lang-btn.active {
  color: var(--accent-deep);
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 12px -6px rgba(28, 52, 104, 0.5);
}

/* ==========================================================================
   workspace
   ========================================================================== */

.workspace {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--gap) var(--gap) 56px;
}

.rail {
  position: sticky;
  top: calc(var(--masthead-h) + 26px);
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-shadow-sm);
}

.rail .tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  transition: background 0.24s ease, color 0.24s ease, box-shadow 0.24s ease,
    transform 0.24s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.rail-num {
  font-family: var(--num);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-4);
  transition: color 0.24s ease;
}
.rail .tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}
.rail .tab:hover .rail-num { color: var(--accent); }
.rail .tab:active { transform: scale(0.98); }
.rail .tab.active {
  color: var(--accent-deep);
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 20px -10px rgba(28, 52, 104, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.7);
}
.rail .tab.active .rail-num { color: var(--accent); }
.rail .tab.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 3px;
  height: 16px;
  margin-top: -8px;
  border-radius: var(--r-pill);
  background: var(--accent);
}

.rail-foot {
  padding: 12px 13px 6px;
  font-family: var(--num);
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
}

main {
  display: block;
  min-width: 0;
}

.panel { display: none; }
.panel.active {
  display: block;
  animation: panel-in 0.4s cubic-bezier(0.22, 0.8, 0.28, 1) both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.panel.active > .block { animation: block-in 0.5s cubic-bezier(0.22, 0.8, 0.28, 1) both; }
.panel.active > .block:nth-child(2) { animation-delay: 0.06s; }
.panel.active > .block:nth-child(3) { animation-delay: 0.12s; }
.panel.active > .block:nth-child(4) { animation-delay: 0.18s; }
@keyframes block-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   panels & blocks — glass cards
   ========================================================================== */

/* tabs other than the simulator are a single glass card */
.panel {
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-shadow);
}

/* the simulator stacks several cards instead */
#panel-sim {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.block {
  position: relative;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-shadow-sm);
}
.block + .block { margin-top: var(--gap); }

.block-lede { max-width: 64ch; }
.block-lede p { font-size: 12.5px; line-height: 1.75; color: var(--ink-3); text-wrap: pretty; }

/* ==========================================================================
   section head
   ========================================================================== */

.sechead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.sechead-idx {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  font-family: var(--num);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
  background: var(--accent-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.sechead-title {
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  text-wrap: balance;
}
.sechead-tail {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.controls > .field { flex: 0 1 auto; }
.controls > .field.song-field { flex: 1 1 240px; min-width: 190px; max-width: 340px; }
.controls > .button { margin-left: auto; }

.summary {
  max-width: 64ch;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-3);
  text-wrap: pretty;
}
.summary + .summary { margin-top: 6px; }

.subtext {
  max-width: 70ch;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink-3);
  text-wrap: pretty;
}

/* ==========================================================================
   buttons — pills
   ========================================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(15, 26, 44, 0.06),
    0 6px 16px -10px rgba(28, 52, 104, 0.5);
  transition: transform 0.2s cubic-bezier(0.3, 1.3, 0.5, 1), box-shadow 0.2s ease,
    background 0.2s ease, color 0.2s ease;
}
.button:hover:not(:disabled) {
  background: #fff;
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 12px 24px -12px rgba(28, 52, 104, 0.6);
}
.button:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: inset 0 2px 6px rgba(15, 26, 44, 0.14);
}
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(160deg, #16a2c2 0%, #0a7d9c 55%, #08607a 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 8px rgba(0, 40, 60, 0.35),
    0 12px 26px -12px rgba(8, 96, 122, 0.9);
  text-shadow: 0 1px 2px rgba(0, 40, 60, 0.35);
}
.button.primary:hover:not(:disabled) {
  background: linear-gradient(160deg, #1ab0d1 0%, #0a86a7 55%, #08687f 100%);
  color: #fff;
}
.button.primary:disabled {
  background: linear-gradient(160deg, #a9d7e2, #8cc3d2);
  box-shadow: none;
  text-shadow: none;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink-3);
  border-color: rgba(255, 255, 255, 0.55);
}
.button.ghost:hover:not(:disabled) { color: var(--ink); }

.button.danger {
  color: var(--ng);
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(178, 58, 85, 0.28);
}
.button.danger:hover:not(:disabled) {
  background: rgba(178, 58, 85, 0.1);
  color: var(--ng);
}

.button.is-busy { color: transparent; text-shadow: none; }
.button.is-busy::after {
  content: "";
  position: absolute;
  inset: 42% 32%;
  border-radius: var(--r-pill);
  background: currentColor;
  opacity: 0.4;
  animation: pulse 1s ease-in-out infinite;
}
.button.is-busy { position: relative; }
@keyframes pulse {
  0%, 100% { opacity: 0.2; transform: scaleX(0.8); }
  50% { opacity: 0.6; transform: scaleX(1); }
}

.help-button {
  flex: none;
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-4);
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.help-button:hover {
  color: var(--accent-deep);
  background: #fff;
  transform: scale(1.08);
}
.help-button:active { transform: scale(0.94); }

/* ==========================================================================
   fields
   ========================================================================== */

.field { display: grid; gap: 4px; min-width: 0; }
.field > span {
  padding-left: 4px;
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

select,
input[type="search"],
input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 3px rgba(15, 26, 44, 0.05);
  transition: box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
select:hover,
input:hover { background: rgba(255, 255, 255, 0.82); }
select:focus,
input:focus {
  background: #fff;
  border-color: rgba(10, 125, 156, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 4px var(--accent-ring);
}
select {
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input::placeholder { color: var(--ink-4); font-weight: 700; }

/* segmented control — pill track */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 3px rgba(15, 26, 44, 0.07);
}
.seg button {
  min-height: 30px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease,
    transform 0.22s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.seg button:hover { color: var(--ink); }
.seg button:active { transform: scale(0.96); }
.seg button.active {
  color: var(--accent-deep);
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 5px 14px -8px rgba(28, 52, 104, 0.6);
}

.mode-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

/* switch — rounded */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: var(--r-pill);
  background: rgba(15, 26, 44, 0.16);
  box-shadow: inset 0 1px 3px rgba(15, 26, 44, 0.2);
  transition: background 0.24s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 26, 44, 0.3);
  transition: transform 0.28s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch input:checked + .switch-track { background: linear-gradient(160deg, #17a5c4, #0a7d9c); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--accent-ring); }

/* ==========================================================================
   workbench (simulator layout)
   ========================================================================== */

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: var(--gap);
  align-items: start;
}

.editor {
  min-width: 0;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-shadow);
}

/* the readout is the brightest pane on the page: a lens */
.readout-col {
  min-width: 0;
  border-radius: var(--r-xl);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.82) 0%,
    rgba(255, 255, 255, 0.62) 45%,
    rgba(232, 246, 252, 0.72) 100%
  );
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -1px 0 rgba(255, 255, 255, 0.7),
    0 26px 54px -26px rgba(28, 52, 104, 0.5);
  overflow: hidden;
}
.readout-sticky {
  position: sticky;
  top: calc(var(--masthead-h) + 26px);
  padding: 22px;
}

.readout-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.readout-head h2 { font-size: 10px; font-weight: 700; }

.readout-main {
  padding: 14px 16px 16px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.readout-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.readout-value {
  display: block;
  margin-top: 2px;
  font-family: var(--num);
  font-size: clamp(34px, 4.6vw, 48px);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-deep);
}
/* gradient numerals only where background-clip:text is supported,
   otherwise the solid colour above stays visible */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .readout-value {
    background: linear-gradient(165deg, #0d8fae 0%, #0a6a86 60%, #085066 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.9));
  }
}
.readout-sub {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-3);
  text-wrap: pretty;
}

.metric-list { display: grid; gap: 2px; margin-top: 12px; }
.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  transition: background 0.2s ease;
}
.metric:hover { background: rgba(255, 255, 255, 0.4); }
.metric-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
}
.metric-value {
  font-family: var(--num);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: right;
}

.condition-list { display: grid; gap: 0; margin-top: 12px; }
.condition-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-3);
}
.condition-line:nth-child(odd) { background: rgba(255, 255, 255, 0.34); }
.condition-line > span { min-width: 0; text-wrap: pretty; }
.condition-line strong {
  flex: none;
  max-width: 56%;
  font-family: var(--num);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink-2);
}
.condition-line strong.ok { color: var(--ok); }
.condition-line strong.ng { color: var(--ng); }

/* long values (special-skill timings) get their own row */
.condition-line.stack {
  display: grid;
  gap: 2px;
  justify-items: start;
  margin-top: 2px;
}
.condition-line.stack > span { font-size: 10px; color: var(--ink-4); }
.condition-line.stack > strong {
  max-width: 100%;
  font-size: 11px;
  text-align: left;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

/* ==========================================================================
   unit editor
   ========================================================================== */

.unit-selectors { display: grid; gap: 6px; }

.picker-field { display: grid; gap: 4px; min-width: 0; }
.picker-field > span {
  padding-left: 4px;
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-native-select { display: none; }

.picker-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.78);
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 5px 14px -10px rgba(28, 52, 104, 0.5);
  transition: transform 0.22s cubic-bezier(0.3, 1.3, 0.5, 1), background 0.22s ease,
    box-shadow 0.22s ease;
}
.picker-button:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 12px 22px -12px rgba(28, 52, 104, 0.55);
}
.picker-button:active { transform: scale(0.99); }
.picker-button-thumb {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 2px 6px -2px rgba(28, 52, 104, 0.5);
}
.picker-text { display: grid; min-width: 0; flex: 1; gap: 0; }
.picker-text strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-text small {
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-arrow {
  flex: none;
  font-size: 9px;
  color: var(--ink-4);
  transition: transform 0.22s ease, color 0.22s ease;
}
.picker-button:hover .picker-arrow { color: var(--accent); transform: translateY(1px); }

.leader-block { margin-bottom: 8px; }
.leader-block .picker-field > span { color: var(--accent); }
.leader-block .picker-button {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(226, 246, 252, 0.75));
  border-color: rgba(10, 125, 156, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 10px 24px -14px rgba(8, 96, 122, 0.6);
}

.member-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 10px;
  align-items: end;
}
.member-block + .member-block { margin-top: 8px; }

.bloom-select {
  min-height: 40px;
  padding: 6px 26px 6px 14px;
  font-size: 11.5px;
  border-radius: var(--r-pill);
}

.unit-visuals {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.unit-visual {
  position: relative;
  flex: none;
  width: 66px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--glass-shadow-sm);
  overflow: hidden;
  transition: transform 0.24s cubic-bezier(0.3, 1.3, 0.5, 1), box-shadow 0.24s ease;
}
.unit-visual:hover { transform: translateY(-3px) scale(1.02); }
.unit-visual-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.unit-visual figcaption {
  padding: 4px 5px 5px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-2);
  text-align: center;
}
.unit-visual .stage {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: var(--num);
  font-size: 8px;
  font-weight: 700;
  color: var(--ink-2);
  box-shadow: 0 2px 6px -3px rgba(15, 26, 44, 0.5);
}
.unit-visual.leader {
  border-color: rgba(10, 125, 156, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 2px rgba(10, 125, 156, 0.16),
    var(--glass-shadow-sm);
}

.warning {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 236, 240, 0.8);
  border: 1px solid rgba(178, 58, 85, 0.24);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.65;
  color: #8c2b45;
}

/* ==========================================================================
   chips
   ========================================================================== */

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 6px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}
.type-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
}
.type-pill.cute::before { background: var(--s-cute); }
.type-pill.happy::before { background: var(--s-happy); }
.type-pill.pure::before { background: var(--s-pure); }

.bloom-badge {
  display: inline-block;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.75);
  font-family: var(--num);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.badge.brand-badge { color: var(--accent-deep); background: var(--accent-soft); }

/* ==========================================================================
   presets
   ========================================================================== */

.preset-list { display: grid; gap: 8px; }
.preset {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}
.preset:hover {
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 #fff, 0 10px 22px -16px rgba(28, 52, 104, 0.6);
}
.preset.best {
  background: linear-gradient(160deg, rgba(226, 250, 255, 0.9), rgba(255, 255, 255, 0.75));
  border-color: rgba(10, 125, 156, 0.32);
  box-shadow: inset 0 1px 0 #fff, 0 12px 28px -18px rgba(8, 96, 122, 0.7);
}

.preset-slot {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--num);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  white-space: nowrap;
}
.preset.best .preset-slot { color: var(--accent-deep); background: #fff; }

.preset-body { min-width: 0; display: grid; gap: 2px; }
.preset-names { font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }
.preset-names .lead { color: var(--ink); font-weight: 700; }
.preset-meta { font-size: 10.5px; font-weight: 400; color: var(--ink-4); font-variant-numeric: tabular-nums; }

.preset-score {
  font-family: var(--num);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}
.preset.best .preset-score { color: var(--accent-deep); }
.preset-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.preset-actions .button { min-height: 30px; padding: 5px 12px; font-size: 11px; }

.preset-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.32);
  border: 1px dashed rgba(255, 255, 255, 0.85);
  font-size: 11.5px;
  color: var(--ink-4);
}

/* ==========================================================================
   board + timeline
   ========================================================================== */

.board-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 16px;
}
.board-summary > .metric {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.board-summary > .metric:hover { background: rgba(255, 255, 255, 0.62); }
.board-summary .metric-label { font-size: 10.5px; justify-content: flex-start; }
.board-summary .metric-value { font-size: 20px; text-align: left; }
.board-summary > .metric.emphasis {
  background: linear-gradient(160deg, rgba(226, 250, 255, 0.95), rgba(255, 255, 255, 0.7));
  box-shadow: inset 0 1px 0 #fff, 0 10px 24px -18px rgba(8, 96, 122, 0.8);
}
.board-summary > .metric.emphasis .metric-value { color: var(--accent-deep); }

.alloc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.alloc {
  padding: 11px 14px 12px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}
.alloc strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alloc-bonus {
  margin: 2px 0 1px;
  font-family: var(--num);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-deep);
}
.alloc-meta {
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 400;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.timeline-wrap { margin-top: 18px; }

.timeline-axis {
  display: flex;
  justify-content: space-between;
  padding: 0 0 6px 116px;
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.timeline-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 2px 0;
}
.timeline-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.timeline-label small { font-family: var(--num); font-size: 9px; color: var(--ink-4); }

.timeline-track {
  position: relative;
  height: 18px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 3px rgba(15, 26, 44, 0.1);
  overflow: hidden;
}
.timeline-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: filter 0.2s ease, transform 0.2s ease;
}
.timeline-block:hover { filter: brightness(1.12) saturate(1.15); }
.timeline-block.cute { background: linear-gradient(180deg, #fa90ad, var(--s-cute)); }
.timeline-block.happy { background: linear-gradient(180deg, #f0bc55, var(--s-happy)); }
.timeline-block.pure { background: linear-gradient(180deg, #5cc99a, var(--s-pure)); }

.timeline-row.special { margin-bottom: 6px; }
.timeline-row.special .timeline-track {
  height: 12px;
  background: rgba(10, 125, 156, 0.1);
}
.timeline-row.special .timeline-label { color: var(--accent-deep); font-weight: 700; }
.timeline-row.special .timeline-block { top: 2px; bottom: 2px; }

.model-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-3);
  text-wrap: pretty;
}
.model-note strong { color: var(--ink-2); font-weight: 700; }

/* ==========================================================================
   tables
   ========================================================================== */

.table-wrap {
  border-radius: var(--r-lg);
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.table-wrap table { width: 100%; font-size: 11.5px; }
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--glass-line-soft);
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  text-align: left;
  white-space: nowrap;
}
.table-wrap td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--glass-line-soft);
  vertical-align: middle;
  color: var(--ink-2);
}
.table-wrap th.num,
.table-wrap td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr { transition: background 0.16s ease; }
.table-wrap tbody tr:hover { background: rgba(255, 255, 255, 0.6); }
.table-wrap tr.clickable { cursor: pointer; }
.table-wrap tr.clickable:hover { background: rgba(10, 125, 156, 0.08); }
.table-wrap tr.clickable:active { background: rgba(10, 125, 156, 0.14); }

.cell-card { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.cell-thumb {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.cell-card strong { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink); }
.cell-meta { font-size: 9.5px; font-weight: 400; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.skill-cell { max-width: 240px; font-size: 10.5px; line-height: 1.55; color: var(--ink-3); }

.rank-number {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--num);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
tr.clickable:hover .rank-number { background: #fff; color: var(--accent-deep); }
.rank-leader { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.rank-leader strong { font-size: 11.5px; font-weight: 700; color: var(--ink); }
.rank-members { display: flex; gap: 12px; flex-wrap: wrap; }
.rank-member { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--ink-3); }
.rank-member > span { display: grid; gap: 0; }
.rank-member img {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.sp-note {
  display: block;
  font-family: var(--num);
  font-size: 8.5px;
  font-weight: 400;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.rank-score {
  font-family: var(--num);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ==========================================================================
   filters / owned grid
   ========================================================================== */

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 10px;
  margin-bottom: 16px;
}

.owned-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
  max-height: 660px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}
.owned-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.owned-item:hover { background: rgba(255, 255, 255, 0.66); transform: translateY(-1px); }
.owned-item.owned {
  background: linear-gradient(160deg, rgba(228, 250, 255, 0.92), rgba(255, 255, 255, 0.7));
  border-color: rgba(10, 125, 156, 0.3);
  box-shadow:
    inset 0 1px 0 #fff,
    0 10px 24px -18px rgba(8, 96, 122, 0.8);
}
.owned-top { display: flex; gap: 8px; align-items: flex-start; }
.owned-thumb {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  object-fit: cover;
  object-position: top center;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.owned-info { min-width: 0; flex: 1; display: grid; gap: 1px; }
.owned-info strong { font-size: 11px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.owned-meta { font-size: 9.5px; font-weight: 400; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.owned-controls { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.owned-controls .switch { min-width: 0; }
.owned-controls select {
  width: auto;
  min-height: 28px;
  padding: 3px 22px 3px 10px;
  font-size: 10.5px;
  border-radius: var(--r-pill);
}
.owned-state { font-size: 9.5px; font-weight: 400; white-space: nowrap; }

/* ==========================================================================
   status / loading / empty
   ========================================================================== */

.search-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  margin: 12px 0 14px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.66);
  font-family: var(--num);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.6;
  color: var(--ink-3);
}
.search-status:empty { display: none; }
.search-status.busy { color: var(--ink-2); }
.search-status.busy::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-ring);
  animation: ripple 1.3s ease-out infinite;
}
@keyframes ripple {
  0% { box-shadow: 0 0 0 0 rgba(10, 125, 156, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(10, 125, 156, 0); }
  100% { box-shadow: 0 0 0 0 rgba(10, 125, 156, 0); }
}

.skeleton { display: grid; gap: 8px; padding: 12px; }
.skeleton-row {
  display: grid;
  grid-template-columns: 34px 150px minmax(0, 1fr) 90px;
  gap: 14px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.4);
}
.skeleton-bar {
  height: 10px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0%, #fff 45%, rgba(255, 255, 255, 0.35) 90%);
  background-size: 220% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-row > :nth-child(1) .skeleton-bar { width: 18px; }
.skeleton-row > :nth-child(4) .skeleton-bar { width: 62px; margin-left: auto; }
@keyframes shimmer {
  from { background-position: 140% 0; }
  to { background-position: -60% 0; }
}

.empty-state {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 34px 22px;
  margin: 6px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.34);
  border: 1px dashed rgba(255, 255, 255, 0.9);
  text-align: center;
}
.empty-state strong { font-size: 14px; font-weight: 700; color: var(--ink); }
.empty-state p { max-width: 46ch; font-size: 11.5px; line-height: 1.75; color: var(--ink-3); }

/* ==========================================================================
   modal — floating glass sheets
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  justify-content: flex-end;
  padding: 12px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 34, 60, 0.28);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
  animation: fade-in 0.24s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(540px, 100%);
  height: calc(100dvh - 24px);
  padding: 22px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
  backdrop-filter: blur(34px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 #fff,
    0 30px 70px -30px rgba(20, 40, 90, 0.6);
  animation: sheet-in 0.34s cubic-bezier(0.22, 0.9, 0.26, 1) both;
}
@keyframes sheet-in {
  from { transform: translateX(26px) scale(0.99); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-dialog {
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-dialog .modal-card {
  width: min(600px, 100%);
  height: auto;
  max-height: min(84dvh, 820px);
  animation: dialog-in 0.3s cubic-bezier(0.22, 0.9, 0.26, 1) both;
}
@keyframes dialog-in {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-card h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.modal-sub {
  margin: 4px 0 14px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-4);
  text-wrap: pretty;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.modal-close:hover { background: #fff; color: var(--ink); transform: rotate(90deg); }
.modal-close:active { transform: scale(0.92); }

.modal-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px;
  gap: 8px;
  margin-bottom: 12px;
}

.picker-list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  margin: 0 -6px 0 0;
  padding-right: 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background 0.18s ease, transform 0.18s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.picker-item:hover { background: rgba(255, 255, 255, 0.75); transform: translateX(2px); }
.picker-item:active { transform: scale(0.99); }
.picker-item.active {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(10, 125, 156, 0.28), 0 8px 20px -14px rgba(8, 96, 122, 0.8);
}
.picker-item img {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.picker-item-body { flex: 1; min-width: 0; display: grid; gap: 0; }
.picker-item-body strong { font-size: 12px; font-weight: 700; color: var(--ink); }
.picker-item-state {
  flex: none;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-4);
}
.picker-item.active .picker-item-state { color: var(--accent-deep); background: var(--accent-soft); }
.picker-empty {
  padding: 34px 20px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-4);
}

.help-body {
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-2);
  text-wrap: pretty;
  scrollbar-width: thin;
}
.help-body h3 {
  margin: 16px 0 5px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.help-body h3:first-child { margin-top: 0; }
.help-body p { margin: 0 0 9px; max-width: 62ch; }
.help-body ul, .help-body ol { margin: 0 0 10px; display: grid; gap: 3px; }
.help-body li { position: relative; padding-left: 16px; }
.help-body li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}
.help-body ol { counter-reset: step; }
.help-body ol li::before {
  content: none;
}
.help-body ol li { padding-left: 22px; counter-increment: step; }
.help-body ol li::after {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
}
.help-body code {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(15, 26, 44, 0.06);
  font-family: var(--num);
  font-size: 11px;
  color: var(--accent-deep);
}

/* ==========================================================================
   footer
   ========================================================================== */

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto var(--gap);
  padding: 0 var(--gap);
}
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-radius: var(--r-lg);
  background: var(--glass-thin);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.footer-brand span {
  font-family: var(--num);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.footer-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.footer-links a {
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.footer-links a:hover { background: rgba(255, 255, 255, 0.7); color: var(--accent-deep); }
.footer-note {
  flex: 1 1 300px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink-4);
  text-align: right;
  text-wrap: pretty;
}

/* ==========================================================================
   boot status
   ========================================================================== */

#bootStatus {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: var(--z-boot);
  width: auto;
  max-width: min(420px, calc(100vw - 32px));
  margin: 0;
  border-radius: var(--r-pill);
  background: rgba(16, 26, 44, 0.82);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #eaf2ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px -20px rgba(10, 20, 40, 0.9);
}
#bootStatus.busy::before { background: #7fe3ff; box-shadow: 0 0 0 0 rgba(127, 227, 255, 0.5); }

/* ==========================================================================
   responsive
   ========================================================================== */

@media (max-width: 1240px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .readout-sticky { position: static; }
  .masthead-note { display: none; }
}

@media (max-width: 980px) {
  :root { --rail: 100%; --masthead-h: 62px; }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding-top: 12px;
  }

  .rail {
    position: sticky;
    top: calc(var(--masthead-h) + 16px);
    z-index: var(--z-rail);
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 8px;
    scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail .tab { flex: none; padding: 8px 12px; }
  .rail .tab.active::before { display: none; }
  .rail-foot { display: none; }

  .panel, .block, .editor { padding: 18px; border-radius: var(--r-lg); }
  .readout-col { border-radius: var(--r-lg); }
  .readout-sticky { padding: 16px; }

  .board-summary { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .owned-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); max-height: 540px; }
  .unit-visual { width: 58px; }
  .member-block { grid-template-columns: minmax(0, 1fr) 92px; }
  .timeline-axis { padding-left: 80px; }
  .timeline-row { grid-template-columns: 72px minmax(0, 1fr); }
  .preset { grid-template-columns: auto minmax(0, 1fr); }
  .preset > div:last-child { grid-column: 2; }
  .preset-score { text-align: left; }
  .preset-actions { justify-content: flex-start; }
  .modal-toolbar { grid-template-columns: minmax(0, 1fr); }
  .footer-note { text-align: left; }
  .site-footer-inner { padding: 12px 16px; }
}

@media (max-width: 720px) {
  .masthead { padding: 8px 12px; gap: 10px; }
  .masthead-meta { display: none; }
  .brand-name { font-size: 17px; }
  .mark { width: 34px; height: 34px; font-size: 16px; border-radius: var(--r-sm); }
  .lang-switch { margin-left: auto; }
  .lang-btn { min-width: 34px; min-height: 30px; padding: 6px 9px; font-size: 10px; }
  .controls > .button { margin-left: 0; width: 100%; }
  .controls > .field.song-field { max-width: none; }
}

@media (max-width: 560px) {
  html { font-size: 14.5px; }
  .brand-latin { display: none; }
  .readout-value { font-size: 38px; }
  .panel, .block, .editor { padding: 15px; }
  .sechead { flex-wrap: wrap; }
  .sechead-tail { width: 100%; justify-content: flex-start; margin-left: 0; }
  .alloc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { padding: 8px; }
  .modal-card { padding: 16px; height: calc(100dvh - 16px); border-radius: var(--r-lg); }
  .skeleton-row { grid-template-columns: 26px 90px minmax(0, 1fr); }
  .skeleton-row > :nth-child(4) { display: none; }

  .table-wrap th, .table-wrap td { padding: 7px 8px; }
  .table-wrap thead th { font-size: 8.5px; letter-spacing: 0.04em; }
  .rank-number { min-width: 20px; height: 20px; font-size: 10px; }
  .rank-leader { min-width: 0; gap: 5px; }
  .rank-leader strong { font-size: 10px; line-height: 1.3; }
  .rank-leader img { display: none; }
  .rank-members { gap: 6px; }
  .rank-member { font-size: 9.5px; }
  .rank-member img { width: 15px; height: 15px; }
  .rank-member .bloom-badge { font-size: 8px; padding: 0 5px; }
  .sp-note { font-size: 8px; }
  .rank-score { font-size: 11px; }
  .skill-cell { max-width: 158px; font-size: 9.5px; }
  .cell-card { min-width: 92px; }
  .cell-thumb { width: 20px; height: 20px; }
  .owned-state { font-size: 9px; }
  .owned-controls { gap: 4px; }
  .owned-controls select { padding: 3px 18px 3px 8px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  body::after { display: none; }
}
