/* ══ Extraído de app/Views/juegos/snake.php ══ */
:root{
      --bg:#f4ecdc; --paper:#fffdf8; --ink:#2a241d; --gold:#e0a800; --gold2:#ffd35e;
      --muted:#8a8175; --board:#141009; --line:rgba(0,0,0,.08);
    }
    *{ box-sizing:border-box; }
    html,body{
      height:100%; margin:0;
      background:radial-gradient(circle at 50% -10%, rgba(224,168,0,.10), transparent 55%), var(--bg);
      font-family:'Montserrat',Arial,Helvetica,sans-serif; color:var(--ink); overflow:hidden;
    }
    body{ min-height:100dvh; display:flex; align-items:center; justify-content:center; padding:10px; }
    .wrap{ width:min(960px,100%); max-height:calc(100dvh - 20px); display:grid; grid-template-columns:minmax(0,1fr) 260px; gap:14px; align-items:stretch; }
    .game-card,.side{
      background:var(--paper); border:1px solid rgba(224,168,0,.35); border-radius:20px;
      box-shadow:0 18px 50px rgba(90,70,20,.14), inset 0 0 0 1px rgba(255,255,255,.5);
      padding:14px; position:relative; overflow:hidden;
    }
    .game-card{ display:flex; flex-direction:column; align-items:stretch; min-height:0; }
    .brand{ display:flex; align-items:center; gap:12px; margin-bottom:10px; flex:0 0 auto; }
    .brand img{ height:clamp(30px,5.5dvh,46px); max-width:200px; object-fit:contain; }
    .brand h1{ font-size:clamp(22px,4vw,40px); margin:0; text-transform:uppercase; font-weight:900; color:var(--ink); letter-spacing:.04em; }
    .brand h1 span{ color:var(--gold); }
    .canvas-wrap{
      position:relative; margin:auto; width:min(520px,100%); aspect-ratio:1/1; border-radius:16px; overflow:hidden;
      background:var(--board); border:3px solid var(--gold);
      box-shadow:0 0 0 6px rgba(224,168,0,.10), 0 14px 36px rgba(90,70,20,.20); flex:0 0 auto; max-width:100%;
    }
    #board{ width:100%; height:100%; display:block; background:var(--board); }
    .overlay{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(28,22,12,.55); backdrop-filter:blur(5px); opacity:0; pointer-events:none; transition:.2s; }
    .overlay.show{ opacity:1; pointer-events:auto; }
    .modal{ width:min(360px,88%); text-align:center; background:var(--paper); border:1px solid rgba(224,168,0,.55); border-radius:18px; padding:24px; box-shadow:0 25px 80px rgba(0,0,0,.35); }
    .modal h2{ margin:0 0 10px; color:var(--gold); font-size:32px; text-transform:uppercase; font-weight:900; }
    .modal p{ color:#5b5347; margin:0 0 18px; line-height:1.45; font-size:14px; }
    .side{ display:grid; gap:12px; align-content:start; min-height:0; overflow:auto; }
    .stat{ background:#faf5e9; border:1px solid var(--line); border-radius:14px; padding:12px; }
    .label{ font-size:11px; text-transform:uppercase; letter-spacing:.16em; color:var(--muted); font-weight:800; margin-bottom:7px; }
    .value{ font-size:clamp(22px,4dvh,30px); font-weight:900; color:var(--gold); }
    .controls{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
    button{
      appearance:none; border:0; border-radius:13px; background:linear-gradient(180deg,var(--gold2),var(--gold));
      color:#3a2c00; font-weight:900; text-transform:uppercase; letter-spacing:.04em; padding:12px; cursor:pointer; font-family:inherit;
      box-shadow:0 6px 0 #b07f00, 0 14px 28px rgba(90,70,20,.22); transition:transform .08s ease, box-shadow .08s ease, filter .15s ease;
    }
    button:hover{ filter:brightness(1.05); }
    button:active{ transform:translateY(5px); box-shadow:0 1px 0 #b07f00, 0 8px 18px rgba(90,70,20,.22); }
    .help{ font-size:13px; line-height:1.55; color:#5b5347; background:#faf5e9; padding:14px; border-radius:14px; border:1px solid var(--line); }
    .credit{ font-size:12px; color:var(--muted); text-align:center; }
    .touch{ display:none; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(2,1fr); gap:8px; margin-top:12px; flex:0 0 auto; }
    .touch button{ padding:12px 6px; font-size:18px; }
    .touch .up{ grid-column:2; } .touch .left{ grid-column:1; grid-row:2; } .touch .down{ grid-column:2; grid-row:2; } .touch .right{ grid-column:3; grid-row:2; }
    @media (max-width:900px){
      body{ align-items:flex-start; padding:8px; overflow:auto; }
      .wrap{ grid-template-columns:1fr; max-height:none; gap:10px; }
      .brand{ justify-content:center; }
      .touch{ display:grid; }
      .side{ order:2; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
      .side .controls,.side .help,.side .credit,.side .touch{ grid-column:1/-1; }
      .side .touch{ order:-1; }
      .help{ display:none; }
    }

    /* ── Modo incrustado (iframe): altura por contenido, sin scroll interno ── */
    html.embed, html.embed body{ height:auto; min-height:0; overflow:visible; }
    html.embed body{ display:block; align-items:initial; justify-content:initial; padding:10px; background:transparent; }
    html.embed .wrap{ max-height:none; grid-template-columns:minmax(0,1fr) 196px; gap:12px; }
    html.embed .side{ overflow:visible; display:flex; flex-direction:column; gap:8px; }
    html.embed .canvas-wrap{ width:min(420px,100%); }
    html.embed .side .stat{ padding:8px 10px; }
    html.embed .side .label{ font-size:10px; letter-spacing:.12em; margin-bottom:4px; }
    html.embed .side .value{ font-size:20px; }
    html.embed .controls{ gap:8px; }
    html.embed .controls button{ padding:9px; font-size:12px; box-shadow:0 4px 0 #b07f00; }
    html.embed .touch{ display:grid; gap:6px; }
    html.embed .touch button{ padding:9px 4px; font-size:15px; box-shadow:0 4px 0 #b07f00; }
    html.embed .help{ display:none; }
    html.embed .credit{ display:none; }
    @media (max-width:560px){
      html.embed .wrap{ grid-template-columns:1fr; }
      html.embed .side{ order:2; }
      html.embed .side .touch{ order:-1; }
    }
