/* ===== K7 NOOR — skeuomorphic cassette player ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:root {
  --bg: #171009;
  --panel: #241a12;
  --cream: #f3e9d2;
  --ink: #2b2118;
  --lcd-bg: #0a0f0a;
  --lcd-fg: #57ff7a;
  --amber: #e8a33d;
  --orange: #e2701d;
  --gold: #d4a24e;
}

/* ---- skins (data-skin on <body>) ---- */
body[data-skin="rouge"]   { --body:#8e1f1f; --body-edge:#5e1212; --cassette:#f3e9d2; --cass-ink:#3a2c1c; --label:#fdf6e3; }
body[data-skin="noir"]    { --body:#26232a; --body-edge:#121016; --cassette:#e8e2d4; --cass-ink:#241f18; --label:#f6f1e4; }
body[data-skin="gris"]    { --body:#6d6a70; --body-edge:#45434a; --cassette:#f3e9d2; --cass-ink:#33291d; --label:#fdf6e3; }
body[data-skin="jaune"]   { --body:#d9a321; --body-edge:#a4740e; --cassette:#2b2620; --cass-ink:#f3e9d2; --label:#3a3126; }
body[data-skin="bleu"]    { --body:#2456a6; --body-edge:#16315e; --cassette:#f3e9d2; --cass-ink:#2c2318; --label:#fdf6e3; }
body[data-skin="rose"]    { --body:#c2537a; --body-edge:#8e3353; --cassette:#f7efe0; --cass-ink:#38271f; --label:#fff8ea; }
body[data-skin="orange"]  { --body:#d96a1e; --body-edge:#9c4710; --cassette:#2b2620; --cass-ink:#f3e9d2; --label:#3a3126; }
body[data-skin="blanc"]   { --body:#ded7c8; --body-edge:#a89f8c; --cassette:#8e1f1f; --cass-ink:#f3e9d2; --label:#a32525; }

html, body { height: 100%; }
body {
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(120% 100% at 50% 0%, #241a12 0%, var(--bg) 55%, #0d0906 100%);
  color: var(--cream);
  min-height: 100%;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
.bg-grain {
  position: fixed; inset: 0; pointer-events: none; opacity: .5; z-index: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px);
}

/* ---- header ---- */
.topbar { text-align: center; padding: 18px 12px 6px; position: relative; z-index: 1; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; }
.brand-mark {
  font-weight: 800; font-size: 30px; letter-spacing: 1px;
  color: #171009; background: linear-gradient(160deg, var(--gold), #b57e2c);
  padding: 2px 10px; border-radius: 8px;
  box-shadow: 0 3px 0 #6e4c15, 0 6px 14px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.5);
}
.brand-name { font-weight: 800; font-size: 30px; letter-spacing: 6px; color: var(--cream); text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.brand-sub { margin-top: 4px; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: #a08a6c; }

/* ---- layout ---- */
.stage {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 12px 14px 24px; gap: 16px; width: 100%;
}

/* ============ DECK ============ */
.deck-wrap { width: 100%; max-width: 470px; position: relative; }
.deck {
  --p: 0; /* progression 0..1 pour les bobines */
  position: relative;
  background: linear-gradient(165deg, var(--body) 0%, var(--body-edge) 100%);
  border-radius: 22px;
  padding: 18px 16px 16px;
  box-shadow:
    0 18px 40px rgba(0,0,0,.65),
    inset 0 2px 0 rgba(255,255,255,.22),
    inset 0 -3px 8px rgba(0,0,0,.45);
  transition: background .4s;
}
.screw { position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cfc4ae, #6d6353 70%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.7); }
.screw::after { content:""; position: absolute; left: 1.5px; right: 1.5px; top: 50%; height: 1.6px;
  background: #3a332a; transform: translateY(-50%) rotate(38deg); }
.screw.tl { top: 8px; left: 8px; } .screw.tr { top: 8px; right: 8px; }
.screw.bl { bottom: 8px; left: 8px; } .screw.br { bottom: 8px; right: 8px; }

.deck-top { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px 10px; }
.deck-brand { font-weight: 800; letter-spacing: 3px; font-size: 15px; color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.deck-model { font-size: 8.5px; letter-spacing: 2px; color: rgba(243,233,210,.72); }

/* fenêtre + cassette */
.window {
  background: linear-gradient(180deg, #100b07, #1c130c);
  border-radius: 14px; padding: 12px 10px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,.85), inset 0 -1px 0 rgba(255,255,255,.07);
}
.cassette {
  background: linear-gradient(180deg, var(--cassette), color-mix(in srgb, var(--cassette) 82%, #000));
  border-radius: 10px; padding: 8px 10px 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.55);
  transition: background .4s;
}
.cass-label {
  background: var(--label); border-radius: 6px 6px 0 0;
  padding: 6px 10px 5px; text-align: center; overflow: hidden;
  border-bottom: 2px solid rgba(0,0,0,.18);
}
.cass-label-strip { white-space: nowrap; overflow: hidden; }
.cass-title { display: inline-block; font-weight: 700; font-size: 14px; color: var(--cass-ink); }
.cass-title.marquee { animation: marquee 9s linear infinite; padding-right: 40px; }
@keyframes marquee { 0% {transform: translateX(0)} 100% {transform: translateX(-50%)} }
.cass-artist { display: block; font-size: 9.5px; letter-spacing: 2.2px; text-transform: uppercase; color: color-mix(in srgb, var(--cass-ink) 75%, transparent); margin-top: 2px; }

.cass-window {
  margin-top: 6px;
  background: linear-gradient(180deg, #171310, #241c14);
  border-radius: 8px; height: 86px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: relative;
  box-shadow: inset 0 3px 8px rgba(0,0,0,.8);
}
.reel {
  --pack: 26px; /* rayon de la bande enroulée */
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle, transparent 17px, #4a3423 17.5px, #2e2015 var(--pack), transparent calc(var(--pack) + 1px));
}
.reel.left  { --pack: calc(16px + (1 - var(--p)) * 12px); }
.reel.right { --pack: calc(16px + var(--p) * 12px); }
.reel i {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, #e8e0cd 0 7px, #8a8074 7px 9px, transparent 9.5px),
    conic-gradient(#d8d0bf 0 12deg, transparent 12deg 60deg, #d8d0bf 60deg 72deg, transparent 72deg 120deg, #d8d0bf 120deg 132deg, transparent 132deg 180deg, #d8d0bf 180deg 192deg, transparent 192deg 240deg, #d8d0bf 240deg 252deg, transparent 252deg 300deg, #d8d0bf 300deg 312deg, transparent 312deg);
  -webkit-mask: radial-gradient(circle, #000 0 15px, transparent 15.5px);
          mask: radial-gradient(circle, #000 0 15px, transparent 15.5px);
}
body.playing .reel i { animation: spin 2.4s linear infinite; }
body.playing .reel.right i { animation-duration: 2.4s; }
@keyframes spin { to { transform: rotate(360deg); } }
.tape-line {
  position: absolute; left: 60px; right: 60px; bottom: 18px; height: 2px;
  background: #3a2a1b; border-radius: 1px;
}
.cass-bottom { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 5px; }
.cass-hole { width: 9px; height: 9px; border-radius: 50%; background: rgba(0,0,0,.35); box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.cass-notch { width: 34px; height: 7px; border-radius: 3px; background: rgba(0,0,0,.28); }

/* LCD + eject */
.lcd-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.lcd {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--lcd-bg); border-radius: 8px; padding: 7px 12px;
  font-family: "Courier New", ui-monospace, monospace; font-weight: 700;
  color: var(--lcd-fg); font-size: 16px; letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(87,255,122,.55);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.9), inset 0 -1px 0 rgba(255,255,255,.06);
}
.led { width: 8px; height: 8px; border-radius: 50%; background: #2c3f2d; transition: .2s; }
body.playing .led { background: #4dff6a; box-shadow: 0 0 8px #4dff6a; }
.lcd-state { font-size: 12px; }
.lcd-sep { opacity: .6; }
.eject-btn {
  font: inherit; font-size: 11px; font-weight: 800; letter-spacing: 2px;
  color: var(--ink); background: linear-gradient(180deg, #f7efdd, #cbbfa4);
  border: 0; border-radius: 8px; padding: 10px 12px; cursor: pointer;
  box-shadow: 0 3px 0 #8d8269, 0 5px 10px rgba(0,0,0,.4), inset 0 1px 0 #fff;
}
.eject-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8d8269, inset 0 1px 0 #fff; }

/* seek (bande) */
.seek { margin-top: 10px; height: 12px; border-radius: 6px; background: #140d08; box-shadow: inset 0 2px 5px rgba(0,0,0,.8); cursor: pointer; overflow: hidden; }
.seek-fill { height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, #6b4a2a, var(--gold)); transition: width .25s linear; }

/* transport */
.transport { display: flex; gap: 10px; margin-top: 12px; }
.tbtn {
  flex: 1; border: 0; cursor: pointer; border-radius: 12px; height: 52px;
  background: linear-gradient(180deg, #efe6d2, #c9bc9f);
  box-shadow: 0 4px 0 #8d8269, 0 7px 12px rgba(0,0,0,.45), inset 0 1px 0 #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-weight: 800; letter-spacing: 1px;
}
.tbtn svg { width: 22px; height: 22px; fill: var(--ink); }
.tbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8d8269, inset 0 1px 0 #fff; }
.tbtn.play { background: linear-gradient(180deg, #ffd98f, var(--amber));
  box-shadow: 0 4px 0 #a06a1c, 0 7px 12px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.7); }
.tbtn.play:active { box-shadow: 0 1px 0 #a06a1c, inset 0 1px 0 rgba(255,255,255,.7); }

/* bande latérale */
.side-strip { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.tbtn.amber { flex: 0 0 auto; padding: 0 16px; height: 44px; font-size: 11px;
  background: linear-gradient(180deg, #f6b352, #cf7f1c);
  box-shadow: 0 4px 0 #8a5410, 0 7px 12px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.6); color: #2c1c08; }
.tbtn.amber:active { box-shadow: 0 1px 0 #8a5410, inset 0 1px 0 rgba(255,255,255,.6); }
.vol { flex: 1; display: flex; align-items: center; gap: 10px; }
.vol-ico { font-size: 10px; font-weight: 800; letter-spacing: 2px; color: rgba(243,233,210,.8); }
.vol input[type=range] { flex: 1; appearance: none; -webkit-appearance: none; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--orange) var(--v,80%), #2c2016 var(--v,80%));
  box-shadow: inset 0 2px 4px rgba(0,0,0,.6); outline: none; }
.vol input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb066, var(--orange) 60%, #a34d0f);
  box-shadow: 0 3px 6px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.5); cursor: pointer; }
.vol input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb066, var(--orange) 60%, #a34d0f); cursor: pointer; }
.knob-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 6px rgba(226,112,29,.8); }

/* ============ RACK ============ */
.rack {
  width: 100%; max-width: 470px;
  background: linear-gradient(180deg, #221810, #181008);
  border: 1px solid #3a2c1c; border-radius: 16px;
  padding: 14px; display: none;
  box-shadow: 0 14px 34px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
}
.rack.open { display: block; animation: rackin .28s ease; }
@keyframes rackin { from { transform: translateY(14px); opacity: 0; } }
.rack-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rack-head h2 { font-size: 14px; letter-spacing: 4px; color: var(--gold); }
.mini-btn { font: inherit; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; cursor: pointer;
  color: var(--cream); background: #33261a; border: 1px solid #4a3823; border-radius: 8px; padding: 7px 10px; }
.mini-btn.amber { background: linear-gradient(180deg, #f6b352, #cf7f1c); color: #2c1c08; border: 0; }

.rack-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; padding: 9px 4px;
  color: #b7a58a; background: #241a10; border: 1px solid #3a2c1c; border-radius: 9px; }
.tab.active { color: #171009; background: linear-gradient(180deg, #ffd98f, var(--amber)); border-color: transparent; }

.rack-pane { margin-bottom: 10px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; font: inherit; font-size: 14px; color: var(--cream);
  background: #120c07; border: 1px solid #3a2c1c; border-radius: 9px; padding: 10px 12px; outline: none; }
.search-row input:focus { border-color: var(--amber); }
.add-files { width: 100%; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  color: var(--cream); background: #2c2014; border: 1.5px dashed #6b5232; border-radius: 10px; padding: 13px; }
.hint { font-size: 10.5px; color: #8d7a5e; margin-top: 6px; }

.rack-status { font-size: 12px; color: #9b8567; padding: 6px 2px; }
.rack-status:empty { display: none; }

.tape-list { list-style: none; max-height: 42vh; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding-right: 2px; }
.tape-list::-webkit-scrollbar { width: 5px; } .tape-list::-webkit-scrollbar-thumb { background: #4a3823; border-radius: 3px; }
.tape {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border-radius: 9px; padding: 9px 10px; color: #241c12;
  box-shadow: 0 3px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.45);
  transition: transform .12s;
}
.tape:active { transform: scale(.985); }
.tape.c0 { background: linear-gradient(180deg, #f3e9d2, #d9cbaa); }
.tape.c1 { background: linear-gradient(180deg, #e2701d, #b3530f); color: #fff4e6; }
.tape.c2 { background: linear-gradient(180deg, #a32727, #7c1717); color: #ffe9d9; }
.tape.c3 { background: linear-gradient(180deg, #3d3a42, #26232b); color: #e8dfc9; }
.tape.c4 { background: linear-gradient(180deg, #d9a321, #ad7c0f); color: #2c1e05; }
.tape.c5 { background: linear-gradient(180deg, #2456a6, #183a75); color: #e6ecff; }
.tape-spine { flex: 0 0 34px; height: 26px; border-radius: 4px; position: relative;
  background: rgba(0,0,0,.28); box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.tape-spine::before, .tape-spine::after { content: ""; position: absolute; top: 50%; width: 11px; height: 11px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.85) 0 3px, rgba(0,0,0,.45) 3.5px); transform: translateY(-50%); }
.tape-spine::before { left: 3px; } .tape-spine::after { right: 3px; }
.tape-meta { min-width: 0; flex: 1; }
.tape-title { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-artist { display: block; font-size: 10.5px; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-dur { font-size: 10.5px; font-weight: 700; opacity: .75; font-variant-numeric: tabular-nums; }
.tape.playing-now { outline: 2px solid var(--lcd-fg); outline-offset: 1px; }
.rack-foot { margin-top: 10px; font-size: 10px; letter-spacing: 1px; color: #77664c; text-align: center; }

/* ============ SKINS ============ */
.skin-drawer {
  position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 5;
  background: linear-gradient(180deg, #241a10, #181008);
  border: 1px solid #3a2c1c; border-radius: 14px; padding: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.7);
}
.skin-drawer h3 { font-size: 12px; letter-spacing: 4px; color: var(--gold); margin-bottom: 10px; }
.skin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.skin-chip { cursor: pointer; border: 2px solid transparent; border-radius: 10px; height: 46px; position: relative; overflow: hidden;
  box-shadow: 0 3px 7px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.3); }
.skin-chip.sel { border-color: var(--lcd-fg); }
.skin-chip::after { content: ""; position: absolute; left: 18%; right: 18%; top: 30%; bottom: 30%;
  border-radius: 4px; background: var(--chip-cass, #f3e9d2); box-shadow: inset 0 1px 3px rgba(0,0,0,.4); }

.foot { text-align: center; font-size: 10px; letter-spacing: 2px; color: #6d5c44; padding: 0 0 16px; position: relative; z-index: 1; }

/* ============ paysage / grand écran : deux panneaux ============ */
@media (min-width: 900px) and (orientation: landscape) {
  .stage { flex-direction: row-reverse; align-items: flex-start; justify-content: center; gap: 26px; }
  .rack { display: block; }
  #rack-close { display: none; }
  .tape-list { max-height: 52vh; }
}

/* ============ PLEIN ÉCRAN (cassette) ============ */
.fs-btn {
  font: inherit; cursor: pointer; border: 0; border-radius: 8px;
  background: rgba(0,0,0,.28); color: var(--cream);
  font-size: 15px; line-height: 1; padding: 5px 9px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
.fs-btn:active { transform: scale(.94); }
.deck-wrap:fullscreen, .deck-wrap.pseudo-fs {
  background: radial-gradient(120% 100% at 50% 0%, #241a12 0%, #171009 55%, #0d0906 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; max-width: none;
}
.deck-wrap.pseudo-fs { position: fixed; inset: 0; z-index: 60; }
.deck-wrap:fullscreen .deck, .deck-wrap.pseudo-fs .deck {
  width: 100%; max-width: 540px;
}
.deck-wrap:fullscreen .cass-window, .deck-wrap.pseudo-fs .cass-window { height: 104px; }
.deck-wrap:fullscreen .reel, .deck-wrap.pseudo-fs .reel { width: 68px; height: 68px;
  background: radial-gradient(circle, transparent 19.5px, #4a3423 20px, #2e2015 var(--pack), transparent calc(var(--pack) + 1px)); }
.deck-wrap:fullscreen .reel.left, .deck-wrap.pseudo-fs .reel.left { --pack: calc(18px + (1 - var(--p)) * 14px); }
.deck-wrap:fullscreen .reel.right, .deck-wrap.pseudo-fs .reel.right { --pack: calc(18px + var(--p) * 14px); }
.deck-wrap:fullscreen .reel i, .deck-wrap.pseudo-fs .reel i {
  -webkit-mask: radial-gradient(circle, #000 0 17px, transparent 17.5px);
          mask: radial-gradient(circle, #000 0 17px, transparent 17.5px); }
.deck-wrap:fullscreen .tape-line, .deck-wrap.pseudo-fs .tape-line { left: 70px; right: 70px; bottom: 21px; }
.deck-wrap:fullscreen .cass-title, .deck-wrap.pseudo-fs .cass-title { font-size: 16px; }
.deck-wrap:fullscreen .lcd, .deck-wrap.pseudo-fs .lcd { font-size: 18px; }
.deck-wrap:fullscreen .tbtn, .deck-wrap.pseudo-fs .tbtn { height: 58px; }
.fs-exit {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  font: inherit; font-size: 12px; font-weight: 800; letter-spacing: 1.5px; cursor: pointer;
  color: var(--cream); background: rgba(0,0,0,.45); border: 1px solid rgba(243,233,210,.3);
  border-radius: 9px; padding: 9px 12px;
}
.fs-exit:active { transform: scale(.95); }
