/* =====================================================================
   夜屿 · 秋の装い  —  presentation layer (2026-10-09)
   Every rule is scoped to :root[data-polish="on"]. Remove that attribute
   (Settings toggle, ?polish=off) and the previous design returns untouched.
   Concept: the app as a novel game you open every night —
     今晚 = title screen · 陪伴 = ADV text window · 记录 = backlog
     构成 = route chart · 角色与声音 = config.
   ===================================================================== */

/* ---------- Bundled display faces (subset to fixed UI strings; see tools note) ---------- */
/* Loaded from yashima-fonts.css: "Yashima Mincho" (headings) and "Yashima Kana" (Japanese labels). */

/* ---------- Tokens ---------- */
:root[data-polish="on"] {
  --yx-display: "Yashima Mincho", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", serif;
  --yx-kana: "Yashima Kana", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", "Noto Serif JP", serif;
  --yx-ja: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", "Noto Serif JP", "Yashima Kana", serif;
  --yx-ease: cubic-bezier(.22, .8, .24, 1);
  --yx-radius: 6px;

  /* 月夜・静水 — 夜藍 / 紺青 / 月白 / 薄藤 / 水浅葱 / 月光 */
  --yx-ink: #ece7dc;
  --yx-ink-soft: #c3c9d8;
  --yx-ink-faint: #949fb6;
  --yx-sheet: linear-gradient(160deg, rgba(31, 42, 72, .74), rgba(20, 28, 52, .80));
  --yx-sheet-solid: #19223d;
  --yx-sheet-hover: rgba(214, 224, 250, .06);
  --yx-rule: rgba(214, 224, 250, .13);
  --yx-rule-strong: rgba(214, 224, 250, .24);
  --yx-accent: #b9a8dc;
  --yx-accent-ink: #1b2140;
  --yx-accent-2: #86c2c7;
  --yx-glow: #f2dfae;
  --yx-danger: #e6a3b4;
  --yx-window: linear-gradient(180deg, rgba(17, 25, 48, .74), rgba(12, 18, 37, .86));
  --yx-plate: linear-gradient(100deg, #cdbde8, #a9cbd2);
  --yx-shadow: 0 28px 60px -34px rgba(3, 7, 20, .85);
  --yx-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}
:root[data-polish="on"][data-theme="soft-anime"] {
  /* 黄昏・樱语 — 胡粉 / 薄紅 / 藤 / 茜 / 墨紫 */
  --yx-ink: #45364d;
  --yx-ink-soft: #66566d;
  --yx-ink-faint: #7f6f86;
  --yx-sheet: linear-gradient(160deg, rgba(255, 252, 250, .86), rgba(255, 246, 244, .80));
  --yx-sheet-solid: #fff8f5;
  --yx-sheet-hover: rgba(217, 114, 143, .06);
  --yx-rule: rgba(150, 96, 126, .17);
  --yx-rule-strong: rgba(150, 96, 126, .30);
  --yx-accent: #d06f8c;
  --yx-accent-ink: #fffaf8;
  --yx-accent-2: #8f7cc0;
  --yx-glow: #f2a07f;
  --yx-danger: #c45775;
  --yx-window: linear-gradient(180deg, rgba(255, 252, 250, .80), rgba(255, 246, 246, .90));
  --yx-plate: linear-gradient(100deg, #e48aa3, #b79ad8);
  --yx-shadow: 0 26px 56px -32px rgba(120, 70, 95, .42);
  --yx-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .35 0 0 0 0 .45 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}

/* ---------- Base ---------- */
:root[data-polish="on"] ::selection { background: color-mix(in srgb, var(--yx-accent) 38%, transparent); color: inherit; }
:root[data-polish="on"] :is(button, a, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--yx-glow); outline-offset: 3px;
}
:root[data-polish="on"] * { scrollbar-width: thin; scrollbar-color: var(--yx-rule-strong) transparent; }
:root[data-polish="on"] .muted, :root[data-polish="on"] .hint { color: var(--yx-ink-soft); }
:root[data-polish="on"] .fineprint, :root[data-polish="on"] small { color: var(--yx-ink-faint); }

/* The fixed sky (stars, petals). Lives under every page; only drawn on 今晚 / 陪伴. */
:root[data-polish="on"] .yx-sky { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
:root[data-polish="on"] .yx-sky.is-on { opacity: 1; }
:root[data-polish="on"] .call-room > .yx-sky { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; z-index: 0; }
:root[data-polish="on"] :is(.night-sparks, .anime-petals, .anime-sparkles) { display: none; }

/* ---------- Page headings: Japanese label set vertically, beside the title ---------- */
:root[data-polish="on"] .page-heading > div:first-child {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; align-items: start;
}
:root[data-polish="on"] .page-heading > div:first-child > .eyebrow {
  grid-row: 1 / span 3; grid-column: 1; margin: 6px 0 0;
  writing-mode: vertical-rl; text-orientation: mixed;
  font-family: var(--yx-kana); font-size: 13px; letter-spacing: .32em; line-height: 1;
  color: var(--yx-accent); display: flex; align-items: center; gap: 10px;
}
:root[data-polish="on"] .page-heading > div:first-child > .eyebrow::before {
  content: ''; flex: 0 0 auto; width: 1px; height: 18px; background: currentColor; opacity: .6;
}
:root[data-polish="on"] .page-heading > div:first-child > :not(.eyebrow) { grid-column: 2; }
:root[data-polish="on"] .page-heading h1 {
  font-family: var(--yx-display); font-weight: 600; letter-spacing: .14em; color: var(--yx-ink);
  font-size: clamp(26px, 2.3vw, 36px); line-height: 1.35; margin-bottom: 8px; text-wrap: balance;
}
:root[data-polish="on"] .page-heading .muted { font-size: 13.5px; letter-spacing: .04em; margin: 0; }
:root[data-polish="on"] :is(.chapter-number, .soft-card > .eyebrow, .persona-editor > .eyebrow, .art-caption .tiny, .small-note, .topbar .tiny) { display: none !important; }
:root[data-polish="on"] .heading-tag { font-family: var(--yx-kana); font-size: 12px; letter-spacing: .2em; color: var(--yx-accent); border: 1px solid var(--yx-rule-strong); border-radius: 3px; padding: 3px 9px; vertical-align: middle; margin-left: 10px; }

/* ---------- Sheets: washi panels with 「 」 corner marks ---------- */
:root[data-polish="on"] :is(.soft-card, .reading-paper, .call-list-panel, .raw-panel, .connection-sidebar, .connection-editor, .persona-editor) {
  position: relative;
  background: var(--yx-paper), var(--yx-sheet);
  border: 1px solid var(--yx-rule);
  border-radius: var(--yx-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), var(--yx-shadow);
  backdrop-filter: blur(10px) saturate(120%);
}
:root[data-polish="on"] :is(.soft-card, .reading-paper, .persona-editor, .connection-editor)::before,
:root[data-polish="on"] :is(.soft-card, .reading-paper, .persona-editor, .connection-editor)::after {
  content: ''; position: absolute; width: 13px; height: 13px; pointer-events: none;
  border-color: var(--yx-accent); border-style: solid; opacity: .7;
}
:root[data-polish="on"] :is(.soft-card, .reading-paper, .persona-editor, .connection-editor)::before { top: 7px; left: 7px; border-width: 1.5px 0 0 1.5px; }
:root[data-polish="on"] :is(.soft-card, .reading-paper, .persona-editor, .connection-editor)::after { right: 7px; bottom: 7px; border-width: 0 1.5px 1.5px 0; }
:root[data-polish="on"] .soft-card h2, :root[data-polish="on"] .connection-editor h2, :root[data-polish="on"] .connection-sidebar h2 {
  font-family: var(--yx-display); font-weight: 600; letter-spacing: .12em; font-size: 17px; color: var(--yx-ink);
}
:root[data-polish="on"] details.soft-card > summary { cursor: pointer; letter-spacing: .06em; color: var(--yx-ink-soft); }
:root[data-polish="on"] .notice {
  background: transparent; border: 0; border-left: 2px solid var(--yx-accent); border-radius: 0;
  color: var(--yx-ink-soft); padding: 4px 0 4px 16px; font-size: 12.5px; line-height: 1.9;
}
:root[data-polish="on"] .pill { border-radius: 3px; border-color: var(--yx-rule-strong); background: transparent; color: var(--yx-ink-soft); letter-spacing: .1em; }

/* ---------- Controls ---------- */
:root[data-polish="on"] :is(button, .button) {
  border-radius: 4px; border-color: var(--yx-rule-strong); background: transparent; color: var(--yx-ink);
  letter-spacing: .06em; transition: background .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}
:root[data-polish="on"] :is(button, .button):hover:not(:disabled) { background: var(--yx-sheet-hover); border-color: var(--yx-accent); }
:root[data-polish="on"] .primary {
  position: relative; overflow: hidden; border: 0; color: var(--yx-accent-ink); background: var(--yx-plate);
  box-shadow: 0 10px 28px -14px color-mix(in srgb, var(--yx-accent) 70%, transparent);
}
:root[data-polish="on"] .primary:hover:not(:disabled) { background: var(--yx-plate); color: var(--yx-accent-ink); filter: brightness(1.06); }
:root[data-polish="on"] .primary::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .42) 50%, transparent 65%);
  transform: translateX(-120%);
}
:root[data-polish="on"] body[data-motion=gentle] .primary:hover:not(:disabled)::after { transition: transform .9s var(--yx-ease); transform: translateX(120%); }
:root[data-polish="on"] .danger, :root[data-polish="on"] .end-call { color: var(--yx-danger); }
:root[data-polish="on"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), textarea, select) {
  background: color-mix(in srgb, var(--yx-sheet-solid) 62%, transparent); border: 1px solid var(--yx-rule-strong);
  border-radius: 4px; color: var(--yx-ink); transition: border-color .25s ease, box-shadow .25s ease;
}
:root[data-polish="on"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), textarea, select):focus {
  border-color: var(--yx-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yx-accent) 22%, transparent);
}
:root[data-polish="on"] :is(input, textarea)::placeholder { color: var(--yx-ink-faint); }
:root[data-polish="on"] input[type=file] { font-size: 12px; color: var(--yx-ink-faint); }
:root[data-polish="on"] input[type=file]::file-selector-button {
  font: inherit; color: var(--yx-ink); background: transparent; border: 1px solid var(--yx-rule-strong);
  border-radius: 4px; padding: 6px 14px; margin-right: 12px; cursor: pointer;
}
/* Range: a hairline with a small moon (or sakura bud) */
:root[data-polish="on"] input[type=range] { -webkit-appearance: none; appearance: none; background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0; height: 26px; }
:root[data-polish="on"] input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--yx-accent), var(--yx-rule-strong)); border-radius: 2px; }
:root[data-polish="on"] input[type=range]::-moz-range-track { height: 2px; background: var(--yx-rule-strong); border-radius: 2px; }
:root[data-polish="on"] input[type=range]::-moz-range-progress { height: 2px; background: var(--yx-accent); }
:root[data-polish="on"] input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -6.5px; border-radius: 50%;
  background: var(--yx-glow); border: 2px solid var(--yx-sheet-solid);
  box-shadow: 0 0 0 1px var(--yx-accent), 0 0 12px color-mix(in srgb, var(--yx-glow) 60%, transparent);
}
:root[data-polish="on"] input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--yx-glow); border: 2px solid var(--yx-sheet-solid); box-shadow: 0 0 0 1px var(--yx-accent); }
/* Switches in Settings become small toggles */
:root[data-polish="on"] .switch-label > input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: 0 0 auto; width: 38px; height: 22px; margin: 2px 0 0;
  border-radius: 999px; background: var(--yx-rule-strong); position: relative; cursor: pointer; transition: background .25s ease;
}
:root[data-polish="on"] .switch-label > input[type=checkbox]::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--yx-ink); transition: transform .3s var(--yx-ease), background .25s ease;
}
:root[data-polish="on"] .switch-label > input[type=checkbox]:checked { background: var(--yx-accent); }
:root[data-polish="on"] .switch-label > input[type=checkbox]:checked::before { transform: translateX(16px); background: var(--yx-accent-ink); }
:root[data-polish="on"] .switch-label > input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }
:root[data-polish="on"] input[type=checkbox]:not(.switch-label > input) { accent-color: var(--yx-accent); }

/* ---------- Sidebar: a title logo, then two groups ---------- */
:root[data-polish="on"] .sidebar { background: linear-gradient(175deg, rgba(20, 28, 52, .9), rgba(14, 20, 40, .93)); border-right: 1px solid var(--yx-rule); }
:root[data-polish="on"][data-theme="soft-anime"] .sidebar { background: linear-gradient(175deg, rgba(255, 251, 249, .9), rgba(253, 243, 243, .92)); }
:root[data-polish="on"] .brand { align-items: center; gap: 12px; letter-spacing: 0; }
:root[data-polish="on"] .brand-mark { font-size: 34px; color: var(--yx-glow); text-shadow: 0 0 22px color-mix(in srgb, var(--yx-glow) 55%, transparent); }
:root[data-polish="on"] .brand > span:last-child { font-family: var(--yx-display); font-weight: 600; font-size: 25px; letter-spacing: .32em; color: var(--yx-ink); }
:root[data-polish="on"] .brand small { font-family: var(--yx-kana); font-size: 10.5px; letter-spacing: .42em; color: var(--yx-accent); margin-top: 6px; }
:root[data-polish="on"] .nav-caption { font-family: var(--yx-kana); font-size: 11px; letter-spacing: .4em; color: var(--yx-ink-faint); padding-left: 14px; }
:root[data-polish="on"] .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
:root[data-polish="on"] .sidebar nav a { order: 5; border: 0; border-radius: 4px; color: var(--yx-ink-soft); letter-spacing: .1em; padding: 11px 14px; }
:root[data-polish="on"] .sidebar nav a > span { color: var(--yx-ink-faint); transition: color .25s ease; }
:root[data-polish="on"] .sidebar nav a[data-page=tonight] { order: 1; }
:root[data-polish="on"] .sidebar nav a[data-page=call] { order: 2; }
:root[data-polish="on"] .sidebar nav a[data-page=history] { order: 3; }
:root[data-polish="on"] .sidebar nav a[data-page=settings] { order: 4; }
:root[data-polish="on"] .sidebar nav a[data-page=outline] { margin-top: 38px; }
:root[data-polish="on"] .sidebar nav a[data-page=outline]::after {
  content: '工作室'; position: absolute; left: 14px; top: -26px; font-size: 11px; letter-spacing: .4em;
  color: var(--yx-ink-faint); font-family: var(--yx-display); pointer-events: none;
}
:root[data-polish="on"] .sidebar nav a:hover { background: var(--yx-sheet-hover); color: var(--yx-ink); }
:root[data-polish="on"] .sidebar nav a.active { background: linear-gradient(90deg, color-mix(in srgb, var(--yx-accent) 20%, transparent), transparent 85%); color: var(--yx-ink); box-shadow: none; }
:root[data-polish="on"] .sidebar nav a.active > span { color: var(--yx-glow); text-shadow: 0 0 12px color-mix(in srgb, var(--yx-glow) 70%, transparent); }
:root[data-polish="on"] .sidebar nav a::before { background: var(--yx-glow) !important; width: 2px; }
:root[data-polish="on"] .sidebar-bottom { color: var(--yx-ink-faint); }
:root[data-polish="on"] .studio-link small { color: var(--yx-ink-faint); }

/* ---------- Topbar ---------- */
:root[data-polish="on"] .topbar { background: transparent; border-bottom: 1px solid var(--yx-rule); }
:root[data-polish="on"] #page-title { font-family: var(--yx-display); font-weight: 600; letter-spacing: .3em; font-size: 14px; color: var(--yx-ink); }
:root[data-polish="on"] .top-status { color: var(--yx-ink-faint); font-size: 12px; }
:root[data-polish="on"] .local-tag { font-family: var(--yx-display); letter-spacing: .2em; border-radius: 3px; border-color: var(--yx-rule-strong); color: var(--yx-ink-soft); }

/* =====================================================================
   今晚 — title screen
   ===================================================================== */
:root[data-polish="on"] .hero-art { border-radius: 10px; box-shadow: 0 40px 80px -40px rgba(4, 8, 22, .9); }
:root[data-polish="on"][data-theme="soft-anime"] .hero-art { box-shadow: 0 40px 80px -42px rgba(120, 66, 92, .55); }
:root[data-polish="on"] .hero-art::after { inset: 12px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .34); box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .06); }
:root[data-polish="on"] .hero-art::before {
  content: '月のそば、きみのそば。'; position: absolute; z-index: 3; top: 76px; right: 30px; pointer-events: none; white-space: nowrap; line-height: 1;
  writing-mode: vertical-rl; font-family: var(--yx-kana); font-size: 15px; letter-spacing: .55em; color: #fff;
  text-shadow: 0 0 18px rgba(20, 24, 50, .55), 0 1px 3px rgba(20, 24, 50, .5);
}
:root[data-polish="on"] .hero-art.has-art .art-caption,
:root[data-polish="on"] .art-caption {
  left: 30px; bottom: 30px; padding: 0; background: none; backdrop-filter: none; border-radius: 0;
  text-shadow: 0 2px 16px rgba(10, 14, 34, .65);
}
:root[data-polish="on"] .art-caption h2 {
  font-family: var(--yx-display); font-weight: 600; font-size: 42px; letter-spacing: .3em; color: #fff; margin: 0 0 6px;
}
:root[data-polish="on"] .art-caption p { color: rgba(255, 255, 255, .86); font-size: 12px; letter-spacing: .35em; margin: 0; }
:root[data-polish="on"] .art-edit { border-radius: 3px; backdrop-filter: blur(6px); background: rgba(20, 24, 48, .35); color: #fff; border: 1px solid rgba(255, 255, 255, .28); }
:root[data-polish="on"] .companion-mini h2 { font-family: var(--yx-display); font-weight: 600; letter-spacing: .3em; color: var(--yx-ink); }
:root[data-polish="on"] .companion-mini .avatar { box-shadow: 0 0 0 2px var(--yx-sheet-solid), 0 0 0 3px var(--yx-accent); }
:root[data-polish="on"] .evening-setup .soft-card > label[for=theme] {
  font-family: var(--yx-display); font-weight: 600; font-size: 18px; letter-spacing: .14em; color: var(--yx-ink); margin-bottom: 10px;
}
:root[data-polish="on"] #theme { line-height: 1.9; }
:root[data-polish="on"] .setup-details > summary { color: var(--yx-ink-soft); }
:root[data-polish="on"] .setup-details > summary span { color: var(--yx-ink-faint); }
:root[data-polish="on"] .start-button {
  width: 100%; justify-content: center; gap: 14px; padding: 16px 22px !important; border-radius: 6px;
  font-family: var(--yx-display); font-weight: 600; font-size: 17px; letter-spacing: .32em;
}
:root[data-polish="on"] .start-button .yx-start-label { padding-left: .32em; }
/* A crescent made from one circle and its shadow */
:root[data-polish="on"] .yx-moon {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(circle at 68% 34%, transparent 0 47%, currentColor 49%);
  transform: rotate(-12deg);
}
:root[data-polish="on"] .evening-setup .fineprint { text-align: center; letter-spacing: .1em; }
:root[data-polish="on"] #modehint:empty { display: none; }
:root[data-polish="on"] :is(#modehint, #history-info, #studio-source) { font-size: 12px; color: var(--yx-ink-faint); letter-spacing: .04em; }
/* A soft scrim under the name so it reads on any illustration */
:root[data-polish="on"] .art-caption::before {
  content: ''; position: absolute; z-index: -1; left: -70px; right: -90px; top: -50px; bottom: -60px; pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 35% 60%, rgba(14, 18, 40, .55), transparent 72%);
}
:root[data-polish="on"][data-theme="soft-anime"] .art-caption::before { background: radial-gradient(ellipse 70% 60% at 35% 60%, rgba(96, 52, 78, .42), transparent 72%); }
:root[data-polish="on"] .art-edit { z-index: 4; }

/* =====================================================================
   陪伴 — the ADV text window
   ===================================================================== */
:root[data-polish="on"] .call-room { border-radius: 12px; border: 1px solid var(--yx-rule); }
:root[data-polish="on"] .call-top .pill {
  font-family: var(--yx-kana); font-size: 12px; letter-spacing: .3em; padding: 5px 12px; border-radius: 3px;
  color: var(--yx-ink); background: color-mix(in srgb, var(--yx-sheet-solid) 55%, transparent); border-color: var(--yx-rule-strong);
}
:root[data-polish="on"] #call-clock { font-family: var(--yx-display); font-size: 14px; letter-spacing: .18em; color: var(--yx-ink-soft); font-variant-numeric: tabular-nums; }
:root[data-polish="on"] .call-top > a { font-size: 12px; letter-spacing: .12em; color: var(--yx-ink-soft); }
:root[data-polish="on"] .call-top .night-caption {
  position: absolute; right: 2px; top: 58px; writing-mode: vertical-rl; font-family: var(--yx-kana);
  font-size: 14px; letter-spacing: .6em; color: var(--yx-ink); opacity: .72; text-shadow: 0 0 14px rgba(10, 14, 34, .4);
  white-space: nowrap; line-height: 1;
}
:root[data-polish="on"][data-theme="soft-anime"] .call-top .night-caption { color: #fff; opacity: .92; text-shadow: 0 1px 10px rgba(120, 60, 90, .45); }

/* Presence: rings replace the record. Ripples while she speaks, a breathing glow while listening. */
:root[data-polish="on"] .record-disc { background: none !important; border: 0 !important; box-shadow: none !important; animation: none !important; }
:root[data-polish="on"] .record-player::before, :root[data-polish="on"] .record-player::after {
  border: 1px solid var(--yx-rule-strong); animation: none;
}
:root[data-polish="on"] .record-player::after { border-color: var(--yx-rule); }
:root[data-polish="on"] .record-disc .call-avatar {
  border: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--yx-sheet-solid) 80%, transparent), 0 0 0 4px var(--yx-accent), 0 18px 40px -16px rgba(0, 0, 0, .6) !important;
  transition: box-shadow .4s ease;
}
:root[data-polish="on"] .record-halo {
  inset: -34px; animation: none !important; opacity: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--yx-glow) calc(10% + var(--yx-level, 0) * 40%), transparent) 30%, transparent 70%) !important;
  transform: scale(calc(1 + var(--yx-level, 0) * .3)); transition: transform .12s linear;
}
:root[data-polish="on"] .record-halo::before, :root[data-polish="on"] .record-halo::after {
  content: ''; position: absolute; inset: 26px; border-radius: 50%; border: 1px solid var(--yx-glow); opacity: 0;
}
@keyframes yx-ripple { 0% { transform: scale(.82); opacity: .55; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes yx-turn { to { transform: rotate(360deg); } }
@keyframes yx-breathe { 0%, 100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.08); opacity: 1; } }
:root[data-polish="on"] body[data-playing=true][data-motion=gentle] .record-halo::before { animation: yx-ripple 3.2s var(--yx-ease) infinite; }
:root[data-polish="on"] body[data-playing=true][data-motion=gentle] .record-halo::after { animation: yx-ripple 3.2s var(--yx-ease) 1.6s infinite; }
:root[data-polish="on"] body[data-playing=true] .record-disc .call-avatar { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yx-sheet-solid) 80%, transparent), 0 0 0 4px var(--yx-glow), 0 0 40px -4px color-mix(in srgb, var(--yx-glow) 55%, transparent) !important; }
:root[data-polish="on"] .record-player:has(#orb:is([data-state=thinking], [data-state=recognizing]))::before {
  border: 1px dashed var(--yx-accent); inset: -14px;
}
:root[data-polish="on"] body[data-motion=gentle] .record-player:has(#orb:is([data-state=thinking], [data-state=recognizing]))::before { animation: yx-turn 9s linear infinite; }
:root[data-polish="on"] .record-player:has(#orb[data-state=listening]) .record-disc .call-avatar { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yx-sheet-solid) 80%, transparent), 0 0 0 4px var(--yx-accent-2), 0 0 36px -6px var(--yx-accent-2) !important; }
:root[data-polish="on"] body[data-motion=gentle] .record-player:has(#orb[data-state=listening])::after { border-color: var(--yx-accent-2); animation: yx-breathe 3.6s ease-in-out infinite; }
:root[data-polish="on"] .record-player:has(#orb:is([data-state=quiet], [data-state=paused])) { opacity: .72; filter: saturate(.7); }
:root[data-polish="on"] .voice-bars { display: none; }
:root[data-polish="on"] .call-presence h1 {
  font-family: var(--yx-display); font-weight: 600; font-size: 24px; letter-spacing: .5em; padding-left: .5em; margin: 18px 0 6px;
}
:root[data-polish="on"] .call-state { font-size: 13px; letter-spacing: .14em; color: var(--yx-ink-soft); }
:root[data-polish="on"] .call-presence #statusdetail { color: var(--yx-ink-faint); margin: 4px auto 0; }
:root[data-polish="on"] .call-presence { padding-bottom: 30px; }

/* The window */
:root[data-polish="on"] .subtitle-area {
  position: relative; flex: 0 1 auto; width: min(880px, 100%); max-width: none; margin: auto auto 16px;
  padding: 30px 44px 34px; min-height: 0; text-align: left; justify-content: flex-start;
  background: var(--yx-paper), var(--yx-window); border: 1px solid var(--yx-rule-strong); border-radius: 8px;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .025), var(--yx-shadow); backdrop-filter: blur(12px) saturate(115%);
}
:root[data-polish="on"] .subtitle-area::before {
  content: ''; position: absolute; inset: 6px; border: 1px solid var(--yx-rule); border-radius: 5px; pointer-events: none;
}
:root[data-polish="on"] .subtitle-area > .adv-name {
  display: block; position: absolute; top: -15px; left: 30px; z-index: 1; padding: 5px 26px 5px 24px;
  font-family: var(--yx-display); font-weight: 600; font-size: 14px; letter-spacing: .4em; line-height: 1.4;
  color: var(--yx-accent-ink); background: var(--yx-plate);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .25));
}
:root[data-polish="on"] #current-subtitle {
  font-family: var(--yx-ja); font-size: 21px; line-height: 2; letter-spacing: .05em; margin: 0;
  color: var(--yx-ink); text-shadow: none; max-height: calc(21px * 2 * 4 + 4px); overflow-y: auto; text-align: left;
}
:root[data-polish="on"][data-theme="refined-moonlit"] #current-subtitle { text-shadow: 0 0 18px rgba(120, 150, 210, .25); }
:root[data-polish="on"] #subtitle-status {
  position: absolute; left: 44px; bottom: 11px; font-size: 11px; letter-spacing: .12em; color: var(--yx-ink-faint);
}
/* The novel-game wait mark: blinks when a line has finished */
@keyframes yx-wait { 0%, 100% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(3px); opacity: .35; } }
:root[data-polish="on"] .subtitle-area::after {
  content: '▼'; position: absolute; right: 24px; bottom: 12px; font-size: 10px; color: var(--yx-glow);
  text-shadow: 0 0 8px var(--yx-glow); transition: opacity .3s ease;
}
:root[data-polish="on"] body[data-motion=gentle] .subtitle-area::after { animation: yx-wait 1.3s ease-in-out infinite; }
:root[data-polish="on"] body[data-playing=true] .subtitle-area::after { opacity: 0; animation: none; }
/* A new line is revealed top-down, like text being sent to the window */
@keyframes yx-reveal { from { -webkit-mask-position: 0 100%; mask-position: 0 100%; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
:root[data-polish="on"] body[data-motion=gentle] #current-subtitle.yx-reveal {
  -webkit-mask-image: linear-gradient(180deg, #000 0 40%, transparent 60% 100%); mask-image: linear-gradient(180deg, #000 0 40%, transparent 60% 100%);
  -webkit-mask-size: 100% 300%; mask-size: 100% 300%;
  animation: yx-reveal 1.6s cubic-bezier(.3, .1, .3, 1) both;
}

/* Bottom: microphone capsule, then a quick-menu bar */
:root[data-polish="on"] .call-bottom { max-width: 880px; }
:root[data-polish="on"] .call-microphone {
  border-radius: 999px; padding: 5px 6px 5px 6px; gap: 12px; margin: 0 auto 8px;
  background: color-mix(in srgb, var(--yx-sheet-solid) 62%, transparent); border: 1px solid var(--yx-rule-strong); backdrop-filter: blur(8px);
}
:root[data-polish="on"] .call-microphone button { border-radius: 999px; padding: 7px 16px; font-size: 12px; }
:root[data-polish="on"] .call-microphone span { font-size: 12px; color: var(--yx-ink-soft); padding-right: 12px; }
:root[data-polish="on"] .call-microphone meter { width: 64px; height: 4px; }
:root[data-polish="on"] .voice-transcript { color: var(--yx-ink-faint); letter-spacing: .06em; margin: 4px 0 10px; }
:root[data-polish="on"] .call-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0; width: fit-content; max-width: 100%; margin: 0 auto 12px;
  border: 1px solid var(--yx-rule); border-radius: 4px; background: color-mix(in srgb, var(--yx-sheet-solid) 50%, transparent); backdrop-filter: blur(8px);
}
:root[data-polish="on"] .call-actions :is(button, .button) {
  flex-direction: row; gap: 7px; min-width: 0; padding: 9px 15px; border: 0; border-radius: 0; background: transparent;
  font-size: 12px; letter-spacing: .1em; color: var(--yx-ink-soft);
}
:root[data-polish="on"] .call-actions :is(button, .button):not([hidden]) ~ :is(button, .button) { border-left: 1px solid var(--yx-rule); }
:root[data-polish="on"] .call-actions :is(button, .button):hover:not(:disabled) { background: var(--yx-sheet-hover); color: var(--yx-ink); }
:root[data-polish="on"] .call-actions b { display: none; }
:root[data-polish="on"] .call-actions .end-call, :root[data-polish="on"] .call-actions .end-call b { color: var(--yx-danger); }
:root[data-polish="on"] #sayform { border-radius: 6px; padding: 6px 6px 6px 16px; background: color-mix(in srgb, var(--yx-sheet-solid) 60%, transparent); border: 1px solid var(--yx-rule-strong); backdrop-filter: blur(8px); }
:root[data-polish="on"] #say { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 8px 0; }
:root[data-polish="on"] #send { border-radius: 4px; padding: 8px 18px; }
:root[data-polish="on"] .input-note { color: var(--yx-ink-faint); letter-spacing: .06em; }

/* =====================================================================
   陪伴记录 — backlog
   ===================================================================== */
:root[data-polish="on"] .reading-paper { padding: 22px 34px; }
:root[data-polish="on"] .transcript-row {
  display: grid; grid-template-columns: 6.5em minmax(0, 1fr); column-gap: 26px; align-items: baseline;
  padding: 16px 4px; border: 0; border-bottom: 1px dashed var(--yx-rule); background: none; border-radius: 0;
}
:root[data-polish="on"] .transcript-row > small { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; font-size: 11px; color: var(--yx-ink-faint); margin: 0; }
:root[data-polish="on"] .transcript-row .row-role { font-family: var(--yx-display); font-weight: 600; font-size: 14px; letter-spacing: .3em; color: var(--yx-accent); }
:root[data-polish="on"] .transcript-row.user .row-role { color: var(--yx-accent-2); }
:root[data-polish="on"] .transcript-row .receipt { font-size: 10.5px; letter-spacing: .06em; opacity: .85; }
:root[data-polish="on"] .transcript-row > p { margin: 0; color: var(--yx-ink); }
:root[data-polish="on"] .transcript-row:not(.user) > p { font-family: var(--yx-ja); font-size: 17.5px; line-height: 2; letter-spacing: .04em; }
:root[data-polish="on"] .transcript-row.user > p { font-size: 14.5px; line-height: 1.9; color: var(--yx-ink-soft); }
:root[data-polish="on"] .transcript-row.user > p::before { content: '「'; color: var(--yx-accent-2); margin-right: 2px; }
:root[data-polish="on"] .transcript-row.user > p::after { content: '」'; color: var(--yx-accent-2); margin-left: 2px; }
:root[data-polish="on"] #transcript .empty { font-family: var(--yx-display); letter-spacing: .2em; color: var(--yx-ink-faint); text-align: center; padding: 60px 0; }
:root[data-polish="on"] #new-messages { border-radius: 999px; }

/* =====================================================================
   今晚构成 — route chart (the stages really are a sequence)
   ===================================================================== */
:root[data-polish="on"] .outline-intro #nightpremise {
  font-family: var(--yx-ja); font-size: 18px; line-height: 2.1; letter-spacing: .05em; color: var(--yx-ink); padding: 6px 10px 0;
}
:root[data-polish="on"] .outline-intro #nightstate { color: var(--yx-accent); letter-spacing: .1em; padding: 0 10px; }
:root[data-polish="on"] .chapter-list { display: flex; flex-direction: column; gap: 10px; position: relative; padding-left: 44px; max-width: 860px; }
:root[data-polish="on"] .chapter-list::before {
  content: ''; position: absolute; left: 17px; top: 22px; bottom: 22px; width: 1px;
  background: linear-gradient(180deg, var(--yx-accent), var(--yx-rule-strong));
}
:root[data-polish="on"] .chapter-card {
  position: relative; display: block; padding: 14px 20px; overflow: visible;
  background: var(--yx-paper), var(--yx-sheet); border: 1px solid var(--yx-rule); border-radius: var(--yx-radius); box-shadow: none;
}
:root[data-polish="on"] .chapter-card .number {
  position: absolute; left: -44px; top: 14px; width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--yx-display); font-size: 13px; color: var(--yx-ink-soft); background: var(--yx-sheet-solid); border: 1px solid var(--yx-rule-strong);
}
:root[data-polish="on"] .chapter-card h3 { font-family: var(--yx-display); font-weight: 600; letter-spacing: .14em; margin: 0 0 4px; color: var(--yx-ink); }
:root[data-polish="on"] .chapter-card p { margin: 0; color: var(--yx-ink-faint); font-size: 12.5px; }
:root[data-polish="on"] .chapter-card.current { border-color: var(--yx-accent); background: var(--yx-paper), linear-gradient(100deg, color-mix(in srgb, var(--yx-accent) 16%, transparent), transparent 70%), var(--yx-sheet); }
:root[data-polish="on"] .chapter-card.current .number { color: var(--yx-accent-ink); background: var(--yx-glow); border-color: var(--yx-glow); box-shadow: 0 0 0 5px color-mix(in srgb, var(--yx-glow) 18%, transparent), 0 0 22px color-mix(in srgb, var(--yx-glow) 60%, transparent); }
:root[data-polish="on"][data-theme="refined-moonlit"] .chapter-card.current .number { color: #1b2140; }
:root[data-polish="on"] .chapter-list .empty { font-family: var(--yx-display); letter-spacing: .14em; color: var(--yx-ink-faint); }
:root[data-polish="on"] .text-link { color: var(--yx-ink-soft); }

/* =====================================================================
   角色与声音 — config screen
   ===================================================================== */
:root[data-polish="on"] .theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
:root[data-polish="on"] .theme-option .theme-preview { border-radius: 6px; overflow: hidden; border: 1px solid var(--yx-rule-strong); transition: border-color .25s ease, box-shadow .25s ease, transform .3s var(--yx-ease); }
:root[data-polish="on"] .theme-option .theme-swatch { height: 92px; }
:root[data-polish="on"] .theme-option .theme-info { padding: 12px 10px 14px; }
:root[data-polish="on"] .theme-option .theme-info strong { font-family: var(--yx-display); letter-spacing: .24em; font-size: 15px; }
:root[data-polish="on"] .theme-option .theme-info small { display: block; margin-top: 4px; font-size: 11px; }
:root[data-polish="on"] .theme-option:has(input:checked) .theme-preview { border-color: var(--yx-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yx-accent) 28%, transparent); }
:root[data-polish="on"] .theme-option:hover .theme-preview { transform: translateY(-2px); }
:root[data-polish="on"] .yx-toggle { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--yx-rule); }
:root[data-polish="on"] .switch-label { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
:root[data-polish="on"] .switch-label small { display: block; }
:root[data-polish="on"] .asset-preview { border-radius: 6px; }

/* ---------- 人设 / API / 后台: quieter pages, same materials ---------- */
:root[data-polish="on"] .built-in-persona .pill { color: var(--yx-accent); }
:root[data-polish="on"] .persona-list > * { border-radius: var(--yx-radius); }
:root[data-polish="on"] .file-button { border-radius: 4px; }
:root[data-polish="on"] .connection-endpoint code, :root[data-polish="on"] #raw-output {
  font-family: "Cascadia Code", "Consolas", "SFMono-Regular", monospace; font-size: 12.5px;
  background: color-mix(in srgb, var(--yx-sheet-solid) 80%, transparent); color: var(--yx-ink-soft); border: 1px solid var(--yx-rule); border-radius: 4px;
}
:root[data-polish="on"] #trace-list > * { border-radius: 4px; }
:root[data-polish="on"] .raw-tabs button[aria-pressed=true] { border-color: var(--yx-accent); color: var(--yx-ink); background: var(--yx-sheet-hover); }

/* ---------- Floating bits ---------- */
:root[data-polish="on"] #mini-call { background: var(--yx-paper), var(--yx-sheet); border-top: 1px solid var(--yx-rule-strong); backdrop-filter: blur(14px); }
:root[data-polish="on"] #mini-call strong { font-family: var(--yx-display); letter-spacing: .24em; }
:root[data-polish="on"] #toast { border-radius: 4px; background: var(--yx-sheet-solid); color: var(--yx-ink); border: 1px solid var(--yx-rule-strong); }

/* ---------- Mobile ---------- */
@media (max-width: 850px) {
  :root[data-polish="on"] .page-heading > div:first-child { column-gap: 12px; }
  :root[data-polish="on"] .page-heading > div:first-child > .eyebrow { font-size: 11.5px; letter-spacing: .26em; }
  :root[data-polish="on"] .mobile-nav { background: color-mix(in srgb, var(--yx-sheet-solid) 88%, transparent); border-top: 1px solid var(--yx-rule-strong); backdrop-filter: blur(14px); }
  :root[data-polish="on"] .mobile-nav :is(a, button) { color: var(--yx-ink-faint); background: none !important; border: 0 !important; box-shadow: none !important; letter-spacing: .1em; }
  :root[data-polish="on"] .mobile-nav :is(a, button).active { color: var(--yx-ink); }
  :root[data-polish="on"] .mobile-nav :is(a, button).active > span { color: var(--yx-glow); text-shadow: 0 0 12px var(--yx-glow); }
  :root[data-polish="on"] .mobile-more { background: var(--yx-sheet-solid); border: 1px solid var(--yx-rule-strong); border-radius: 6px; }
  :root[data-polish="on"] .hero-art::before { font-size: 13px; top: 22px; right: 20px; }
  :root[data-polish="on"] .art-caption h2 { font-size: 32px; }
  :root[data-polish="on"] .call-top .night-caption { display: none; }
  :root[data-polish="on"] .subtitle-area { padding: 26px 20px 30px; margin: 22px auto 12px; }
  :root[data-polish="on"] .call-presence { padding-bottom: 6px; }
  :root[data-polish="on"] .call-room { --disc-size: clamp(110px, 17dvh, 140px); --label-size: clamp(82px, 12.5dvh, 104px); }
  :root[data-polish="on"] .call-presence h1 { margin-top: 12px; font-size: 21px; }
  :root[data-polish="on"] .call-microphone { flex-wrap: nowrap; width: 100%; justify-content: space-between; border-radius: 10px; padding: 5px; }
  :root[data-polish="on"] .call-microphone meter { display: none; }
  :root[data-polish="on"] .call-microphone span { width: auto; padding-right: 8px; text-align: right; }
  :root[data-polish="on"] .call-actions :is(button, .button) { font-size: 12.5px; }
  :root[data-polish="on"] .subtitle-area > .adv-name { left: 16px; font-size: 13px; }
  :root[data-polish="on"] #current-subtitle { font-size: 18px; max-height: calc(18px * 1.9 * 4 + 4px); line-height: 1.9; }
  :root[data-polish="on"] #subtitle-status { left: 20px; }
  :root[data-polish="on"] .call-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  :root[data-polish="on"] .call-actions :is(button, .button) { justify-content: center; padding: 10px 6px; border-left: 0 !important; border-top: 1px solid var(--yx-rule); }
  :root[data-polish="on"] .call-actions :is(button, .button):nth-child(-n+3) { border-top: 0; }
  :root[data-polish="on"] .reading-paper { padding: 14px 16px; }
  :root[data-polish="on"] .transcript-row { grid-template-columns: 1fr; row-gap: 6px; }
  :root[data-polish="on"] .transcript-row > small { flex-direction: row; gap: 10px; align-items: baseline; }
  :root[data-polish="on"] .theme-options { grid-template-columns: 1fr 1fr; gap: 10px; }
  :root[data-polish="on"] .theme-option .theme-swatch { height: 64px; }
  :root[data-polish="on"] .chapter-list { padding-left: 40px; }
}
@media (max-height: 820px) and (min-width: 851px) {
  :root[data-polish="on"] .page-heading > div:first-child > .eyebrow { font-size: 11px; letter-spacing: .2em; }
  :root[data-polish="on"] .page[data-view="tonight"] .page-heading h1 { font-size: clamp(24px, 2vw, 30px); }
  :root[data-polish="on"] .start-button { padding: 13px 20px !important; }
}
@media (max-width: 1100px) and (min-width: 851px) {
  :root[data-polish="on"] .sidebar nav a[data-page=outline] { margin-top: 18px; }
  :root[data-polish="on"] .sidebar nav a[data-page=outline]::after { display: none; }
}

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  :root[data-polish="on"] *, :root[data-polish="on"] *::before, :root[data-polish="on"] *::after { animation: none !important; transition: none !important; }
}
