/* CARL V4.0 BLOCK A — Entertainment-only styles. Never touches the V7 core or 3D face. */
#carlFun .carl-fun-card:has(.v40-game){max-width:min(1120px,100%)}
#carlFun .carl-fun-card:has(.carl-mines-v4){max-width:min(740px,100%)}
#carlFun .carl-fun-card:has(.sb-stage){max-width:min(1080px,100%)}
#carlFun .carl-fun-card:has(.v40-game){background:linear-gradient(145deg,#111a1d,#0b1016 65%,#0f1110);border-color:#9b955b}
.v40-game{--v40-highlight:#eccb6e;color:#e7dfcf;min-width:0;display:grid;gap:12px;padding:4px 0 18px}
.v40-game *, .v40-game *::before,.v40-game *::after{box-sizing:border-box}
.v40-game .v40-panel,.v40-game .v40-call{background:linear-gradient(145deg,#1d2830,#11181e);border:1px solid #6883936b;border-radius:14px;padding:13px;min-width:0}
.v40-game h3{font:800 13px ui-monospace,monospace;letter-spacing:.10em;color:#ffdfa0;margin:0 0 9px}
.v40-game p{font-size:12px;line-height:1.6;color:#b9cbd2;margin:8px 0}
.v40-game textarea,.v40-game select,.v40-game input{display:block;background:#0c131b;color:#fff1cf;border:1px solid #657887;max-width:100%;width:100%;padding:12px;border-radius:9px;font-size:14px;line-height:1.5}
.v40-game .v40-setup{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.v40-game .v40-setup label{min-width:0;display:grid;gap:5px;color:#d2c79d;font:700 10px ui-monospace,monospace}
.v40-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(98px,1fr));gap:7px}
.v40-stat{background:#121d23;border:1px solid #657d8259;border-radius:10px;padding:9px 8px;min-width:0;display:flex;flex-direction:column;gap:5px}
.v40-stat small{font:700 9px ui-monospace,monospace;color:#90adb2;letter-spacing:.05em;overflow-wrap:anywhere}
.v40-stat strong{color:#f9e7a7;font-size:clamp(11px,2.8vw,15px);overflow-wrap:anywhere}
.v40-story{border:1px solid #867e4788;border-radius:13px;background:#292517;padding:16px;color:#fbebc5}
.v40-story h3{color:#ffe39a;font-size:16px}
.v40-options,.v40-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:8px;min-width:0}
.v40-actions{margin:10px 0}
.v40-btn,.v40-choice{min-height:44px;border-radius:9px;border:1px solid #c9b16f90;background:linear-gradient(135deg,#38404a,#202931);color:#ffe6a6;font:750 11px ui-monospace,monospace;line-height:1.35;letter-spacing:.02em;padding:11px;cursor:pointer;white-space:normal;overflow-wrap:anywhere}
.v40-choice{background:#232f38;border-color:#678f9e77;text-align:left}
.v40-btn:active,.v40-choice:active{background:#516070}.v40-choice:disabled{opacity:.48;cursor:not-allowed}
.v40-hint{color:#b4c0c0;font-size:11px}
.v40-log{max-height:210px;overflow:auto;background:#10181a;border:1px solid #5b6d6570;border-radius:11px;padding:11px;display:grid;gap:7px;font-size:11px;color:#b4cbc5;line-height:1.5}
.v40-log>div{padding:7px;border-bottom:1px solid #57635f33}
.v40-canvas-wrap{width:100%;min-width:0;border:1px solid #6fa1b977;border-radius:13px;overflow:hidden;box-shadow:0 0 30px #5ca5b117;background:#09141b;position:relative}
.v40-stage{display:block;width:100%;height:auto;max-width:100%;background:#0c1720;touch-action:none}
.v40-dpad{display:grid;grid-template-columns:repeat(3,58px);grid-template-rows:repeat(3,51px);gap:5px;width:max-content;margin:12px auto;max-width:100%}
.v40-dpad .v40-btn{font-size:24px;border:1px solid #88a6b2;background:#213440;color:#cfe9f9;min-height:0;padding:3px}
.v40-dpad .v40-btn:nth-child(1){grid-column:2;grid-row:1}
.v40-dpad .v40-btn:nth-child(2){grid-column:1;grid-row:2}
.v40-dpad .v40-btn:nth-child(3){grid-column:2;grid-row:2}
.v40-dpad .v40-btn:nth-child(4){grid-column:3;grid-row:2}
.v40-call{border-left:3px solid #e7b45f!important}
.v40-game:has(.v40-canvas-wrap) .v40-story{margin-top:8px}
/* Responsive board for redesigned minesweeper */
.carl-mine-toolbar{display:flex;flex-wrap:wrap;gap:7px;align-items:center;margin:10px 0}
.carl-mine-select{background:#17170c;color:#fcecb1;border:1px solid #aa9544;border-radius:9px;min-height:42px;padding:8px;min-width:0;flex:1 1 170px}
.carl-mines-v4{width:min(100%,540px);max-width:100%;margin:12px auto;display:grid;grid-template-columns:repeat(var(--mine-cols,9),minmax(0,1fr));gap:clamp(2px,.7vw,4px)}
.carl-mines-v4 .carl-mine-cell{width:100%;min-width:0;min-height:0;aspect-ratio:1;border-radius:5px;padding:0;font-size:clamp(10px,2.8vw,17px);background:linear-gradient(135deg,#3a3520,#201e14);color:#c8c4ab;border:1px solid #857c49;touch-action:manipulation}
.carl-mines-v4 .carl-mine-cell.opened{background:#111912;border-color:#384838;color:#fbea90}
.carl-mines-v4 .carl-mine-cell.flagged{color:#ffcf4f;background:#403617}
.carl-mines-v4 .carl-mine-cell.mine-revealed{color:#ff8383;background:#402020}
@media(max-width:600px){
 #carlFun .carl-fun-card:has(.v40-game){max-width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 7px);border-radius:14px;padding:10px}
 #carlFun .carl-fun-card:has(.carl-mines-v4){max-width:100%}
 .v40-game{gap:9px}
 .v40-game .v40-panel,.v40-game .v40-call{padding:10px}
 .v40-metrics{grid-template-columns:repeat(3,minmax(0,1fr))}
 .v40-options,.v40-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
 .v40-game .v40-setup{grid-template-columns:1fr}
 .v40-btn,.v40-choice{font-size:10px;padding:10px 7px;min-height:46px}
 .v40-dpad{grid-template-columns:repeat(3,60px)}
 .carl-mines-v4{gap:2px}
}
@media(max-width:375px){.v40-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.v40-actions,.v40-options{grid-template-columns:1fr 1fr}.carl-mine-toolbar .carl-btn{padding:8px;font-size:10px}.carl-mines-v4 .carl-mine-cell{font-size:11px}}
@media(prefers-reduced-motion:reduce){.v40-game *{scroll-behavior:auto!important}}
