/* ══ Extraído de app/Views/juegos/tetris.php ══ */
:root{
      --bg:#f4ecdc;
      --paper:#fffdf8;
      --ink:#2a241d;
      --gold:#e0a800;
      --gold2:#ffd35e;
      --muted:#8a8175;
      --board:#141009;
      --line:rgba(0,0,0,.08);
      --panelRadius:20px;
    }
    *{ 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(1100px,100%);
      max-height:calc(100dvh - 20px);
      display:grid;
      grid-template-columns:minmax(0,1fr) 280px;
      gap:14px; align-items:stretch;
    }

    .game-card,.side{
      background:var(--paper);
      border:1px solid rgba(224,168,0,.35);
      border-radius:var(--panelRadius);
      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:before,.side:before{
      content:""; position:absolute; inset:-90px auto auto -90px;
      width:190px; height:190px; background:rgba(224,168,0,.16);
      filter:blur(40px); border-radius:50%; pointer-events:none;
    }
    .game-card{ display:flex; flex-direction:column; align-items:stretch; min-height:0; }

    .brand{ display:flex; align-items:center; gap:12px; margin-bottom:10px; position:relative; z-index:1; flex:0 0 auto; }
    .brand img{ height:clamp(30px,5.5dvh,46px); max-width:200px; object-fit:contain; filter:drop-shadow(0 2px 6px rgba(224,168,0,.3)); }
    .brand h1{
      font-size:clamp(22px,4vw,40px); letter-spacing:.04em; line-height:.9; margin:0;
      text-transform:uppercase; color:var(--ink); font-weight:900;
    }
    .brand h1 span{ color:var(--gold); }

    .canvas-wrap{
      position:relative; margin:auto; width:min(460px,100%); aspect-ratio:10/20;
      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); }

    #next{
      width:100%; height:auto; max-height:136px; aspect-ratio:1.35/1; background:var(--board);
      border-radius:12px; border:1px solid rgba(224,168,0,.3); display:block;
    }

    .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); }
    .keys{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-top:10px; }
    .key{ border:1px solid rgba(224,168,0,.4); border-radius:9px; padding:7px; text-align:center; color:#9a7400; font-weight:800; background:rgba(224,168,0,.08); }

    .touch{ display:none; grid-template-columns:repeat(4,1fr); gap:10px; margin-top:12px; flex:0 0 auto; }
    .touch button{ padding:12px 6px; font-size:18px; }
    .credit{ font-size:12px; color:var(--muted); text-align:center; }

    @media (max-width:900px){
      body{ align-items:flex-start; padding:8px; overflow:auto; }
      .wrap{ grid-template-columns:1fr; max-height:none; gap:10px; }
      .game-card,.side{ padding:10px; border-radius:16px; }
      .brand{ justify-content:center; flex-wrap:wrap; text-align:center; margin-bottom:8px; }
      .brand h1{ font-size:clamp(20px,7vw,32px); }
      .touch{ display:grid; gap:8px; margin-top:10px; }
      .touch button{ padding:10px 6px; font-size:16px; }
      .side{ order:2; overflow:visible; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
      .side .stat{ padding:9px; }
      .side .stat-next,.side .help,.side .credit,.side .controls,.side .touch{ grid-column:1/-1; }
      .side .touch{ order:-1; margin-top:0; }
      .help{ display:none; }
      #next{ max-height:95px; }
    }
    @media (max-width:520px){
      .label{ font-size:10px; letter-spacing:.1em; }
      .value{ font-size:19px; }
      .touch button{ font-size:15px; }
    }
    @media (max-height:760px) and (min-width:901px){
      .game-card,.side{ padding:10px; }
      .side{ gap:10px; }
      .help{ font-size:12px; line-height:1.4; padding:10px; }
      button{ padding:10px; }
      #next{ max-height:110px; }
    }

    /* ── 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 .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 #next{ max-height:112px; }
    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; margin-top:0; }
    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; }
    }
