/* ==================================================
   BANDE+ DOPPEL-TAPEDECK
   Große Sichtfenster und separate SVG-Kassetten
   ================================================== */


/* ==================================================
   GEMEINSAMES LAYOUT
   ================================================== */

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
}

.receiver,
.tapedeck {
    flex-shrink: 0;
}


/* ==================================================
   GEHÄUSE
   ================================================== */

.tapedeck {
    --tape-text: #e8e9eb;
    --tape-muted: #aeb1b8;
    --tape-glow: #b8f4ed;
    --tape-orange: #ed913e;
    --tape-icon: #fff;
    --tape-record: #f04444;

    box-sizing: border-box;
    width: min(760px, 100%);
    max-width: 760px;
    margin: 0 0 16px;
    padding: 25px;

    color: var(--tape-text);
    font-family: Arial, Helvetica, sans-serif;

    background: linear-gradient(
        145deg,
        var(--receiver-light, #45474e),
        var(--receiver-dark, #22242a)
    );

    border: 2px solid #565960;
    border-radius: 8px;

    box-shadow:
        0 18px 55px #000b,
        inset 0 1px #ffffff20;
}

.tapedeck,
.tapedeck * {
    box-sizing: border-box;
}


/* ==================================================
   HEADER
   ================================================== */

.tapedeck .tapedeck-header,
.tapedeck .tape-unit-header,
.tapedeck .tape-display-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tapedeck .tapedeck-header {
    margin-bottom: 24px;
}

.tapedeck .tapedeck-header > div {
    min-width: 0;
}

.tapedeck .tapedeck-brand {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .18em;
}

.tapedeck .tapedeck-brand span {
    color: var(--tape-orange);
}

.tapedeck .tapedeck-model {
    margin: 6px 0 0;
    color: var(--tape-muted);
    font-size: .7rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: .13em;
}

.tapedeck .tapedeck-format {
    flex-shrink: 0;
    color: var(--tape-muted);
    font-size: .7rem;
    letter-spacing: .08em;
    white-space: nowrap;
}


/* ==================================================
   LAUFWERKSFRONTEN
   ================================================== */

.tapedeck .tapedeck-decks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.tapedeck .tape-unit {
    min-width: 0;
    padding: 16px;

    background: linear-gradient(
        145deg,
        var(--receiver, #303238),
        var(--receiver-dark, #22242a)
    );

    border: 1px solid #15161a;
    border-bottom-color: #565960;
    border-radius: 5px;

    box-shadow:
        inset 0 2px 5px #0006,
        0 1px 0 #ffffff0d;
}

.tapedeck .tape-unit-header {
    min-height: 20px;
    margin-bottom: 14px;
}

.tapedeck .tape-unit-header h3 {
    flex-shrink: 0;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.tapedeck .tape-unit-header > span {
    color: var(--tape-muted);
    font-size: 9px;
    line-height: 1.4;
    letter-spacing: 1px;
    text-align: right;
}


/* ==================================================
   DISPLAYS UND LAUFTEXT
   ================================================== */

.tapedeck .tape-display {
    min-width: 0;
    min-height: 82px;
    padding: 13px 12px;

    color: var(--tape-glow);

    font-family:
        "Share Tech Mono",
        "Courier New",
        monospace;

    background: linear-gradient(
        150deg,
        #171b1e,
        #080d0f
    );

    border: 3px solid #1b1c20;
    border-radius: 3px;

    box-shadow:
        inset 0 3px 12px #000b,
        0 1px 0 #777;

    text-shadow: 0 0 7px rgb(184 244 237 / 35%);
}

.tapedeck .tape-title {
    min-width: 0;
    overflow: hidden;
    margin: 0 0 12px;

    font-size: 13px;
    line-height: 1.3;
    letter-spacing: 1px;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.tapedeck #tape-a-title {
    display: block;
    min-width: 0;
    max-width: 100%;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
}

.tapedeck #tape-a-title > .tape-title-text {
    display: inline-block;
    white-space: nowrap;
}

.tapedeck .tape-display-line {
    gap: 8px;
    font-size: 11px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.tapedeck .tape-display-line > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tapedeck .tape-display-line > span:last-child {
    flex-shrink: 0;
    white-space: nowrap;
}

.tapedeck #tape-b-status {
    color: var(--tape-orange);
    text-transform: none;
    text-shadow: 0 0 6px rgb(237 145 62 / 30%);
}


/* ==================================================
   KLAPPENRAHMEN
   Schmaler Rahmen, große freie Sichtfläche
   ================================================== */

.tapedeck .tape-door {
    position: relative;
    isolation: isolate;

    margin-top: 18px;
    padding: 17px 7px 25px;

    background: linear-gradient(
        165deg,
        #45474e 0%,
        #35373e 18%,
        #303238 60%,
        #27292f 100%
    );

    border: 1px solid #111216;
    border-top-color: #6b6e77;
    border-bottom: 4px solid #15161a;
    border-radius: 5px 5px 8px 8px;

    box-shadow:
        0 4px 0 #111216,
        0 7px 9px #0007,
        inset 0 1px 0 #ffffff24,
        inset 1px 0 0 #ffffff0d,
        inset -1px 0 0 #0005;
}

.tapedeck .tape-door::before,
.tapedeck .tape-door::after {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 13px;
    width: 1px;

    background: #111216;
    box-shadow: 1px 0 0 #ffffff10;

    pointer-events: none;
}

.tapedeck .tape-door::before {
    left: 3px;
}

.tapedeck .tape-door::after {
    right: 3px;
}

.tapedeck .tape-door-top-edge {
    position: absolute;
    top: 5px;
    left: 16px;
    right: 16px;

    height: 5px;

    background: linear-gradient(#15161a, #45474e);

    border: 1px solid #111216;
    border-bottom-color: #646770;
    border-radius: 2px;

    box-shadow: 0 1px 2px #0007;
}


/* ==================================================
   GROSSES SICHTFENSTER
   Gemeinsame Zeichenfläche für Mechanik und Kassette
   ================================================== */

.tapedeck .tape-window {
    position: relative;
    display: block;

    width: 100%;
    height: auto;
    aspect-ratio: 1000 / 640;

    margin: 0;
    padding: 0;
    overflow: hidden;

    background: radial-gradient(
        ellipse at 50% 40%,
        #252c34 0%,
        #13181e 58%,
        #070a0e 100%
    );

    border: 3px solid #171a20;
    border-top-color: #111419;
    border-bottom-color: #646770;
    border-radius: 5px;

    box-shadow:
        inset 0 5px 13px #000c,
        0 1px 0 #ffffff14;
}


/* ==================================================
   LEERER KASSETTENSCHACHT
   ================================================== */

.tapedeck .tape-mechanism {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.tapedeck .tape-mechanism-plate {
    position: absolute;
    inset: 10% 7% 12%;

    background: linear-gradient(
        145deg,
        #30373d,
        #1b2228 55%,
        #11171d
    );

    border: 1px solid #080b0f;
    border-radius: 7px;

    box-shadow:
        inset 0 1px 0 #ffffff0d,
        inset 0 -3px 8px #0007,
        0 2px 4px #0008;
}

/* Positionen passend zu den SVG-Wickeln: 34% und 66%. */

.tapedeck .tape-spindle {
    position: absolute;
    top: 50%;

    width: 9%;
    aspect-ratio: 1;

    transform: translate(-50%, -50%);

    background: repeating-conic-gradient(
        #a7afb4 0deg 18deg,
        #414b54 18deg 42deg,
        #171e25 42deg 60deg
    );

    border: 2px solid #10161c;
    border-radius: 50%;

    box-shadow:
        0 2px 4px #000b,
        0 0 0 3px #343d45,
        0 0 0 4px #080d12;
}

.tapedeck .tape-spindle::after {
    content: "";

    position: absolute;
    inset: 29%;

    background: #151d24;
    border: 1px solid #a6afb5;
    border-radius: 50%;
}

.tapedeck .tape-spindle-left {
    left: 34%;
}

.tapedeck .tape-spindle-right {
    left: 66%;
}

.tapedeck .tape-head {
    position: absolute;
    left: 50%;
    bottom: 10.5%;

    width: 16%;
    height: 9%;

    transform: translateX(-50%);

    background: linear-gradient(
        90deg,
        #68737d,
        #c1c9ce 45%,
        #828e98 55%,
        #434e58
    );

    border: 2px solid #10171e;
    border-radius: 3px;

    box-shadow: 0 2px 5px #000b;
}

.tapedeck .tape-head::after {
    content: "";

    position: absolute;
    inset: 18% 24%;

    background: #202b35;
    border: 1px solid #8f9aa4;
    border-radius: 2px;
}

.tapedeck .tape-guide {
    position: absolute;
    bottom: 12%;

    width: 3%;
    height: 9%;

    background: linear-gradient(
        90deg,
        #505d67,
        #d0d7da,
        #56636d
    );

    border: 1px solid #0a1117;
    border-radius: 3px;

    box-shadow: 0 2px 3px #0009;
}

.tapedeck .tape-guide-left {
    left: 22%;
}

.tapedeck .tape-guide-right {
    right: 22%;
}

.tapedeck .tape-empty-label {
    position: absolute;
    top: 20%;
    left: 0;
    right: 0;

    color: #727e89;
    font-family: "Courier New", monospace;
    font-size: clamp(8px, 1.2vw, 11px);
    letter-spacing: .18em;
    text-align: center;
}


/* ==================================================
   EINGELEGTE SVG-KASSETTE
   ================================================== */

.tapedeck .tape-cassette {
    position: absolute;
    inset: 0;
    z-index: 1;

    display: block;

    width: 100%;
    height: 100%;
    object-fit: contain;

    filter: drop-shadow(0 3px 3px #0009);

    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

/* hidden muss trotz display:block zuverlässig gelten. */

.tapedeck .tape-cassette[hidden],
.tapedeck .tape-door[data-loaded="false"] .tape-cassette {
    display: none;
}

.tapedeck .tape-door[data-loaded="true"] .tape-empty-label {
    visibility: hidden;
}


/* ==================================================
   GLAS VOR DER KASSETTE
   Keine starke Abdunklung der Etiketten
   ================================================== */

.tapedeck .tape-window-glass {
    position: absolute;
    inset: 0;
    z-index: 2;

    background: linear-gradient(
        135deg,
        rgb(230 242 255 / 7%) 0%,
        rgb(230 242 255 / 2%) 31%,
        transparent 32%,
        transparent 76%,
        rgb(230 242 255 / 3%) 100%
    );

    border: 1px solid rgb(215 230 245 / 10%);
    border-radius: 2px;

    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 8%),
        inset 0 -2px 5px rgb(0 0 0 / 18%);

    pointer-events: none;
}


/* ==================================================
   KLAPPENBESCHRIFTUNG UND GRIFF
   ================================================== */

.tapedeck .tape-door-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    margin-top: 10px;
    padding: 0 3px;

    color: var(--tape-muted);
    font-size: 8px;
    line-height: 1.4;
    letter-spacing: 1px;
}

.tapedeck .tape-door-caption > span:first-child {
    flex-shrink: 0;
    color: #d5d7dc;
}

.tapedeck .tape-door-caption > span:last-child {
    text-align: right;
}

.tapedeck .tape-door-grip {
    position: absolute;
    bottom: 7px;
    left: 50%;

    width: 74px;
    height: 9px;

    transform: translateX(-50%);

    background: linear-gradient(
        #111216,
        #22242a 65%,
        #36383f
    );

    border: 1px solid #15161a;
    border-bottom-color: #62656e;
    border-radius: 5px 5px 3px 3px;

    box-shadow:
        inset 0 2px 3px #000b,
        0 1px 0 #ffffff08;
}


/* ==================================================
   POSITIONSLEISTEN
   ================================================== */

.tapedeck .tape-seek {
    display: block;

    width: 100%;
    height: 18px;
    margin: 18px 0 14px;
    padding: 0;

    accent-color: #aeb1b8;
    cursor: pointer;
}

.tapedeck .tape-seek:disabled {
    opacity: .4;
    cursor: not-allowed;
}


/* ==================================================
   TASTEN: GEMEINSAME BASIS
   ================================================== */

.tapedeck .tape-controls button,
.tapedeck .tape-eject {
    appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 0;

    color: var(--tape-icon);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1;

    background: linear-gradient(#555860, #2a2c31);

    border: 1px solid #15161a;
    border-radius: 4px;

    box-shadow:
        inset 0 1px #ffffff20,
        0 2px 3px #0008;

    cursor: pointer;
}

.tapedeck button:not(:disabled):hover {
    border-color: #1caaa6;
}

.tapedeck button:not(:disabled):active {
    transform: translateY(1px);

    box-shadow:
        inset 0 2px 4px #0006,
        0 1px 1px #0006;
}

.tapedeck button:focus-visible,
.tapedeck input:focus-visible {
    outline: 2px solid var(--tape-glow);
    outline-offset: 3px;
}

.tapedeck button:disabled {
    opacity: .55;
    cursor: not-allowed;
}


/* ==================================================
   TRANSPORTTASTEN
   ================================================== */

.tapedeck .tape-controls {
    display: flex;
    align-items: stretch;
    gap: 5px;
}

.tapedeck .tape-controls button {
    flex: 1 1 0;
    height: 40px;
    min-height: 40px;
    padding: 0;
}

.tapedeck .tape-controls .tape-control-icon,
.tapedeck .tape-controls .tape-transport-icon {
    display: block;
    flex-shrink: 0;

    width: 20px;
    height: 20px;

    fill: currentColor;
    pointer-events: none;
}

.tapedeck #tape-a-play,
.tapedeck #tape-b-play,
.tapedeck #tape-a-pause,
.tapedeck #tape-b-pause,
.tapedeck #tape-a-stop,
.tapedeck #tape-b-stop,
.tapedeck #tape-a-rewind,
.tapedeck #tape-b-rewind,
.tapedeck #tape-a-forward,
.tapedeck #tape-b-forward {
    color: var(--tape-icon);
}

.tapedeck #tape-a-stop .tape-control-icon,
.tapedeck #tape-b-stop .tape-control-icon,
.tapedeck #tape-a-stop .tape-transport-icon,
.tapedeck #tape-b-stop .tape-transport-icon {
    width: 24px;
    height: 24px;
}

.tapedeck .tape-controls .tape-record {
    flex: 1 1 0;
    color: var(--tape-record);
    font-size: 10px;
    white-space: nowrap;
}

.tapedeck .tape-controls .tape-record:not(:disabled):hover {
    color: #ff5b5b;
    border-color: var(--tape-record);
}

.tapedeck .tape-controls .tape-record[aria-pressed="true"] {
    color: #ff4545;
    border-color: #d84444;
}

.tapedeck .tape-record[aria-pressed="true"] .tape-control-icon,
.tapedeck .tape-record[aria-pressed="true"] .tape-transport-icon {
    filter: drop-shadow(0 0 4px rgb(255 69 69 / 55%));
}


/* ==================================================
   EJECT UND SAVE
   ================================================== */

.tapedeck .tape-eject-row {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 36px;
    margin-top: 13px;
}

.tapedeck .tape-eject {
    flex: 1 1 0;

    width: auto;
    min-height: 36px;
    margin: 0;
    padding: 9px 10px;

    font-size: 10px;
    line-height: 1.3;
    letter-spacing: .8px;
}

.tapedeck .tape-eject:not(:disabled):hover {
    color: var(--tape-glow);
}

.tapedeck .tape-save-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;

    min-height: 36px;
    margin: 0;

    color: var(--tape-text);
    font-size: 11px;
    letter-spacing: .4px;
    white-space: nowrap;

    cursor: pointer;
}

.tapedeck .tape-save-option input {
    flex: 0 0 auto;

    width: 15px;
    height: 15px;
    margin: 0;

    accent-color: var(--tape-orange);
    cursor: pointer;
}

.tapedeck .tape-save-option:hover {
    color: var(--tape-orange);
}


/* ==================================================
   SCHMALE BILDSCHIRME
   ================================================== */

@media (max-width: 720px) {
    .tapedeck .tapedeck-decks {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Auf Tablets keine übergroßen Kassettenfenster. */

    .tapedeck .tape-door {
        max-width: 430px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 560px) {
    .tapedeck {
        padding: 17px;
    }

    .tapedeck .tapedeck-header {
        align-items: flex-start;
        gap: 12px;
    }

    .tapedeck .tapedeck-brand {
        font-size: 1.45rem;
    }

    .tapedeck .tapedeck-model {
        font-size: 9px;
        letter-spacing: 1.2px;
    }

    .tapedeck .tapedeck-format {
        padding-top: 4px;
        font-size: 9px;
    }

    .tapedeck .tape-unit {
        padding: 14px;
    }
}

@media (max-width: 380px) {
    .tapedeck {
        padding: 12px;
    }

    .tapedeck .tape-unit {
        padding: 10px;
    }

    .tapedeck .tapedeck-format {
        display: none;
    }

    .tapedeck .tape-door {
        padding-left: 6px;
        padding-right: 6px;
    }

    .tapedeck .tape-door-caption {
        font-size: 7px;
        letter-spacing: .5px;
    }

    .tapedeck .tape-controls {
        gap: 3px;
    }

    .tapedeck .tape-controls .tape-record {
        font-size: 9px;
    }

    .tapedeck .tape-eject-row {
        gap: 8px;
    }
}
/* ==================================================
   TAPE SELECT
   Mechanischer Zweistellungs-Schiebeschalter
   ================================================== */

.tapedeck .tape-format-select {
    min-width: 0;
    margin: 18px 0 0;
    padding: 12px 10px 13px;

    border: 1px solid #17191e;
    border-radius: 4px;

    background: linear-gradient(
        145deg,
        #292c32,
        #22242a
    );

    box-shadow:
        inset 0 1px 3px #0006,
        0 1px 0 #ffffff10;
}

.tapedeck .tape-format-select legend {
    margin: 0 auto;
    padding: 0 8px;

    color: var(--tape-muted, #aeb1b8);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: .14em;
}

.tapedeck .tape-format-selector {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

/* Beschriftungen links und rechts */

.tapedeck .tape-format-option {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    min-height: 32px;

    color: var(--tape-muted, #aeb1b8);
    font-size: 10px;
    line-height: 1.3;
    white-space: nowrap;

    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/*
 * Radiofelder bleiben per Tastatur bedienbar.
 * Nur ihre Standarddarstellung wird ausgeblendet.
 */

.tapedeck .tape-format-option input {
    position: absolute;

    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;

    overflow: hidden;
    clip-path: inset(50%);

    border: 0;
}

.tapedeck .tape-format-option span {
    position: relative;
    padding-top: 9px;

    transition: color .15s ease;
}

/* Kleine orange Kontrollanzeige über der aktiven Seite */

.tapedeck .tape-format-option span::before {
    content: "";

    position: absolute;
    top: 0;
    left: 50%;

    width: 12px;
    height: 3px;

    transform: translateX(-50%);

    background: #4a4038;
    border-radius: 1px;

    box-shadow: inset 0 1px 1px #0008;
}

.tapedeck .tape-format-option input:checked + span {
    color: var(--tape-text, #e8e9eb);
}

.tapedeck .tape-format-option input:checked + span::before {
    background: var(--tape-text, #e8e9eb);

    box-shadow:
        0 0 5px rgb(237 145 62 / 35%),
        inset 0 1px 0 #ffffff30;
}

.tapedeck .tape-format-option input:focus-visible + span {
    outline: 2px solid var(--tape-glow, #b8f4ed);
    outline-offset: 4px;
    border-radius: 2px;
}

.tapedeck .tape-format-option:hover span {
    color: var(--tape-text, #e8e9eb);
}

/* Eingelassener Schlitz */

.tapedeck .tape-format-track {
    position: relative;

    width: 62px;
    height: 24px;

    background: linear-gradient(
        #090b0f,
        #171a20
    );

    border: 1px solid #111216;
    border-bottom-color: #60636b;
    border-radius: 3px;

    box-shadow:
        inset 0 3px 5px #000c,
        0 1px 0 #ffffff08;

    pointer-events: none;
}

/* Geriffelter Schieber */

.tapedeck .tape-format-thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;

    width: 27px;

    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 3px,
            rgb(0 0 0 / 35%) 3px,
            rgb(0 0 0 / 35%) 4px
        ),
        linear-gradient(
            #757981,
            #454950
        );

    border: 1px solid #14161b;
    border-top-color: #9a9ea6;
    border-radius: 2px;

    box-shadow:
        inset 0 1px 0 #ffffff20,
        1px 1px 3px #000b;

    transform: translateX(0);
    transition: transform .15s ease;
}

/* Rechtsstellung, sobald MP3 ausgewählt ist */

.tapedeck
.tape-format-selector:has(#tape-b-format-mp3:checked)
.tape-format-thumb {
    transform: translateX(29px);
}

@media (prefers-reduced-motion: reduce) {
    .tapedeck .tape-format-thumb,
    .tapedeck .tape-format-option span {
        transition: none;
    }
}

@media (max-width: 380px) {
    .tapedeck .tape-format-select {
        padding-right: 6px;
        padding-left: 6px;
    }

    .tapedeck .tape-format-selector {
        gap: 5px;
    }

    .tapedeck .tape-format-option {
        font-size: 9px;
    }
}
/* ==================================================
   DECK B: AUFNAHMEEINSTELLUNGEN
   Format-Toggle links, REC QUALITY auf der MP3-Seite
   ================================================== */

.tapedeck .tape-record-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;

    min-width: 0;
    margin-top: 18px;
    padding: 10px 8px 12px;

    background: linear-gradient(
        145deg,
        #292c32,
        #22242a
    );

    border: 1px solid #17191e;
    border-radius: 4px;

    box-shadow:
        inset 0 1px 3px #0006,
        0 1px 0 #ffffff10;
}


/* Gemeinsames Gehäuse statt zweier separater Kästen. */

.tapedeck .tape-record-settings .tape-format-select {
    flex: 1 1 142px;

    min-width: 142px;
    margin: 0;
    padding: 0;

    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.tapedeck .tape-record-settings .tape-format-select legend {
    margin: 0 auto 12px;
    padding: 0 4px;

    font-size: 9px;
    letter-spacing: .12em;
}

.tapedeck .tape-record-settings .tape-format-selector {
    grid-template-columns:
        minmax(0, 1fr)
        62px
        minmax(0, 1fr);

    gap: 4px;
}

.tapedeck .tape-record-settings .tape-format-option {
    font-size: 9px;
}


/* ==================================================
   REC QUALITY: GRUPPE UND BESCHRIFTUNG
   ================================================== */

.tapedeck .tape-rec-quality {
    flex: 0 0 120px;

    min-width: 0;
    width: 120px;
    margin: 0;
    padding: 0;

    background: none;
    border: 0;

    transition: opacity .18s ease;
}

.tapedeck .tape-rec-quality legend {
    width: 100%;
    margin: 0;
    padding: 0;

    color: var(--tape-muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: .12em;
    text-align: center;
    white-space: nowrap;
}


/* ==================================================
   BITRATENSKALA
   Sechs Positionen auf einem 270-Grad-Kreisbogen
   ================================================== */

.tapedeck .tape-bitrate-control {
    position: relative;
    isolation: isolate;

    width: 120px;
    height: 116px;

    color: var(--tape-muted);

    user-select: none;
    -webkit-user-select: none;
}

.tapedeck .tape-bitrate-scale {
    position: absolute;
    inset: 0;

    z-index: 2;
    pointer-events: none;
}

.tapedeck .tape-bitrate-value {
    appearance: none;

    position: absolute;
    top: 55px;
    left: 60px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 24px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;

    color: var(--tape-muted);
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 400;
    line-height: 1;
    font-variant-numeric: tabular-nums;

    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    box-shadow: none;

    transform:
        translate(-50%, -50%)
        rotate(var(--tick-angle))
        translateY(-43px)
        rotate(calc(0deg - var(--tick-angle)));

    pointer-events: auto;
    cursor: pointer;

    transition:
        color .15s ease,
        text-shadow .15s ease,
        background-color .15s ease;
}

.tapedeck .tape-bitrate-value:not(:disabled):hover {
    color: var(--tape-text);
    background-color: rgb(255 255 255 / 5%);
    border-color: transparent;
}

/* Allgemeine Button-Regeln dürfen die Skalenposition nicht ändern. */

.tapedeck .tape-bitrate-value:not(:disabled):active {
    transform:
        translate(-50%, -50%)
        rotate(var(--tick-angle))
        translateY(-43px)
        rotate(calc(0deg - var(--tick-angle)));

    background-color: rgb(0 0 0 / 12%);
    box-shadow: none;
}

.tapedeck .tape-bitrate-value.is-active,
.tapedeck .tape-bitrate-value[aria-pressed="true"] {
    color: var(--tape-orange);

    text-shadow:
        0 0 5px rgb(237 145 62 / 35%);
}

.tapedeck .tape-bitrate-value:focus-visible {
    outline: 2px solid var(--tape-glow);
    outline-offset: -2px;
}


/* ==================================================
   DREHKNOPF: FESTER AUSSENRING
   ================================================== */

.tapedeck .tape-quality-knob-wrap {
    position: absolute;
    top: 55px;
    left: 60px;

    z-index: 3;

    width: 56px;
    height: 56px;

    transform: translate(-50%, -50%);
}

.tapedeck .tape-quality-knob {
    position: absolute;
    inset: 0;

    padding: 4px;

    background: linear-gradient(
        145deg,
        #111318,
        #454950 52%,
        #15171c
    );

    border: 1px solid #101115;
    border-radius: 50%;

    box-shadow:
        0 3px 5px #0009,
        inset 0 1px 0 #ffffff15,
        0 1px 0 #ffffff12;

    pointer-events: none;
}


/* ==================================================
   DREHBARE KNOPFFLÄCHE
   JavaScript setzt --knob-angle am übergeordneten Element.
   ================================================== */

.tapedeck .tape-quality-knob-face {
    position: relative;

    width: 100%;
    height: 100%;

    background:
        radial-gradient(
            circle at center,
            #41454c 0%,
            #33363d 62%,
            transparent 64%
        ),
        repeating-conic-gradient(
            #53575f 0deg 5deg,
            #30333a 5deg 10deg
        );

    border: 1px solid #16181d;
    border-radius: 50%;

    box-shadow:
        inset 0 0 0 2px #ffffff08,
        inset 0 0 6px #0005;

    transform: rotate(var(--knob-angle, 27deg));

    transition:
        transform .2s cubic-bezier(.2, .7, .3, 1);
}


/* ==================================================
   LEUCHTSTRICH
   Gleiche Farbe und gleicher Glow wie beim Format-Toggle
   ================================================== */

.tapedeck .tape-quality-knob-marker {
    position: absolute;
    top: 4px;
    left: 50%;

    width: 3px;
    height: 12px;

    transform: translateX(-50%);

    background: var(--tape-orange);
    border-radius: 1px;

    box-shadow:
        0 0 5px rgb(237 145 62 / 35%),
        inset 0 1px 0 #ffffff30;

    transition:
        background-color .18s ease,
        box-shadow .18s ease;
}


/* ==================================================
   BEDIENFLÄCHE
   Unsichtbares Range-Input über dem sichtbaren Knopf
   ================================================== */

.tapedeck .tape-quality-knob-input {
    appearance: none;
    -webkit-appearance: none;

    position: absolute;
    inset: 0;
    z-index: 4;

    display: block;

    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;

    opacity: 0;

    background: transparent;
    border: 0;
    border-radius: 50%;

    cursor: grab;
    touch-action: pan-y;
}

.tapedeck .tape-quality-knob-input:not(:disabled):active {
    cursor: grabbing;
}

/* Sichtbarer Tastaturfokus trotz unsichtbarem Input. */

.tapedeck
.tape-quality-knob-wrap:has(.tape-quality-knob-input:focus-visible)
.tape-quality-knob {
    outline: 2px solid var(--tape-glow);
    outline-offset: 3px;
}


/* ==================================================
   EINHEIT
   Keine zusätzliche MP3-Beschriftung
   ================================================== */

.tapedeck .tape-bitrate-unit {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;

    color: var(--tape-muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    line-height: 1.4;
    letter-spacing: .04em;
    text-align: center;

    pointer-events: none;
}


/* ==================================================
   DEAKTIVIERT: WAV ODER GESPERRTER EXPORT
   Letzter Wert bleibt sichtbar, Glow erlischt.
   ================================================== */

.tapedeck .tape-rec-quality:disabled,
.tapedeck .tape-rec-quality.is-disabled {
    opacity: .45;
}

.tapedeck .tape-rec-quality:disabled .tape-quality-knob-marker,
.tapedeck .tape-rec-quality.is-disabled .tape-quality-knob-marker {
    background: #4a4038;
    box-shadow: inset 0 1px 1px #0008;
}

.tapedeck .tape-rec-quality:disabled .tape-bitrate-value,
.tapedeck .tape-rec-quality.is-disabled .tape-bitrate-value {
    text-shadow: none;
}

.tapedeck .tape-rec-quality:disabled .tape-bitrate-value {
    opacity: 1;
    cursor: not-allowed;
}

.tapedeck .tape-rec-quality:disabled .tape-quality-knob-input {
    cursor: not-allowed;
}


/* ==================================================
   SCHMALE BILDSCHIRME
   ================================================== */

@media (max-width: 380px) {
    .tapedeck .tape-record-settings {
        column-gap: 6px;
        row-gap: 12px;
        padding-right: 6px;
        padding-left: 6px;
    }

    .tapedeck .tape-record-settings .tape-format-select {
        flex-basis: 138px;
        min-width: 138px;
    }

    .tapedeck .tape-record-settings .tape-format-selector {
        gap: 3px;
    }
}


/* ==================================================
   REDUZIERTE BEWEGUNG
   ================================================== */

@media (prefers-reduced-motion: reduce) {
    .tapedeck .tape-rec-quality,
    .tapedeck .tape-bitrate-value,
    .tapedeck .tape-quality-knob-face,
    .tapedeck .tape-quality-knob-marker {
        transition: none;
    }
}
/* ==================================================
   FESTE BESCHRIFTUNGEN WEISS, INDIKATOREN ORANGE
   ================================================== */


/* Toggle: Beschriftung bleibt in jeder Stellung weiß. */

.tapedeck .tape-format-option,
.tapedeck .tape-format-option span,
.tapedeck .tape-format-option input:checked + span,
.tapedeck .tape-format-option:hover span {
    color: var(--tape-text, #e8e9eb);
    text-shadow: none;
}


/* Toggle: nur das kleine aktive Licht leuchtet orange. */

.tapedeck .tape-format-option input:checked + span::before {
    background: var(--tape-orange, #ed913e);

    box-shadow:
        0 0 5px rgb(237 145 62 / 35%),
        inset 0 1px 0 #ffffff30;
}


/* Drehknopf: alle Zahlen bleiben weiß, auch die ausgewählte. */

.tapedeck .tape-bitrate-value,
.tapedeck .tape-bitrate-value.is-active,
.tapedeck .tape-bitrate-value[aria-pressed="true"],
.tapedeck .tape-bitrate-value:not(:disabled):hover {
    color: var(--tape-text, #e8e9eb);
    text-shadow: none;
}
/* ==================================================
   AUFNAHMEEINSTELLUNGEN
   Zwei Toggles links, Qualitätsregler rechts
   ================================================== */

#tape-b .tape-record-settings {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    grid-template-rows: auto auto;
    align-items: center;

    column-gap: 12px;
    row-gap: 20px;

    padding: 16px 10px;
}

/* Dolby System: links oben */

#tape-b .tape-record-settings
> .tape-format-select:not(.tape-rate-select) {
    grid-column: 1;
    grid-row: 1;
}

/* Tape Select: links unten */

#tape-b .tape-record-settings > .tape-rate-select {
    grid-column: 1;
    grid-row: 2;

    min-width: 0;
    margin: 0;
    padding: 0;

    border: 0;
}

/* Beide Schalter verwenden dieselbe Breite und Achse. */

#tape-b .tape-record-settings > .tape-format-select {
    min-width: 0;
    width: 100%;
}

#tape-b .tape-record-settings
.tape-format-selector {
    grid-template-columns:
        minmax(0, 1fr)
        62px
        minmax(0, 1fr);

    width: 100%;
    max-width: none;
    margin: 0;
    gap: 4px;
}

#tape-b .tape-record-settings
.tape-format-select legend {
    margin: 0 auto 12px;
    text-transform: none;
}

/* Rec Quality: rechts über beide Zeilen zentriert */

#tape-b .tape-record-settings > .tape-rec-quality {
    grid-column: 2;
    grid-row: 1 / 3;

    align-self: center;
    justify-self: center;

    width: 120px;
    min-width: 0;
    margin: 0;
}

/* Sehr schmale Bildschirme */

@media (max-width: 380px) {
    #tape-b .tape-record-settings {
        column-gap: 6px;
        row-gap: 16px;
        padding: 14px 6px;
    }

    #tape-b .tape-record-settings
    .tape-format-selector {
        gap: 2px;
    }

    #tape-b .tape-record-settings
    .tape-format-option {
        font-size: 8px;
    }
}

/* XL: playback bay left, recording bay with side controls right. */
@media (min-width: 1200px) {
    .tapedeck {
        width: min(1280px, 100%);
        max-width: 1280px;
    }
    .tapedeck .tapedeck-decks {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
        gap: 24px;
        align-items: stretch;
    }
    .tapedeck .tape-unit {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto 1fr auto auto auto;
        align-content: start;
    }
    .tapedeck .tape-unit > .tape-unit-header {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .tapedeck .tape-unit > .tape-display {
        grid-column: 1;
        grid-row: 2;
    }
    .tapedeck .tape-unit > .tape-door {
        grid-column: 1;
        grid-row: 3;
        width: 100%;
        align-self: start;
    }
    .tapedeck .tape-unit > .tape-seek {
        grid-column: 1;
        grid-row: 4;
    }
    .tapedeck .tape-unit > .tape-controls {
        grid-column: 1;
        grid-row: 5;
    }
    .tapedeck .tape-unit > .tape-eject-row {
        grid-column: 1;
        grid-row: 6;
    }
    .tapedeck #tape-b {
        grid-template-columns: minmax(0, 1fr) 190px;
        column-gap: 20px;
    }
    #tape-b > .tape-record-settings {
        grid-column: 2;
        grid-row: 2 / 7;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        align-content: center;
        align-self: stretch;
        gap: 28px;
        margin: 0;
        padding: 20px 10px;
    }
    #tape-b .tape-record-settings > .tape-format-select:not(.tape-rate-select) {
        grid-column: 1;
        grid-row: 1;
    }
    #tape-b .tape-record-settings > .tape-rate-select {
        grid-column: 1;
        grid-row: 2;
    }
    #tape-b .tape-record-settings > .tape-rec-quality {
        grid-column: 1;
        grid-row: 3;
        justify-self: center;
    }
}
