/* ============================================================
   SHUFFLE DRUMMER — Layout global (.machine, .edge, .top, écrans, footer)
   ============================================================ */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html {
    min-height: 100%;
    background: #a0a09a;
  }
  body {
    min-height: 100vh;
    background: #a0a09a;
    display: flex;
    align-items: center;
    overflow-y: auto;
    justify-content: center;
    padding: 10px 6px;
    font-family: 'Share Tech Mono', 'OCR B', 'Courier New', monospace;
  }
  .machine {
    width: 100%; max-width: 940px; min-width: 340px;
    margin: auto;
    background: linear-gradient(180deg,var(--surface-light) 0%,#bfbbb3 8%,var(--surface-light2) 100%);
    border: 1px solid var(--border-color); border-radius: var(--border-radius-machine);
    padding: 7px 12px 16px;
    box-shadow: 0 26px 70px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  }
  /* Le viewport est redevenu zoomable (accessibilite / Lighthouse — fin de
     user-scalable=no) : on coupe le double-tap zoom sur les controles tactiles
     pour ne pas gener le jeu. :where() = specificite 0, ne remplace donc AUCUN
     touch-action existant (knobs/faders en touch-action:none, etc.). */
  :where(.machine button, .machine [onclick]) { touch-action: manipulation; }
  /* Edge */
  .edge {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; letter-spacing: 0.2em; color: var(--text-primary);
    padding-bottom: 6px; margin-bottom: 8px;
    /* Header au-dessus du panneau .top : sinon le popup MASTER VOL (piégé dans
       le contexte d'empilement du span header transformé) passe derrière les knobs. */
    position: relative; z-index: 30;
  }
  .edge-title { font-size: 24px; font-weight: 300; letter-spacing: 0.28em; color: var(--text-primary); display: inline-block; transform: translateY(7px); }
  .edge-cat-shadow { height: 34px; width: auto; vertical-align: middle; margin: 0 5px 0 -10px; display: inline-block; }
  .v1 { color: var(--accent); background: #000; padding: 1px 3px; border-radius: 2px; margin-left: 2px; font-size: 17px; }
  /* Uniformise la hauteur des boutons de l'en-tête (account / MIDI / help / volume) */
  .edge .pact-btn,
  .edge .midi-edge-btn,
  .edge .help-btn,
  .edge .vol-btn {
    height: 25px; box-sizing: border-box;
    display: inline-flex; align-items: center; justify-content: center;
  }
  /* Top panel */
  .top {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch;
    background: var(--surface-mid); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-panel); padding: 8px; margin-bottom: 10px;
  }
  .screen-col { display: flex; flex-direction: column; gap: 7px; align-items: center; flex: 1; min-width: 120px; }
  .screen {
    width: 100%; max-width: 240px; align-self: flex-start; background: #150900;
    border: 2px solid #0d0e10; border-radius: 6px;
    padding: 8px 6px 12px;
    min-height: 150px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
    cursor: pointer;
    display: flex; flex-direction: column; justify-content: space-between;
  }
  .screen-bpm { color: var(--accent); font-size: 22px; font-weight: 700; text-shadow: 0 0 9px var(--led-shadow); cursor: ns-resize; user-select: none; -webkit-user-select: none; touch-action: none; }
  .screen-bpm-input {
    background: transparent; border: none; outline: none;
    color: var(--accent); font-size: 22px; font-weight: 700;
    font-family: inherit; letter-spacing: 0.04em;
    text-shadow: 0 0 9px var(--led-shadow);
    width: 100%; caret-color: var(--accent-bright);
    border-bottom: 1px solid var(--accent-dim-strong);
  }
  .screen-status { color: var(--accent-light); font-size: 10px; margin-top: 4px; letter-spacing: 0.08em; min-height: 12px; }
  .screen-status.err { color: var(--danger); }
  .screen-meta { color: #7a4aaa; font-size: 9px; margin-top: 4px; letter-spacing: 0.06em; }
  .footer {
    margin-top: 8px; text-align: center;
    font-size: 11px; letter-spacing: 0.22em; color: var(--text-deep);
  }
  /* Liens SEO masqués visuellement, gardés dans le DOM (maillage interne). */
  .footer .seo-footer-link { display: none; }
  @keyframes sd-glow {
    0%, 100% { box-shadow: 0 8px 22px var(--shadow-strong), 0 0 14px rgba(255,122,26,0.25); }
    50% { box-shadow: 0 8px 22px var(--shadow-strong), 0 0 26px rgba(255,122,26,0.5); }
  }
  @media (prefers-reduced-motion: reduce) {
    .wheel-outer.playing { animation: none; }
    .drum-btn { transition: none; }
  }


/* ── MIDI Edge Button ──────────────────────────────────── */
.midi-edge-btn {
  background: var(--metal-dark);
  border: 1px solid #cc333366;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  white-space: nowrap;
  letter-spacing: 0.14em;
  color: #ff5555;
  padding: 4px 9px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.12s;
}
.midi-edge-btn:hover { background: #ff333322; border-color: #ff5555; }
.midi-edge-btn.on {
  color: #6acf6a;
  border-color: #6acf6a88;
}
.midi-edge-btn.on:hover { background: #6acf6a22; border-color: #6acf6a; }
.midi-edge-btn.denied {
  color: #ff5555;
  border-color: #ff555566;
}
.midi-edge-btn.unsupported {
  color: #777;
  border-color: #44444466;
  cursor: default;
}
.midi-edge-btn.unsupported:hover { background: transparent; border-color: #666; }

/* ── Learn / Tutorial Mode ─────────────────────────────── */
.help-btn {
  background: var(--metal-dark);
  border: 1px solid #6a9a6a66;
  border-radius: 3px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  white-space: nowrap;
  letter-spacing: 0.14em;
  padding: 4px 9px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.12s;
  animation: help-blink 2s ease-in-out infinite;
}
.help-btn:hover { background: #6acf6a22; border-color: #6acf6a; }
.help-btn.used { animation: none; color: #ffffff; }
body.learn-mode .help-btn { animation: none; color: #ff4444; border-color: #ff4444; }
@keyframes help-blink {
  0%, 40%, 100% { color: #ffffff; }
  70% { color: #ff3333; }
}
body.learn-mode .machine { opacity: 0.72; transition: opacity 0.3s ease; }
body.learn-mode * { cursor: help !important; }
body.learn-mode .trn-btn,
body.learn-mode .drum-btn,
body.learn-mode .btab,
body.learn-mode .pact-btn,
body.learn-mode button { cursor: help !important; }

.wheel-label.learn-active {
  color: var(--accent, #ff7a1a) !important;
}

/* Popup */
#learn-popup {
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
#learn-popup.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.learn-popup-inner {
  position: relative;
  background: #f0ece4;
  border: 1px solid #c8c0b0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 13px;
  color: #3a2a1a;
  line-height: 1.7;
  overflow: hidden;
}
.learn-popup-cat-wrap {
  position: absolute;
  top: 6px;
  right: 22px;
  width: 60px;
  height: 60px;
  z-index: 1;
}
.learn-popup-cat {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}
.learn-popup-body {
  padding: 12px 14px 8px;
  max-height: 240px;
  overflow-y: auto;
}
.learn-popup-body b { color: #1a1814; }
.learn-popup-body b:first-child { font-size: 15px; letter-spacing: 0.06em; color: #c05a00; }
.learn-popup-body u { color: #1a4a7a; text-decoration-color: rgba(26,74,122,0.4); }
.learn-popup-body i { color: #7a6a58; }
.learn-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 7px;
  border-top: 1px solid #c8c0b0;
  background: #e8e4dc;
}
.learn-lang-btn {
  background: #fff;
  border: 1px solid #c8c0b0;
  border-radius: 4px;
  color: #3a2a1a;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  cursor: pointer !important;
  transition: background 0.15s, border-color 0.15s;
}
.learn-lang-btn:hover {
  background: #f5f0e8;
  border-color: #a89880;
}
.learn-close-btn {
  color: #9a8a78;
  font-size: 13px;
  cursor: pointer !important;
  padding: 2px 4px;
  transition: color 0.15s;
}
.learn-close-btn:hover { color: #c05a00; }
.learn-search-wrap {
  flex: 1;
  margin: 0 8px;
}
.learn-search-input {
  width: 100%;
  background: #fff;
  border: 1px solid #c8c0b0;
  border-radius: 4px;
  color: #3a2a1a;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  outline: none;
  transition: border-color 0.15s;
}
.learn-search-input:focus { border-color: #a89880; }
.learn-search-input::placeholder { color: #b0a090; }
.learn-search-results {
  display: none;
  background: #f8f5f0;
  border-top: 1px solid #c8c0b0;
  max-height: 160px;
  overflow-y: auto;
}
.learn-search-item {
  padding: 6px 14px;
  font-size: 12px;
  color: #3a2a1a;
  cursor: pointer !important;
  border-bottom: 1px solid #e8e4dc;
  transition: background 0.1s;
}
.learn-search-item:last-child { border-bottom: none; }
.learn-search-item:hover { background: #ede8e0; color: #b84a00; }
.learn-search-empty { padding: 8px 14px; font-size: 11px; color: #9a8a78; font-style: italic; }
