  :root{
    --bg: #EDE7D8;
    --panel: #FFFFFF;
    --panel-2: #F5F0E4;
    --ink: #24211C;
    --muted: #6E6858;
    --line: #D8CFB8;
    --board: #FBF8F0;
    --target: #B7AC8E;
    --accent: #3E5C50;
    --blocked: #B23B3B;
  }
  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --bg: #1C1E1A; --panel: #262922; --panel-2: #2D3128; --ink: #ECE6D6;
      --muted: #A6A08D; --line: #3C4136; --board: #211F1B; --target: #6C6650; --accent: #8FBBA8;
    }
  }
  :root[data-theme="dark"]{
    --bg: #1C1E1A; --panel: #262922; --panel-2: #2D3128; --ink: #ECE6D6;
    --muted: #A6A08D; --line: #3C4136; --board: #211F1B; --target: #6C6650; --accent: #8FBBA8;
  }
  *{ box-sizing: border-box; }
  html, body{ margin:0; padding:0; }
  body{
    background: var(--bg); color: var(--ink);
    font-family: "Iowan Old Style","Georgia","Charter",serif;
    -webkit-font-smoothing: antialiased;
  }
  .wrap{ max-width: 1400px; margin: 0 auto; padding: 28px 24px 60px; }
  header{ margin-bottom: 14px; text-align: center; }
  h1{ font-size: 1.4rem; font-weight: 600; margin: 0 0 4px; }
  .touch-hint{
    position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%);
    display: none; pointer-events: none; text-align: center; max-width: 82%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.7rem; line-height: 1.5; color: #4E6B68; letter-spacing: 0.02em;
    transition: opacity 0.5s ease;
  }
  .touch-hint.gone{ opacity: 0; }
  header p{
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--muted); max-width: 64ch; line-height: 1.4; margin: 0 auto; font-size: 0.8rem;
  }
  .layout{ margin-top: 22px; }
  .board-card{ background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px 20px 16px; }
  .shape-tabs{ display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
  .shape-tabs button{
    font: inherit; font-size: 0.88rem; padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  .shape-tabs button.active{ background: var(--accent); border-color: var(--accent); color: var(--board); }
  .shape-tabs button:hover:not(.active){ border-color: var(--accent); }
  header, footer{ display: none; }
  .wrap{ padding: 10px; max-width: none; }
  .board-card{ background: transparent; border: none; padding: 0; }
  .board-frame{ aspect-ratio: var(--vb, 640 / 460); height: min(calc(100vh - 20px), 96vh);
    width: auto; max-width: calc(100vw - 20px); margin: 0 auto; }
  svg#board{ width: 100%; height: 100%; }
  .hud{ position: absolute; z-index: 3; display: flex; align-items: center; gap: 8px; }
  .hud-tl{ left: 10px; top: 9px; }
  .hud-tr{ right: 10px; top: 9px; }
  .hud-bottom{ left: 50%; bottom: 10px; transform: translateX(-50%); justify-content: center; }
  .hud-bl{ left: 10px; bottom: 10px; }
  .hud-br{ right: 10px; bottom: 10px; }
  .eye-btn{ padding: 9px !important; border-radius: 50% !important; color: #9BB4AE; }
  .eye-btn svg{ display: block; width: 26px; height: 26px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .eye-btn.on{ color: #EAFFFA; border-color: rgba(0,255,214,0.65);
    box-shadow: 0 0 16px rgba(0,255,214,0.55), inset 0 0 12px rgba(0,255,214,0.25); }
  .eye-btn.on svg{ filter: drop-shadow(0 0 5px #00FFD6); }
  .hud button{
    font: inherit; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.8rem; line-height: 1; cursor: pointer; padding: 8px 14px; border-radius: 999px;
    background: rgba(8,14,18,0.82); border: 1px solid rgba(255,255,255,0.14); color: #DCEAE6; white-space: nowrap;
    backdrop-filter: blur(6px); transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  }
  .hud button:not(:disabled):hover{ border-color: #37E0C0; box-shadow: 0 0 12px rgba(0,255,214,0.3); }
  .hud button:disabled{ opacity: 0.35; cursor: not-allowed; }
  .hud button.icon{ padding: 8px 12px; font-size: 1rem; }
  .hud #homeBtn{ color: #9BF5E2; border-color: rgba(0,255,214,0.4); }
  .key-btn{ padding: 9px !important; border-radius: 50% !important; color: #FFD9A0; border-color: rgba(255,180,84,0.45) !important; }
  .key-btn svg{ display: block; width: 26px; height: 26px; fill: none; stroke: currentColor;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .key-btn.flash{ animation: keyFlash 0.5s ease-in-out 2; }
  @keyframes keyFlash{
    0%, 100%{ color: #FFD9A0; border-color: rgba(255,180,84,0.45); box-shadow: none; }
    40%, 60%{ color: #FF6B6B; border-color: #FF6B6B; box-shadow: 0 0 20px rgba(255,90,90,0.65); }
  }
  .hud #createDoneBtn{ color: #7CF0A6; border-color: rgba(124,240,166,0.45); }
  .hud .options{ position: relative; }
  .hud .options-menu{ top: calc(100% + 8px); bottom: auto; right: 0; left: auto; }
  .hud[hidden]{ display: none; }
  .board-frame{ position: relative; background: #000; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; touch-action: none; }
  svg#board{ display: block; width: 100%; height: auto; }
  .piece{ cursor: grab; }
  svg#board{ -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .piece:active{ cursor: grabbing; }
  .piece polygon{ stroke: rgba(0,0,0,0.25); stroke-width: 1; stroke-linejoin: round; }
  .piece.selected polygon, .piece.won polygon{ fill: var(--neon); stroke: #fff; stroke-width: 1.6; }
  .piece.selected, .piece.won{ filter: drop-shadow(0 0 5px var(--neon)) drop-shadow(0 0 12px var(--neon)); }
  .piece.blocked polygon{ stroke: var(--blocked); stroke-width: 2.5; }
  .piece.reset-anim{ transition: transform 0.6s cubic-bezier(.34,1.56,.64,1); }
  .toolbar{
    display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    flex-wrap: wrap;
  }
  .toolbar button{
    font: inherit; font-size: 0.88rem; padding: 7px 13px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
  }
  .toolbar button:disabled{ opacity: 0.4; cursor: not-allowed; }
  .toolbar button:not(:disabled):hover{ border-color: var(--accent); }
  .toolbar .spacer{ flex: 1; }
  .toolbar button.on{ background: var(--accent); border-color: var(--accent); color: var(--board); }
  #silhouette{ filter: drop-shadow(0 0 4px rgba(0,255,214,0.8)) drop-shadow(0 0 12px rgba(120,80,255,0.55)); }
  .cut-lines polygon{ fill: none; stroke: #FFFFFF; stroke-width: 1.8; stroke-linejoin: round;
    stroke-dasharray: 6 5; animation: cutRun 1.4s linear infinite;
    filter: drop-shadow(0 0 4px #00FFD6) drop-shadow(0 0 9px rgba(0,255,214,0.7)); }
  @keyframes cutRun{ to{ stroke-dashoffset: -11; } }

  #silhouette polygon{ fill: #0F332E; stroke: #0F332E; stroke-width: 0.8; stroke-linejoin: miter; pointer-events: none; }
  .toolbar button.solved, .toolbar button.solved:not(:disabled):hover{ background: #3F8F5B; border-color: #3F8F5B; color: #fff; }
  .toolbar button.solved:disabled{ opacity: 1; }
  .toolbar button.current:disabled{ opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
  .difficulty[hidden]{ display: none; }
  .fig-clock{
    pointer-events: none;
    font-family: "SF Mono", ui-monospace, "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums; font-size: 0.92rem; letter-spacing: 0.06em;
    color: #7CF0A6; text-shadow: 0 0 8px rgba(124,240,166,0.4);
    background: rgba(5,10,12,0.72); border: 1px solid rgba(124,240,166,0.25);
    border-radius: 999px; padding: 3px 11px;
  }
  .fig-clock[hidden]{ display: none; }
  .fig-clock.done{ color: #FFE27A; border-color: rgba(255,226,122,0.35); text-shadow: 0 0 8px rgba(255,226,122,0.45); }
  .diff-light{
    pointer-events: none; flex: none;
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(5,10,12,0.72); border: 1px solid rgba(255,255,255,0.10);
  }
  .diff-light[hidden]{ display: none; }
  .diff-light i{
    display: block; width: 13px; height: 13px; border-radius: 50%;
    background: var(--lit, #6BD37A);
    box-shadow: 0 0 8px var(--lit, #6BD37A), 0 0 18px var(--lit, #6BD37A);
    animation: lightPulse 2.6s ease-in-out infinite;
  }
  @keyframes lightPulse{ 0%,100%{ opacity: 0.85; } 50%{ opacity: 1; } }
  .difficulty{
    position: absolute; right: 12px; top: 10px; pointer-events: none; z-index: 2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 0.82rem;
    color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
  }
  .difficulty b{ color: var(--ink); font-weight: 700; }
  .bravo{
    position: absolute; left: 50%; bottom: 62px; transform: translate(-50%, 12px); z-index: 4; opacity: 0; pointer-events: none;
    background: #3F8F5B; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600; font-size: 1.05rem; padding: 8px 22px; border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18); transition: opacity 0.25s ease, transform 0.35s cubic-bezier(.34,1.56,.64,1);
  }
  .bravo.show{ opacity: 1; transform: translate(-50%, 0); }
  .chal-bonus{ bottom: 104px; }
  .chrono{
    position: absolute; left: 50%; top: 8px; transform: translateX(-50%); pointer-events: none; z-index: 2;
    display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 20px 5px;
    background: #16201B; border: 1px solid #2E4A3D; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  }
  .chrono[hidden]{ display: none; }
  .chrono-time{
    font-family: "SF Mono", ui-monospace, "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.7rem; letter-spacing: 0.06em;
    color: #7CF0A6; text-shadow: 0 0 8px rgba(124,240,166,0.45); line-height: 1.15;
  }
  .chrono-count{
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.72rem; letter-spacing: 0.08em; color: #8FB8A2;
  }
  .chrono.done .chrono-time{ color: #FFE27A; text-shadow: 0 0 8px rgba(255,226,122,0.45); }
  .chrono.low .chrono-time{ color: #FF8A7A; text-shadow: 0 0 8px rgba(255,138,122,0.5); }
  .puff{ transform-box: fill-box; transform-origin: center; opacity: 0; animation: puff var(--dur, 0.75s) ease-out forwards; }
  @keyframes puff{ from{ opacity: var(--peak, 0.6); transform: translate(0,0) scale(0.6); } to{ opacity: 0; transform: translate(var(--dx), var(--dy)) scale(var(--grow, 2.4)); } }
  .snake-layer{ pointer-events: none; animation: snakeHue 6s linear infinite; }
  .snake-layer path{ fill: none; stroke-linejoin: round; stroke-linecap: round; }
  .snake-base{ stroke: #00FFD6; stroke-width: 2.2; opacity: 0.55; filter: drop-shadow(0 0 4px #00FFD6); }
  .snake-tail{ stroke: #00FFD6; stroke-width: 3.4; stroke-dasharray: 26 74; filter: drop-shadow(0 0 6px #00FFD6) drop-shadow(0 0 12px #00FFD6); opacity: 0.55; animation: snakeRun 2.6s linear infinite; }
  .snake-head{ stroke: #fff; stroke-width: 3.6; stroke-dasharray: 9 91; stroke-dashoffset: -17; filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 14px #00FFD6); animation: snakeRunHead 2.6s linear infinite; }
  @keyframes snakeRun{ to{ stroke-dashoffset: -100; } }
  @keyframes snakeRunHead{ from{ stroke-dashoffset: -17; } to{ stroke-dashoffset: -117; } }
  @keyframes snakeHue{ to{ filter: hue-rotate(360deg); } }
  .chal-bonus{
    position: absolute; left: 50%; bottom: 84px; transform: translate(-50%, 0); opacity: 0; pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-weight: 700; font-size: 1.3rem; color: #7CF0A6;
    text-shadow: 0 2px 10px rgba(0,0,0,0.35);
  }
  .chal-bonus.penalty{ color: #FF8A7A; }
  .chal-bonus.show{ animation: chalBonus 1s ease-out; }
  @keyframes chalBonus{ 0%{ opacity: 0; transform: translate(-50%, 8px); } 15%{ opacity: 1; } 100%{ opacity: 0; transform: translate(-50%, -34px); } }
  .chal-end{ position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(20,20,19,0.55); }
  .chal-end[hidden]{ display: none; }
  .chal-card{ background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 40px 22px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.3); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-width: 260px; }
  .chal-title{ font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  .chal-score{ margin: 8px 0 4px; display: flex; flex-direction: column; align-items: center; }
  .chal-score span{ font-size: 4.2rem; font-weight: 700; line-height: 1.05; color: var(--accent); font-family: "Iowan Old Style", Georgia, serif; }
  .chal-score small{ font-size: 0.9rem; color: var(--muted); }
  .chal-best{ min-height: 1.3em; margin-bottom: 14px; font-size: 0.9rem; color: var(--ink); }
  .chal-actions{ display: flex; gap: 10px; justify-content: center; }
  .chal-actions button.ghost{ background: transparent; border-color: #2A3A44; color: #9BF5E2; }
  .chal-actions button.ghost:hover{ border-color: #37E0C0; }
  .chal-actions button{ font: inherit; font-size: 0.9rem; padding: 8px 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; }
  .chal-actions button:first-child{ background: var(--accent); border-color: var(--accent); color: var(--board); }
  .bravo.warn{ background: #B23B3B; }
  .create-name{ font: inherit; font-size: 0.95rem; width: 100%; margin: 6px 0 14px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--board); color: var(--ink); text-align: center; }
  .mymenu{ min-width: 240px; max-height: 280px; overflow-y: auto; padding: 6px; }
  .mymenu .row{ display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
  .mymenu .row:hover{ background: var(--panel-2); }
  .mymenu .row .nm{ flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mymenu .row .rt{ color: var(--muted); font-size: 0.8rem; }
  .mymenu .row .del{ border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 4px; }
  .mymenu .row .del:hover{ color: var(--blocked); }
  .mymenu .empty{ padding: 8px 10px; color: var(--muted); }
  .levels{ left: 0; right: auto; padding: 10px 12px 12px; width: max-content; max-width: 92vw; }
  .levels .grid{ display: grid; grid-template-columns: repeat(8, minmax(44px, 1fr)); gap: 6px; }
  .levels .grp{ display: flex; align-items: baseline; gap: 8px; margin: 2px 2px 8px; }
  .levels .grp b{ font-size: 0.86rem; }
  .levels[hidden]{ display: none; }
  .levels button{ padding: 7px 0; }
  .collection{ left: 0; right: auto; width: max-content; max-width: 92vw; max-height: 62vh; overflow-y: auto; padding: 10px 12px 12px; }
  .collection[hidden]{ display: none; }
  .collection .grp{ display: flex; align-items: baseline; gap: 8px; margin: 10px 2px 6px; }
  .collection .grp:first-child{ margin-top: 2px; }
  .collection .grp.top{ border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .collection .grp b{ font-size: 0.86rem; }
  .collection .grp span, .levels .grp span{ color: var(--muted); font-size: 0.74rem; }
  .levels button[data-stars]::after, .collection .grid button[data-stars]::after{
    content: attr(data-stars); display: block; font-size: 0.5rem; line-height: 1;
    letter-spacing: 1px; color: #E8B84B; margin-top: 2px;
  }
  .toolbar button.solved[data-stars]::after{ color: #FFF0C2; }
  .bravo.stars{ font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
  .collection .grid{ display: grid; grid-template-columns: repeat(10, minmax(40px, 1fr)); gap: 6px; }
  .collection .grid button{ padding: 7px 0; }
  #collectionBtn .cnt, #levelsBtn .cnt{ color: var(--muted); font-size: 0.78rem; margin-left: 4px; }
  .options{ position: relative; }
  .options-menu{
    position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5; min-width: 200px; max-width: calc(100vw - 28px);
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15); font-size: 0.88rem;
  }
  .options-menu[hidden]{ display: none; }
  .options-menu label{ display: flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
  .toolbar .moved{ display: none !important; }
  .toolbar .pair{ display: inline-flex; gap: 6px; }
  .toolbar button.icon{ font-size: 1.05rem; line-height: 1; padding: 6px 11px; }
  .toolbar #homeBtn{ color: #9BF5E2; border-color: rgba(0,255,214,0.35); }
  .toolbar #homeBtn:not(:disabled):hover{ border-color: #37E0C0; box-shadow: 0 0 12px rgba(0,255,214,0.35); }
  #optionsBtn{ display: inline-flex; align-items: center; padding: 7px 9px; }
  .counter{ font-size: 0.85rem; color: var(--muted); }
  footer{ margin-top: 18px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--muted); font-size: 0.85rem; line-height: 1.6; }

  /* ---- Touch screens: no sticky hover, comfortable tap targets ---- */
  @media (hover: none){
    .toolbar button:not(:disabled):hover{ border-color: var(--line); }
    .toolbar button{ padding: 9px 14px; }
    .mymenu .row:hover{ background: transparent; }
  }
  /* ---- Phones and small windows ---- */
  @media (max-width: 760px){
    .wrap{ padding: 0; max-width: none; }
    header, footer{ display: none; }
    .layout{ margin-top: 0; }
    .wrap{ padding: 0; }
    .board-frame{ border-radius: 0; border: none; height: 100vh; max-width: 100vw; }
    /* la carte "Comment jouer" explique désormais les gestes : plus de phrase sur le plateau,
       qui passait sous les pièces et devenait illisible */
    .touch-hint{ display: none; }
    /* installée sur l'écran d'accueil, l'app occupe tout l'écran : on garde les boutons
       hors de l'encoche et de la barre de geste du bas */
    .hud-tl, .hud-tr{ top: calc(9px + env(safe-area-inset-top, 0px)); }
    .hud-bottom, .hud-bl, .hud-br{ bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    /* every control becomes a small pill, all on the same dark strip */
    .toolbar{ gap: 6px; margin-top: 0; padding: 8px 8px 10px; justify-content: center; border-top: none; }
    .toolbar button{ font-size: 0.76rem; padding: 7px 12px; border-radius: 999px; }
    .toolbar .spacer{ display: none; }
    .toolbar button.icon{ padding: 6px 10px; }
    #optionsBtn{ padding: 6px 9px; }
    /* the pop-up panels become a sheet anchored to the bottom of the screen */
    .options-menu{ position: fixed; left: 10px; right: 10px; bottom: 12px; width: auto;
      min-width: 0; max-width: none; max-height: 70vh; overflow-y: auto; }
    .levels{ grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); padding: 12px; }
    .collection{ padding: 12px; }
    .collection .grid{ grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
    .levels button, .collection .grid button{ padding: 10px 0; }
    .difficulty{ left: 8px; right: auto; top: 8px; font-size: 0.74rem; padding: 3px 9px; }
    .bravo{ font-size: 0.95rem; padding: 7px 16px; }
    .chrono{ padding: 5px 16px 4px; }
    .chrono-time{ font-size: 1.35rem; }
    .chal-bonus{ bottom: 96px; font-size: 1.1rem; }
    .chal-card{ padding: 18px 20px; }
  }
  /* ---- Short screens (phone held sideways): fit the board to the height ---- */
  @media (orientation: landscape) and (max-height: 620px){
    header, footer{ display: none; }
    .wrap{ padding: 8px 10px 10px; }
    .layout{ margin-top: 0; }
    .board-card{ padding: 10px 10px 8px; }
    .board-frame{ height: 100vh; }
    .toolbar{ margin-top: 8px; padding-top: 8px; gap: 7px; }
    .toolbar button{ font-size: 0.8rem; padding: 6px 12px; border-radius: 999px; }
    .toolbar .spacer{ display: none; }
    .options-menu{ max-height: 74vh; overflow-y: auto; }
    .levels{ grid-template-columns: repeat(10, minmax(38px, 1fr)); }
  }

  /* ---- On a phone the whole screen becomes the game: dark skin, neon title ---- */
  @media (max-width: 760px), (orientation: landscape) and (max-height: 620px){
    :root{
      --bg: #05070A; --panel: #0C1218; --panel-2: #121C24; --ink: #DCEAE6;
      --muted: #7E9A94; --line: #22303A; --board: #000; --accent: #37E0C0;
    }
    body{ background: #05070A; }
    .board-card{ background: transparent; border-color: transparent; padding: 0 0 6px; }
    .board-frame{ border-color: rgba(0,255,214,0.22); box-shadow: 0 0 22px rgba(0,255,214,0.10); }
    h1{
      color: #9BF5E2; font-size: 0.98rem; letter-spacing: 0.16em; text-transform: uppercase;
      text-shadow: 0 0 8px rgba(0,255,214,0.55), 0 0 22px rgba(120,80,255,0.35);
    }
    .hint-touch{ color: #6E8A85; letter-spacing: 0.01em; }
    .toolbar{ border-top-color: rgba(0,255,214,0.14); }
    .toolbar button.on{ color: #04120E; }
    .toolbar button.solved, .toolbar button.solved:not(:disabled):hover{ background: #1C7A4E; border-color: #1C7A4E; }
    .fig-clock{ font-size: 0.8rem; padding: 3px 9px; }
    .diff-light{ width: 26px; height: 26px; }
    .diff-light i{ width: 11px; height: 11px; }
    .hud-tl{ left: 8px; top: 8px; gap: 6px; }
    .hud-tr{ right: 8px; top: 8px; gap: 6px; }
    .hud-bottom{ bottom: 8px; gap: 6px; }
    .hud-bl{ left: 8px; bottom: 8px; }
    .hud-br{ right: 8px; bottom: 8px; }
    .eye-btn svg, .key-btn svg{ width: 23px; height: 23px; }
    .hud button{ font-size: 0.72rem; padding: 8px 10px; }
    .hud button.icon{ padding: 8px 10px; }
    .hud-bottom{ gap: 5px; flex-wrap: nowrap; }
    .difficulty b{ color: #9BF5E2; }
    .options-menu{ box-shadow: 0 10px 34px rgba(0,0,0,0.6); }
  }

  /* ---- Screens: one art direction, dark and luminous, an accent colour per screen ---- */
  .screen{
    --tint: #37E0C0;
    position: fixed; inset: 0; z-index: 40; background: #05070A; color: #DCEAE6;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    padding: 18px 16px 22px; overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }
  .screen::before{        /* a soft halo of the screen's colour */
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
    background:
      radial-gradient(55% 40% at 50% 0%, color-mix(in srgb, var(--tint) 11%, transparent), transparent 72%),
      radial-gradient(45% 35% at 12% 100%, color-mix(in srgb, var(--tint) 8%, transparent), transparent 72%);
  }
  .screen[hidden]{ display: none; }
  .deco{ position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
  .deco svg{ position: absolute; opacity: 0.16; filter: blur(0.3px);
    animation: float var(--dur, 20s) ease-in-out var(--delay, 0s) infinite; }
  @keyframes float{
    0%,100%{ transform: translate(0,0) rotate(0deg); }
    50%{ transform: translate(14px,-22px) rotate(16deg); }
  }
  .screen > *:not(.deco){ position: relative; z-index: 1; }
  .screen.entering{ animation: screenIn 0.32s ease; }
  @keyframes screenIn{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: none; } }
  #scrClassic{ --tint: #37E0C0; }
  #scrChallenge{ --tint: #FFB454; }
  #scrOther{ --tint: #B48CFF; }
  /* header shared by the three screens */
  .scr-head{ display: flex; align-items: center; gap: 14px; width: min(1180px, 96vw);
    position: sticky; top: -18px; z-index: 5; padding: 10px 0; margin-top: -10px;
    background: linear-gradient(180deg, #05070A 72%, rgba(5,7,10,0)); }
  .scr-back{
    font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; flex: none;
    padding: 9px 15px; border-radius: 999px; background: rgba(12,20,26,0.9);
    border: 1px solid color-mix(in srgb, var(--tint) 45%, #22303A); color: var(--tint);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
  }
  .scr-back:hover{ border-color: var(--tint); box-shadow: 0 0 14px color-mix(in srgb, var(--tint) 45%, transparent); }
  .scr-name{ flex: 1; display: flex; flex-direction: column; gap: 3px; }
  .scr-word{ height: clamp(22px, 3.4vw, 34px); }
  .scr-word .home-word{ height: 100%; width: auto; }
  .scr-name span{ font-size: 0.78rem; color: #7E9A94; }
  .scr-side{ text-align: right; display: flex; flex-direction: column; gap: 2px; }
  .scr-side b{ font-size: 1.05rem; color: #DCEAE6; }
  .scr-side span{ font-size: 0.76rem; color: #E8B84B; }
  /* the light running around a card */
  .snake-border{
    position: absolute; left: 0; top: 0; width: calc(100% - 2px); height: calc(100% - 2px);
    pointer-events: none; overflow: visible; opacity: 0; transition: opacity 0.2s ease;
  }
  .snake-border rect{
    fill: none; stroke: var(--tint, #37E0C0); stroke-width: 2; stroke-linecap: round;
    stroke-dasharray: 16 84; filter: drop-shadow(0 0 6px var(--tint, #37E0C0));
  }
  .home-item:hover .snake-border, .home-item:focus-visible .snake-border,
  .my-card:hover .snake-border, .home-item:active .snake-border, .my-card:active .snake-border{ opacity: 1; }
  .home-item:hover .snake-border rect, .home-item:focus-visible .snake-border rect,
  .my-card:hover .snake-border rect, .home-item:active .snake-border rect{
    animation: snakeRun 2.1s linear infinite;
  }
  /* cards */
  .home-item, .my-card{
    position: relative; font: inherit; cursor: pointer; text-align: left;
    background: linear-gradient(160deg, rgba(20,32,40,0.92), rgba(10,16,21,0.92));
    border: 1px solid #22303A; color: #DCEAE6; border-radius: 16px;
    transition: border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
  }
  .home-item{ display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; }
  .home-item b{ font-size: 1.06rem; font-weight: 600; color: var(--tint);
    text-shadow: 0 0 12px color-mix(in srgb, var(--tint) 45%, transparent); letter-spacing: 0.04em; }
  .home-item span{ font-size: 0.78rem; color: #8AA5A0; }
  .home-item:hover, .my-card:hover{ border-color: color-mix(in srgb, var(--tint) 60%, #22303A);
    box-shadow: 0 0 24px color-mix(in srgb, var(--tint) 22%, transparent); transform: translateY(-1px); }
  .home-item:active{ transform: translateY(0) scale(0.995); }
  /* Classique: one chip per figure, easiest first */
  #scrClassic{ justify-content: flex-start; }
  .chip-grid{
    display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(46px, 7vw, 74px), 1fr));
    gap: clamp(6px, 0.8vw, 10px); width: min(1180px, 96vw); align-content: start; flex: none;
  }
  .chip{
    position: relative; font: inherit; cursor: pointer;
    padding: clamp(7px, 1vw, 12px) clamp(4px, 0.6vw, 8px) clamp(7px, 0.9vw, 11px); border-radius: 12px;
    background: linear-gradient(170deg, rgba(18,28,36,0.9), rgba(9,14,18,0.9));
    border: 1px solid #22303A; color: #DCEAE6; line-height: 1;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    box-shadow: inset 0 -3px 0 -1px var(--tint, #37E0C0);
    transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .chip .sil{ width: 100%; height: clamp(26px, 3.6vw, 44px); opacity: 0.92;
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--tint) 55%, transparent)); }
  .chip i{ font-style: normal; font-size: clamp(0.66rem, 1vw, 0.8rem); color: #93AAA5;
    font-variant-numeric: tabular-nums; }
  .chip:hover{ border-color: var(--tint, #37E0C0); transform: translateY(-2px);
    box-shadow: inset 0 -3px 0 -1px var(--tint), 0 0 18px color-mix(in srgb, var(--tint) 35%, transparent); }
  .chip.solved{ background: linear-gradient(170deg, rgba(20,48,34,0.95), rgba(10,26,19,0.95)); border-color: #2E6B48; }
  .chip[data-stars]::after{ content: attr(data-stars); font-size: 0.5rem; letter-spacing: 1px; color: #E8B84B; }
  .chip:not([data-stars])::after{ content: "·"; font-size: 0.5rem; color: #35454E; }
  .scr-legend{ display: flex; align-items: center; gap: 10px; font-size: 0.72rem; color: #7E9A94; }
  .lg-bar{ width: min(220px, 40vw); height: 4px; border-radius: 2px;
    background: linear-gradient(90deg, hsl(130,85%,55%), hsl(65,85%,55%), hsl(0,85%,55%));
    box-shadow: 0 0 10px rgba(255,255,255,0.12); }
  /* Challenge */
  .chal-hero{ display: flex; align-items: center; justify-content: center; gap: clamp(16px, 6vw, 60px);
    width: min(980px, 96vw); }
  #scrChallenge, #scrOther{ justify-content: center; padding-top: 74px; }
  #scrChallenge .scr-head, #scrOther .scr-head{ position: absolute; top: 18px; left: 50%; transform: translateX(-50%); }
  .chal-hero{ flex-direction: column; gap: 18px; }
  .go-btn{
    position: relative; font: inherit; cursor: pointer; width: clamp(140px, 36vw, 210px); aspect-ratio: 1;
    border-radius: 50%; border: none; padding: 0; background: #070B0E; overflow: hidden;
    box-shadow: 0 0 34px rgba(255,255,255,0.12);
  }
  .go-btn::before{                       /* only the ring turns, the button itself stays put */
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 210deg, #4C7EA8, #5C8A6E, #D9A441, #B25B4B, #8B6BAE, #C77B4A, #3F6D63, #4C7EA8);
    animation: goSpin 18s linear infinite;
  }
  .go-btn span{
    position: absolute; inset: 9px; border-radius: 50%; display: grid; place-items: center;
    background: #070B0E; color: #FFF3DC; font-size: clamp(1.5rem, 6vw, 2.2rem); font-weight: 700;
    letter-spacing: 0.16em; text-shadow: 0 0 14px rgba(255,214,150,0.55);
  }
  .go-btn:hover{ filter: brightness(1.1); }
  .go-btn:active{ transform: scale(0.97); }
  @keyframes goSpin{ to{ transform: rotate(360deg); } }
  .chal-badges{ display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
  .badge{ font-size: 0.78rem; color: #8AA5A0; background: rgba(12,20,26,0.85);
    border: 1px solid #22303A; border-radius: 999px; padding: 7px 14px; }
  .badge b{ color: #DCEAE6; font-size: 0.9rem; margin-left: 4px; }
  .badge.gold{ color: #E8B84B; border-color: rgba(232,184,75,0.4); }
  .badge.gold b{ color: #FFE27A; }
  .chal-rules{ list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: center; width: min(980px, 96vw); }
  .chal-rules li{ font-size: 0.76rem; color: #8AA5A0; background: rgba(12,20,26,0.85);
    border: 1px solid #22303A; border-radius: 999px; padding: 7px 14px; }
  .chal-rules b{ color: var(--tint); }
  .chal-hist{ width: min(760px, 92vw); display: flex; flex-direction: column; align-items: center; gap: 7px; }
  .chal-hist .empty{ font-size: 0.8rem; color: #5E7A75; }
  .hist-row{ display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
  .hist-chip{
    min-width: 30px; text-align: center; font-size: 0.8rem; font-weight: 600; color: #071014;
    background: var(--c, #37E0C0); border-radius: 9px; padding: 5px 8px;
    box-shadow: 0 0 10px color-mix(in srgb, var(--c) 40%, transparent); opacity: 0.85;
  }
  .hist-chip.best{ outline: 2px solid #FFE27A; outline-offset: 2px; opacity: 1; }
  .hist-label{ font-size: 0.7rem; color: #5E7A75; letter-spacing: 0.04em; }
  /* Classement permanent du challenge */
  .chal-board{ width: min(460px, 92vw); display: flex; flex-direction: column; gap: 8px; }
  .chal-board .empty{ font-size: 0.8rem; color: #5E7A75; text-align: center; }
  .board-head{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .board-head b{ font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: #7E9A94; font-weight: 600; }
  .board-me{ display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font: inherit; font-size: 0.76rem; color: #8AA5A0; padding: 4px 11px; border-radius: 999px;
    background: rgba(12,20,26,0.85); border: 1px solid #22303A; }
  .board-me span{ color: #DCEAE6; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .board-me:hover{ border-color: #37E0C0; color: #DCEAE6; }
  .board-rows{ display: flex; flex-direction: column; gap: 5px; }
  .board-row{ display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px;
    background: rgba(12,20,26,0.85); border: 1px solid #1B2730; }
  .board-rank{ width: 20px; text-align: center; font-size: 0.74rem; font-weight: 700; color: #5E7A75; }
  .board-name{ flex: 1; font-size: 0.86rem; color: #DCEAE6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .board-score{ font-size: 0.92rem; color: var(--c, #37E0C0); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 55%, transparent); }
  .board-row.top{ border-color: color-mix(in srgb, var(--c) 40%, transparent); }
  .board-row.top .board-rank{ color: var(--c); }
  .board-row.me{ background: rgba(18,32,36,0.95); border-color: rgba(55,224,192,0.7);
    box-shadow: 0 0 14px rgba(55,224,192,0.2); }
  .board-row.me .board-name{ font-weight: 600; }
  /* pastilles de statistiques */
  .chal-stats{ display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: min(560px, 92vw); }
  .stats-block{ display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .stat-chip{ display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 15px;
    border-radius: 13px; background: rgba(12,20,26,0.85); border: 1px solid color-mix(in srgb, var(--c, #37E0C0) 30%, transparent); }
  .stat-chip b{ font-size: 1.02rem; color: var(--c, #37E0C0);
    text-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); }
  .stat-chip span{ font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: #7E9A94; }
  .stats-note{ font-size: 0.76rem; color: #6F8B86; width: 100%; }
  /* bouton profil, en haut à droite de l'accueil */
  .screen > .profile-btn{ position: absolute; right: 14px; top: 14px; z-index: 3; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 10px 6px;
    font: inherit; border-radius: 16px; background: rgba(12,20,26,0.85); border: 1px solid #22303A; }
  .profile-btn:hover{ border-color: #37E0C0; box-shadow: 0 0 16px rgba(55,224,192,0.25); }
  .profile-btn .avatar{ width: 26px; height: 26px; display: block;
    filter: drop-shadow(0 0 6px rgba(55,224,192,0.5)); }
  .profile-count{ font-size: 0.62rem; letter-spacing: 0.04em; color: #8AA5A0; }
  .profile-btn:hover .profile-count{ color: #9BF5E2; }
  /* écran profil */
  .profile-id{ display: flex; align-items: center; gap: 14px; }
  .profile-avatar{ width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%;
    background: rgba(12,20,26,0.9); border: 1px solid rgba(55,224,192,0.4);
    box-shadow: 0 0 20px rgba(55,224,192,0.18); }
  .profile-avatar .avatar{ width: 32px; height: 32px; }
  .profile-who{ display: flex; flex-direction: column; gap: 2px; }
  .profile-rename{ font: inherit; font-size: 1.14rem; text-align: left; cursor: pointer; padding: 0;
    color: #DCEAE6; background: none; border: none; }
  .profile-rename:hover{ color: #9BF5E2; text-decoration: underline; }
  .profile-who span{ font-size: 0.76rem; color: #7E9A94; }
  .stats-block.wide{ justify-content: center; width: min(760px, 94vw); }
  .ach-head{ display: flex; align-items: baseline; gap: 10px; width: min(760px, 94vw); }
  .ach-head b{ font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: #7E9A94; font-weight: 600; }
  .ach-head span{ font-size: 0.78rem; color: #FFE27A; }
  .ach-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 8px;
    width: min(760px, 94vw); }
  .ach{ display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 13px;
    background: rgba(12,20,26,0.8); border: 1px solid #1B2730; opacity: 0.72; }
  .ach.on{ opacity: 1; border-color: color-mix(in srgb, var(--c) 45%, transparent);
    background: rgba(16,26,32,0.95); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 14%, transparent); }
  .ach-ic{ flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
    background: rgba(6,12,16,0.8); border: 1px solid #1B2730; }
  .ach.on .ach-ic{ border-color: color-mix(in srgb, var(--c) 40%, transparent); }
  .ach-pic{ width: 28px; height: 28px; display: block; }
  .ach.on .ach-pic{ filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 60%, transparent)); }
  .ach-tx{ display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
  .ach-tx b{ font-size: 0.82rem; color: #8AA5A0; }
  .ach.on .ach-tx b{ color: var(--c); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 40%, transparent); }
  .ach-tx i{ font-style: normal; font-size: 0.7rem; line-height: 1.25; color: #5E7A75; }
  .ach-bar{ display: block; height: 3px; border-radius: 2px; background: #1B2730; margin-top: 4px; overflow: hidden; }
  .ach-bar span{ display: block; height: 100%; background: var(--c); opacity: 0.65; }
  .ach-tx u{ text-decoration: none; font-size: 0.64rem; color: #5E7A75; margin-top: 2px; }
  /* bouton partager */
  .share-btn{ font: inherit; font-size: 0.84rem; cursor: pointer; color: #9BF5E2; padding: 9px 22px;
    border-radius: 999px; background: rgba(12,20,26,0.85); border: 1px solid rgba(55,224,192,0.45); }
  .share-btn:hover{ color: #071014; background: #37E0C0; box-shadow: 0 0 18px rgba(55,224,192,0.35); }
  .share-btn.done, .chal-actions button.done{ color: #071014; background: #7CF0A6; border-color: #7CF0A6; }
  /* la carte "comment jouer" */
  .help-card-wrap, .name-ask{ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
  .help-card-wrap{ position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
    background: rgba(4,8,11,0.78); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.22s ease; }
  .help-card-wrap.show{ opacity: 1; }
  .help-card-wrap[hidden]{ display: none; }
  .help-card{ width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column;
    gap: 12px; padding: 24px 22px 20px; border-radius: 20px; background: #0A1117; border: 1px solid #22303A;
    box-shadow: 0 20px 60px rgba(0,0,0,0.65), 0 0 30px rgba(55,224,192,0.1); }
  .help-title{ font-size: 1.3rem; text-align: center; color: #DCEAE6; letter-spacing: 0.02em;
    text-shadow: 0 0 18px rgba(55,224,192,0.35); }
  .help-sub{ font-size: 0.88rem; text-align: center; color: #9BB3AE; margin-top: -6px; }
  .help-gestures{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .help-gestures.two{ grid-template-columns: repeat(2, 1fr); }
  .help-gesture{ display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 11px;
    border-radius: 15px; background: rgba(12,20,26,0.9); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
  .help-gesture b{ font-size: 0.92rem; color: var(--c); text-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); }
  .help-gesture span{ font-size: 0.7rem; line-height: 1.25; text-align: center; color: #8AA5A0; }
  .help-pic{ width: 68px; height: 54px; }
  .help-sep{ font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #6F8B86;
    text-align: center; margin-top: 4px; }
  .help-keys{ display: flex; flex-direction: column; gap: 6px; }
  .help-key{ display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 12px;
    background: rgba(12,20,26,0.85); border: 1px solid #1B2730; }
  .help-ic{ flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
    color: var(--c); font-size: 1rem; background: color-mix(in srgb, var(--c) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
  .help-ic svg{ width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round; }
  .help-dot{ width: 11px; height: 11px; border-radius: 50%;
    background: linear-gradient(135deg, #48E06B, #E04848); box-shadow: 0 0 8px rgba(120,220,120,0.6); }
  .help-tx{ display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .help-tx b{ font-size: 0.84rem; color: #DCEAE6; }
  .help-tx i{ font-style: normal; font-size: 0.74rem; line-height: 1.25; color: #8AA5A0; }
  .help-go{ align-self: center; margin-top: 6px; font: inherit; font-size: 0.95rem; cursor: pointer;
    color: #071014; background: #37E0C0; border: none; border-radius: 999px; padding: 11px 34px;
    box-shadow: 0 0 22px rgba(55,224,192,0.4); }
  .help-go:hover{ filter: brightness(1.1); }
  .menu-link{ font: inherit; font-size: 0.82rem; text-align: left; cursor: pointer; color: #9BF5E2;
    background: none; border: none; padding: 6px 2px; }
  .menu-link:hover{ text-decoration: underline; }
  /* bouton recommencer, sur le plateau */
  #restartBtn svg{ width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; display: block; }
  #restartBtn.spin svg{ animation: restartSpin 0.5s ease; }
  @keyframes restartSpin{ from{ transform: rotate(0deg); } to{ transform: rotate(-360deg); } }
  @media (max-width: 520px){
    .help-card{ padding: 18px 14px 16px; gap: 10px; }
    .help-gestures{ gap: 7px; }
    .help-gesture{ padding: 9px 4px; }
    .help-pic{ width: 56px; height: 44px; }
    .help-gesture span{ font-size: 0.64rem; }
    .help-title{ font-size: 1.12rem; }
  }
  /* la petite fenêtre qui demande le nom */
  .name-ask{ position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
    background: rgba(4,8,11,0.72); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.18s ease; }
  .name-ask.show{ opacity: 1; }
  .name-ask[hidden]{ display: none; }
  .name-card{ width: min(320px, 88vw); display: flex; flex-direction: column; gap: 12px;
    padding: 20px 20px 18px; border-radius: 18px; background: #0B1319; border: 1px solid #22303A;
    box-shadow: 0 18px 50px rgba(0,0,0,0.6), 0 0 22px rgba(55,224,192,0.12); }
  .name-title{ font-size: 0.96rem; color: #DCEAE6; text-align: center; }
  .name-card input{ font: inherit; font-size: 1rem; text-align: center; color: #DCEAE6;
    background: #060C10; border: 1px solid #22303A; border-radius: 12px; padding: 11px 12px; outline: none; }
  .name-card input:focus{ border-color: #37E0C0; box-shadow: 0 0 14px rgba(55,224,192,0.25); }
  .name-card input.bad{ animation: nameBad 0.3s ease; border-color: #FF6B6B; }
  @keyframes nameBad{ 25%{ transform: translateX(-6px); } 75%{ transform: translateX(6px); } }
  .name-actions{ display: flex; justify-content: center; }
  .name-actions button{ font: inherit; font-size: 0.88rem; cursor: pointer; color: #071014;
    background: #37E0C0; border: none; border-radius: 999px; padding: 10px 26px;
    box-shadow: 0 0 18px rgba(55,224,192,0.35); }
  .name-actions button:hover{ filter: brightness(1.1); }
  /* Autres */
  .other-menu{ display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px;
    width: min(860px, 96vw); }
  .other-menu .home-item{ min-height: clamp(96px, 15vh, 140px); justify-content: flex-end;
    overflow: hidden; padding-right: 92px; }
  .other-menu .mini{ position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 72px; height: 72px; opacity: 0.8;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--tint) 45%, transparent)); }
  .my-block{ width: min(860px, 96vw); display: flex; flex-direction: column; gap: 8px; }
  .my-title{ font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: #7E9A94; }
  .my-list{ display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
  .my-list .empty{ font-size: 0.8rem; color: #5E7A75; }
  .my-card{ width: 116px; padding: 8px 8px 10px; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .my-card .mini{ width: 76px; height: 62px; }
  .my-card b{ font-size: 0.78rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #DCEAE6; }
  .my-card span{ font-size: 0.68rem; color: #8AA5A0; }
  .my-card .my-del{ position: absolute; right: 2px; top: 0; border: none; background: transparent;
    color: #5E7A75; font-size: 1rem; cursor: pointer; padding: 2px 6px; z-index: 2; }
  .my-card .my-del:hover{ color: #FF6B6B; }
  .other-opts{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: min(860px, 96vw); }
  .other-opts label{ display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.82rem;
    color: #DCEAE6; background: rgba(12,20,26,0.85); border: 1px solid #22303A; border-radius: 999px; padding: 8px 16px; }
  .other-opts label:hover{ border-color: color-mix(in srgb, var(--tint) 55%, #22303A); }
  /* ---- Home ---- */
  .home{ justify-content: center; gap: clamp(20px, 4vh, 40px); }
  .home-title{ width: min(760px, 94vw); }
  .home-word{ width: 100%; height: auto; overflow: visible; }
  .home-word .letter{ filter: drop-shadow(0 0 3px var(--glow, #37E0C0)) drop-shadow(0 0 11px var(--glow, #37E0C0)); }
  .home-word .body{ filter: saturate(1.35) brightness(1.12); }
  .home-word .halo polygon{ stroke-width: 0.55; stroke-linejoin: round; }
  .home-word .body polygon{ stroke: rgba(4,7,9,0.85); stroke-width: 0.14; stroke-linejoin: round; }
  .home.entering .home-word .body polygon{ animation: letterIn 0.55s cubic-bezier(.34,1.3,.64,1) backwards; animation-delay: var(--d, 0s); }
  @keyframes letterIn{
    from{ opacity: 0; transform: translate(var(--ox, 0), var(--oy, 0)) rotate(-12deg); }
    to{ opacity: 1; transform: none; }
  }
  .home-menu{ display: flex; flex-direction: column; gap: 14px; width: min(420px, 86vw); }
  .home-menu .home-item{ align-items: center; padding: 20px 20px; }
  .home-menu .home-item b{ font-size: 1.35rem; letter-spacing: 0.14em; text-transform: uppercase; }
  .home-stats{ font-size: 0.8rem; color: #8AA5A0; letter-spacing: 0.03em; text-align: center; }
  /* le podium du challenge, sur l'écran d'accueil */
  .home-podium{ display: flex; flex-direction: column; align-items: center; gap: 9px; cursor: pointer;
    font: inherit; color: inherit; background: none; border: none; padding: 4px 8px; }
  .podium-label{ font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: #6F8B86; }
  .home-podium:hover .podium-label{ color: #9BF5E2; }
  .podium-row{ display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
  .podium-chip{ display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px;
    background: rgba(12,20,26,0.85); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
  .podium-chip i{ font-style: normal; font-size: 0.9rem; }
  .podium-name{ font-size: 0.82rem; color: #DCEAE6; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .podium-chip b{ font-size: 0.86rem; color: var(--c); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 55%, transparent); }
  .podium-chip.me{ box-shadow: 0 0 12px color-mix(in srgb, var(--c) 25%, transparent); }
  .home-podium.empty .podium-label{ text-transform: none; letter-spacing: 0.03em; font-size: 0.78rem; }
  .back-btn{
    position: absolute; right: 10px; top: 8px; z-index: 3; cursor: pointer;
    font: inherit; font-size: 1rem; line-height: 1; padding: 5px 11px; border-radius: 999px;
    background: rgba(5,10,12,0.8); border: 1px solid rgba(0,255,214,0.25); color: #9BF5E2;
  }
  .back-btn:hover{ border-color: #37E0C0; }

  /* every control now lives on the board itself */
  .toolbar{ display: none !important; }
  /* the page is only a frame around the board now: keep it dark everywhere */
  body{ background: #05070A; }
  .board-frame{ border-color: rgba(0,255,214,0.18); box-shadow: 0 0 26px rgba(0,255,214,0.08); }

  /* Défi du jour */
  #scrDaily{ --tint: #FFE27A; justify-content: center; padding-top: 74px; gap: 16px; }
  #scrDaily .scr-head{ position: absolute; top: 18px; left: 50%; transform: translateX(-50%); }
  .daily-date{ font-size: 0.95rem; color: #E8B84B; text-transform: capitalize; letter-spacing: 0.04em; }
  .daily-shapes{ display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: min(760px, 94vw); }
  .daily-shapes .chip{ width: clamp(88px, 17vw, 124px); cursor: default; }
  .daily-shapes .chip:hover{ transform: none; }
  .daily-shapes .chip .sil{ height: clamp(44px, 8vw, 64px); }
  .daily-week{ display: flex; gap: 8px; }
  .daily-week span{ width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #2A3A44; display: inline-flex; align-items: center; justify-content: center; font-size: 0.66rem; color: #6F8B86; }
  .daily-week span.on{ background: #37E0C0; color: #04120E; border-color: #37E0C0; font-weight: 700; }
  .daily-week span.today{ box-shadow: 0 0 0 2px #FFE27A; }

/* touch pad: decorative stick echoing the finger movement (touch devices only) */
.pad-stick{ display:none; position:absolute; left:50%; bottom:calc(64px + env(safe-area-inset-bottom, 0px)); width:84px; height:84px; margin-left:-42px; border-radius:50%;
  border:1.5px solid rgba(0,255,214,.28); background:radial-gradient(circle at 50% 50%, rgba(0,255,214,.10), rgba(0,255,214,.02) 70%); pointer-events:none; opacity:.25; transition:opacity .2s; z-index:4; touch-action:none; }
.pad-stick::before{ content:""; position:absolute; inset:14px; border-radius:50%; border:1px dashed rgba(0,255,214,.18); }
.pad-knob{ position:absolute; left:50%; top:50%; width:34px; height:34px; margin:-17px 0 0 -17px; border-radius:50%;
  background:radial-gradient(circle at 35% 30%, #7FFFE6, #14B8A0 70%); box-shadow:0 0 12px rgba(0,255,214,.45); transition:transform .12s ease-out; }
.pad-stick.active .pad-knob{ transition:none; }
body.touch-mode .pad-stick{ display:block; }
body.touch-mode .pad-stick.ready{ opacity:.85; }
body.touch-mode .pad-stick.active{ opacity:1; }
body.touch-mode .pad-stick.ready{ pointer-events:auto; }
.pad-knob{ display:flex; align-items:center; justify-content:center; color:#03211C; font-size:20px; font-weight:800; line-height:1; user-select:none; -webkit-user-select:none; }
.pad-stick.tap{ transform:scale(.92); border-color:rgba(0,255,214,.7); }
.pad-stick{ transition:opacity .2s, transform .12s; }
body.touch-mode .pad-stick.last{ pointer-events:auto; opacity:.6; }
.key-btn:disabled{ opacity:.35; cursor:not-allowed; }

/* ---- Home leaderboard: same neon language as the title ---- */
.home-main{ display: flex; align-items: center; justify-content: center; gap: clamp(22px, 4vw, 48px); flex-wrap: wrap; }
.home-board{ --tint: #FFB454; width: min(380px, 90vw); padding: 14px 16px 12px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(10,16,22,.92), rgba(6,10,14,.92));
  border: 1px solid color-mix(in srgb, var(--tint) 55%, #22303A);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 22px color-mix(in srgb, var(--tint) 30%, transparent), inset 0 0 26px color-mix(in srgb, var(--tint) 8%, transparent);
  transition: border-color .25s ease, box-shadow .25s ease; }
.hb-head{ display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hb-word{ flex: 1; display: flex; justify-content: center; height: 28px; }
.hb-word .home-word{ height: 100%; width: auto; }
.hb-arrow{ font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; width: 38px; height: 38px; flex: none; padding: 0 0 3px;
  border-radius: 50%; background: rgba(12,20,26,.9); color: var(--tint); border: 1px solid color-mix(in srgb, var(--tint) 50%, #22303A);
  text-shadow: 0 0 10px color-mix(in srgb, var(--tint) 70%, transparent); transition: box-shadow .18s ease, transform .1s ease; }
.hb-arrow:hover{ box-shadow: 0 0 14px color-mix(in srgb, var(--tint) 55%, transparent); }
.hb-arrow:active{ transform: scale(.92); }
.hb-dots{ display: flex; justify-content: center; gap: 7px; margin: 9px 0 6px; }
.hb-dots i{ width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--c) 30%, #1B2630); transition: all .2s ease; }
.hb-dots i.on{ background: var(--c); box-shadow: 0 0 9px var(--c); transform: scale(1.25); }
.hb-table{ width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: .86rem; }
.hb-table th{ font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--tint) 75%, #7E9A94); text-align: left; padding: 2px 8px; }
.hb-table th:last-child, .hb-score{ text-align: right; }
.hb-table td{ padding: 5px 8px; background: rgba(16,25,32,.75); }
.hb-table td:first-child{ border-radius: 9px 0 0 9px; } .hb-table td:last-child{ border-radius: 0 9px 9px 0; }
.hb-rank{ width: 2em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c, #7E9A94);
  text-shadow: 0 0 8px color-mix(in srgb, var(--c, #37E0C0) 70%, transparent); }
.hb-name{ color: #DCEAE6; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-score{ font-weight: 700; font-variant-numeric: tabular-nums; color: var(--tint); text-shadow: 0 0 9px color-mix(in srgb, var(--tint) 55%, transparent); white-space: nowrap; }
.hb-score small{ font-weight: 500; color: #7E9A94; text-shadow: none; }
.hb-table tr.blank td{ opacity: .35; } .hb-table tr.blank .hb-name{ color: #5E7A75; }
.hb-table tr.me td{ background: color-mix(in srgb, var(--tint) 16%, #101920);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--tint) 60%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--tint) 60%, transparent); }
.hb-table tr.me .hb-name{ font-weight: 700; }
.hb-table tr.gap td{ background: transparent; text-align: center; color: #5E7A75; padding: 0; line-height: .8; }
.hb-foot{ margin-top: 8px; text-align: center; font-size: .72rem; color: #6F8B86; letter-spacing: .03em; }
@media (max-width: 900px){
  .home{ justify-content: flex-start; }
  .home{ padding-top: 64px; }
  .home-title{ margin-top: auto; } .home-podium{ margin-bottom: auto; }
  .home-main{ flex-direction: column; }
}

.home-foot{ display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: -6px; }
.foot-btn{ font: inherit; font-size: .74rem; letter-spacing: .06em; color: #6F8B86; background: none; border: 1px solid #1E2A33;
  border-radius: 999px; padding: 6px 14px; cursor: pointer; text-decoration: none; transition: color .15s, border-color .15s; }
.foot-btn:hover{ color: #9BF5E2; border-color: #37E0C0; }

.hb-scope{ display: flex; justify-content: center; gap: 4px; margin: 0 0 8px; }
.hb-scope button{ font: inherit; font-size: .72rem; letter-spacing: .05em; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  color: #7E9A94; background: rgba(12,20,26,.9); border: 1px solid #22303A; }
.hb-scope button.on{ color: var(--tint); border-color: color-mix(in srgb, var(--tint) 60%, #22303A); text-shadow: 0 0 8px color-mix(in srgb, var(--tint) 55%, transparent); }
/* welcome card (first visit) */
.welcome{ position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(3,5,8,.8); backdrop-filter: blur(4px); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.welcome[hidden]{ display: none; }
.welcome-card{ width: min(420px, 94vw); padding: 24px 22px 20px; border-radius: 20px; text-align: center; color: #DCEAE6;
  background: linear-gradient(180deg, #0B1218, #070B0F); border: 1px solid rgba(55,224,192,.45);
  box-shadow: 0 0 30px rgba(55,224,192,.22), 0 20px 50px rgba(0,0,0,.5); }
.welcome-card h2{ margin: 0 0 6px; font-size: 1.35rem; letter-spacing: .04em; color: #9BF5E2; text-shadow: 0 0 14px rgba(55,224,192,.55); }
.welcome-card p{ margin: 0 0 14px; color: #A8BDB8; font-size: .92rem; line-height: 1.5; }
.welcome-modes{ display: grid; gap: 6px; margin: 0 0 16px; text-align: left; }
.welcome-modes div{ display: flex; gap: 10px; align-items: baseline; font-size: .85rem; color: #C5D3CE; padding: 7px 10px; border-radius: 10px; background: rgba(16,25,32,.8); }
.welcome-modes b{ color: var(--c); min-width: 6.4em; }
.welcome-actions{ display: flex; flex-direction: column; gap: 8px; }
.welcome-actions button{ font: inherit; cursor: pointer; padding: 12px 16px; border-radius: 12px; color: #DCEAE6; background: rgba(16,25,32,.95); border: 1px solid #22303A; }
.welcome-actions button.primary{ color: #05130F; font-weight: 700; background: linear-gradient(180deg, #5BF0D2, #2FCBAE); border-color: transparent; box-shadow: 0 0 18px rgba(55,224,192,.4); }
.welcome-actions button.ghost{ background: none; border-color: transparent; color: #7E9A94; font-size: .85rem; }
