/* ============================================================
   EPSON PX-8 — корпус, стіл, касети
   ============================================================ */
:root {
    --plastic-hi: #d6d0c1;
    --plastic: #c6bfae;
    --plastic-lo: #a9a291;
    --plastic-edge: #7d776a;
    --panel: #2a2825;
    --key-top: #4a4741;
    --key-bot: #36332f;
    --key-side: #1f1d1a;
    --legend: #ece6d6;
    --cy-legend: #d9894f;
    --led-off: #4a2320;
    --led-on: #ff4a36;
    --led-g-on: #7dff5a;
    --led-g-off: #243a1d;
    --lcd-a: #aeb89e;
    --lcd-b: #9ba78a;
    --lcd-c: #8c987b;
    --hand: 'Caveat', 'Segoe Print', 'Comic Sans MS', cursive;
    --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    min-height: 100vh;
    background: #120d09;
    font-family: Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}

/* ===================== СТІЛ ===================== */
.desk {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    padding: 40px 16px 60px;
    background:
        radial-gradient(ellipse 70% 60% at 50% 38%, rgba(255,214,150,0.20), rgba(255,200,130,0.06) 55%, transparent 75%),
        radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(0,0,0,0.75) 100%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='900' height='300'><filter id='w'><feTurbulence type='fractalNoise' baseFrequency='0.0035 0.09' numOctaves='4' seed='7'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.05  0 0 0 0 0.02  0 0 0 0.85 0'/></filter><rect width='100%' height='100%' filter='url(%23w)'/></svg>"),
        linear-gradient(90deg, #4a3020, #573826 30%, #4b311f 60%, #553624);
    background-size: auto, auto, 900px 300px, auto;
}
.desk::before {                      /* дрібне зерно */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: var(--noise); opacity: 0.25; mix-blend-mode: multiply;
}
.coffee-ring {
    position: absolute; width: 150px; height: 150px; border-radius: 50%;
    right: 7%; top: 64%;
    border: 7px solid rgba(40,20,8,0.22);
    box-shadow: inset 0 0 0 2px rgba(40,20,8,0.12), 0 0 3px rgba(40,20,8,0.2);
    transform: rotate(18deg) scaleY(0.93);
    filter: blur(0.6px);
    pointer-events: none;
}
.coffee-ring::after {
    content: ""; position: absolute; inset: -11px 20px auto auto; width: 60px; height: 40px;
    border-top: 4px solid rgba(40,20,8,0.16); border-radius: 50%;
}

.scene-wrap { position: relative; }
#scene {
    position: absolute;
    left: 50%; top: 0;
    width: 1330px;
    transform: translateX(-50%);
    transform-origin: 50% 0;
}

/* ===================== ПРИСТРІЙ ===================== */
.device {
    position: relative;
    padding: 20px 24px 22px;
    border-radius: 14px 14px 18px 18px;
    background:
        linear-gradient(178deg, var(--plastic-hi) 0%, var(--plastic) 18%, #bdb6a5 70%, var(--plastic-lo) 100%);
    box-shadow:
        0 3px 0 var(--plastic-edge),
        0 5px 0 #5f5a50,
        0 30px 60px rgba(0,0,0,0.65),
        0 12px 20px rgba(0,0,0,0.45),
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -2px 4px rgba(0,0,0,0.12);
    user-select: none;
}
.device::after {                     /* зерно і потертості пластику */
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background:
        linear-gradient(104deg, transparent 62%, rgba(255,255,255,0.18) 62.2%, transparent 62.5%),
        linear-gradient(97deg, transparent 18%, rgba(90,80,65,0.14) 18.1%, transparent 18.35%),
        linear-gradient(8deg, transparent 88%, rgba(90,80,65,0.10) 88.1%, transparent 88.3%),
        var(--noise);
    background-size: 100% 100%, 100% 100%, 100% 100%, 220px;
    opacity: 0.5; mix-blend-mode: multiply;
}

.top-panel {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

/* --- екран --- */
.screen-frame {
    position: relative;
    padding: 12px 18px 16px;
    border-radius: 9px;
    background: linear-gradient(180deg, #2e2c28, var(--panel) 30%, #232120);
    box-shadow:
        inset 0 2px 5px rgba(0,0,0,0.85),
        inset 0 -1px 0 rgba(255,255,255,0.08),
        0 1px 0 rgba(255,255,255,0.45);
}
.screen-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin: 0 2px 9px;
}
.brand {
    font: italic 900 21px/1 "Arial Black", Arial, sans-serif;
    letter-spacing: 1px;
    color: #d7d2c4;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.6);
}
.model-name {
    font: bold 12px/1 Arial, sans-serif; letter-spacing: 4px; color: #a39e91;
}
.model-name b { color: #c8553f; font-style: italic; letter-spacing: 1px; font-weight: bold; margin-left: 8px; }
.fine-print {
    font: 9px/1 Arial, sans-serif; letter-spacing: 1.5px; color: #77736a;
}

.lcd-well {
    position: relative;
    padding: 7px;
    border-radius: 3px;
    background: #141311;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.07);
}
.lcd-glass {
    position: relative;
    padding: 8px 10px;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(40,50,30,0.22) 100%),
        linear-gradient(172deg, var(--lcd-a) 0%, var(--lcd-b) 45%, var(--lcd-c) 100%);
    box-shadow: inset 0 4px 10px rgba(20,28,12,0.45), inset 0 0 2px rgba(20,28,12,0.6);
    border-radius: 1px;
    overflow: hidden;
}
.lcd-glass::after {                  /* відблиск скла */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background:
        linear-gradient(112deg, rgba(255,255,255,0.20) 0%, rgba(255,255,255,0.05) 20%, transparent 34%),
        linear-gradient(112deg, transparent 70%, rgba(255,255,255,0.05) 78%, transparent 86%);
}
#lcd { display: block; position: relative; }
body.frozen #lcd { filter: contrast(1.05); }

/* --- касетний привід --- */
.drive-panel {
    flex: 1;
    display: flex; flex-direction: column; gap: 10px;
    padding: 12px 14px;
    border-radius: 9px;
    background: linear-gradient(180deg, #b7b09f, #aaa392);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.25), inset 0 -1px 0 rgba(255,255,255,0.3), 0 1px 0 rgba(255,255,255,0.4);
}
.drive-cap {
    display: flex; justify-content: space-between;
    font: bold 9px/1 Arial, sans-serif; letter-spacing: 1.5px; color: #4f4a41;
}
.drive-well {
    position: relative;
    height: 122px;
    border-radius: 6px;
    background: linear-gradient(180deg, #1a1917, #26241f);
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
    perspective: 400px;
}
#driveSlot { width: 156px; height: 104px; position: relative; }
#driveSlot:empty::after {
    content: "B:  ПОРОЖНЬО"; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font: bold 10px/1 Arial, sans-serif; letter-spacing: 2px; color: #3e3a33;
}
#driveDoor {
    position: absolute; inset: 4px;
    border-radius: 4px;
    background:
        linear-gradient(115deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.05) 30%, transparent 45%, rgba(255,255,255,0.07) 80%, transparent 90%),
        rgba(40,34,28,0.30);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
    transform-origin: 50% 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
    pointer-events: none;
}
#driveDoor.open { transform: rotateX(38deg) translateY(-6px); opacity: 0.35; }
.drive-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.counter {
    display: flex; gap: 2px;
    padding: 3px; border-radius: 3px;
    background: #0d0d0c;
    box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255,255,255,0.35);
    font: bold 15px/1 "Courier New", monospace;
    color: #f1ece0;
    letter-spacing: 5px;
    padding-left: 7px;
    background-image: linear-gradient(180deg, rgba(255,255,255,0.12), transparent 40%, transparent 60%, rgba(0,0,0,0.5));
}
.leds { display: flex; flex-direction: column; gap: 6px; }
.drive-row.ctl .led-wrap { flex-direction: column; gap: 6px; }
.drive-panel { min-width: 0; }
.led-wrap { display: flex; align-items: center; gap: 4px; }
.led {
    width: 9px; height: 9px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #6a3531, var(--led-off));
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.3);
}
.led.on { background: radial-gradient(circle at 35% 30%, #ffc1b5, var(--led-on) 60%); box-shadow: 0 0 8px var(--led-on), 0 0 2px #fff; }
.led.green { background: radial-gradient(circle at 35% 30%, #3b5a30, var(--led-g-off)); }
.led.green.on { background: radial-gradient(circle at 35% 30%, #e8ffd9, var(--led-g-on) 60%); box-shadow: 0 0 8px var(--led-g-on); }
.cap { font: bold 8.5px/1 Arial, sans-serif; letter-spacing: 1px; color: #4f4a41; }

.btn-hw {
    cursor: pointer;
    font: bold 8.5px/1 Arial, sans-serif; letter-spacing: 1px;
    color: #e3ddcf;
    padding: 7px 9px 6px;
    border-radius: 3px;
    background: linear-gradient(180deg, #5b5750, #423f39);
    box-shadow: 0 2px 0 #26241f, 0 3px 4px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-hw:active { transform: translateY(2px); box-shadow: 0 0 0 #26241f, inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-hw.red { background: linear-gradient(180deg, #a14b3a, #7f382b); box-shadow: 0 2px 0 #4d2119, 0 3px 4px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }

.knob {
    --rot: 0deg;
    width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer;
    background:
        repeating-conic-gradient(from 0deg, rgba(0,0,0,0.25) 0 4deg, transparent 4deg 12deg),
        radial-gradient(circle at 35% 30%, #77736a, #45423b 70%);
    border: 1px solid #2b2925;
    box-shadow: 0 2px 3px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.25);
    position: relative;
    transform: rotate(var(--rot));
    transition: transform 0.2s;
}
.knob::after {
    content: ""; position: absolute; top: 3px; left: 50%; width: 2px; height: 8px; margin-left: -1px;
    background: #e8e2d2; border-radius: 1px;
}

.switch {
    cursor: pointer;
    width: 36px; height: 14px; border-radius: 7px; position: relative;
    background: #1d1c19;
    box-shadow: inset 0 1px 3px #000, 0 1px 0 rgba(255,255,255,0.35);
}
.switch::after {
    content: ""; position: absolute; top: 1px; left: 19px; width: 16px; height: 12px; border-radius: 5px;
    background: linear-gradient(180deg, #d8d2c3, #9d9686);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    transition: left 0.12s;
}
.switch.off::after { left: 1px; }
body.powered #power::after { left: 19px; }
#power::after { left: 1px; }

/* --- петля --- */
.hinge {
    height: 12px;
    margin: 12px 30px 10px;
    border-radius: 6px;
    background: linear-gradient(180deg, #8f897b, #d0c9b8 40%, #a39c8b 70%, #7a7467);
    box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

/* ===================== КЛАВІАТУРА ===================== */
.keyboard {
    display: flex; gap: 18px; justify-content: space-between;
    padding: 12px 14px 14px;
    border-radius: 8px;
    background: linear-gradient(180deg, #1f1d1a, #2a2824);
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.85), 0 1px 0 rgba(255,255,255,0.45);
}
.kb-main, .kb-side { display: flex; flex-direction: column; gap: 6px; }
.kb-main { flex: 0 0 auto; }
.krow { display: flex; gap: 6px; }
.kb-side .krow { justify-content: center; }
.krow.fn .key { height: 28px; }

.key {
    --u: 56px;
    position: relative;
    width: var(--u); height: 46px;
    flex: 0 0 auto;
    cursor: pointer;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--key-top), var(--key-bot));
    box-shadow:
        0 3px 0 var(--key-side),
        0 5px 6px rgba(0,0,0,0.55),
        inset 0 1px 0 rgba(255,255,255,0.14),
        inset 0 -3px 4px rgba(0,0,0,0.25);
    color: var(--legend);
    transition: transform 0.05s, box-shadow 0.05s;
}
.key::before {                        /* увігнута верхівка */
    content: ""; position: absolute; inset: 3px 5px 7px; border-radius: 4px;
    background: radial-gradient(ellipse at 50% 30%, rgba(255,255,255,0.09), transparent 70%);
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.25);
}
.key span {
    position: absolute; left: 9px; top: 8px;
    font: bold 11px/1 Arial, Helvetica, sans-serif; letter-spacing: 0.5px;
    text-shadow: 0 0 1px rgba(236,230,214,0.3);
}
.key .cy {
    left: auto; right: 9px; top: auto; bottom: 10px;
    font-size: 10px; color: var(--cy-legend); opacity: 0.75;
    transition: opacity 0.15s, text-shadow 0.15s;
}
body.cyr .key .cy { opacity: 1; text-shadow: 0 0 4px rgba(255,150,80,0.55); }
.key.small span { font-size: 9px; }
.key.center span { left: 0; right: 0; text-align: center; top: 50%; transform: translateY(-60%); }
.key.worn span { opacity: 0.55; }
.key.red { --key-top: #9d4938; --key-bot: #7c3729; --key-side: #4a1f17; }
.key.blue { --key-top: #4d5d80; --key-bot: #394764; --key-side: #20283a; }
.key.light { --key-top: #8b857a; --key-bot: #6f6a60; --key-side: #3f3c36; }
.key.down, .key:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 var(--key-side), 0 1px 2px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1), inset 0 -2px 3px rgba(0,0,0,0.3);
}
.key .lamp {
    position: absolute; right: 7px; top: 7px; width: 5px; height: 5px; border-radius: 50%;
    background: #3a1f16; box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
}
body.cyr .key .lamp { background: #ff8a3c; box-shadow: 0 0 5px #ff8a3c; }

.under {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding: 0 6px;
}
.under-note { font: bold 9px/1 Arial, sans-serif; letter-spacing: 2px; color: #6e695e; }
.dymo {
    display: inline-block;
    padding: 5px 12px 4px;
    background: linear-gradient(180deg, #1c1c1f, #0c0c0e 60%, #16161a);
    color: #f4f4f4;
    font: bold 12px/1 "Courier New", monospace; letter-spacing: 3px;
    text-shadow: 0 1px 0 rgba(0,0,0,0.9), 0 -1px 0 rgba(255,255,255,0.35);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.18);
    transform: rotate(-1.2deg);
}
.tape-strip {
    position: absolute; left: 70px; top: 298px; z-index: 3;
    padding: 3px 10px;
    background: rgba(234,221,176,0.92);
    color: #29354f;
    font: 600 16px/1 var(--hand);
    transform: rotate(2deg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    clip-path: polygon(2% 0, 98% 4%, 100% 50%, 97% 100%, 1% 96%, 0 40%);
}

/* ===================== КОРОБКА КАСЕТ І ЗАПИСКА ===================== */
.desk-row {
    display: flex; gap: 40px; align-items: flex-start;
    margin-top: 44px; padding: 0 30px;
}
.tray-box {
    position: relative;
    min-width: 420px;
    padding: 18px 20px 20px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(38,35,33,0.94), rgba(22,21,20,0.96));
    box-shadow:
        0 18px 36px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.12),
        inset 0 0 0 2px rgba(0,0,0,0.4);
    transform: rotate(-1.2deg);
}
.tray-box::before {
    content: "мікрокасети // Н.К."; position: absolute; left: 22px; top: -24px;
    font: 600 19px/1 var(--hand); color: rgba(240,232,210,0.72); white-space: nowrap;
}
#tray { display: flex; gap: 5px; align-items: flex-end; }
.tray-slot {                          /* гніздо лотка — видно згори */
    position: relative;
    width: 24px; height: 158px;
    border-radius: 3px;
    background: linear-gradient(90deg, #0b0a09, #171615 50%, #0b0a09);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.95), 0 1px 0 rgba(255,255,255,0.07);
}
.tray-slot.has { cursor: pointer; }
.tray-slot.empty { cursor: default; }
.tray-slot.empty .spine { visibility: hidden; }
.tray-slot.empty::after {
    content: "\25B2"; position: absolute; left: 0; right: 0; bottom: 6px; text-align: center;
    font: 9px/1 Arial, sans-serif; color: #5a544a;
}

.spine {                              /* корінець касети */
    --lean: 0deg;
    position: absolute; inset: 3px 2px;
    border-radius: 3px;
    background: linear-gradient(90deg, #121110 0%, #33312d 30%, #2a2825 70%, #0f0e0d 100%);
    box-shadow: 0 2px 3px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.12);
    transform: rotate(var(--lean));
    transition: transform 0.16s, box-shadow 0.16s, filter 0.16s;
}
.spine::before, .spine::after {       /* виступи корпусу на кінцях */
    content: ""; position: absolute; left: 3px; right: 3px; height: 3px; border-radius: 1px;
    background: rgba(255,255,255,0.1); box-shadow: 0 1px 0 rgba(0,0,0,0.6);
}
.spine::before { top: 5px; } .spine::after { bottom: 5px; }
.spine.shell-smoke { background: linear-gradient(90deg, #3d352d 0%, #7a6e60 30%, #6a5e51 70%, #3a3129 100%); }
.spine.shell-white { background: linear-gradient(90deg, #9d9a91 0%, #ecebe6 30%, #dcdad2 70%, #9a978e 100%); }
.spine.shell-blue { background: linear-gradient(90deg, #111d33 0%, #34507e 30%, #2b456f 70%, #0f1a2e 100%); }
.spine.shell-green { background: linear-gradient(90deg, #172414 0%, #3f5a3a 30%, #354d31 70%, #152112 100%); }
.spine.shell-red { background: linear-gradient(90deg, #3e120c 0%, #8e3325 30%, #7a2a1e 70%, #3a0f0a 100%); }
.spine-label {
    position: absolute; left: 3px; right: 3px; top: 13px; bottom: 13px;
    border-radius: 1px;
    background: linear-gradient(90deg, #d8cfb8, #f1ead8 40%, #e4dbc3);
    box-shadow: inset 0 0 0 1px rgba(120,100,70,0.2);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.spine-label span {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font: 700 15px/1 var(--hand); color: #1d1b1a; white-space: nowrap;
}
.tray-slot.has:hover .spine {
    transform: translateY(-9px) rotate(var(--lean));
    box-shadow: 0 10px 12px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.15);
    filter: brightness(1.12);
}

.sticky {
    width: 250px;
    padding: 20px 18px 22px;
    background: linear-gradient(175deg, #f6e98a, #efdc6c 60%, #e6d060);
    color: #2c2f45;
    font: 600 20px/1.12 var(--hand);
    transform: rotate(2.5deg);
    box-shadow: 0 12px 18px rgba(0,0,0,0.45), 0 2px 3px rgba(0,0,0,0.3);
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 94%, 94% 100%, 0 100%);
}
.sticky::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 18px;
    background: linear-gradient(180deg, rgba(0,0,0,0.07), transparent);
}
.sticky h4 { margin: 0 0 8px; font: 700 23px/1 var(--hand); text-decoration: underline; text-decoration-thickness: 1px; }
.sticky ul { margin: 0; padding-left: 16px; }
.sticky li { margin-bottom: 4px; }
.sticky .sig { text-align: right; margin-top: 6px; font-size: 22px; }

/* ===================== МІКРОКАСЕТА ===================== */
.mc {
    --pack-l: 1; --pack-r: 0.45; --pack-dur: 0ms;
    position: relative;
    width: 156px; height: 104px;
    border-radius: 6px 6px 8px 8px;
    background: linear-gradient(180deg, #34322f 0%, #242321 40%, #1a1918 100%);
    box-shadow:
        0 5px 9px rgba(0,0,0,0.55),
        inset 0 1px 0 rgba(255,255,255,0.18),
        inset 0 -2px 0 rgba(0,0,0,0.5),
        inset 0 0 0 1px rgba(0,0,0,0.6);
    overflow: hidden;
}
.mc::after {                          /* глянець */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(120deg, rgba(255,255,255,0.12), transparent 35%, transparent 70%, rgba(255,255,255,0.05));
}
.mc.shell-smoke { background: linear-gradient(180deg, rgba(122,110,96,0.95), rgba(88,78,68,0.96) 45%, rgba(66,58,51,0.98)); }
.mc.shell-white { background: linear-gradient(180deg, #ecebe6, #d6d4cc 50%, #bebbb1); }
.mc.shell-blue { background: linear-gradient(180deg, #34507e, #243a61 50%, #1a2b4a); }
.mc.shell-green { background: linear-gradient(180deg, #3f5a3a, #2e4529 50%, #22331f); }
.mc.shell-red { background: linear-gradient(180deg, #8e3325, #6e2419 50%, #531a12); }

.mc-label {
    position: absolute; left: 9px; right: 9px; top: 7px; height: 36px;
    padding: 3px 7px 0;
    border-radius: 2px;
    background: linear-gradient(180deg, #f3ecda, #e6dcc3);
    box-shadow: 0 1px 1px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(120,100,70,0.2);
    color: #1d1b1a;
    font-family: var(--hand);
    overflow: hidden;
    background-image:
        linear-gradient(180deg, transparent 17px, rgba(200,60,60,0.35) 17px, rgba(200,60,60,0.35) 18px, transparent 18px),
        linear-gradient(180deg, #f3ecda, #e6dcc3);
}
.mc-l1 { display: block; font-weight: 700; font-size: 16px; line-height: 16px; white-space: nowrap; transform: rotate(-1deg); }
.mc-l2 { display: block; font-weight: 500; font-size: 13px; line-height: 16px; white-space: nowrap; opacity: 0.85; }

.mc-window {
    position: absolute; left: 32px; right: 32px; top: 50px; height: 34px;
    border-radius: 4px;
    background: rgba(12,10,9,0.92);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: space-around;
}
.mc-window::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(110deg, rgba(255,255,255,0.18), transparent 40%);
}
.mc-hub { position: relative; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.mc-pack {
    position: absolute; left: 50%; top: 50%;
    width: 30px; height: 30px; margin: -15px 0 0 -15px;
    border-radius: 50%;
    background: radial-gradient(circle, #5a3a22 0 45%, #3e2716 46%, #4c311c 80%, #2e1d10);
    transition: transform var(--pack-dur) linear;
}
.mc-hub.l .mc-pack { transform: scale(var(--pack-l)); }
.mc-hub.r .mc-pack { transform: scale(var(--pack-r)); }
.mc-reel {
    position: relative;
    width: 14px; height: 14px; border-radius: 50%;
    background: conic-gradient(#e6e1d3 0 25deg, #8d887c 25deg 120deg, #e6e1d3 120deg 145deg, #8d887c 145deg 240deg, #e6e1d3 240deg 265deg, #8d887c 265deg 360deg);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}
.mc-reel::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #111; }
@keyframes spin { to { transform: rotate(360deg); } }
.mc.spin-read .mc-reel { animation: spin 2s linear infinite; }
.mc.spin-ff .mc-reel { animation: spin 0.3s linear infinite; }
.mc.spin-rew .mc-reel { animation: spin 0.3s linear infinite reverse; }

.mc-brand {
    position: absolute; left: 10px; bottom: 7px;
    font: bold 8px/1 Arial, sans-serif; letter-spacing: 1px; color: rgba(230,225,210,0.55);
}
.mc.shell-white .mc-brand { color: rgba(40,40,40,0.55); }
.mc-screw {
    position: absolute; width: 6px; height: 6px; border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #b7b3a8, #5d5a53);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
    bottom: 8px;
}
.mc-screw::after { content: ""; position: absolute; left: 1px; right: 1px; top: 2.5px; height: 1px; background: rgba(0,0,0,0.6); }
.mc-screw.a { left: 58px; } .mc-screw.b { right: 58px; }
.mc-tape {
    position: absolute; left: 44px; right: 44px; bottom: 0; height: 4px;
    background: linear-gradient(180deg, #5a3a22, #3a2413);
}
.mc.flying { box-shadow: 0 30px 40px rgba(0,0,0,0.6); }

/* ===================== СЕНСОРНА ПАНЕЛЬ (телефон) ===================== */
.touchpad { display: none; }
#sysKbd {
    position: fixed; left: 0; top: 0; width: 1px; height: 1px;
    opacity: 0; border: 0; padding: 0; font-size: 16px;     /* 16px — щоб iOS не зумив */
    pointer-events: none;
}
@media (hover: none) {
    .tray-slot.has:hover .spine { transform: rotate(var(--lean)); box-shadow: 0 2px 3px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.12); filter: none; }
}
.key { touch-action: none; -webkit-tap-highlight-color: transparent; }

body.phone .keyboard, body.phone .hinge, body.phone .under,
body.phone .tape-strip, body.phone .sticky, body.phone .coffee-ring { display: none; }
body.phone .desk { padding: 6px 8px; min-height: 100vh; min-height: 100dvh; }
body.phone .device { padding: 16px 24px 18px; }
body.phone .touchpad {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-top: 14px; padding: 14px 16px;
    border-radius: 8px;
    background: linear-gradient(180deg, #1f1d1a, #2a2824);
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.85), 0 1px 0 rgba(255,255,255,0.45);
}
.tp-main, .tp-arrows { display: flex; flex-direction: column; gap: 10px; }
.tp-arrows { align-items: center; }
.tp-row { display: flex; gap: 10px; }
.key.tp { --u: 104px; height: 70px; }
.key.tp span { left: 0; right: 0; top: 50%; transform: translateY(-55%); text-align: center; font-size: 17px; }
.key.tp.wide { --u: 250px; }
.key.tp.wide2 { --u: 214px; }
.tp-arrows .key.tp { --u: 96px; }
.tp-arrows .key.tp span { font-size: 22px; }

/* лоток на телефоні — шухляда поверх Епсона */
body.phone .desk-row {
    display: none;
    position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 30;
    margin: 0; padding: 0;
    align-items: center; justify-content: center;
    background: rgba(10,8,6,0.72);
    border-radius: 14px;
}
body.phone.tray-open .desk-row { display: flex; }
body.phone .tray-box { transform: scale(1.35); }

/* ===================== МОБІЛЬНА ЗАГЛУШКА ===================== */
.stub { display: none; }
@media (max-width: 899px) and (orientation: portrait) {
    .desk { display: none; }
    .stub {
        display: block;
        margin: 40px auto;
        width: min(340px, calc(100vw - 32px));
        background: linear-gradient(178deg, var(--plastic-hi), var(--plastic) 40%, var(--plastic-lo));
        border-radius: 10px;
        padding: 14px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    }
    .stub-screen {
        background: linear-gradient(160deg, var(--lcd-a), var(--lcd-c));
        border-radius: 2px;
        padding: 14px 12px;
        font: bold 12px/1.65 "Courier New", monospace;
        color: #1c2416;
        white-space: pre-wrap;
        box-shadow: inset 0 3px 10px rgba(20,25,15,0.35);
    }
    .stub-brand { font: italic 900 15px/1 "Arial Black", Arial, sans-serif; color: #3a3833; margin-bottom: 10px; }
}

.rotate-phone {
    width: 64px; height: 64px; margin: 0 auto 16px; position: relative;
}
.rotate-phone i {
    position: absolute; left: 20px; top: 4px; width: 24px; height: 44px;
    border: 3px solid #3a3833; border-radius: 5px;
    animation: rot 2.4s ease-in-out infinite;
}
.rotate-phone i::after { content: ""; position: absolute; left: 7px; bottom: 2px; width: 4px; height: 2px; background: #3a3833; }
@keyframes rot { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (max-width: 899px) and (orientation: portrait) {
    body { background: #120d09; }
    .stub { margin-top: 18vh; text-align: left; }
}
