:root {
    color-scheme: dark;
    font-family: Inter, Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #020c1b;
    color: #f5f8ff;
    --navy-950: #020c1b;
    --navy-900: #04152b;
    --navy-850: #071d38;
    --line: rgba(104, 174, 243, 0.34);
    --line-soft: rgba(122, 183, 241, 0.15);
    --text-muted: #a9bdd7;
    --mint: #6fe6d0;
    --cyan: #58c9ee;
    --blue: #5079fa;
}

html[data-theme="dark"],
body[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"],
body[data-theme="light"] {
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--navy-950);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 90% 20%, rgba(36, 102, 194, 0.16), transparent 32rem),
        linear-gradient(180deg, #020b19 0%, #04162b 45%, #020b18 100%);
}

p,
h1,
h2,
h3,
label,
button {
    word-break: keep-all;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(111, 230, 208, 0.46);
    outline-offset: 3px;
}

.app-shell {
    width: min(100%, 1180px);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
}

.hero {
    position: relative;
    min-height: 455px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    background-image:
        linear-gradient(90deg, rgba(2, 12, 27, 0.98) 0%, rgba(2, 13, 29, 0.88) 36%, rgba(3, 18, 38, 0.18) 69%, rgba(3, 18, 38, 0.05) 100%),
        linear-gradient(0deg, rgba(3, 17, 35, 0.45), transparent 44%),
        url("assets/tinnitus-night-hero.png");
    background-position: center;
    background-size: cover;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
}

.app-actions {
    position: absolute;
    z-index: 3;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 9px;
}

.header-icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(130, 193, 244, 0.35);
    border-radius: 12px;
    background: rgba(3, 20, 42, 0.72);
    color: #d9ebff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.language-button {
    font-size: 1.15rem;
    color: #d9ebff;
}

.language-menu {
    position: fixed;
    top: calc(max(16px, env(safe-area-inset-top)) + 58px);
    right: max(12px, calc((100vw - 1180px) / 2 + 20px));
    z-index: 5000;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 190px;
    max-height: min(70vh, 360px);
    overflow-y: auto;
    padding: 7px;
    border: 1px solid rgba(130, 193, 244, 0.36);
    border-radius: 13px;
    background: rgba(4, 21, 43, 0.97);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
}

.language-menu[hidden] {
    display: none;
}

.language-menu button {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    background: transparent;
    color: #cfe1f5;
    text-align: left;
}

.language-menu button:hover,
.language-menu button.is-current {
    background: rgba(111, 230, 208, 0.15);
    color: #7bf0db;
}

.sun-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow:
        0 -9px 0 -7px currentColor,
        0 9px 0 -7px currentColor,
        9px 0 0 -7px currentColor,
        -9px 0 0 -7px currentColor;
    transition: opacity 160ms ease, transform 160ms ease;
}

.moon-icon {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: -5px 3px 0 0 currentColor;
    opacity: 0;
    transform: rotate(-18deg) scale(0.72);
    transition: opacity 160ms ease, transform 160ms ease;
}

.hero-copy {
    position: relative;
    z-index: 1;
    width: min(58%, 640px);
    padding: 44px;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--mint);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wave-mark {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.wave-mark i {
    display: block;
    width: 2px;
    height: 8px;
    border-radius: 2px;
    background: var(--mint);
}

.wave-mark i:nth-child(2),
.wave-mark i:nth-child(4) {
    height: 18px;
}

.wave-mark i:nth-child(3) {
    height: 26px;
}

.hero h1 {
    max-width: 570px;
    margin: 0;
    font-size: clamp(2.4rem, 5.2vw, 4.2rem);
    line-height: 1.12;
    letter-spacing: 0;
    text-wrap: balance;
}

.hero h1 span {
    display: inline;
}

.hero-description {
    margin: 22px 0 0;
    color: #d5e0ee;
    font-size: 1.08rem;
    line-height: 1.75;
}

.safety-notice {
    display: flex;
    align-items: center;
    gap: 22px;
    width: min(100%, 530px);
    margin-top: 24px;
    padding: 18px 22px;
    border: 1px solid rgba(126, 190, 244, 0.32);
    border-radius: 16px;
    background: rgba(10, 37, 68, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.safety-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 52px;
    border: 3px solid var(--mint);
    border-radius: 22px 22px 26px 26px;
    color: var(--mint);
    font-size: 1.8rem;
    font-weight: 500;
}

.safety-notice p {
    margin: 0;
    color: #d5e1ef;
    line-height: 1.58;
}

.safety-notice strong {
    color: var(--mint);
}

.workspace {
    display: grid;
    gap: 20px;
    padding-top: 20px;
}

.surface {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(12, 39, 73, 0.92), rgba(3, 19, 39, 0.97)),
        var(--navy-900);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 18px 44px rgba(0, 0, 0, 0.22);
}

.master-card {
    padding: 22px;
}

.master-heading {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 0 14px 18px;
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 70px;
    height: 70px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(62, 116, 182, 0.34), rgba(18, 48, 85, 0.44));
    color: #b6d5ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sliders-icon i {
    position: relative;
    width: 3px;
    height: 34px;
    border-radius: 4px;
    background: currentColor;
}

.sliders-icon i::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    transform: translate(-50%, 7px);
}

.sliders-icon i:nth-child(2)::after {
    transform: translate(-50%, 18px);
}

.sliders-icon i:nth-child(3)::after {
    transform: translate(-50%, 2px);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.master-heading h2,
.layer-toolbar h2,
.recipe-card h2 {
    margin: 0;
    font-size: 1.7rem;
    letter-spacing: 0;
}

.master-heading p:last-child,
.layer-toolbar p,
.section-title p {
    margin: 7px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.cockpit-switch {
    display: grid;
    gap: 7px;
    width: 96px;
    padding: 12px 10px;
    border: 1px solid rgba(112, 180, 240, 0.34);
    border-radius: 28px;
    background: rgba(3, 16, 35, 0.78);
    color: #7b9abc;
    box-shadow: inset 0 8px 26px rgba(0, 0, 0, 0.28);
    filter: saturate(0.28) brightness(0.64);
    opacity: 0.72;
    transition: filter 180ms ease, opacity 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.switch-label {
    font-size: 0.88rem;
    line-height: 1;
}

.switch-track {
    position: relative;
    width: 60px;
    height: 104px;
    margin: 0 auto;
    border: 1px solid rgba(113, 228, 208, 0.6);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(92, 111, 126, 0.3), rgba(21, 35, 48, 0.6));
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.4);
}

.switch-lever {
    position: absolute;
    left: 7px;
    bottom: 7px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, #aeb8c3, #667382);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.cockpit-switch.is-on {
    color: #ecffff;
    filter: saturate(1) brightness(1);
    opacity: 1;
    border-color: rgba(111, 230, 208, 0.5);
    box-shadow: inset 0 8px 26px rgba(0, 0, 0, 0.24), 0 0 22px rgba(78, 201, 235, 0.13);
}

.cockpit-switch.is-on .switch-track {
    background: linear-gradient(180deg, rgba(83, 226, 203, 0.5), rgba(16, 69, 101, 0.5));
    box-shadow: inset 0 0 18px rgba(86, 232, 210, 0.3), 0 0 18px rgba(78, 201, 235, 0.15);
}

.cockpit-switch.is-on .switch-lever {
    transform: translateY(-46px);
    background: linear-gradient(180deg, #ffffff, #c9e9e6);
    box-shadow: 0 0 24px rgba(111, 230, 208, 0.58), 0 6px 18px rgba(0, 0, 0, 0.38);
}

.cockpit-switch.is-on .switch-label-on,
.cockpit-switch:not(.is-on) .switch-label-off {
    color: #fff;
}

.master-volume-panel {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    padding: 18px 24px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: rgba(3, 18, 38, 0.54);
}

.master-volume-panel label {
    color: #c3d0e0;
    font-size: 1.06rem;
    font-weight: 700;
}

.master-volume-panel output {
    color: var(--mint);
    font-size: 1.55rem;
    font-weight: 700;
}

.range-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 12px;
}

.range-icon {
    color: #7abbea;
    font-size: 1.7rem;
    text-align: center;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    margin: 14px 0;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--mint) 0 var(--range-progress, 40%), #294aa2 var(--range-progress, 40%) 100%);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    appearance: none;
    border: 3px solid #e8f5ff;
    border-radius: 50%;
    background: #eef7ff;
    box-shadow: 0 0 0 5px rgba(92, 161, 230, 0.18), 0 4px 12px rgba(0, 0, 0, 0.32);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: 3px solid #e8f5ff;
    border-radius: 50%;
    background: #eef7ff;
}

input[type="range"]:disabled {
    cursor: default;
}

.master-card.is-off .master-heading > :not(.cockpit-switch),
.master-card.is-off .master-volume-panel {
    filter: saturate(0.28) brightness(0.66);
    opacity: 0.62;
}

.master-card.is-off .master-volume-panel input[type="range"] {
    background: #324458;
}

.master-card.is-off .master-volume-panel input[type="range"]::-webkit-slider-thumb {
    border-color: #8794a2;
    background: #aeb8c2;
    box-shadow: none;
}

.master-card.is-off .master-volume-panel output {
    color: #82909f;
}

.control-note {
    grid-column: 1 / -1;
    margin: 0;
    color: #afc1d7;
    font-size: 0.9rem;
    line-height: 1.55;
}

.control-note span {
    margin-right: 6px;
    color: var(--cyan);
}

.notice {
    grid-column: 1 / -1;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid rgba(255, 142, 135, 0.28);
    border-radius: 9px;
    background: rgba(123, 40, 48, 0.24);
    color: #ffd9d5;
    font-size: 0.78rem;
    line-height: 1.35;
    opacity: 1;
    visibility: visible;
    transition: opacity 130ms ease, visibility 130ms ease;
}

.hidden {
    display: none;
}

.notice.hidden {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.layer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    padding: 0 24px;
    border: 1px solid rgba(106, 231, 213, 0.54);
    border-radius: 13px;
    background: linear-gradient(110deg, var(--mint), #58bde6 52%, var(--blue));
    color: #03152b;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(53, 126, 235, 0.24);
}

.primary-button:hover {
    filter: brightness(1.08);
}

.layer-list {
    display: grid;
    gap: 18px;
}

.layer-card {
    padding: 24px 28px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(7, 32, 62, 0.97), rgba(3, 17, 34, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 44px rgba(0, 0, 0, 0.2);
    transition: opacity 160ms ease, border-color 160ms ease;
}

.layer-card.disabled {
    background: linear-gradient(135deg, rgba(5, 17, 32, 0.98), rgba(2, 10, 21, 0.99));
    border-color: rgba(111, 145, 177, 0.16);
    box-shadow: none;
}

.layer-card.disabled .layer-title,
.layer-card.disabled .layer-card-body {
    opacity: 0.42;
    filter: saturate(0.28) brightness(0.72);
}

.layer-card.disabled .layer-power-switch {
    color: #c4cfdb;
    background: rgba(35, 48, 62, 0.95);
    border-color: rgba(141, 169, 196, 0.42);
}

.layer-card.disabled .power-dot {
    background: #5d6875;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.48);
}

.layer-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.layer-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.layer-wave-icon,
.section-wave {
    color: var(--cyan);
    font-size: 2rem;
    line-height: 1;
}

.layer-card-header h3 {
    margin: 0 0 5px;
    font-size: 1.45rem;
}

.layer-card-description {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.layer-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.layer-power-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: rgba(11, 39, 73, 0.76);
    color: #95abc5;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.layer-power-switch .power-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #35506d;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.32);
}

.layer-power-switch.is-on {
    color: #fff;
    border-color: rgba(111, 230, 208, 0.38);
    background: rgba(11, 56, 83, 0.82);
}

.layer-power-switch.is-on .power-dot {
    background: var(--mint);
    box-shadow: 0 0 16px rgba(111, 230, 208, 0.64);
}

.icon-button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line-soft);
    border-radius: 13px;
    background: rgba(9, 35, 67, 0.72);
    color: #9db9db;
    font-size: 1.4rem;
}

.layer-card-body {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(250px, 1.12fr) minmax(210px, 1fr);
    gap: 28px;
    align-items: center;
}

.control-column {
    display: grid;
    gap: 24px;
}

.field-label,
.control-column label,
.recipe-fields label {
    display: grid;
    gap: 9px;
    color: #c4d1e1;
    font-size: 0.92rem;
}

.channel-status {
    min-height: 52px;
    padding: 15px 16px;
    border: 1px solid rgba(111, 171, 231, 0.18);
    border-radius: 12px;
    background: rgba(5, 22, 44, 0.46);
    color: #a8bdd6;
}

.pan-control {
    gap: 5px !important;
}

.pan-readout {
    display: grid;
    grid-template-columns: 24px 1fr 24px;
    align-items: center;
    color: #9eb2ca;
    font-size: 0.8rem;
    text-align: center;
}

.pan-readout strong {
    color: var(--mint);
    font-size: 0.86rem;
    font-weight: 700;
}

.pan-control input[type="range"] {
    height: 6px;
    margin: 8px 0 0;
}

select,
input[type="text"] {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid rgba(111, 171, 231, 0.26);
    border-radius: 12px;
    background: rgba(5, 22, 44, 0.86);
    color: #f3f8ff;
    outline: none;
}

.volume-readout {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    color: var(--mint);
    font-size: 1.2rem;
}

.volume-readout small {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.knob-panel {
    display: grid;
    justify-items: center;
    gap: 16px;
}

.knob-wrapper {
    position: relative;
    display: grid;
    place-items: center;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background:
        repeating-conic-gradient(from -110deg, rgba(92, 204, 237, 0.7) 0 1deg, transparent 1deg 5deg),
        conic-gradient(from -110deg, var(--mint) 0deg, var(--cyan) 112deg, rgba(42, 95, 154, 0.22) 112deg 220deg, transparent 220deg);
    box-shadow: 0 0 32px rgba(46, 133, 216, 0.16);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.knob-wrapper::before {
    content: "";
    position: absolute;
    inset: 15px;
    border-radius: 50%;
    background: #06172c;
    border: 2px solid rgba(56, 129, 208, 0.72);
    box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.46);
}

.knob-wrapper.dragging {
    cursor: grabbing;
}

.knob-display,
.knob-ring {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 172px;
    height: 172px;
    border-radius: 50%;
}

.knob-pointer {
    position: absolute;
    top: -19px;
    left: 50%;
    width: 7px;
    height: 32px;
    border-radius: 5px;
    background: var(--mint);
    transform-origin: center 105px;
    box-shadow: 0 0 12px rgba(111, 230, 208, 0.82);
}

.knob-value {
    color: #fff;
    font-size: 2.3rem;
    font-weight: 750;
    pointer-events: none;
}

.knob-value .unit {
    font-size: 1.05rem;
    font-weight: 500;
}

.knob-label {
    position: absolute;
    top: 138px;
    color: #9ab1ce;
    font-size: 0.88rem;
    pointer-events: none;
}

.fine-buttons {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.fine-buttons button {
    min-height: 44px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: rgba(12, 42, 78, 0.72);
    color: #c9d8eb;
}

.fine-buttons button:hover {
    border-color: var(--mint);
    color: var(--mint);
}

.ambient-note {
    grid-column: 1 / -1;
    margin: 0;
    padding: 13px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    color: #9fb5ce;
    text-align: center;
    line-height: 1.5;
}

.recipe-card {
    display: grid;
    gap: 20px;
    padding: 28px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 13px;
}

.section-title h2 {
    font-size: 1.5rem;
}

.recipe-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.save-button {
    width: 100%;
}

.saved-list-container {
    padding-top: 4px;
}

.saved-list-container h3 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.saved-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.recipe-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 15px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(3, 18, 37, 0.55);
}

.recipe-item span {
    display: grid;
    gap: 4px;
}

.recipe-item small {
    color: var(--text-muted);
}

.recipe-item button {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(15, 51, 91, 0.72);
    color: #d9e7f8;
}

.recipe-empty {
    color: #91a9c5;
    padding: 8px 0;
}

.install-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    border: 1px solid rgba(111, 230, 208, 0.3);
    border-radius: 18px;
    background: rgba(5, 27, 51, 0.74);
}

.install-panel h2 {
    margin: 0;
    font-size: 1.35rem;
}

.install-panel p:last-child {
    margin: 7px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.install-panel [hidden] {
    display: none;
}

.app-footer {
    padding: 8px 0 2px;
    color: rgba(169, 189, 215, 0.72);
    font-size: 12.5px;
    line-height: 1.5;
    text-align: center;
}

.app-footer a {
    margin-left: 8px;
    color: rgba(169, 189, 215, 0.78);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 880px) {
    .app-shell {
        padding-inline: 12px;
    }

    .hero {
        min-height: 520px;
        background-image:
            linear-gradient(180deg, rgba(2, 12, 27, 0.72) 0%, rgba(2, 12, 27, 0.72) 52%, rgba(2, 12, 27, 0.98) 100%),
            url("assets/tinnitus-night-hero.png");
        background-position: 66% center;
    }

    html[data-theme="light"] .hero {
        background-image:
            linear-gradient(180deg, rgba(248, 252, 255, 0.42) 0%, rgba(248, 252, 255, 0.24) 52%, rgba(240, 249, 255, 0.92) 100%),
            url("assets/tinnitus-light-hero.png");
        background-position: 66% center;
    }

    .hero-copy {
        width: 100%;
        padding: 28px 24px;
    }

    .hero h1 {
        max-width: 520px;
        font-size: clamp(2.15rem, 9vw, 3.2rem);
    }

    .hero-description {
        font-size: 0.98rem;
    }

    .safety-notice {
        margin-top: 220px;
    }

    .layer-card-body {
        grid-template-columns: 1fr 1fr;
    }

    .knob-panel {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .fine-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .app-shell {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-inline: 8px;
    }

    .hero {
        min-height: 540px;
        border-radius: 18px 18px 0 0;
    }

    .hero-copy {
        padding: 24px 18px;
    }

    .app-actions {
        top: 14px;
        right: 14px;
        gap: 7px;
    }

    .header-icon-button {
        width: 40px;
        height: 40px;
    }

    .brand-mark {
        margin-bottom: 18px;
        font-size: 0.72rem;
    }

    .hero-description br {
        display: none;
    }

    .hero h1 span {
        display: block;
    }

    .safety-notice {
        gap: 14px;
        margin-top: 230px;
        padding: 15px;
        font-size: 0.85rem;
    }

    .safety-icon {
        width: 40px;
        height: 46px;
    }

    .workspace {
        gap: 14px;
        padding-top: 14px;
    }

    .surface,
    .layer-card {
        border-radius: 17px;
    }

    .master-card,
    .layer-card,
    .recipe-card {
        padding: 16px;
    }

    .master-heading {
        grid-template-columns: 54px 1fr 72px;
        gap: 12px;
        padding: 0 0 16px;
    }

    .feature-icon {
        width: 54px;
        height: 54px;
    }

    .master-heading h2,
    .layer-toolbar h2 {
        font-size: 1.35rem;
    }

    .master-heading p:last-child {
        display: none;
    }

    .cockpit-switch {
        width: 70px;
        padding: 8px 6px;
        border-radius: 22px;
    }

    .switch-label {
        font-size: 0.7rem;
    }

    .switch-track {
        width: 42px;
        height: 72px;
    }

    .switch-lever {
        left: 5px;
        bottom: 5px;
        width: 30px;
        height: 30px;
    }

    .cockpit-switch.is-on .switch-lever {
        transform: translateY(-30px);
    }

    .master-volume-panel {
        padding: 15px;
    }

    .range-row {
        grid-template-columns: 26px 1fr 26px;
        gap: 6px;
    }

    .layer-toolbar {
        align-items: stretch;
        flex-direction: column;
        padding: 18px;
    }

    .layer-toolbar .primary-button {
        width: 100%;
    }

    .layer-card-header {
        align-items: flex-start;
    }

    .layer-title {
        gap: 9px;
    }

    .layer-wave-icon {
        font-size: 1.4rem;
    }

    .layer-card-header h3 {
        font-size: 1.2rem;
    }

    .layer-card-description {
        max-width: 170px;
        line-height: 1.4;
    }

    .layer-power-switch {
        min-height: 42px;
        padding-inline: 10px;
    }

    .layer-power-switch .power-dot {
        width: 20px;
        height: 20px;
    }

    .icon-button {
        width: 42px;
        height: 42px;
    }

    .layer-card-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .knob-panel {
        grid-column: auto;
        grid-row: auto;
    }

    .knob-wrapper {
        width: 210px;
        height: 210px;
    }

    .knob-display,
    .knob-ring {
        width: 156px;
        height: 156px;
    }

    .knob-pointer {
        transform-origin: center 97px;
    }

    .knob-label {
        top: 126px;
    }

    .fine-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-top: 4px;
    }

    .fine-buttons button {
        min-height: 46px;
        font-size: 0.82rem;
    }

    .recipe-fields {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .install-panel {
        align-items: stretch;
        flex-direction: column;
        padding: 20px;
    }

    .install-panel .primary-button {
        width: 100%;
    }

    .recipe-item {
        align-items: stretch;
        flex-direction: column;
    }
}

html[data-theme="light"] {
    color-scheme: light;
    background: #eaf3fb;
    color: #10253d;
    --navy-950: #eaf3fb;
    --navy-900: #f7fbff;
    --navy-850: #e8f2fb;
    --line: rgba(45, 104, 158, 0.3);
    --line-soft: rgba(45, 104, 158, 0.17);
    --text-muted: #536c86;
    --mint: #168d80;
    --cyan: #187fa8;
    --blue: #315fd2;
}

html[data-theme="light"] body {
    background:
        radial-gradient(circle at 90% 20%, rgba(85, 161, 215, 0.17), transparent 32rem),
        linear-gradient(180deg, #dcecf8 0%, #f8fbfe 48%, #e5eff7 100%);
}

html[data-theme="light"] .sun-icon {
    opacity: 0;
    transform: rotate(25deg) scale(0.72);
}

html[data-theme="light"] .moon-icon {
    opacity: 1;
    transform: rotate(-18deg) scale(1);
}

html[data-theme="light"] .header-icon-button {
    border-color: rgba(160, 205, 235, 0.55);
    background: rgba(238, 248, 255, 0.86);
    color: #163f66;
}

html[data-theme="light"] .language-menu {
    border-color: rgba(83, 145, 197, 0.32);
    background: rgba(250, 253, 255, 0.98);
    box-shadow: 0 18px 42px rgba(65, 105, 140, 0.2);
}

html[data-theme="light"] .language-menu button {
    color: #234d74;
}

html[data-theme="light"] .language-menu button:hover,
html[data-theme="light"] .language-menu button.is-current {
    background: rgba(39, 160, 174, 0.12);
    color: #087f8e;
}

html[data-theme="light"] .hero {
    border-color: rgba(80, 142, 195, 0.48);
    box-shadow: 0 18px 50px rgba(46, 85, 119, 0.22);
    color: #0c3c7d;
    background-image:
        linear-gradient(90deg, rgba(248, 252, 255, 0.98) 0%, rgba(246, 252, 255, 0.82) 42%, rgba(240, 249, 255, 0.12) 72%, rgba(240, 249, 255, 0.02) 100%),
        linear-gradient(0deg, rgba(232, 246, 255, 0.24), transparent 42%),
        url("assets/tinnitus-light-hero.png");
}

html[data-theme="light"] .hero .brand-mark,
html[data-theme="light"] .hero .safety-notice strong {
    color: #168fbb;
}

html[data-theme="light"] .hero-description {
    color: #365d8a;
}

html[data-theme="light"] .safety-notice {
    border-color: rgba(85, 151, 211, 0.32);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 28px rgba(77, 128, 172, 0.13);
}

html[data-theme="light"] .safety-notice p {
    color: #36536f;
}

html[data-theme="light"] .safety-icon {
    border-color: #24b7cf;
    color: #168fbb;
}

html[data-theme="light"] .surface,
html[data-theme="light"] .layer-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(227, 240, 250, 0.98));
    color: #10253d;
    box-shadow: inset 0 1px 0 #fff, 0 14px 36px rgba(57, 91, 122, 0.13);
}

html[data-theme="light"] .master-volume-panel,
html[data-theme="light"] .channel-status,
html[data-theme="light"] .install-panel,
html[data-theme="light"] .recipe-item {
    background: rgba(234, 244, 252, 0.9);
    color: #19344f;
}

html[data-theme="light"] .master-heading p:last-child,
html[data-theme="light"] .layer-toolbar p,
html[data-theme="light"] .section-title p,
html[data-theme="light"] .control-note,
html[data-theme="light"] .layer-card-description,
html[data-theme="light"] .install-panel p:last-child {
    color: #536c86;
}

html[data-theme="light"] .app-footer {
    color: rgba(83, 108, 134, 0.68);
}

html[data-theme="light"] .app-footer a {
    color: rgba(55, 85, 120, 0.72);
}

html[data-theme="light"] select,
html[data-theme="light"] input[type="text"] {
    border-color: rgba(44, 103, 156, 0.26);
    background: #f8fbfe;
    color: #10253d;
}

html[data-theme="light"] .layer-power-switch,
html[data-theme="light"] .icon-button,
html[data-theme="light"] .fine-buttons button,
html[data-theme="light"] .recipe-item button {
    background: rgba(218, 235, 248, 0.95);
    color: #284d70;
}

html[data-theme="light"] .master-card.is-off .master-heading > :not(.cockpit-switch),
html[data-theme="light"] .master-card.is-off .master-volume-panel {
    filter: saturate(0.2) brightness(0.94);
    opacity: 0.5;
}

html[data-theme="light"] .master-card.is-off .master-volume-panel input[type="range"] {
    background: #c5d0dc;
}

html[data-theme="light"] .pan-readout {
    color: #607a94;
}

html[data-theme="light"] .knob-wrapper::before {
    background: #eaf4fb;
    border-color: rgba(35, 111, 174, 0.68);
    box-shadow: inset 0 0 24px rgba(75, 120, 158, 0.16);
}

html[data-theme="light"] .knob-value {
    color: #10253d;
}

html[data-theme="light"] .knob-label {
    color: #56708a;
}

html[data-theme="light"] .layer-card.disabled {
    background: linear-gradient(145deg, rgba(211, 221, 229, 0.98), rgba(194, 207, 218, 0.98));
    border-color: rgba(69, 92, 112, 0.2);
}

html[data-theme="light"] .layer-card.disabled .layer-title,
html[data-theme="light"] .layer-card.disabled .layer-card-body {
    opacity: 0.46;
    filter: saturate(0.24) brightness(0.9);
}

html[data-theme="light"] .layer-card.disabled .layer-power-switch {
    background: #d6dee5;
    color: #42576a;
}

html[data-theme="light"] .notice {
    background: rgba(193, 73, 75, 0.1);
    color: #8b3035;
}

@media (max-width: 360px) {
    .hero h1 {
        font-size: 2rem;
        line-height: 1.18;
    }

    .hero-description {
        font-size: 0.92rem;
        line-height: 1.7;
    }

    .safety-notice {
        font-size: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* v07 compact detailed mode */
.compact-hero {
    min-height: 220px;
    border-radius: 22px;
    background-image:
        linear-gradient(90deg, rgba(2, 12, 27, 0.95), rgba(5, 30, 58, 0.68)),
        url("assets/tinnitus-night-hero.png");
}

.compact-hero .hero-copy {
    max-width: 720px;
    padding: 54px 38px 32px;
}

.compact-hero h1 {
    margin: 14px 0 8px;
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.compact-hero .hero-description {
    max-width: 620px;
    margin-bottom: 16px;
    white-space: pre-line;
}

.compact-master-card,
.compact-layer-toolbar,
.selected-layer-card,
.compact-recipe-card {
    padding: 18px 20px;
}

.compact-master-card .master-heading {
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    margin-bottom: 14px;
}

.compact-master-card .feature-icon {
    width: 54px;
    height: 54px;
}

.compact-master-card h2 {
    font-size: 1.45rem;
}

.compact-master-card .master-volume-panel {
    padding: 14px 16px;
}

.master-card.is-off {
    opacity: 0.9;
    filter: saturate(0.84) brightness(0.9);
}

.master-card.is-off .cockpit-switch {
    opacity: 1;
    filter: none;
}

.compact-layer-toolbar {
    align-items: center;
}

.compact-layer-toolbar h2 {
    font-size: 1.35rem;
}

.compact-layer-toolbar p {
    margin-top: 5px;
}

.summary-layer-list {
    gap: 10px;
}

.layer-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: rgba(7, 32, 62, 0.84);
}

.layer-summary.is-selected {
    border: 2px solid rgba(111, 230, 208, 0.9);
    box-shadow: 0 0 0 2px rgba(111, 230, 208, 0.08);
}

.layer-summary.disabled {
    background: rgba(5, 22, 44, 0.62);
}

.layer-summary.disabled .summary-main {
    opacity: 0.72;
}

.summary-main {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.summary-main strong {
    overflow: hidden;
    color: #fff;
    font-size: 1.05rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-main span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.summary-title {
    color: var(--mint) !important;
    font-size: 0.78rem !important;
    font-weight: 800;
}

.summary-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-delete-button {
    display: grid;
    place-items: center;
    width: 46px;
    min-width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 126, 126, 0.46);
    border-radius: 13px;
    background: rgba(102, 31, 48, 0.48);
    color: #ffd8d8;
    font-size: 1.45rem;
    line-height: 1;
    font-weight: 700;
}

.summary-delete-button:hover {
    border-color: rgba(255, 154, 154, 0.74);
    background: rgba(122, 38, 56, 0.72);
}

.secondary-button,
.danger-button {
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(12, 42, 78, 0.72);
    color: #d9e7f8;
    font-weight: 800;
}

.secondary-button.small {
    min-height: 44px;
    padding-inline: 13px;
}

.danger-button {
    border-color: rgba(255, 126, 126, 0.5);
    background: rgba(102, 31, 48, 0.82);
    color: #ffe1e1;
}

.selected-detail {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.selected-detail.disabled {
    opacity: 1;
    filter: none;
}

.selected-detail.disabled .selected-control-grid,
.selected-detail.disabled .fine-buttons {
    opacity: 0.5;
}

.selected-detail.enabled .selected-control-grid,
.selected-detail.enabled .fine-buttons {
    opacity: 1;
}

.selected-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.selected-detail-heading h2 {
    margin: 2px 0 4px;
    font-size: 1.5rem;
}

.selected-detail-heading p:last-child {
    margin: 0;
    color: var(--text-muted);
}

.selected-control-grid {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    gap: 20px;
}

.selected-detail .control-column {
    gap: 16px;
}

.selected-detail .knob-wrapper {
    width: 198px;
    height: 198px;
}

.selected-detail .knob-display,
.selected-detail .knob-ring {
    width: 150px;
    height: 150px;
}

.selected-detail .knob-pointer {
    transform-origin: center 94px;
}

.selected-detail .knob-value {
    font-size: 1.9rem;
}

.selected-detail .knob-label {
    top: 119px;
}

.selected-detail .fine-buttons {
    margin-top: 14px;
}

@media (max-width: 1079px) {
    .selected-control-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .selected-detail .knob-panel {
        order: -1;
    }

    .selected-detail .fine-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-top: 10px;
    }
}

@media (orientation: landscape) {
    .selected-control-grid {
        grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr) !important;
        align-items: center;
        gap: 20px;
    }

    .selected-detail .knob-panel {
        order: 0 !important;
    }

    .selected-detail .fine-buttons {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        gap: 10px;
        margin-top: 14px;
    }
}

@media (min-width: 720px) and (max-width: 1079px) and (orientation: landscape) {
    .selected-control-grid {
        grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.8fr) !important;
        align-items: start;
        gap: 22px;
    }

    .selected-detail .knob-panel {
        grid-column: 1 / -1;
        justify-self: center;
        order: -1 !important;
    }

    .selected-detail .control-column {
        min-width: 0;
        align-self: start;
    }

    .selected-detail .control-column > label:first-child {
        width: 100%;
    }

    .selected-detail select {
        width: 100%;
    }
}

.compact-recipe-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.intro-modal,
.save-modal,
.bottom-sheet {
    position: fixed;
    z-index: 3000;
    inset: 0;
}

.intro-modal,
.save-modal {
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(1, 8, 18, 0.72);
}

.intro-modal[hidden],
.save-modal[hidden],
.bottom-sheet[hidden],
.toast[hidden] {
    display: none;
}

.dialog-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    max-height: 88vh;
    overflow: auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #071d38;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.dialog-panel h2 {
    margin: 0 0 14px;
    font-size: 1.55rem;
}

.dialog-panel p {
    color: var(--text-muted);
    line-height: 1.7;
}

.dialog-panel .primary-button {
    width: 100%;
}

.dialog-scrim,
.sheet-scrim {
    position: absolute;
    inset: 0;
    background: rgba(1, 8, 18, 0.64);
}

.sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    overflow: auto;
    padding: 18px 18px max(22px, env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    background: #06172c;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.48);
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.sheet-header h2 {
    margin: 0;
    font-size: 1.35rem;
}

.sheet-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 14px;
}

.toast {
    position: fixed;
    z-index: 4000;
    left: 50%;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: min(calc(100% - 32px), 420px);
    transform: translateX(-50%);
    padding: 14px 16px;
    border: 1px solid rgba(111, 230, 208, 0.5);
    border-radius: 14px;
    background: rgba(5, 31, 58, 0.96);
    color: #fff;
    text-align: center;
    font-weight: 800;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

html[data-theme="light"] .compact-hero {
    background-image:
        linear-gradient(90deg, rgba(235, 247, 255, 0.96), rgba(235, 247, 255, 0.62)),
        url("assets/tinnitus-light-hero.png");
}

html[data-theme="light"] .layer-summary,
html[data-theme="light"] .dialog-panel,
html[data-theme="light"] .sheet-panel {
    background: rgba(255, 255, 255, 0.94);
}

html[data-theme="light"] .summary-main strong {
    color: #11376a;
}

html[data-theme="light"] .summary-delete-button {
    background: rgba(255, 241, 242, 0.96);
    color: #9f2f3f;
}

html[data-theme="light"] .dialog-scrim,
html[data-theme="light"] .sheet-scrim {
    background: rgba(206, 225, 242, 0.58);
}

@media (max-width: 760px) {
    .app-shell {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-inline: 8px;
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .compact-hero {
        min-height: 112px;
        border-radius: 16px;
        background-position: center 42%;
    }

    .compact-hero .hero-copy {
        padding: 38px 14px 12px;
    }

    .compact-hero h1 {
        margin: 8px 0 3px;
        font-size: 1.45rem;
        line-height: 1.15;
    }

    .compact-hero .brand-mark {
        font-size: 0.7rem;
    }

    .compact-hero .hero-description {
        max-width: 260px;
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.45;
    }

    .app-actions {
        top: 10px;
        right: 10px;
    }

    .header-icon-button {
        width: 38px;
        height: 38px;
    }

    .workspace {
        gap: 8px;
    }

    .compact-master-card,
    .compact-layer-toolbar,
    .selected-layer-card,
    .compact-recipe-card {
        padding: 10px;
        border-radius: 16px;
    }

    .compact-master-card .master-heading {
        grid-template-columns: 1fr auto;
        gap: 8px;
        margin-bottom: 8px;
        padding: 0;
    }

    .compact-master-card .feature-icon {
        display: none;
    }

    .compact-master-card h2,
    .compact-layer-toolbar h2 {
        font-size: 1.12rem;
    }

    .compact-master-card .eyebrow,
    .compact-master-card .master-heading p:last-child {
        display: none;
    }

    .compact-master-card .master-volume-panel {
        padding: 8px 10px;
        border-radius: 12px;
        gap: 4px 10px;
    }

    .compact-master-card .master-volume-panel label {
        font-size: 0.95rem;
    }

    .compact-master-card #masterVolumeLabel {
        font-size: 1.08rem;
    }

    .compact-master-card .range-row {
        gap: 8px;
        grid-template-columns: 22px 1fr 22px;
    }

    .compact-master-card .range-icon {
        font-size: 1.1rem;
    }

    .compact-master-card .notice.hidden {
        display: none;
    }

    .notice {
        min-height: 30px;
        margin-top: 8px;
        padding: 7px 10px;
        font-size: 0.8rem;
    }

    .cockpit-switch {
        display: grid;
        grid-template-columns: auto 48px auto;
        align-items: center;
        width: auto;
        min-height: 44px;
        padding: 7px 9px;
        gap: 6px;
        border-radius: 16px;
        transform: none;
    }

    .switch-label {
        font-size: 0.76rem;
    }

    .switch-track {
        width: 48px;
        height: 26px;
    }

    .switch-lever {
        left: 3px;
        bottom: 2px;
        width: 20px;
        height: 20px;
    }

    .cockpit-switch.is-on .switch-lever {
        transform: translateX(22px);
    }

    .compact-layer-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
    }

    .compact-layer-toolbar p {
        margin-top: 2px;
        font-size: 0.86rem;
        line-height: 1.35;
    }

    .compact-layer-toolbar .primary-button {
        width: 100%;
        min-height: 46px;
    }

    .layer-summary {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 8px;
        border-radius: 14px;
    }

    .summary-main strong {
        font-size: 1rem;
    }

    .summary-main span {
        font-size: 0.84rem;
    }

    .summary-title {
        font-size: 0.72rem !important;
    }

    .summary-actions {
        justify-content: space-between;
    }

    .summary-delete-button,
    .layer-power-switch {
        min-height: 42px;
        height: 42px;
    }

    .summary-delete-button {
        width: 42px;
        min-width: 42px;
    }

    .selected-detail-heading {
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 10px;
    }

    .selected-detail-heading h2 {
        font-size: 1.22rem;
    }

    .selected-detail-heading p:last-child {
        font-size: 0.86rem;
    }

    .selected-control-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .selected-detail .control-column {
        gap: 10px;
    }

    .selected-detail select,
    .selected-detail input[type="text"] {
        min-height: 46px;
    }

    .volume-readout {
        font-size: 1rem;
    }

    .selected-detail .knob-wrapper {
        width: min(58vw, 172px);
        height: min(58vw, 172px);
    }

    .selected-detail .knob-wrapper::before {
        inset: 12px;
    }

    .selected-detail .knob-display,
    .selected-detail .knob-ring {
        width: 126px;
        height: 126px;
    }

    .selected-detail .knob-pointer {
        height: 24px;
        transform-origin: center 77px;
    }

    .selected-detail .knob-value {
        font-size: 1.45rem;
    }

    .selected-detail .knob-label {
        top: 99px;
        font-size: 0.72rem;
    }

    .selected-detail .fine-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
        margin-top: 10px;
    }

    .selected-detail .fine-buttons button {
        min-height: 40px;
        font-size: 0.9rem;
    }

    .compact-recipe-card {
        grid-template-columns: 1fr;
    }

    .recipe-fields {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .sheet-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .compact-master-card {
        padding: 10px !important;
    }

    .compact-master-card .master-heading {
        padding: 0 !important;
        margin-bottom: 8px !important;
    }

    .compact-master-card .master-heading p:last-child,
    .compact-master-card .eyebrow {
        display: none !important;
    }

    .compact-master-card .master-volume-panel {
        padding: 8px 10px !important;
        gap: 4px 10px !important;
    }

    .compact-master-card .notice.hidden {
        display: none !important;
    }

    .compact-master-card .cockpit-switch {
        display: grid !important;
        grid-template-columns: auto 48px auto !important;
        align-items: center !important;
        width: auto !important;
        min-height: 44px !important;
        height: 44px !important;
        padding: 7px 9px !important;
        gap: 6px !important;
        border-radius: 16px !important;
        transform: none !important;
    }

    .compact-master-card .switch-track {
        width: 48px !important;
        height: 26px !important;
    }

    .compact-master-card .switch-lever {
        left: 3px !important;
        bottom: 2px !important;
        width: 20px !important;
        height: 20px !important;
    }

    .compact-master-card .cockpit-switch.is-on .switch-lever {
        transform: translateX(22px) !important;
    }
}

@media (orientation: landscape) {
    .selected-control-grid {
        grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr) !important;
        align-items: center !important;
        gap: 20px !important;
    }

    .selected-detail .knob-panel {
        order: 0 !important;
    }

    .selected-detail .fine-buttons {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        gap: 10px !important;
        margin-top: 14px !important;
    }
}

@media (min-width: 720px) and (max-width: 1079px) and (orientation: landscape) {
    .selected-control-grid {
        grid-template-columns: minmax(280px, 1fr) minmax(160px, auto) minmax(260px, 0.9fr) !important;
        align-items: start !important;
        column-gap: 22px !important;
        row-gap: 12px !important;
    }

    .selected-detail .control-column {
        min-width: 0 !important;
        width: 100% !important;
        align-self: start !important;
    }

    .selected-detail .control-column > label:first-child,
    .selected-detail select {
        width: 100% !important;
    }

    .selected-detail .knob-panel {
        order: 0 !important;
        align-self: start !important;
        justify-self: center !important;
    }
}

.app-shell {
    padding-bottom: calc(172px + env(safe-area-inset-bottom)) !important;
}

.fixed-player,
.bottom-menu {
    position: fixed;
    left: 50%;
    width: min(calc(100% - 24px), 1180px);
    transform: translateX(-50%);
    z-index: 2600;
}

.fixed-player {
    bottom: calc(76px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(74px, auto) minmax(0, 1fr) minmax(100px, auto);
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 8px;
    border: 1px solid rgba(111, 230, 208, 0.38);
    border-radius: 18px;
    background: rgba(4, 21, 43, 0.96);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
}

.fixed-player button,
.bottom-menu button {
    min-height: 48px;
}

.fixed-player-timer,
.fixed-player-power {
    border: 1px solid rgba(130, 193, 244, 0.36);
    border-radius: 14px;
    background: rgba(8, 35, 70, 0.9);
    color: #ecf7ff;
    font-weight: 800;
}

.fixed-player-timer {
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 6px 8px;
    font-size: 0.78rem;
}

.player-icon {
    color: var(--mint);
    font-size: 1.15rem;
    line-height: 1;
}

.fixed-player-status {
    min-width: 0;
    display: grid;
    gap: 2px;
    padding: 0 4px;
}

.fixed-player-status strong {
    color: var(--mint);
    font-size: 0.86rem;
}

.fixed-player-status span {
    overflow: hidden;
    color: #f7fbff;
    font-size: 0.96rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fixed-player-power {
    min-width: 104px;
    padding: 0 12px;
    background: linear-gradient(135deg, var(--mint), #58c9ee 45%, var(--blue));
    color: #021021;
    box-shadow: 0 12px 26px rgba(80, 121, 250, 0.28);
}

.bottom-menu {
    bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    min-height: 68px;
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    border: 1px solid rgba(104, 174, 243, 0.25);
    border-radius: 18px 18px 0 0;
    background: rgba(3, 18, 38, 0.97);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(16px);
}

.bottom-menu-item {
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 5px 2px;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
}

.bottom-menu-item span {
    color: var(--cyan);
    font-size: 1.15rem;
    line-height: 1;
}

.bottom-menu-item strong {
    font-size: 0.75rem;
    line-height: 1.1;
}

.bottom-menu-item.is-active {
    background: rgba(111, 230, 208, 0.12);
    color: #f6fbff;
}

.utility-panel {
    width: min(100%, 560px);
}

.utility-copy {
    margin-top: 0;
}

.timer-options,
.settings-list {
    display: grid;
    gap: 10px;
}

.timer-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timer-options button,
.settings-list button {
    min-height: 54px;
    padding: 0 16px;
    border: 1px solid rgba(130, 193, 244, 0.28);
    border-radius: 12px;
    background: rgba(7, 29, 56, 0.88);
    color: #edf7ff;
    font-weight: 800;
    text-align: left;
}

.timer-options button {
    text-align: center;
}

.settings-version,
.pro-note,
.ad-slot {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.settings-version {
    padding: 8px 2px 0;
    text-align: center;
}

.pro-note {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(7, 29, 56, 0.55);
}

.ad-slot {
    min-height: 54px;
    margin-top: 14px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(130, 193, 244, 0.24);
    border-radius: 12px;
    background: rgba(3, 18, 38, 0.42);
}

[data-plan="pro"] [data-ad-slot] {
    display: none !important;
}

.main-ad-slot {
    min-height: 96px;
    margin: 8px 0 2px;
    display: grid;
    place-items: center;
    border: 2px dashed rgba(73, 143, 205, 0.34);
    border-radius: 16px;
    background: rgba(4, 24, 50, 0.52);
    color: rgba(196, 217, 235, 0.7);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0;
}

.prompt-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.prompt-actions .secondary-button,
.ad-close-button {
    min-height: 48px;
}

.interstitial-ad-slot {
    min-height: 180px;
    font-size: 1.25rem;
    font-weight: 800;
}

.info-content p {
    margin: 0 0 12px;
}

.toast {
    bottom: calc(154px + env(safe-area-inset-bottom)) !important;
}

html[data-theme="light"] .fixed-player,
html[data-theme="light"] .bottom-menu {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(58, 125, 218, 0.2);
    box-shadow: 0 -12px 34px rgba(67, 94, 130, 0.16);
}

html[data-theme="light"] .fixed-player-timer,
html[data-theme="light"] .timer-options button,
html[data-theme="light"] .settings-list button {
    background: rgba(245, 250, 255, 0.96);
    color: #11345d;
}

html[data-theme="light"] .fixed-player-status span,
html[data-theme="light"] .bottom-menu-item.is-active {
    color: #123760;
}

html[data-theme="light"] .pro-note,
html[data-theme="light"] .ad-slot {
    background: rgba(245, 250, 255, 0.78);
}

html[data-theme="light"] .main-ad-slot {
    background: rgba(245, 250, 255, 0.78);
    border-color: rgba(58, 125, 218, 0.24);
    color: rgba(55, 85, 120, 0.62);
}

html,
body,
.app-shell,
.workspace,
.fixed-player,
.bottom-menu,
.dialog-scrim,
.sheet-scrim,
.dialog-panel,
.sheet-panel {
    filter: none !important;
    backdrop-filter: none !important;
}

html,
body,
.app-shell,
.workspace,
.fixed-player,
.bottom-menu {
    opacity: 1 !important;
}

.cockpit-switch,
.cockpit-switch.is-on,
.layer-power-switch,
.layer-power-switch.is-on {
    opacity: 1 !important;
    filter: none !important;
}

.cockpit-switch:not(.is-on),
.layer-power-switch:not(.is-on) {
    background: rgba(18, 34, 53, 0.98) !important;
    border-color: rgba(118, 148, 179, 0.5) !important;
    color: #d4e0ee !important;
}

.cockpit-switch:not(.is-on) .switch-track {
    background: linear-gradient(180deg, #33475c, #17283b) !important;
    border-color: rgba(127, 157, 187, 0.58) !important;
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.34) !important;
}

.cockpit-switch:not(.is-on) .switch-lever,
.layer-power-switch:not(.is-on) .power-dot {
    background: linear-gradient(180deg, #536a82, #263b53) !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.38) !important;
}

.cockpit-switch.is-on,
.layer-power-switch.is-on {
    background: rgba(4, 75, 103, 0.98) !important;
    border-color: rgba(111, 230, 208, 0.86) !important;
    color: #ffffff !important;
}

.cockpit-switch.is-on .switch-track {
    background: linear-gradient(180deg, #78f2df, #3f9cf5) !important;
    border-color: rgba(111, 230, 208, 0.95) !important;
    box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.24), 0 0 18px rgba(88, 201, 238, 0.35) !important;
}

.cockpit-switch.is-on .switch-lever,
.layer-power-switch.is-on .power-dot {
    background: #6fe6d0 !important;
    box-shadow: 0 0 18px rgba(111, 230, 208, 0.74) !important;
}

html[data-theme="light"] .cockpit-switch:not(.is-on),
html[data-theme="light"] .layer-power-switch:not(.is-on) {
    background: #e5eef7 !important;
    border-color: rgba(84, 121, 158, 0.44) !important;
    color: #123d67 !important;
}

html[data-theme="light"] .cockpit-switch:not(.is-on) .switch-track {
    background: linear-gradient(180deg, #d7e3ee, #b7c8d8) !important;
    border-color: rgba(84, 121, 158, 0.5) !important;
}

html[data-theme="light"] .cockpit-switch:not(.is-on) .switch-lever,
html[data-theme="light"] .layer-power-switch:not(.is-on) .power-dot {
    background: linear-gradient(180deg, #44617d, #28435f) !important;
}

html[data-theme="light"] .cockpit-switch.is-on,
html[data-theme="light"] .layer-power-switch.is-on {
    background: #d9f9f4 !important;
    border-color: rgba(22, 141, 128, 0.7) !important;
    color: #07335f !important;
}

html[data-theme="light"] .cockpit-switch.is-on .switch-track {
    background: linear-gradient(180deg, #70ead6, #49aaf6) !important;
}

html[data-theme="light"] .cockpit-switch.is-on .switch-lever,
html[data-theme="light"] .layer-power-switch.is-on .power-dot {
    background: #4fd5c4 !important;
}

/* Mobile browser forced-dark guard. Keep app-selected theme colors explicit. */
html,
body {
    color-scheme: dark;
}

html[data-theme="dark"],
body[data-theme="dark"] {
    color-scheme: dark;
    forced-color-adjust: none;
    background-color: #020c1b !important;
    color: #f5f8ff !important;
    --navy-950: #020c1b;
    --navy-900: #04152b;
    --navy-850: #071d38;
    --line: rgba(104, 174, 243, 0.34);
    --line-soft: rgba(122, 183, 241, 0.15);
    --text-muted: #a9bdd7;
    --mint: #6fe6d0;
    --cyan: #58c9ee;
    --blue: #5079fa;
}

html[data-theme="light"],
body[data-theme="light"] {
    color-scheme: light;
    forced-color-adjust: none;
    background-color: #eaf3fb !important;
    color: #10253d !important;
    --navy-950: #eaf3fb;
    --navy-900: #f7fbff;
    --navy-850: #e8f2fb;
    --line: rgba(45, 104, 158, 0.3);
    --line-soft: rgba(45, 104, 158, 0.17);
    --text-muted: #536c86;
    --mint: #168d80;
    --cyan: #187fa8;
    --blue: #315fd2;
}

html[data-theme="dark"] body,
body[data-theme="dark"] {
    background:
        radial-gradient(circle at 90% 20%, rgba(36, 102, 194, 0.16), transparent 32rem),
        linear-gradient(180deg, #020b19 0%, #04162b 45%, #020b18 100%) !important;
}

html[data-theme="light"] body,
body[data-theme="light"] {
    background:
        radial-gradient(circle at 90% 20%, rgba(85, 161, 215, 0.17), transparent 32rem),
        linear-gradient(180deg, #dcecf8 0%, #f8fbfe 48%, #e5eff7 100%) !important;
}

html[data-theme="dark"] .app-shell,
body[data-theme="dark"] .app-shell,
html[data-theme="dark"] main,
body[data-theme="dark"] main {
    background-color: transparent !important;
    color: #f5f8ff !important;
}

html[data-theme="light"] .app-shell,
body[data-theme="light"] .app-shell,
html[data-theme="light"] main,
body[data-theme="light"] main {
    background-color: transparent !important;
    color: #10253d !important;
}

html[data-theme="dark"] .hero,
body[data-theme="dark"] .hero {
    background-image:
        linear-gradient(90deg, rgba(2, 12, 27, 0.98) 0%, rgba(2, 13, 29, 0.88) 36%, rgba(3, 18, 38, 0.18) 69%, rgba(3, 18, 38, 0.05) 100%),
        linear-gradient(0deg, rgba(3, 17, 35, 0.45), transparent 44%),
        url("assets/tinnitus-night-hero.png") !important;
    background-color: #04152b !important;
    color: #f5f8ff !important;
}

html[data-theme="light"] .hero,
body[data-theme="light"] .hero {
    background-image:
        linear-gradient(90deg, rgba(248, 252, 255, 0.98) 0%, rgba(246, 252, 255, 0.82) 42%, rgba(240, 249, 255, 0.12) 72%, rgba(240, 249, 255, 0.02) 100%),
        linear-gradient(0deg, rgba(232, 246, 255, 0.24), transparent 42%),
        url("assets/tinnitus-light-hero.png") !important;
    background-color: #f7fbff !important;
    color: #0c3c7d !important;
}

html[data-theme="dark"] .surface,
html[data-theme="dark"] .layer-card,
html[data-theme="dark"] .recipe-card,
html[data-theme="dark"] .dialog-panel,
html[data-theme="dark"] .sheet-panel,
body[data-theme="dark"] .surface,
body[data-theme="dark"] .layer-card,
body[data-theme="dark"] .recipe-card,
body[data-theme="dark"] .dialog-panel,
body[data-theme="dark"] .sheet-panel {
    background: linear-gradient(145deg, rgba(7, 29, 56, 0.98), rgba(4, 21, 43, 0.98)) !important;
    background-color: #071d38 !important;
    color: #f5f8ff !important;
}

html[data-theme="light"] .surface,
html[data-theme="light"] .layer-card,
html[data-theme="light"] .recipe-card,
html[data-theme="light"] .dialog-panel,
html[data-theme="light"] .sheet-panel,
body[data-theme="light"] .surface,
body[data-theme="light"] .layer-card,
body[data-theme="light"] .recipe-card,
body[data-theme="light"] .dialog-panel,
body[data-theme="light"] .sheet-panel {
    background: linear-gradient(145deg, #ffffff, #e3f0fa) !important;
    background-color: #f7fbff !important;
    color: #10253d !important;
}

html[data-theme="dark"] select,
html[data-theme="dark"] input,
html[data-theme="dark"] .timer-options button,
html[data-theme="dark"] .settings-list button,
html[data-theme="dark"] .secondary-button,
body[data-theme="dark"] select,
body[data-theme="dark"] input,
body[data-theme="dark"] .timer-options button,
body[data-theme="dark"] .settings-list button,
body[data-theme="dark"] .secondary-button {
    background-color: #071d38 !important;
    color: #edf7ff !important;
}

html[data-theme="light"] select,
html[data-theme="light"] input,
html[data-theme="light"] .timer-options button,
html[data-theme="light"] .settings-list button,
html[data-theme="light"] .secondary-button,
body[data-theme="light"] select,
body[data-theme="light"] input,
body[data-theme="light"] .timer-options button,
body[data-theme="light"] .settings-list button,
body[data-theme="light"] .secondary-button {
    background-color: #f8fbfe !important;
    color: #10253d !important;
}

html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .add-layer-button,
html[data-theme="dark"] .save-button,
html[data-theme="dark"] .fixed-player-power,
body[data-theme="dark"] .primary-button,
body[data-theme="dark"] .add-layer-button,
body[data-theme="dark"] .save-button,
body[data-theme="dark"] .fixed-player-power,
html[data-theme="light"] .primary-button,
html[data-theme="light"] .add-layer-button,
html[data-theme="light"] .save-button,
html[data-theme="light"] .fixed-player-power,
body[data-theme="light"] .primary-button,
body[data-theme="light"] .add-layer-button,
body[data-theme="light"] .save-button,
body[data-theme="light"] .fixed-player-power {
    background: linear-gradient(90deg, #6fe6d0 0%, #58c9ee 48%, #5079fa 100%) !important;
    color: #03152b !important;
}

html[data-theme="dark"] .fixed-player,
html[data-theme="dark"] .bottom-menu,
body[data-theme="dark"] .fixed-player,
body[data-theme="dark"] .bottom-menu {
    background: #04152b !important;
    color: #f5f8ff !important;
    border-color: rgba(104, 174, 243, 0.34) !important;
}

html[data-theme="light"] .fixed-player,
html[data-theme="light"] .bottom-menu,
body[data-theme="light"] .fixed-player,
body[data-theme="light"] .bottom-menu {
    background: #ffffff !important;
    color: #10253d !important;
    border-color: rgba(58, 125, 218, 0.2) !important;
}

html[data-theme="dark"] .bottom-menu-item,
body[data-theme="dark"] .bottom-menu-item {
    background-color: transparent !important;
    color: #a9bdd7 !important;
}

html[data-theme="light"] .bottom-menu-item,
body[data-theme="light"] .bottom-menu-item {
    background-color: transparent !important;
    color: #536c86 !important;
}

html[data-theme="dark"] .bottom-menu-item.is-active,
body[data-theme="dark"] .bottom-menu-item.is-active {
    background-color: #0e3247 !important;
    color: #f5f8ff !important;
}

html[data-theme="light"] .bottom-menu-item.is-active,
body[data-theme="light"] .bottom-menu-item.is-active {
    background-color: #e4f8f5 !important;
    color: #123760 !important;
}

@media (max-width: 520px) {
    .fixed-player,
    .bottom-menu {
        width: calc(100% - 12px);
    }

    .fixed-player {
        grid-template-columns: 72px minmax(0, 1fr) 96px;
        min-height: 60px;
        gap: 6px;
        padding: 6px;
        border-radius: 16px;
    }

    .fixed-player-status span {
        font-size: 0.86rem;
    }

    .fixed-player-power {
        min-width: 96px;
        padding-inline: 8px;
        font-size: 0.86rem;
    }

    .bottom-menu-item strong {
        font-size: 0.68rem;
    }
}
