/* Brick Tank — console 9999-in-1 dessinée en CSS */
:root {
  --lcd: #9ead86;
  --lcd-dark: #8f9e78;
  --ink: #1b1f16;
  --off: rgba(27, 31, 22, 0.085);
  --shell: #f3c623;
  --shell-dark: #d9a90c;
  --shell-light: #ffe46b;
  --btn: #d4312b;
  --btn-dark: #8e1a16;
}
* { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html, body {
  margin: 0; padding: 0; position: fixed; inset: 0; overflow: hidden;
  touch-action: none; overscroll-behavior: none;
  background: radial-gradient(ellipse at 50% 35%, #3a3d42 0%, #1c1d20 70%, #141517 100%);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", Verdana, Arial, sans-serif;
}
#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
button { font: inherit; border: 0; padding: 0; margin: 0; cursor: pointer; outline: none; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- coque ---------- */
.console {
  position: relative; flex: none;
  transform-origin: center center;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,255,255,.35), transparent 55%),
    linear-gradient(160deg, var(--shell-light) 0%, var(--shell) 35%, var(--shell-dark) 100%);
  border-radius: 34px 34px 90px 34px;
  box-shadow:
    inset 0 3px 2px rgba(255,255,255,.6),
    inset 0 -6px 10px rgba(120,80,0,.45),
    inset 4px 0 6px rgba(255,255,255,.25),
    0 18px 40px rgba(0,0,0,.6), 0 3px 0 #a87f00;
}
.console.portrait { width: 360px; height: 680px; }
.console.landscape { width: 760px; height: 400px; border-radius: 40px 40px 40px 40px; }

.brand {
  position: absolute; top: 11px; left: 0; right: 0; text-align: center;
  font-size: 15px; font-weight: 900; letter-spacing: 6px; color: #7a1410;
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
.landscape .brand { left: 24px; right: auto; top: 22px; width: 170px; font-size: 16px; letter-spacing: 4px; }
.screws i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6, #8a6a00 70%); top: 14px; }
.screws i:first-child { left: 18px; } .screws i:last-child { right: 18px; }
.landscape .screws { display: none; }

/* ---------- écran ---------- */
#bezel {
  position: absolute; left: 20px; top: 36px; width: 320px; height: 398px;
  background: linear-gradient(#45484e, #2c2e33);
  border-radius: 14px 14px 30px 14px;
  padding: 24px 8px 8px 8px;
  box-shadow: inset 0 2px 3px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.5);
}
.landscape #bezel { left: 220px; top: 3px; }
.bezel-label {
  position: absolute; top: 5px; left: 0; right: 0; text-align: center;
  color: #e9e9e9; font-size: 11px; font-weight: 900; letter-spacing: 3px; line-height: 14px;
}
.stripe { display: inline-block; width: 64px; height: 4px; margin: 0 8px 2px; vertical-align: middle;
  background: linear-gradient(#e33 0 33%, #fd3 33% 66%, #39f 66%); border-radius: 2px; }

#lcd {
  width: 304px; height: 362px; display: flex; gap: 8px; padding: 8px;
  background: linear-gradient(170deg, #a7b590, var(--lcd) 40%, var(--lcd-dark));
  border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(0,0,0,.35);
  color: var(--ink);
}
#field-wrap { position: relative; width: 176px; height: 346px; border: 1px solid rgba(27,31,22,.55); padding: 2px; flex: none; }
#field { display: grid; grid-template-columns: repeat(10, 17px); grid-template-rows: repeat(20, 17px); }

/* brique LCD : contour + carré intérieur */
.cell { --c: 17px; --ci: 1px; --cb: 2px; --cn: 5px; width: var(--c); height: var(--c); position: relative; color: var(--off); }
.cell::before { content: ""; position: absolute; inset: var(--ci); border: var(--cb) solid currentColor; }
.cell::after { content: ""; position: absolute; inset: var(--cn); background: currentColor; }
.cell.on { color: var(--ink); }
.mini .cell, .lives .cell { --c: 11px; --ci: 1px; --cb: 1px; --cn: 3px; }

/* ---------- panneau ---------- */
#panel { flex: 1; display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.lbl { font-size: 10px; font-weight: 900; letter-spacing: 1px; margin-top: 6px; }
.num { position: relative; font-family: "Courier New", Courier, monospace; font-weight: 900; font-size: 21px; line-height: 22px; text-align: right; height: 22px; letter-spacing: -0.5px; }
.num.small { font-size: 21px; text-align: left; }
.num .ghost { opacity: .09; }
.num .val { position: absolute; right: 0; top: 0; }
.num.small .val { right: auto; left: 0; }
.num.small .ghost { visibility: visible; }
.mini { display: grid; grid-template-columns: repeat(4, 11px); gap: 1px; margin-top: 3px; }
.row2 { display: flex; gap: 14px; }
.row2 .num.small .val { left: auto; right: 0; }
.row2 .num.small { text-align: right; width: 28px; }
.lives { display: flex; gap: 3px; margin-top: 3px; }
.indicators { margin-top: auto; display: flex; flex-direction: column; gap: 3px; padding-bottom: 2px; }
.ind { font-size: 10px; font-weight: 900; letter-spacing: 1px; opacity: .1; }
.ind.on { opacity: 1; }
.ind.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .1; } }

.overlay {
  position: absolute; left: 6px; right: 6px; bottom: 8px;
  padding: 6px 5px; text-align: center;
  background: rgba(158,173,134,.93); border: 2px solid var(--ink); border-radius: 3px;
  font-size: 10.5px; line-height: 14px; font-weight: 800; color: var(--ink);
  display: none;
}
.overlay.show { display: block; }
.overlay.center { bottom: auto; top: 50%; transform: translateY(-50%); }
.overlay b { font-size: 13px; letter-spacing: 1px; display: block; margin-bottom: 2px; }
.overlay .k { display: inline-block; border: 1px solid var(--ink); border-radius: 2px; padding: 0 3px; line-height: 12px; margin: 1px 0; }

/* ---------- boutons ---------- */
#smallBtns { position: absolute; left: 0; right: 0; top: 444px; display: flex; justify-content: center; gap: 30px; }
.landscape #smallBtns { left: 552px; right: 14px; top: 58px; gap: 20px; }
.sbtn-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; }
.sbtn-wrap span, #fireWrap span, .dlbl {
  font-size: 9px; font-weight: 900; letter-spacing: .5px; color: #6b4b00; text-align: center; line-height: 10px;
  text-shadow: 0 1px 0 rgba(255,255,255,.45); pointer-events: none;
}
.sbtn {
  width: 34px; height: 20px; border-radius: 10px;
  background: linear-gradient(#5d6168, #2f3236);
  box-shadow: 0 3px 0 #1d1f22, 0 4px 6px rgba(0,0,0,.4), inset 0 1px 1px rgba(255,255,255,.35);
}
.sbtn.pressed { transform: translateY(2px); box-shadow: 0 1px 0 #1d1f22, inset 0 1px 1px rgba(255,255,255,.2); }

#dpad { position: absolute; left: 14px; top: 498px; width: 172px; height: 172px; touch-action: none; }
.landscape #dpad { left: 24px; top: 150px; }
.dbtn {
  position: absolute; width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #ff7a6e, var(--btn) 45%, var(--btn-dark) 100%);
  box-shadow: 0 5px 0 #5e0f0c, 0 7px 10px rgba(0,0,0,.45), inset 0 2px 2px rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.dbtn b { color: rgba(255,255,255,.75); font-size: 16px; line-height: 1; text-shadow: 0 -1px 0 rgba(0,0,0,.35); }
.dbtn[data-dir=up] { left: 56px; top: 0; }
.dbtn[data-dir=down] { left: 56px; top: 104px; }
.dbtn[data-dir=left] { left: 0; top: 52px; }
.dbtn[data-dir=right] { left: 112px; top: 52px; }
.dbtn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 #5e0f0c, 0 2px 4px rgba(0,0,0,.4), inset 0 2px 3px rgba(0,0,0,.25); filter: brightness(.92); }
.dlbl { position: absolute; font-size: 8px; }
.l-up { left: 118px; top: 4px; } .l-down { left: 118px; top: 154px; }
.l-left { left: 2px; top: 116px; } .l-right { left: 128px; top: 116px; }

#fireWrap { position: absolute; left: 222px; top: 528px; width: 110px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.landscape #fireWrap { left: 610px; top: 190px; }
#fireBtn {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #ff7a6e, var(--btn) 45%, var(--btn-dark) 100%);
  box-shadow: 0 7px 0 #5e0f0c, 0 10px 14px rgba(0,0,0,.45), inset 0 3px 3px rgba(255,255,255,.35);
  touch-action: none;
}
#fireBtn.pressed { transform: translateY(5px); box-shadow: 0 2px 0 #5e0f0c, 0 3px 6px rgba(0,0,0,.4), inset 0 3px 4px rgba(0,0,0,.25); filter: brightness(.92); }
#fireWrap span { font-size: 12px; letter-spacing: 2px; }
