/* ============================================================
   Jailbreak — shared theme
   Calm, dignified, mobile-first. One warm accent.
   ============================================================ */

:root {
  --bg:        #11141a;
  --bg-2:      #161b23;
  --panel:     #1c222c;
  --panel-2:   #232b37;
  --line:      #2c3543;
  --ink:       #e8ecf2;
  --ink-soft:  #aeb8c6;
  --ink-faint: #6c7787;
  --accent:    #f0b429;  /* warm amber — a light left on */
  --accent-2:  #5bb3a6;  /* muted teal */
  --danger:    #e5687a;
  --good:      #6fce8f;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --maxw:      1040px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1100px 520px at 50% -180px, #1b2330 0%, rgba(27,35,48,0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(17,20,26,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 14px;
  height: 60px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 9px;
  font-weight: 800; font-size: 1.28rem; letter-spacing: .2px;
  color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent); }
.brand .tag {
  font: 500 .72rem/1 var(--mono);
  color: var(--ink-faint); letter-spacing: .5px;
  padding-left: 2px;
}
.header-spacer { flex: 1; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .92rem; color: var(--ink-soft);
}
.back-link:hover { color: var(--ink); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; cursor: pointer;
  font: 600 .95rem/1 var(--font);
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 16px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #2a3340; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #2a2207; border-color: transparent; }
.btn.primary:hover { background: #f6c33f; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 38px; padding: 8px 12px; font-size: .86rem; }

/* ---------- Generic panel / toolbar ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 14px 0;
}
.toolbar .grow { flex: 1; }
.stat {
  display: inline-flex; flex-direction: column; align-items: center;
  min-width: 74px; padding: 6px 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.stat .k { font: 600 .66rem/1 var(--mono); color: var(--ink-faint); letter-spacing: .6px; text-transform: uppercase; }
.stat .v { font: 800 1.15rem/1.2 var(--font); color: var(--ink); margin-top: 3px; font-variant-numeric: tabular-nums; }

select.sel {
  font: 600 .9rem var(--font); color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}

/* ---------- Game page scaffold ---------- */
.game-main { padding: 16px 0 40px; }
.game-title { margin: 6px 0 2px; font-size: 1.35rem; font-weight: 800; }
.game-sub { margin: 0 0 6px; color: var(--ink-soft); font-size: .92rem; }
.stage { display: flex; justify-content: center; }

.banner {
  text-align: center; padding: 12px 16px; margin: 12px 0;
  border-radius: var(--radius-sm); font-weight: 700;
  border: 1px solid var(--line); background: var(--panel);
}
.banner.win  { color: var(--good);   border-color: rgba(111,206,143,.4); background: rgba(111,206,143,.08); }
.banner.lose { color: var(--danger); border-color: rgba(229,104,122,.4); background: rgba(229,104,122,.08); }
.hidden { display: none !important; }

/* ---------- Footer + ad slot ---------- */
.ad-slot {
  max-width: 728px; margin: 22px auto; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font: 600 .72rem/1 var(--mono); letter-spacing: 1px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.012) 10px, rgba(255,255,255,.012) 20px);
}
.site-footer {
  border-top: 1px solid var(--line); margin-top: 30px;
  color: var(--ink-faint); font-size: .85rem;
}
.site-footer .wrap { padding-top: 20px; padding-bottom: 30px; }
.site-footer a { color: var(--ink-soft); }

/* ---------- Touch D-pad (shared by arcade games) ---------- */
.dpad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); gap: 8px; justify-content: center; margin: 14px auto 0; }
.dpad button {
  font-size: 1.4rem; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.dpad button:active { background: #2a3340; }
.dpad .up { grid-area: 1/2; } .dpad .left { grid-area: 2/1; }
.dpad .right { grid-area: 2/3; } .dpad .down { grid-area: 3/2; }

@media (max-width: 560px) {
  .brand { font-size: 1.14rem; }
  .brand .tag { display: none; }
  .game-title { font-size: 1.2rem; }
}

/* ===== Polish pass — accessibility, consistency, mobile (2026-06-16) ===== */
:root{ --ink-faint:#7d8898; --focus:#ffcf4d; }
*:focus-visible{ outline:3px solid var(--focus); outline-offset:2px; border-radius:5px; }
a:focus-visible,.btn:focus-visible,.sel:focus-visible,.brand:focus-visible,.back-link:focus-visible{ outline-offset:3px; }
canvas:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; }
.btn{ transition:transform .05s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn.sm{ min-height:40px; }
.banner{ animation:jb-pop .18s ease both; }
@keyframes jb-pop{ from{ transform:translateY(5px); opacity:.3 } to{ transform:none; opacity:1 } }
.game-main{ animation:jb-fade .25s ease both; }
@keyframes jb-fade{ from{ opacity:0 } to{ opacity:1 } }
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; scroll-behavior:auto !important; }
}
@media (max-width:560px){
  .toolbar{ gap:8px; }
  .toolbar .btn,.toolbar .sel{ flex:1 1 auto; }
  .stat{ min-width:62px; padding:6px 10px; }
  .dpad button{ min-width:48px; }
}
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
