/* ==========================================================================
   铁轨语言 · CIR / LKJ 语音合成台 — visual system
   ========================================================================== */

:root {
    --font-sans: "Inter", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
    --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --ease-soft: cubic-bezier(.4, 0, .2, 1);
    --r-lg: 22px;
    --r-md: 14px;
    --r-sm: 9px;
    --maxw: 1220px;
    --head-h: 0px;
    --speed: .42s;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #070708;
    --bg-2: #0b0b0d;
    --panel: #0f0f12;
    --panel-2: #141418;
    --panel-3: #191920;
    --line: rgba(255, 255, 255, .10);
    --line-2: rgba(255, 255, 255, .18);
    --line-3: rgba(255, 255, 255, .30);
    --text: #f4f4f6;
    --text-2: #a9a9b4;
    --text-3: #6d6d78;
    --ink: #08080a;
    --solid: #f6f6f8;
    --solid-ink: #0a0a0c;
    --glow: rgba(255, 255, 255, .07);
    --shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
    --chip: #17171c;
    --danger: #ff8f8f;
    --ok: #c8f5c8;
    --grid: rgba(255, 255, 255, .045);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f4f1;
    --bg-2: #ecece7;
    --panel: #ffffff;
    --panel-2: #f7f7f4;
    --panel-3: #efefea;
    --line: rgba(12, 12, 14, .12);
    --line-2: rgba(12, 12, 14, .2);
    --line-3: rgba(12, 12, 14, .34);
    --text: #0c0c0f;
    --text-2: #56565f;
    --text-3: #6e6e78;
    --ink: #ffffff;
    --solid: #0d0d10;
    --solid-ink: #fdfdfd;
    --glow: rgba(0, 0, 0, .05);
    --shadow: 0 30px 70px -34px rgba(10, 10, 20, .35);
    --chip: #f0f0eb;
    --danger: #b42323;
    --ok: #1f7a34;
    --grid: rgba(12, 12, 14, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body.app {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: .01em;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color .5s var(--ease-soft), color .5s var(--ease-soft);
}

::selection { background: var(--solid); color: var(--solid-ink); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

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

/* ---------- atmosphere ---------- */
.atmosphere { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.grid-lines {
    position: absolute; inset: -20%;
    background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 80% 65% at 50% 0%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 80% 65% at 50% 0%, #000 20%, transparent 78%);
    animation: gridDrift 40s linear infinite alternate;
}
@keyframes gridDrift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-32px, -32px, 0); } }

.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; transition: opacity .6s var(--ease-soft); }
.glow-a { width: 46vw; height: 46vw; left: -12vw; top: -18vw; background: var(--glow); animation: floatA 18s var(--ease-soft) infinite alternate; }
.glow-b { width: 40vw; height: 40vw; right: -14vw; top: 8vw; background: var(--glow); animation: floatB 22s var(--ease-soft) infinite alternate; }
:root[data-theme="light"] .glow { opacity: .8; }
@keyframes floatA { to { transform: translate3d(6vw, 4vw, 0) scale(1.15); } }
@keyframes floatB { to { transform: translate3d(-5vw, 6vw, 0) scale(.9); } }

.noise {
    position: absolute; inset: 0; opacity: .22; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .noise { opacity: .10; }

/* ---------- header ---------- */
.site-head { position: relative; z-index: 2; padding: 26px 24px 0; }
.head-inner { max-width: var(--maxw); margin: 0 auto; }

.head-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .04em; }
.brand-mark {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
    border: 1px solid var(--line-2); background: var(--panel);
    transition: transform .5s var(--ease), background .3s;
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-text { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2); }

.head-tools { display: flex; gap: 8px; align-items: center; }
.icon-btn {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
    transition: transform .35s var(--ease), border-color .3s, background .3s;
    position: relative; overflow: hidden;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--line-3); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.ghost { background: transparent; }
.theme-ico { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .55s var(--ease), opacity .35s; }
.theme-ico[data-ico="sun"] { opacity: 0; transform: translateY(16px) rotate(-40deg); }
:root[data-theme="light"] .theme-ico[data-ico="moon"] { opacity: 0; transform: translateY(-16px) rotate(40deg); }
:root[data-theme="light"] .theme-ico[data-ico="sun"] { opacity: 1; transform: none; }

.head-main { margin: 54px 0 26px; }
.site-title {
    margin: 0; font-size: clamp(38px, 7.4vw, 82px); line-height: .98; letter-spacing: -.035em;
    font-weight: 650; color: var(--text);
    animation: titleIn 1s var(--ease) both;
}
@keyframes titleIn { from { opacity: 0; transform: translateY(26px); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
.site-sub {
    margin: 18px 0 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: clamp(14px, 1.8vw, 17px); color: var(--text-2); letter-spacing: .06em;
    animation: titleIn 1s .1s var(--ease) both;
}
.ver-badge {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
    padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2);
    background: var(--panel);
}
.head-meta { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: flex-start; padding-bottom: 8px; }
.notice {
    margin: 0; max-width: 720px; font-size: 12.5px; line-height: 1.85; color: var(--text-3);
    animation: titleIn 1s .2s var(--ease) both;
}
.qq { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); animation: titleIn 1s .26s var(--ease) both; }
.qq-label { white-space: nowrap; }
.qq-code {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--panel); color: var(--text-2);
    font-family: var(--font-mono); font-size: 12px; transition: all .3s var(--ease);
}
.qq-code:hover { border-color: var(--line-3); color: var(--text); transform: translateY(-1px); }

/* ---------- quick nav ---------- */
.quick-nav { position: sticky; top: 0; z-index: 30; margin-top: 20px; backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); background: color-mix(in srgb, var(--bg) 72%, transparent); border-bottom: 1px solid var(--line); }
.quick-nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 6px; }
.quick-link {
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-2);
    font-size: 13px; padding: 7px 12px; border-radius: 999px; transition: all .3s var(--ease);
}
.quick-link .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .5; transition: all .3s; }
.quick-link:hover { color: var(--text); background: var(--panel-2); }
.quick-link.is-active { color: var(--text); }
.quick-link.is-active .dot { opacity: 1; box-shadow: 0 0 0 3px var(--glow); }
.nav-spacer { flex: 1; }
.cache-pill {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3);
    font-family: var(--font-mono); padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
    transition: color .3s;
}

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 34px 24px 60px; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.panel {
    position: relative; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 30px; margin-bottom: 26px; box-shadow: var(--shadow);
    transition: border-color .4s, background-color .4s;
}
.panel::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 32%);
    opacity: .9;
}
:root[data-theme="light"] .panel::before { background: linear-gradient(180deg, rgba(255, 255, 255, .9), transparent 40%); }
.panel::after {
    content: ""; position: absolute; left: 30px; right: 30px; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-3), transparent); opacity: .6;
}

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.panel-kicker { font-size: 10px; letter-spacing: .3em; color: var(--text-3); font-family: var(--font-mono); margin-bottom: 8px; }
.panel-head h2 { margin: 0 0 6px; font-size: clamp(24px, 3.1vw, 32px); letter-spacing: -.02em; font-weight: 640; }
.panel-desc { margin: 0; color: var(--text-2); font-size: 13.5px; max-width: 62ch; }
.panel-badge {
    flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
    border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 12px;
    background: var(--panel-2); white-space: nowrap;
    transition: transform .4s var(--ease), color .3s, border-color .3s;
}
.panel-badge.pop { animation: badgePop .5s var(--ease); }
@keyframes badgePop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }

/* ---------- form ---------- */
.loco-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); gap: 26px; align-items: start; }
.loco-col { min-width: 0; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { position: relative; }
.field.wide { grid-column: span 2; }
.field label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; letter-spacing: .03em; }
.field label .req { color: var(--text-3); font-size: 10px; font-family: var(--font-mono); }
.field input {
    width: 100%; padding: 14px 15px; border-radius: var(--r-md); border: 1px solid var(--line-2);
    background: var(--panel-2); color: var(--text); font-size: 17px; letter-spacing: .06em;
    font-family: var(--font-mono); transition: border-color .3s, background .3s, box-shadow .35s, transform .35s var(--ease);
    outline: none;
}
.field input::placeholder { color: var(--text-3); letter-spacing: .02em; font-size: 13.5px; font-family: var(--font-sans); }
.field input:hover { border-color: var(--line-3); }
.field input:focus { border-color: var(--line-3); background: var(--panel-3); box-shadow: 0 0 0 4px var(--glow); transform: translateY(-1px); }
.field input.is-error { border-color: var(--danger); animation: shake .4s; }
.field .hint-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--text-3); }
.field .counter { font-family: var(--font-mono); }
.field .counter.over { color: var(--danger); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }

/* switches */
.switch-stack { display: grid; gap: 10px; margin-top: 20px; }
.switch {
    display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px;
    border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2);
    cursor: pointer; transition: border-color .3s, background .3s, transform .35s var(--ease);
    position: relative; overflow: hidden;
}
.switch:hover { border-color: var(--line-2); transform: translateY(-1px); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
    flex: none; width: 40px; height: 23px; border-radius: 999px; border: 1px solid var(--line-2);
    background: transparent; position: relative; transition: background .35s var(--ease), border-color .35s;
    margin-top: 2px;
}
.switch-thumb {
    position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
    background: var(--text-3); transition: transform .38s var(--ease), background .3s;
}
.switch input:checked + .switch-track { background: var(--solid); border-color: var(--solid); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(17px); background: var(--solid-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--line-3); outline-offset: 3px; }
.switch-text { display: grid; gap: 3px; }
.switch-title { font-size: 13.5px; }
.switch-hint { font-size: 11.5px; color: var(--text-3); }
.switch.on { border-color: var(--line-3); background: var(--panel-3); }

/* letters */
.letters-box { margin-top: 18px; padding: 14px; border-radius: var(--r-md); border: 1px dashed var(--line-2); background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.letters-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-3); margin-bottom: 10px; letter-spacing: .08em; }
.letters-plan { font-family: var(--font-mono); color: var(--text-2); }
.letters { display: flex; flex-wrap: wrap; gap: 6px; }
.letter-chip {
    font-family: var(--font-mono); font-size: 12px; padding: 4px 9px; border-radius: 7px;
    border: 1px solid var(--line); background: var(--panel); color: var(--text-2);
    transition: all .35s var(--ease); animation: chipIn .45s var(--ease) both;
}
.letter-chip:hover { color: var(--text); border-color: var(--line-3); transform: translateY(-2px); }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: none; } }

/* buttons */
.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 18px; border-radius: var(--r-md); border: 1px solid var(--line-2);
    background: var(--panel-2); color: var(--text); font-size: 13.5px; font-weight: 550;
    transition: transform .35s var(--ease), background .3s, border-color .3s, color .3s, box-shadow .35s;
    overflow: hidden; white-space: nowrap; text-decoration: none;
}
.btn::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 60%);
    opacity: 0; transition: opacity .35s;
}
.btn:hover::after { opacity: 1; }
.btn:hover { transform: translateY(-2px); border-color: var(--line-3); }
.btn:active { transform: scale(.97); }
.btn svg { flex: none; }
.btn-primary { background: var(--solid); color: var(--solid-ink); border-color: var(--solid); }
.btn-primary:hover { background: var(--solid); color: var(--solid-ink); box-shadow: 0 14px 34px -14px color-mix(in srgb, var(--solid) 60%, transparent); }
.btn-ghost { background: transparent; }
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn.is-busy::before {
    content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor;
    border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.pulse { animation: softPulse 2.6s var(--ease-soft) infinite; }
@keyframes softPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--glow); } 50% { box-shadow: 0 0 0 7px transparent; } }

.loco-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

/* preview */
.loco-preview {
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel-2);
    padding: 18px; display: flex; flex-direction: column; min-height: 300px; position: sticky; top: 72px;
}
.preview-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: .18em; color: var(--text-3); text-transform: uppercase; }
.preview-dur { font-family: var(--font-mono); letter-spacing: .02em; color: var(--text-2); font-size: 12px; }
.preview-body { flex: 1; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 7px; align-content: flex-start; }
.preview-body .empty-hint { color: var(--text-3); font-size: 12.5px; display: grid; gap: 10px; place-items: start; animation: fadeIn .6s var(--ease); }
.empty-ico { font-size: 22px; opacity: .5; animation: breathe 3.4s var(--ease-soft) infinite; }
@keyframes breathe { 50% { opacity: .9; transform: scale(1.08); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pv-chip {
    font-size: 12.5px; padding: 5px 10px; border-radius: 8px; background: var(--chip);
    border: 1px solid var(--line); color: var(--text-2); position: relative; overflow: hidden;
    animation: chipIn .38s var(--ease) both; cursor: pointer;
}
.pv-chip:hover { color: var(--text); border-color: var(--line-3); }
.pv-chip.is-playing { color: var(--solid-ink); background: var(--solid); border-color: var(--solid); }
.preview-foot { font-size: 11.5px; color: var(--text-3); border-top: 1px dashed var(--line); padding-top: 12px; display: flex; justify-content: space-between; }

/* ---------- module tabs ---------- */
.module-tabs {
    position: relative; display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px;
    background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 20px;
    max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.module-tabs::-webkit-scrollbar { display: none; }
.module-tab {
    position: relative; z-index: 1; border: 0; background: transparent; color: var(--text-2);
    padding: 9px 20px; border-radius: 999px; font-size: 13.5px; white-space: nowrap;
    transition: color .35s var(--ease);
}
.module-tab .mt-sub { font-size: 10.5px; color: var(--text-3); margin-left: 6px; letter-spacing: .04em; }
.module-tab:hover { color: var(--text); }
.module-tab.is-active { color: var(--solid-ink); }
.tab-indicator {
    position: absolute; top: 4px; bottom: 4px; border-radius: 999px; background: var(--solid);
    transition: transform .5s var(--ease), width .5s var(--ease); z-index: 0;
    will-change: transform, width;
}

/* ---------- splice layout ---------- */
.splice-layout { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, .84fr); gap: 24px; align-items: start; }
.browser { min-width: 0; }
.browser-tools { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }

/* 桌面端：浏览区内部滚动，避免超长页面 */
@media (min-width: 1081px) {
    .browser {
        position: sticky; top: 72px; max-height: calc(100vh - 96px);
        display: flex; flex-direction: column; min-height: 0;
    }
    .browser-tools, .cat-strip, .search-results, .cat-strip { flex: none; }
    .item-area {
        overflow-y: auto; overscroll-behavior: contain; padding-right: 4px;
        scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
        -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
        mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
    }
    .item-area::-webkit-scrollbar { width: 6px; }
    .item-area::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
    .sequencer { max-height: calc(100vh - 96px); }
}
.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input {
    width: 100%; padding: 12px 38px 12px 39px; border-radius: var(--r-md); border: 1px solid var(--line-2);
    background: var(--panel-2); color: var(--text); font-size: 14px; outline: none;
    transition: border-color .3s, box-shadow .35s, background .3s;
}
.search-input::placeholder { color: var(--text-3); font-size: 12.5px; }
.search-input:focus { border-color: var(--line-3); box-shadow: 0 0 0 4px var(--glow); background: var(--panel-3); }
.search-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--panel-3); color: var(--text-2);
    font-size: 15px; line-height: 1; display: grid; place-items: center;
}
.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; flex: none; }
.view-toggle button { border: 0; background: transparent; color: var(--text-3); padding: 10px 12px; font-size: 12px; transition: all .3s; }
.view-toggle button.is-active { background: var(--solid); color: var(--solid-ink); }

.cat-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 6px; scrollbar-width: none; }
.cat-strip::-webkit-scrollbar { display: none; }
.cat-pill {
    flex: none; border: 1px solid var(--line); background: transparent; color: var(--text-2);
    border-radius: 999px; padding: 6px 12px; font-size: 12px; transition: all .3s var(--ease);
    display: inline-flex; align-items: center; gap: 6px;
}
.cat-pill:hover { border-color: var(--line-3); color: var(--text); }
.cat-pill .n { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-left: 2px; }
.cat-pill.is-active { background: var(--solid); color: var(--solid-ink); border-color: var(--solid); }
.cat-pill.is-active .n { color: var(--solid-ink); opacity: .7; }

.item-area { min-height: 260px; }
.cat-block { margin-bottom: 22px; animation: fadeIn .5s var(--ease); }
.cat-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cat-block-head h3 { margin: 0; font-size: 13px; letter-spacing: .12em; color: var(--text-2); font-weight: 600; text-transform: uppercase; }
.cat-block-head .line { flex: 1; height: 1px; background: var(--line); }
.cat-block-head .cat-note { font-size: 11px; color: var(--text-3); }

.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.sound-btn {
    position: relative; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
    border-radius: 11px; padding: 11px 9px; font-size: 13px; text-align: center; line-height: 1.3;
    transition: all .32s var(--ease); overflow: hidden; min-height: 46px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.sound-btn .sb-name { position: relative; z-index: 1; }
.sound-btn .sb-dur { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-3); letter-spacing: .02em; }
.sound-btn::after {
    content: "+"; position: absolute; top: 4px; right: 8px; font-family: var(--font-mono);
    font-size: 13px; line-height: 1; color: var(--text-3); opacity: 0; transform: translateY(3px);
    transition: opacity .28s, transform .35s var(--ease); z-index: 1;
}
.sound-btn:hover::after { opacity: .8; transform: none; }
.sound-btn::before {
    content: ""; position: absolute; inset: 0; background: var(--solid); opacity: 0;
    transform: scale(.6); border-radius: inherit; transition: opacity .3s, transform .4s var(--ease); z-index: 0;
}
.sound-btn:hover { color: var(--text); border-color: var(--line-3); transform: translateY(-2px); box-shadow: 0 10px 24px -16px var(--line-3); }
.sound-btn:hover::before { opacity: .06; transform: scale(1); }
.sound-btn:active { transform: scale(.96); }
.sound-btn.is-flash { animation: soundFlash .5s var(--ease); }
@keyframes soundFlash { 0% { transform: scale(.94); border-color: var(--line-3); } 55% { transform: scale(1.03); } 100% { transform: none; } }
.sound-btn.is-playing { border-color: var(--line-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.sound-btn.is-playing::before { opacity: .1; transform: scale(1); }
.sound-btn .eq { position: absolute; right: 8px; top: 8px; display: flex; gap: 2px; align-items: flex-end; height: 10px; opacity: 0; transition: opacity .3s; }
.sound-btn .eq i { width: 2px; background: currentColor; border-radius: 1px; height: 4px; animation: eqBounce .8s infinite ease-in-out; }
.sound-btn .eq i:nth-child(2) { animation-delay: .15s; }
.sound-btn .eq i:nth-child(3) { animation-delay: .3s; }
.sound-btn.is-playing .eq { opacity: .9; }
@keyframes eqBounce { 0%, 100% { height: 3px; } 50% { height: 10px; } }

/* signal cards */
.signal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.signal-card {
    position: relative; border: 1px solid var(--line); background: var(--panel-2); border-radius: 14px;
    padding: 14px 8px 11px; display: flex; flex-direction: column; align-items: center; gap: 9px;
    transition: all .34s var(--ease); overflow: hidden;
}
.signal-card:hover { border-color: var(--line-3); transform: translateY(-3px); }
.signal-card:active { transform: scale(.97); }
.signal-card::after {
    content: ""; position: absolute; inset: auto -30% -60% -30%; height: 70%;
    background: radial-gradient(ellipse at center, var(--lamp-glow, transparent), transparent 70%);
    opacity: 0; transition: opacity .5s;
}
.signal-card:hover::after { opacity: .5; }
.signal-card .lamp-box { position: relative; display: grid; place-items: center; width: 54px; height: 54px; }
.signal-card .lamp {
    width: 44px; height: 44px; border-radius: 50%; position: relative;
    border: 2px solid rgba(0, 0, 0, .55);
    box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .28), inset 0 4px 8px rgba(255, 255, 255, .35), 0 6px 16px -6px rgba(0, 0, 0, .7);
    filter: saturate(1.05);
}
:root[data-theme="light"] .signal-card .lamp { border-color: rgba(0, 0, 0, .35); }
.signal-name { font-size: 12px; color: var(--text-2); text-align: center; line-height: 1.25; }
.signal-card.is-playing .lamp { animation: lampGlow 1.2s var(--ease-soft) infinite; }
@keyframes lampGlow { 0%, 100% { box-shadow: inset 0 -6px 12px rgba(0,0,0,.28), 0 0 0 0 rgba(255,255,255,.35); } 50% { box-shadow: inset 0 -6px 12px rgba(0,0,0,.28), 0 0 0 8px rgba(255,255,255,0); } }

.lamp.green { background: radial-gradient(circle at 34% 28%, #b9ffd0, #34d76b 46%, #0f7a35 100%); --lamp-glow: #34d76b; }
.lamp.yellow { background: radial-gradient(circle at 34% 28%, #fff6b8, #f5cf25 46%, #9a7a00 100%); --lamp-glow: #f5cf25; }
.lamp.red { background: radial-gradient(circle at 34% 28%, #ffc2bb, #ef3b2d 46%, #8d0f08 100%); --lamp-glow: #ef3b2d; }
.lamp.white { background: radial-gradient(circle at 34% 28%, #ffffff, #e6e6e6 52%, #b9b9b9 100%); --lamp-glow: #ffffff; }
.lamp.green-yellow { background: linear-gradient(180deg, #34d76b 0 50%, #f5cf25 50% 100%); --lamp-glow: #c9e04a; }
.lamp.red-yellow { background: linear-gradient(180deg, #ef3b2d 0 50%, #f5cf25 50% 100%); --lamp-glow: #f28a2a; }
.lamp.red-white { background: linear-gradient(180deg, #ef3b2d 0 50%, #f2f2f2 50% 100%); --lamp-glow: #ef3b2d; }
.lamp.red-blue { background: linear-gradient(180deg, #ef3b2d 0 50%, #3d8fe0 50% 100%); --lamp-glow: #7a5bd6; }
.lamp.double-yellow {
    background: linear-gradient(180deg, #f5cf25 0 46%, #1c1c1c 46% 54%, #f5cf25 54% 100%);
    --lamp-glow: #f5cf25;
}
.lamp.yellow-two { background: radial-gradient(circle at 34% 28%, #fff6b8, #f5cf25 46%, #9a7a00 100%); --lamp-glow: #f5cf25; }
.lamp.yellow-two::after {
    content: "Ⅱ"; position: absolute; inset: 0; display: grid; place-items: center;
    font-family: var(--font-mono); font-size: 15px; color: rgba(0, 0, 0, .62); font-weight: 700;
}
.signal-card .lamp-cap { position: absolute; inset: -6px; border-radius: 50%; border: 1px dashed var(--line-2); opacity: .55; }

/* search results */
.search-results {
    border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--panel);
    margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.sr-head { padding: 9px 13px; font-size: 11px; color: var(--text-3); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; letter-spacing: .08em; }
.sr-list { max-height: 320px; overflow-y: auto; }
.sr-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    padding: 10px 13px; border: 0; background: transparent; border-bottom: 1px solid var(--line);
    text-align: left; transition: background .2s; animation: srIn .3s var(--ease) both;
}
@keyframes srIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.is-active { background: var(--panel-2); }
.sr-main { display: grid; gap: 1px; min-width: 0; }
.sr-name { font-size: 13.5px; }
.sr-name mark { background: var(--solid); color: var(--solid-ink); border-radius: 3px; padding: 0 2px; }
.sr-cat { font-size: 10.5px; color: var(--text-3); }
.sr-add { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; flex: none; }
.sr-item:hover .sr-add { border-color: var(--line-3); color: var(--text); }
.sr-empty { padding: 18px 13px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------- sequencer ---------- */
.sequencer {
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel-2);
    padding: 16px; display: flex; flex-direction: column; position: sticky; top: 72px;
    max-height: calc(100vh - 100px); transition: border-color .4s, transform .4s var(--ease);
}
.sequencer.drag-active { border-color: var(--line-3); }
.sequencer.flash { animation: seqFlash .9s var(--ease); }
@keyframes seqFlash {
    0% { box-shadow: 0 0 0 0 var(--line-3); }
    40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 12%, transparent); }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.seq-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seq-title { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.seq-count {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0; padding: 1px 7px; border-radius: 999px;
    background: var(--panel-3); border: 1px solid var(--line); color: var(--text-2);
}
.seq-tools { display: flex; gap: 4px; }
.mini-btn {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
    border: 1px solid var(--line); background: transparent; color: var(--text-2);
    transition: all .3s var(--ease);
}
.mini-btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-3); background: var(--panel); transform: translateY(-1px); }
.mini-btn:disabled { opacity: .35; cursor: not-allowed; }
.mini-btn.danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.seq-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin: 10px 0 8px; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; display: inline-block; }

.seq-list {
    flex: 1; min-height: 160px; overflow-y: auto; padding: 4px; margin: 0 -4px;
    display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}
.seq-list:empty::after {
    content: attr(data-empty); display: grid; place-items: center; height: 100%; min-height: 150px;
    font-size: 12px; color: var(--text-3); text-align: center; padding: 0 24px; line-height: 1.8;
}
.seq-list::-webkit-scrollbar { width: 6px; }
.seq-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.seq-item {
    display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--panel); cursor: grab;
    transition: border-color .25s, background .25s, transform .25s var(--ease), box-shadow .25s;
    position: relative; animation: seqIn .38s var(--ease) both; touch-action: pan-y;
}
@keyframes seqIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.seq-item:hover { border-color: var(--line-2); }
.seq-item.is-dragging { opacity: .45; cursor: grabbing; transform: scale(.98); }
.seq-item.is-over { border-color: var(--line-3); box-shadow: inset 0 2px 0 var(--text-3); }
.seq-item.is-playing { border-color: var(--line-3); background: var(--panel-3); }
.seq-item .idx {
    font-family: var(--font-mono); font-size: 10px; color: var(--text-3); width: 20px; flex: none;
    text-align: right;
}
.seq-item .grab { color: var(--text-3); opacity: .6; flex: none; display: grid; place-items: center; }
.seq-item .name { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-item .dur { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); flex: none; }
.seq-item .del {
    flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid transparent;
    background: transparent; color: var(--text-3); display: grid; place-items: center; font-size: 13px;
    transition: all .25s;
}
.seq-item .del:hover { color: var(--danger); border-color: var(--danger); transform: rotate(90deg); }
.seq-item.enter { animation: seqAdd .5s var(--ease); }
@keyframes seqAdd { 0% { opacity: 0; transform: translateY(-12px) scale(.94); } 60% { opacity: 1; } 100% { transform: none; } }
.seq-item.leave { animation: seqOut .32s var(--ease) forwards; pointer-events: none; }
@keyframes seqOut { to { opacity: 0; transform: translateX(28px) scale(.94); height: 0; padding-top: 0; padding-bottom: 0; margin-top: -6px; } }

.seq-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.seq-actions .btn { padding: 11px 12px; font-size: 13px; }
.seq-actions .btn:first-child { grid-column: span 2; }

.seq-progress { margin-top: 10px; }
.seq-progress-bar { height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.seq-progress-bar span { display: block; height: 100%; width: 0; background: var(--solid); border-radius: inherit; transition: width .3s var(--ease); }
.seq-progress-text { font-size: 11px; color: var(--text-3); margin-top: 6px; font-family: var(--font-mono); display: flex; justify-content: space-between; }

/* item empty state */
.empty-area { display: grid; place-items: center; min-height: 220px; color: var(--text-3); font-size: 13px; gap: 10px; text-align: center; }

/* ---------- footer ---------- */
.site-foot { position: relative; z-index: 2; border-top: 1px solid var(--line); margin-top: 20px; padding: 34px 24px 40px; }
.foot-rotator { max-width: var(--maxw); margin: 0 auto 18px; height: 26px; overflow: hidden; position: relative; }
.rotator-item {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 13px; letter-spacing: .1em; color: var(--text-2);
    opacity: 0; transform: translateY(120%); transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.rotator-item.is-active { opacity: 1; transform: none; }
.rotator-item.is-out { opacity: 0; transform: translateY(-120%); }
.foot-actions { max-width: var(--maxw); margin: 0 auto 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.foot-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px;
    border: 1px solid var(--line-2); background: transparent; color: var(--text-2);
    font-size: 12.5px; text-decoration: none; transition: all .3s var(--ease);
}
.foot-btn:hover { color: var(--text); border-color: var(--line-3); transform: translateY(-2px); }
.foot-btn.is-disabled { opacity: .45; pointer-events: none; }
.foot-fine {
    max-width: var(--maxw); margin: 0 auto; display: flex; gap: 10px; align-items: center; justify-content: center;
    flex-wrap: wrap; font-size: 11px; color: var(--text-3); text-align: center;
}

/* ---------- mobile bar ---------- */
.mobile-bar {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--line);
    animation: barUp .45s var(--ease);
}
@keyframes barUp { from { transform: translateY(100%); } to { transform: none; } }
.mb-info {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-bottom: 8px;
    background: transparent; border: 0; padding: 2px 2px; text-align: left;
}
.mb-info .mb-jump { color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.mb-actions { display: flex; gap: 8px; }
.mb-btn {
    flex: 1; padding: 11px; border-radius: 11px; border: 1px solid var(--solid);
    background: var(--solid); color: var(--solid-ink); font-size: 13px; font-weight: 600;
}
.mb-btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.mb-btn:active { transform: scale(.97); }

/* ---------- toast ---------- */
.toast-stack {
    position: fixed; z-index: 90; left: 50%; bottom: 26px; transform: translateX(-50%);
    display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none;
    width: min(92vw, 460px);
}
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: 13px; border: 1px solid var(--line-2);
    background: color-mix(in srgb, var(--panel) 94%, transparent); color: var(--text);
    box-shadow: var(--shadow); font-size: 13px; line-height: 1.55; width: 100%;
    animation: toastIn .45s var(--ease) both; backdrop-filter: blur(14px);
}
.toast.is-out { animation: toastOut .35s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
.toast .t-ico { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-3); font-size: 11px; margin-top: 1px; }
.toast.ok .t-ico { color: var(--ok); border-color: var(--ok); }
.toast.err .t-ico { color: var(--danger); border-color: var(--danger); }
.toast .t-body { min-width: 0; }
.toast .t-title { font-weight: 600; margin-bottom: 2px; }
.toast .t-sub { font-size: 11.5px; color: var(--text-2); }

/* ---------- modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px;
    background: rgba(0, 0, 0, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    animation: fadeIn .3s var(--ease); overflow-y: auto;
}
:root[data-theme="light"] .modal-overlay { background: rgba(20, 20, 24, .32); }
.modal {
    width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line-2);
    border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
    animation: modalIn .45s var(--ease); margin: auto;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
    color: var(--text-2); font-size: 17px; line-height: 1; display: grid; place-items: center;
    transition: all .3s var(--ease);
}
.modal-close:hover { transform: rotate(90deg); color: var(--text); border-color: var(--line-3); }
.modal-body { padding: 16px 22px; }
.modal-sub { margin: 0 0 14px; font-size: 12.5px; color: var(--text-3); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 20px; flex-wrap: wrap; }

.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.format-card { position: relative; cursor: pointer; }
.format-card input { position: absolute; opacity: 0; pointer-events: none; }
.format-inner {
    display: grid; gap: 4px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line-2);
    background: var(--panel-2); transition: all .3s var(--ease); height: 100%;
}
.format-card:hover .format-inner { border-color: var(--line-3); transform: translateY(-2px); }
.format-card input:checked + .format-inner { border-color: var(--solid); box-shadow: inset 0 0 0 1px var(--solid); }
.format-ico { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--text-3); }
.format-name { font-size: 14px; font-weight: 600; }
.format-desc { font-size: 11px; color: var(--text-3); line-height: 1.5; }

.export-progress { margin-top: 18px; }
.progress-track { height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--solid); border-radius: inherit; transition: width .3s var(--ease); position: relative; }
.progress-track span::after {
    content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    animation: shimmer 1.4s linear infinite;
}
:root[data-theme="light"] .progress-track span::after { background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .18), transparent); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 8px; font-family: var(--font-mono); }
.export-summary { margin-top: 14px; font-size: 12px; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; }
.export-summary .k { color: var(--text-2); }

.json-area {
    width: 100%; min-height: 190px; resize: vertical; padding: 12px; border-radius: var(--r-md);
    border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
    font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; outline: none;
    transition: border-color .3s, box-shadow .3s;
}
.json-area:focus { border-color: var(--line-3); box-shadow: 0 0 0 4px var(--glow); }
.json-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--text-3); }

/* ---------- theme transition ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-fade { animation: themeFade .55s var(--ease-soft); }
@keyframes themeFade { from { opacity: .55; } to { opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
    .loco-grid { grid-template-columns: 1fr; }
    .loco-preview { position: relative; top: 0; min-height: 200px; }
    .splice-layout { grid-template-columns: 1fr; }
    .sequencer { position: relative; top: 0; max-height: none; }
    .seq-list { max-height: 42vh; }
}

@media (max-width: 820px) {
    .site-head { padding: 18px 16px 0; }
    .wrap { padding: 24px 16px 120px; }
    .head-main { margin: 34px 0 20px; }
    .panel { padding: 20px; border-radius: 18px; }
    .panel-head { flex-direction: column; gap: 10px; }
    .panel::after { left: 20px; right: 20px; }
    .field-grid { grid-template-columns: 1fr; }
    .field.wide { grid-column: auto; }
    .loco-actions .btn { flex: 1 1 calc(50% - 9px); }
    .quick-nav-inner { padding: 8px 14px; gap: 2px; }
    .quick-link { padding: 8px 10px; font-size: 12px; }
    .cache-pill { display: none; }
    .site-foot { padding: 26px 16px 96px; }
    .mobile-bar { display: block; }
    .toast-stack { bottom: 92px; }
    .sound-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .signal-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
    .module-tabs { width: 100%; }
    .module-tab { flex: 1; padding: 10px 8px; font-size: 12.5px; }
    .module-tab .mt-sub { display: none; }
    .seq-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modal { width: 100%; }
    .modal-foot { padding: 12px 18px 18px; }
    .modal-foot .btn { flex: 1; }
    .format-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .head-tools .icon-btn { width: 36px; height: 36px; }
    .brand-text { display: none; }
    .site-title { letter-spacing: -.03em; }
    .head-meta { gap: 10px; }
    .notice { font-size: 11.5px; line-height: 1.8; }
    .view-toggle { display: none; }
    .seq-actions .btn { font-size: 12px; padding: 10px 8px; }
    .sound-btn { font-size: 12.5px; padding: 10px 6px; }
    .signal-card { padding: 12px 6px 10px; }
    .signal-card .lamp { width: 38px; height: 38px; }
    .signal-card .lamp-box { width: 46px; height: 46px; }
    .toast { font-size: 12.5px; }
}

/* touch devices: no sticky hover lift */
@media (hover: none) {
    .sound-btn:hover, .btn:hover, .signal-card:hover, .seq-item:hover { transform: none; }
}

/* print */
@media print {
    .atmosphere, .quick-nav, .mobile-bar, .toast-stack, .site-head, .site-foot, .seq-actions, .loco-actions { display: none !important; }
    body.app { background: #fff; color: #000; }
    .panel { box-shadow: none; border-color: #ddd; }
}
