*, *::before, *::after { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; min-height: 100vh; background: #04070f; color: #e6e9f2;
      font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
    a { color: #5dd4f7; }
    .wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
    .topbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap;
      padding: .5rem .25rem 1rem; font-size: .85rem; }
    .topbar a, .topbar button { text-decoration: none; opacity: .75; color: inherit;
      background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
    .topbar a:hover, .topbar button:hover { opacity: 1; }
    .topbar .sep { opacity: .35; }
    .topbar .pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
      background: #5dd4f7; box-shadow: 0 0 12px #5dd4f7;
      animation: pulse 2s ease-in-out infinite; vertical-align: middle; margin-right: .35rem; }
    @keyframes pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }
    h1 { margin: 0 0 .25rem; font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 700;
      letter-spacing: .02em; }
    .lead { color: #a3aabb; margin: 0 0 .5rem; font-size: .95rem; line-height: 1.55; }
    .privacy { margin: 0 0 1rem; padding: .6rem .85rem;
      background: rgba(93,212,247,0.08); border: 1px solid rgba(93,212,247,0.25);
      border-radius: 8px; font-size: .82rem; color: #c0d8e8; line-height: 1.5; }
    .privacy strong { color: #5dd4f7; }
    .clip-bg { position: absolute; inset: 0; width: 100%; height: 100%;
               object-fit: cover; z-index: 0; opacity: 0; transition: opacity .35s;
               pointer-events: none; background: #000; }
    .clip-bg.is-on { opacity: .55; }
    .game-frame canvas { position: relative; z-index: 1; }
    .game-frame .hud { position: absolute; z-index: 2; }
    .game-frame .lanes-touch { position: absolute; z-index: 2; }
    .game-frame .gate { z-index: 10; }
    .game-frame .end { z-index: 10; }
    .game-frame .whisper { z-index: 5; }
    .game-frame { position: relative; background: #050810; border: 1px solid #1b2a44;
      border-radius: 12px; overflow: hidden; box-shadow: 0 14px 40px -16px rgba(0,0,0,0.8);
      min-height: 540px; }
    canvas { display: block; width: 100%; height: auto; image-rendering: crisp-edges; }
    .hud { position: absolute; inset: 0; pointer-events: none; padding: .65rem .85rem;
      font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .8rem;
      color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
    .hud-top { display: flex; justify-content: space-between; gap: .5rem; }
    .hud-top > div { background: rgba(0,0,0,0.5); padding: .35rem .55rem; border-radius: 6px;
      border: 1px solid rgba(255,255,255,0.08); backdrop-filter: blur(4px); }
    .hud .score b, .hud .combo b, .hud .bpm b { color: #5dd4f7; }
    .hud .combo b.hot { color: #ffd060; }
    .hud .acc { color: #b8bfd0; }

    /* Pre-game pane (file picker) */
    .gate { position: absolute; inset: 0;
      display: grid;
      grid-template-rows: 1fr;
      place-items: safe center;
      background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
      padding: 1.5rem;
      pointer-events: auto;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    .gate.hidden { display: none; }
    .gate__inner { text-align: center; max-width: 480px; width: 100%;
      margin: auto 0; padding-block: .5rem; }
    .gate h2 { margin: 0 0 .5rem; font-size: clamp(1.3rem, 4vw, 1.7rem); color: #5dd4f7; }
    .gate p { margin: 0 0 1rem; color: #c0c7d6; line-height: 1.55; }
    .drop {
      display: grid; place-items: center; gap: .5rem;
      padding: 1.5rem 1rem; border: 2px dashed rgba(93,212,247,0.4);
      border-radius: 12px; background: rgba(93,212,247,0.04);
      cursor: pointer; transition: background .15s, border-color .15s;
      margin: 0 0 .85rem; min-height: 110px;
    }
    .drop.is-over { background: rgba(93,212,247,0.12); border-color: #5dd4f7; }
    .drop strong { color: #e6e9f2; font-size: 1.05rem; }
    .drop small { color: #8aa0bd; font-size: .8rem; }
    .drop svg { width: 32px; height: 32px; color: #5dd4f7; }
    .gate input[type="file"] { display: none; }
    .gate .progress { height: 8px; background: rgba(255,255,255,0.06);
      border-radius: 4px; margin: .85rem 0; overflow: hidden; }
    .gate .progress .bar { height: 100%; background: linear-gradient(90deg, #5dd4f7, #a56ff0);
      width: 0%; transition: width .25s ease; }
    .gate .status { color: #8aa0bd; font-size: .82rem; min-height: 1.2rem; }
    .gate .btn { display: inline-block; background: linear-gradient(135deg, #5dd4f7, #2189c4);
      color: #04070f; border: 0; padding: .75rem 1.5rem; font-size: 1rem; font-weight: 700;
      border-radius: 999px; cursor: pointer; box-shadow: 0 6px 20px -6px rgba(93,212,247,0.6); }
    .gate .btn:hover { transform: translateY(-1px); }
    .gate .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
    .gate .demo { margin-top: .85rem; font-size: .78rem; color: #5dd4f7; opacity: .8;
      background: none; border: 0; cursor: pointer; text-decoration: underline; }

    /* End screen */
    .end { position: absolute; inset: 0; display: grid; place-items: center;
      background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); padding: 2rem;
      text-align: center; pointer-events: auto; }
    .end.hidden { display: none; }
    .end h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 1rem; }
    .end .grade { font-size: clamp(3rem, 10vw, 5rem); font-weight: 800;
      background: linear-gradient(135deg, #5dd4f7, #a56ff0); -webkit-background-clip: text;
      background-clip: text; color: transparent; margin: .5rem 0; line-height: 1; }
    .end .breakdown { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem;
      margin: 1rem 0; max-width: 380px; }
    .end .breakdown div { padding: .65rem .35rem; background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; font-family: ui-monospace, monospace; }
    .end .breakdown b { display: block; color: #5dd4f7; font-size: 1.4rem; }
    .end .breakdown span { color: #b8bfd0; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
    .end p { color: #c0c7d6; margin: .5rem 0 1.5rem; max-width: 32rem; line-height: 1.55; }
    .end .actions { display: flex; gap: .65rem; justify-content: center; flex-wrap: wrap; }

    /* Mobile lanes */
    .lanes-touch { position: absolute; left: 0; right: 0; bottom: 0; display: none;
      pointer-events: auto; user-select: none; height: 80px; }
    .lanes-touch button { flex: 1; background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08); border-radius: 0; color: #fff;
      font-size: 1.4rem; font-weight: 700; touch-action: none;
      -webkit-tap-highlight-color: transparent; }
    .lanes-touch button:active { background: rgba(93,212,247,0.25); }

    .panel { margin: 1.5rem 0; background: #0a1322; border: 1px solid #1b2a44;
      border-radius: 12px; padding: 1.1rem 1.25rem; font-size: .92rem; line-height: 1.6;
      color: #c0c7d6; }
    .panel h3 { margin: 0 0 .6rem; color: #e6e9f2; font-size: 1rem; }
    .panel code { background: rgba(255,255,255,0.06); padding: .05rem .35rem; border-radius: 3px;
      font-size: .85em; }
    .panel ul { padding-left: 1.2rem; margin: .25rem 0; }
    .panel a { color: #5dd4f7; }

    .gate .btn#btn-start:not(:disabled) { animation: kr-glow 1.8s ease-in-out infinite; }
    @keyframes kr-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(93,212,247,.55); }
                         50%      { box-shadow: 0 0 0 18px rgba(93,212,247,0); } }
    /* tempo-zone retained for historical reasons (no longer used after YT removal) */
    .tempo-zone { display: none; }
    /* original styles below kept as dead-CSS — harmless without matching DOM */
    .tempo-zone-dead { background: rgba(93,212,247,0.06); border: 1px solid rgba(93,212,247,0.25);
      border-radius: 10px; padding: .85rem; margin: .5rem 0; }
    .tempo-zone h3 { margin: 0 0 .35rem; font-size: .85rem; color: #5dd4f7; }
    .tempo-zone p { margin: 0 0 .5rem; font-size: .78rem; color: #8aa0bd; }
    .tempo-zone .tempo-row { display: flex; gap: .5rem; align-items: center; }
    .tempo-zone .tap-btn { flex: 1; padding: .75rem; background: rgba(93,212,247,0.18);
      border: 2px solid #5dd4f7; border-radius: 10px; color: #fff; font-weight: 700;
      font-size: 1rem; cursor: pointer; transition: transform .08s, background .08s;
      font-family: ui-monospace, monospace; }
    .tempo-zone .tap-btn:active, .tempo-zone .tap-btn.is-flash {
      transform: scale(0.96); background: rgba(93,212,247,0.45); }
    .tempo-zone .bpm-input { width: 80px; padding: .65rem .35rem; text-align: center;
      background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
      border-radius: 8px; color: #fff; font-size: 1rem; font-weight: 700;
      font-family: ui-monospace, monospace; }
    .tempo-zone .bpm-input:focus { outline: none; border-color: #5dd4f7; }
    .tempo-zone .tempo-result { font-size: .78rem; color: #c0c7d6; margin-top: .35rem;
      font-family: ui-monospace, monospace; min-height: 1rem; }

    /* v2.5 — key remap + hold visual */
    .keymap-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem;
      margin: .65rem 0 .35rem; }
    .keymap-row .keymap-cell { display: flex; flex-direction: column; align-items: center;
      gap: .25rem; padding: .45rem .25rem; background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; }
    .keymap-row .keymap-cell .lab { font-size: .65rem; color: #8aa0bd; letter-spacing: .04em;
      text-transform: uppercase; }
    .keymap-row .keymap-cell button { background: transparent; color: #5dd4f7; border: 0;
      cursor: pointer; font: 700 1rem/1 ui-monospace, monospace; padding: .15rem .35rem;
      border-radius: 4px; text-transform: uppercase; min-width: 32px; }
    .keymap-row .keymap-cell button.is-capturing { background: rgba(93,212,247,0.2);
      color: #fff; animation: capturePulse 1s ease-in-out infinite; }
    @keyframes capturePulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
    .keymap-toggle { background: none; border: 0; color: #8aa0bd; font-size: .78rem;
      cursor: pointer; text-decoration: underline; margin-top: .25rem; padding: 0; }
    .keymap-toggle:hover { color: #5dd4f7; }
    .keymap-panel { display: none; }
    .keymap-panel.is-open { display: block; }

    /* v2 — whisper + difficulty + story */
    .whisper { position: absolute; left: 1rem; right: 1rem; bottom: 1rem;
      max-width: 560px; margin: 0 auto; padding: .6rem .9rem .6rem 2.6rem;
      background: rgba(10,14,26,0.92); border: 1px solid rgba(93,212,247,0.35);
      border-radius: 12px; color: #e6e9f2; font-size: .85rem; line-height: 1.5;
      backdrop-filter: blur(8px); pointer-events: none;
      transform: translateY(20px); opacity: 0;
      transition: transform .3s ease, opacity .3s ease; z-index: 18; }
    .whisper.is-on { transform: translateY(0); opacity: 1; }
    .whisper::before { content: ''; position: absolute; left: .65rem; top: 50%;
      transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%;
      background: radial-gradient(circle at 50% 48%, #fff8e0 0%, #ffd060 12%, #ff5025 38%, #a8121a 78%, #3a0509 100%);
      box-shadow: 0 0 10px rgba(255,80,30,0.55); animation: pulse 2.4s ease-in-out infinite; }
    .whisper .speaker { display: block; font-size: .62rem; letter-spacing: .14em;
      text-transform: uppercase; color: #ff8a30; font-weight: 700; margin-bottom: .12rem; }
    /* v2.15 — Multi-mix queue UI */
    .mix-queue { margin: .65rem 0; padding: .65rem .75rem; background: rgba(93,212,247,.06);
                 border: 1px solid rgba(93,212,247,.2); border-radius: 10px; }
    .mix-queue__head { display: flex; justify-content: space-between; align-items: center;
                       margin-bottom: .45rem; }
    .mix-queue__head strong { font-size: .85rem; color: #5dd4f7; letter-spacing: .02em; }
    .mix-queue__clear { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
                        color: #c0c7d6; padding: .25rem .55rem; border-radius: 6px; cursor: pointer;
                        font-size: .72rem; }
    .mix-queue__clear:hover { background: rgba(255,80,80,.18); color: #fff; border-color: rgba(255,80,80,.3); }
    .mix-queue__list { list-style: none; padding: 0; margin: 0; max-height: 140px; overflow-y: auto; }
    .mix-queue__list li { display: flex; align-items: center; gap: .5rem; padding: .35rem .25rem;
                          font-size: .82rem; color: #c0c7d6; border-bottom: 1px solid rgba(255,255,255,.06); }
    .mix-queue__list li:last-child { border-bottom: 0; }
    .mix-queue__list .mix-idx { color: #5dd4f7; font-weight: 700; font-family: ui-monospace, monospace;
                                min-width: 1.5rem; }
    .mix-queue__list .mix-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
                                 white-space: nowrap; }
    .mix-queue__list .mix-status { font-size: .7rem; opacity: .7; }
    .mix-queue__list .mix-status.is-current { color: #5dd4f7; opacity: 1; font-weight: 700; }
    .mix-queue__list .mix-status.is-ready { color: #3cffa0; }
    .mix-queue__list .mix-status.is-error { color: #ff7050; }
    .mix-queue__list .mix-remove { background: none; border: 0; color: #95a3b8; cursor: pointer;
                                   font-size: 1rem; padding: .15rem .4rem; border-radius: 4px; }
    .mix-queue__list .mix-remove:hover { background: rgba(255,80,80,.2); color: #fff; }
    .mix-queue__hint { font-size: .72rem; color: #95a3b8; margin: .45rem 0 0; }

    /* v2.15 — HAL plays toggle + HAL difficulty pill */
    .play-mode-row { margin: .35rem 0 .25rem; display: flex; justify-content: center; }
    .play-mode-toggle { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer;
                        font-size: .82rem; color: #c0c7d6; padding: .35rem .65rem;
                        border-radius: 999px; border: 1px solid rgba(255,255,255,.1);
                        background: rgba(255,255,255,.03); transition: all .2s; }
    .play-mode-toggle:hover { background: rgba(165,111,240,.08); border-color: rgba(165,111,240,.3); color: #fff; }
    .play-mode-toggle input[type=checkbox] { accent-color: #a56ff0; }
    .play-mode-toggle .hal-eye-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
                                     background: radial-gradient(circle, #ff3010, #a8121a);
                                     box-shadow: 0 0 6px rgba(255,48,16,.5); }
    .diff-row button.diff-hal {
      background: linear-gradient(135deg, rgba(255,48,16,.18), rgba(165,111,240,.18));
      border: 1px solid rgba(255,48,16,.35); color: #ffaca0; font-weight: 700;
      letter-spacing: .04em;
    }
    .diff-row button.diff-hal:hover { color: #fff; border-color: rgba(255,48,16,.6); }
    .diff-row button.diff-hal[aria-pressed="true"] {
      background: linear-gradient(135deg, rgba(255,48,16,.4), rgba(165,111,240,.4));
      border-color: #ff3010; color: #fff;
      box-shadow: 0 0 12px rgba(255,48,16,.4);
    }

    .diff-row { display: flex; gap: .35rem; justify-content: center; margin: .65rem 0 .35rem; }
    .diff-row button { flex: 0 0 auto; padding: .35rem .8rem; border-radius: 999px;
      background: rgba(255,255,255,0.04); color: #c0c7d6; border: 1px solid rgba(255,255,255,0.1);
      font-size: .78rem; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
    .diff-row button:hover { color: #fff; border-color: rgba(93,212,247,0.4); }
    .diff-row button[aria-pressed="true"] { background: rgba(93,212,247,0.18);
      color: #5dd4f7; border-color: #5dd4f7; }
    .gate__lore { margin: 0 0 1rem; padding: .6rem .85rem; background: rgba(165,111,240,0.08);
      border: 1px solid rgba(165,111,240,0.3); border-radius: 8px; font-style: italic;
      color: #d0c0e8; font-size: .82rem; line-height: 1.5; text-align: left; }
    .gate__lore strong { color: #a56ff0; font-style: normal; }
    .end .title-line { font-size: 1.05rem; color: #5dd4f7; font-weight: 600; letter-spacing: .04em;
      margin: 0 0 .35rem; }
    .end .title-name { font-size: clamp(1.3rem, 4vw, 1.7rem); margin: 0 0 1rem;
      background: linear-gradient(135deg, #5dd4f7, #ffd060); -webkit-background-clip: text;
      background-clip: text; color: transparent; font-weight: 700; }

    @media (max-width: 720px) {
      .hud { font-size: .7rem; padding: .4rem .5rem; }
      .lanes-touch { display: flex; }
    }

    /* v2.17.x — Mobile + tablette : éviter overflow horizontal du gate */
    @media (max-width: 600px) {
      .game-frame { min-height: 420px; }
      .gate { padding: 1rem; }
      .gate__inner { max-width: 100%; padding-block: .25rem; }
      .gate h2 { font-size: 1.15rem; }
      .gate__lore { font-size: .8rem; padding: .5rem .65rem; }
      .drop { padding: 1rem .65rem; }
      #t-drop-strong { font-size: .92rem; }
      #t-drop-small { font-size: .72rem; }
      .diff-row { flex-wrap: wrap; gap: .3rem; }
      .diff-row button { padding: .35rem .65rem; font-size: .72rem; min-height: 32px; }
      .play-mode-toggle { font-size: .76rem; padding: .35rem .55rem; }
      .mix-queue { padding: .55rem .6rem; }
      .mix-queue__head strong { font-size: .78rem; }
      .mix-queue__list li { padding: .3rem .15rem; font-size: .76rem; }
      .mix-queue__list .mix-idx { min-width: 1.2rem; }
      .mix-queue__list .mix-status { font-size: .65rem; }
      .keymap-toggle { font-size: .75rem; }
      .keymap-row { grid-template-columns: repeat(2, 1fr); }
      .gate .btn { width: 100%; }
      .privacy { font-size: .78rem; }
    }
    @media (max-width: 400px) {
      .gate h2 { font-size: 1rem; }
      .diff-row button { padding: .32rem .55rem; font-size: .68rem; }
      .play-mode-toggle { font-size: .72rem; }
      .mix-queue__list li { gap: .35rem; }
      .mix-queue__list .mix-status { display: none; }
    }
