/* JavaPlay player. Home = app bar + game grid + FAB. Player = edge-to-edge: screen on top, keypad below
   (wide screen / phone held sideways: D-pad left, screen centre, soft keys + numpad right).
   Keypad colours come from theme variables set on .player by app.js (THEMES), sizes from --ks / --ds.
   Written for old Android WebViews too: no flex gap / inset / aspect-ratio without fallbacks. */
:root {
  --bg: #0e1014;
  --panel: #171a21;
  --card: #1c2029;
  --key: #262a34;
  --key-edge: #363c4b;
  --fg: #eef0f4;
  --muted: #8d95a7;
  --accent: #ff8a1f;
  --accent-ink: #1a1206;
  --danger: #ff5b5b;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Roboto Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--ui); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font: 0.9em var(--mono); }
a { color: var(--accent); }
.app { height: 100%; position: relative; }

/* ---------- home ---------- */
.home { height: 100%; display: flex; flex-direction: column; }
.appbar {
  flex: none; display: flex; align-items: center;
  padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  min-height: calc(58px + env(safe-area-inset-top, 0px)); background: var(--panel); border-bottom: 1px solid #22262f;
}
.appbar img { width: 32px; height: 32px; border-radius: 8px; margin-right: 12px; }
.appbar h1 { flex: 1; margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn:active, .icon-btn:hover { background: var(--key); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .off { display: none; }
.icon-btn.muted .on { display: none; }
.icon-btn.muted .off { display: block; }

.home-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px max(12px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-gap: 12px; max-width: 980px; margin: 0 auto; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  background: var(--card); border: 1px solid #282d38; border-radius: 18px; padding: 14px; min-height: 176px; cursor: pointer; text-align: left;
  transition: transform .12s ease;
}
.card:active { transform: scale(0.97); }
.card img, .card .noicon { width: 64px; height: 64px; border-radius: 14px; image-rendering: pixelated; background: #0b0c10; object-fit: contain; margin-bottom: 12px; }
.card .noicon { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.6rem; color: var(--accent); }
.card .name { font-weight: 700; line-height: 1.25; word-break: break-word; margin-bottom: 6px; min-height: 2.5em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Android app: the home screen sits below the status bar, so ignore the safe-area inset the WebView
   keeps from full-screen play (it left a gap above the app bar after leaving a game) */
.in-app .appbar { padding-top: 0; min-height: 58px; }
.card .meta { font: 0.72rem var(--mono); color: var(--muted); margin-top: auto; }
.card .more { position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(14, 16, 20, 0.7); color: #fff; cursor: pointer; font-size: 1.3rem; line-height: 1; }
.card .more:active { background: var(--key); }
.home-note { max-width: 980px; margin: 14px auto 0; color: var(--accent); font-size: 0.9rem; }

.empty { max-width: 380px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.empty img { width: 88px; height: 88px; margin-bottom: 18px; }
.empty h2 { margin: 0 0 8px; font-size: 1.35rem; }
.empty p { margin: 0 0 22px; color: var(--muted); }
.empty .btn { width: 100%; margin-bottom: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--key-edge); background: var(--key); color: var(--fg); font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.fab {
  position: absolute; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  width: 60px; height: 60px; border-radius: 18px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 138, 31, 0.35), 0 4px 10px rgba(0, 0, 0, 0.4);
}
.fab:active { transform: scale(0.95); }
#jarInput { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.home.drag .home-body { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* ---------- player ---------- */
.player {
  /* theme defaults (Midnight); app.js overrides these per theme */
  --stage: #07080b; --pad-bg: linear-gradient(#1b1e26, #111318); --pad-edge: #262b36;
  --k-bg: #262a34; --k-edge: #363c4b; --k-fg: #eef0f4; --k-sub: #8d95a7; --dpad: #262a34; --arrow: #b9bfcc;
  --hl: #ff8a1f; --hl-ink: #1a1206; --ok: #ff8a1f; --ok-ink: #1a1206; --kr: 14px; --glow: none;
  --ks: 1; --ds: 1;
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; background: var(--stage);
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.device { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
.device.portrait { max-width: 480px; }
.screen-wrap { position: relative; flex: 1 1 auto; min-height: 120px; display: flex; align-items: center; justify-content: center; background: #000; border-radius: 12px; overflow: hidden; }
#screen { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; outline: none; }
.float-menu {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(14, 16, 20, 0.55); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 2;
}
.device.nokeys .float-menu { display: flex; }
.rec-badge { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; background: rgba(14, 16, 20, 0.7); color: #fff; border-radius: 999px; padding: 5px 10px; font: 600 0.8rem var(--mono); z-index: 2; }
.rec-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); margin-right: 6px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(16, 18, 23, 0.94); color: var(--fg); border: 1px solid var(--key-edge); padding: 9px 14px; border-radius: 12px; font-size: 0.86rem; max-width: 90%; text-align: center; z-index: 3; }
.kbd-hint { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; text-align: center; display: none; }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: block; } }

/* keypad below the screen */
.keypad {
  flex: none; display: grid; grid-gap: 8px; margin-top: 8px;
  grid-template-columns: 1fr 1.3fr 1fr;
  grid-template-areas: "kl dpad kr" "num num num";
  background: var(--pad-bg); border: 1px solid var(--pad-edge); border-radius: 20px; padding: 10px;
  touch-action: none;
}
.kp-left { grid-area: kl; } .kp-right { grid-area: kr; } .dpad { grid-area: dpad; } .numpad, .actions { grid-area: num; }
.kp-left, .kp-right { display: grid; grid-template-rows: 1fr 1fr; grid-gap: 8px; }
.k-pair { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 6px; }
.device:not(.can-rotate) .k-pair { grid-template-columns: 1fr; }
.device:not(.can-rotate) .rot { display: none; }
.k {
  border: 1px solid var(--k-edge); background: var(--k-bg); color: var(--k-fg); border-radius: var(--kr); font-weight: 700; cursor: pointer; box-shadow: var(--glow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; min-height: 42px; min-height: calc(42px * var(--ks)); touch-action: none;
}
.k.down { background: var(--hl); color: var(--hl-ink); border-color: transparent; }
.k small { font-weight: 500; font-size: 0.62rem; color: var(--k-sub); letter-spacing: 0.06em; line-height: 1; margin-top: 2px; }
.k.down small { color: var(--hl-ink); }
.k.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.soft .bar-ind { width: 34%; height: 4px; border-radius: 2px; background: var(--hl); margin-bottom: 4px; }
.soft.down .bar-ind { background: var(--hl-ink); }
.soft-label { font-size: 0.68rem; font-weight: 600; color: var(--k-sub); max-width: 95%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 0.9em; }
.soft.down .soft-label { color: var(--hl-ink); }
.burger { width: 20px; height: 14px; background: linear-gradient(currentColor, currentColor) top/100% 2.5px no-repeat, linear-gradient(currentColor, currentColor) center/100% 2.5px no-repeat, linear-gradient(currentColor, currentColor) bottom/100% 2.5px no-repeat; }
.clear { font-size: 1rem; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 7px; }
.numpad .k { min-height: 46px; min-height: calc(46px * var(--ks)); font-size: 1.15rem; }

/* big 5 + OK keys, shown when the number keys are hidden */
.actions { display: none; grid-template-columns: 1fr 1fr; grid-gap: 10px; }
.device.nonum .numpad { display: none; }
.device.nonum .actions { display: grid; }
.actions .k { min-height: 56px; min-height: calc(56px * var(--ks)); font-size: 1.3rem; border-radius: 999px; }
.actions .fire { background: var(--ok); color: var(--ok-ink); border-color: transparent; }
.actions .fire.down { filter: brightness(1.25); }

.dpad { position: relative; width: 100%; max-width: 190px; max-width: calc(190px * var(--ds)); justify-self: center; align-self: center; border-radius: 50%; background: var(--dpad); border: 1px solid var(--k-edge); box-shadow: var(--glow); touch-action: none; cursor: pointer; aspect-ratio: 1; }
@supports not (aspect-ratio: 1) { .dpad::after { content: ""; display: block; padding-bottom: 100%; } }
.dpad::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 50%; pointer-events: none; opacity: 0.5; }
.dpad.up::before { background: conic-gradient(from -45deg, var(--hl) 0 90deg, transparent 0); }
.dpad.right::before { background: conic-gradient(from 45deg, var(--hl) 0 90deg, transparent 0); }
.dpad.down::before { background: conic-gradient(from 135deg, var(--hl) 0 90deg, transparent 0); }
.dpad.left::before { background: conic-gradient(from 225deg, var(--hl) 0 90deg, transparent 0); }
.arr { position: absolute; width: 0; height: 0; border: 8px solid transparent; pointer-events: none; }
.arr.up { top: 9%; left: 50%; margin-left: -8px; border-bottom: 11px solid var(--arrow); border-top: 0; }
.arr.down { bottom: 9%; left: 50%; margin-left: -8px; border-top: 11px solid var(--arrow); border-bottom: 0; }
.arr.left { left: 9%; top: 50%; margin-top: -8px; border-right: 11px solid var(--arrow); border-left: 0; }
.arr.right { right: 9%; top: 50%; margin-top: -8px; border-left: 11px solid var(--arrow); border-right: 0; }
.ok { position: absolute; left: 31%; top: 31%; width: 38%; height: 38%; border-radius: 50%; border: 0; background: var(--ok); color: var(--ok-ink); font-weight: 800; letter-spacing: 0.04em; cursor: pointer; touch-action: none; }
.ok.down { filter: brightness(1.25); }

/* portrait on a phone: keep the keypad compact so the game screen gets the room */
@media (max-aspect-ratio: 5/4) {
  .device .keypad { grid-gap: 6px; padding: 8px; border-radius: 18px; margin-top: 6px; }
  .device .kp-left, .device .kp-right { grid-gap: 6px; }
  .device .k { min-height: 36px; min-height: calc(36px * var(--ks)); }
  .device .numpad { grid-gap: 5px; }
  .device .numpad .k { min-height: 0; height: 36px; height: calc(clamp(30px, 4.8vh, 42px) * var(--ks)); font-size: 1.05rem; }
  .device .numpad .k small { display: none; }
  .device .dpad { max-width: 140px; max-width: calc(min(140px, 18vh) * var(--ds)); }
  .device .actions .k { min-height: 48px; min-height: calc(clamp(40px, 6.5vh, 56px) * var(--ks)); }
}

/* wide screen (desktop, phone held sideways): D-pad on the left, big screen in the centre,
   soft keys + number keys on the right. "swap" puts the D-pad on the right. */
@media (min-aspect-ratio: 5/4) {
  .device:not(.nokeys) {
    display: grid; max-width: 1400px; margin: 0 auto; grid-gap: 10px 18px;
    grid-template-columns: minmax(140px, 250px) minmax(0, 1fr) minmax(150px, 270px);
    grid-template-columns: minmax(140px, calc(250px * var(--ks))) minmax(0, 1fr) minmax(150px, calc(270px * var(--ks)));
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "kl screen kr" "dpad screen num";
  }
  .device.swap:not(.nokeys) { grid-template-areas: "kl screen kr" "num screen dpad"; }
  .device .screen-wrap { grid-area: screen; height: 100%; }
  .device .keypad { display: contents; }
  .device .kp-left, .device .kp-right { grid-template-rows: none; grid-template-columns: 1fr 1fr; align-self: start; }
  .device .k { min-height: 48px; min-height: calc(48px * var(--ks)); }
  .device .dpad { width: 100%; max-width: 210px; align-self: center; }
  @supports (width: min(1px, 2px)) { .device .dpad { width: min(100%, calc(210px * var(--ds)), calc(60vh * var(--ds))); max-width: none; } }
  .device .numpad, .device .actions { align-self: center; }
  .device .numpad .k { min-height: 0; height: 40px; height: calc(clamp(30px, 8.6vh, 54px) * var(--ks)); font-size: 1.1rem; }
  .device .actions { justify-items: center; }
  .device .actions .k { width: 100%; max-width: 104px; max-width: calc(104px * var(--ks)); height: auto; aspect-ratio: 1; border-radius: 50%; }
  .device .actions .fire { margin-top: 40%; }
}
/* very short landscape phones: drop the letters, tighten the soft-key row */
@media (min-aspect-ratio: 5/4) and (max-height: 420px) {
  .device .numpad .k small { display: none; }
  .device .numpad { grid-gap: 5px; }
  .device .k { min-height: 40px; min-height: calc(40px * var(--ks)); }
  .player { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
}

/* touch games / keypad hidden */
.device.nokeys .keypad { display: none; }
.device.nokeys { max-width: none; }
.player.immersive { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.player.immersive .screen-wrap { border-radius: 0; }

/* ---------- bottom sheet ---------- */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(5, 6, 9, 0.62); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet {
  width: 100%; max-width: 460px; max-height: 88%; overflow-y: auto; background: var(--panel); border: 1px solid var(--key-edge); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0.5; } }
.grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--key-edge); margin: 4px auto 12px; }
.sheet h2 { margin: 0 0 10px; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .opt { width: 100%; display: flex; align-items: center; text-align: left; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 0; background: transparent; cursor: pointer; font-weight: 600; margin-bottom: 2px; }
.sheet .opt:active, .sheet .opt:hover { background: var(--key); }
.sheet .opt .ico { width: 26px; margin-right: 12px; text-align: center; font-size: 1.1rem; opacity: 0.9; }
.sheet .opt .val { margin-left: auto; color: var(--muted); font: 500 0.85rem var(--mono); }
.sheet .opt.primary { background: var(--accent); color: var(--accent-ink); justify-content: center; margin-bottom: 8px; }
.sheet .opt.danger { color: var(--danger); }
.sheet textarea { width: 100%; min-height: 90px; padding: 12px; border-radius: 12px; border: 1px solid var(--key-edge); background: #0f1116; color: var(--fg); font: inherit; resize: vertical; margin-bottom: 10px; -webkit-user-select: text; user-select: text; }
.sheet .row { display: flex; }
.sheet .row .opt { justify-content: center; }
.sheet .row .opt + .opt { margin-left: 8px; }
.sheet .info { color: var(--muted); font-size: 0.88rem; margin: 0 0 12px; }

@media (min-width: 700px) {
  .modal { align-items: center; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--key-edge); }
}
/* Controls opened during a game: keep the keypad visible behind the sheet for a live preview */
.modal.peek { background: rgba(5, 6, 9, 0.28); }
@media (max-aspect-ratio: 5/4) {
  .modal.peek { align-items: flex-start; }
  .modal.peek .sheet { max-height: 56%; border-radius: 0 0 22px 22px; border: 1px solid var(--key-edge); border-top: 0; padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-bottom: 12px; }
}
@media (min-aspect-ratio: 5/4) and (max-width: 1000px) { .modal.peek { align-items: stretch; } .modal.peek .sheet { max-height: none; border-radius: 0; max-width: 420px; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .rec-badge .dot { animation: none; } }

/* ---------- controls sheet ---------- */
.sec { margin: 6px 0 16px; }
.sec h3 { margin: 0 0 8px; font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); grid-gap: 10px; }
.tcard { display: flex; flex-direction: column; align-items: stretch; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: center; }
.tcard .pv { position: relative; height: 62px; border-radius: 14px; background: var(--pad-bg); border: 2px solid var(--pad-edge); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tcard[aria-pressed="true"] .pv { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tcard .pv i { display: block; width: 18px; height: 14px; margin: 0 2px; border-radius: 5px; background: var(--k-bg); border: 1px solid var(--k-edge); box-shadow: var(--glow); }
.tcard .pv b { display: block; width: 24px; height: 24px; margin: 0 4px; border-radius: 50%; background: var(--dpad); border: 1px solid var(--k-edge); position: relative; }
.tcard .pv b::after { content: ""; position: absolute; left: 7px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.tcard .pv i.hl { background: var(--hl); border-color: transparent; }
.tcard .nm { margin-top: 5px; font-size: 0.78rem; font-weight: 600; color: var(--fg); }
.swatches { display: flex; flex-wrap: wrap; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); margin: 0 10px 10px 0; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--fg); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--fg); }
.range { display: flex; align-items: center; min-height: 48px; padding: 0 4px; }
.range label { width: 108px; flex: none; font-weight: 600; }
.range input { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
.range output { width: 52px; text-align: right; font: 500 0.85rem var(--mono); color: var(--muted); }
.keyrow .val b { color: var(--accent); font-weight: 700; margin-right: 6px; }
.keyrow.wait { background: var(--key); }
.keyrow.wait .val { color: var(--accent); }

/* ---------- about / credits ---------- */
.about-top { display: flex; align-items: center; margin-bottom: 14px; }
.about-top img { width: 56px; height: 56px; border-radius: 14px; margin-right: 14px; }
.about-top strong { display: block; font-size: 1.25rem; }
.about-top span { color: var(--muted); font-size: 0.86rem; }
.credit { display: flex; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid #282d38; color: var(--fg); text-decoration: none; margin-bottom: 8px; }
.credit:active, .credit:hover { border-color: var(--accent); }
.credit .av { width: 40px; height: 40px; border-radius: 12px; flex: none; margin-right: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; background: var(--accent); color: var(--accent-ink); }
.credit .av.cl { background: #000; padding: 7px; }
.credit .av.cl svg { display: block; width: 100%; height: 100%; }
.credit .av.logo { background: transparent; }
.credit .av.logo img { display: block; width: 40px; height: 40px; border-radius: 11px; }
.cl-banner { display: block; width: 190px; margin: 18px auto 0; }
.cl-banner img { display: block; width: 100%; height: auto; }
.credit small { display: block; color: var(--muted); font-size: 0.8rem; }
.credit .go { margin-left: auto; color: var(--muted); font-size: 1.2rem; }
.sites { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-gap: 8px; }
.sites a { display: block; min-width: 0; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid #282d38; color: var(--fg); text-decoration: none; font-size: 0.86rem; font-weight: 600; line-height: 1.3; }
.sites a small { display: block; color: var(--muted); font: 500 0.66rem var(--mono); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.sites a:active, .sites a:hover { border-color: var(--accent); }
.fine { color: var(--muted); font-size: 0.8rem; line-height: 1.5; margin: 14px 2px 4px; }
.fine .heart { color: var(--danger); }

/* ---------- tabs + free games store ---------- */
.tabs { flex: none; display: flex; background: var(--panel); border-bottom: 1px solid #22262f; padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); }
.tab { flex: 1; max-width: 220px; height: 46px; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; position: relative; }
.tab[aria-selected="true"] { color: var(--fg); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.badge { display: inline-block; min-width: 22px; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: var(--key); color: var(--muted); font: 600 0.7rem var(--mono); }
.tab[aria-selected="true"] .badge { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.store-head { max-width: 980px; margin: 0 auto 12px; }
/* Android app: Free games tab shows javaplay.codelove.in/games with a small address bar */
.home-body.web { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.home-body.web[hidden] { display: none; }
.urlbar { flex: none; display: flex; align-items: center; margin: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px)); padding: 0 4px 0 12px; height: 42px; border-radius: 999px; background: var(--card); border: 1px solid #282d38; }
.urlbar > svg { width: 15px; height: 15px; fill: none; stroke: #7ee2a8; stroke-width: 2.2; stroke-linecap: round; margin-right: 8px; flex: none; }
.urlbar .url { flex: 1; min-width: 0; font: 500 0.9rem var(--mono); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urlbar .icon-btn { width: 36px; height: 36px; }
/* PHONEKY tab (Android app) */
.web-card { max-width: 460px; margin: 6vh auto 0; padding: 22px 20px; border-radius: 22px; background: var(--card); border: 1px solid #282d38; text-align: center; }
.web-card h2 { margin: 0 0 8px; font-size: 1.3rem; }
.web-card p { margin: 0 0 18px; color: var(--muted); }
.web-card .fine { margin: 12px 0 0; font-size: 0.78rem; text-align: left; }
.in-app-browse .web-only, .in-web .app-only { display: none; }
.site { display: block; text-align: left; padding: 14px 40px 14px 16px; margin-bottom: 10px; border-radius: 16px; background: var(--bg); border: 1px solid #2c3140; color: var(--fg); text-decoration: none; position: relative; }
.site::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--muted); }
.site:active, .site:hover { border-color: var(--accent); }
.site b { display: block; font-size: 1.02rem; }
.site span { display: block; color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.site i { display: block; font: normal 500 0.72rem var(--mono); color: var(--accent); margin-top: 4px; }
.urlbar .icon-btn svg { width: 18px; height: 18px; }
#gamesFrame { flex: 1; width: 100%; min-height: 0; border: 0; background: #0f1116; display: block; }
.store-search { display: flex; align-items: center; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--card); border: 1px solid #282d38; }
.store-search svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; margin-right: 10px; flex: none; }
.store-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--fg); font: 500 1rem var(--ui); outline: none; -webkit-user-select: text; user-select: text; }
.chips { display: flex; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; margin-right: 8px; border-radius: 999px; border: 1px solid #2c3140; background: var(--card); color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.store-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.scard { display: flex; flex-direction: column; background: var(--card); border: 1px solid #282d38; border-radius: 18px; padding: 8px 8px 10px; cursor: pointer; text-align: left; min-width: 0; transition: transform .12s ease; }
.scard:active { transform: scale(0.97); }
.shot { display: block; position: relative; border-radius: 12px; overflow: hidden; background: #000; border: 3px solid #0b0c10; }
.shot::before { content: ""; display: block; padding-top: 133.33%; }
.shot img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.shot .ico { position: absolute; left: 6px; bottom: 6px; width: 30px; height: 30px; top: auto; border-radius: 8px; background: #0b0c10; border: 2px solid rgba(255, 255, 255, 0.14); object-fit: contain; }
.shot .got { position: absolute; top: 6px; right: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(14, 16, 20, 0.8); color: #7ee2a8; font: 600 0.68rem var(--mono); }
/* old WebViews do not stretch children of a flex <button> */
.scard .shot, .scard .nm, .scard .ct { display: block; width: 100%; }
.scard .nm { font-weight: 700; margin: 9px 2px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard .ct { font: 500 0.72rem var(--mono); color: var(--accent); margin: 0 2px; }
.store-msg { max-width: 420px; margin: 30px auto; text-align: center; color: var(--muted); }
.sheet .detail { display: flex; margin-bottom: 14px; }
.sheet .detail .shot { width: 112px; flex: none; margin-right: 14px; }
.sheet .detail p { margin: 0 0 8px; color: #c9cfdb; font-size: 0.92rem; }
.sheet .detail small { color: var(--muted); display: block; line-height: 1.5; }
.sheet .detail small a { color: var(--accent); }
.progress { height: 4px; border-radius: 2px; background: var(--key); overflow: hidden; margin: 4px 0 10px; }
.progress span { display: block; height: 100%; width: 30%; background: var(--accent); animation: load 1s ease-in-out infinite; }
.progress.fixed span { width: 0; animation: none; transition: width .2s; }
.sheet .notes { margin: 0 0 14px; padding-left: 20px; color: #c9cfdb; font-size: 0.9rem; }
.sheet .notes li { margin-bottom: 4px; }
.upd-label { text-align: center; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.card .shot.lib { display: block; width: 100%; margin-bottom: 10px; }
.card .shot.lib img { width: 100%; height: 100%; margin: 0; border-radius: 0; background: #000; }
.card .shot.lib img.fit { object-fit: contain; }
.card .shot.lib .ico { width: 30px; height: 30px; border-radius: 8px; }
/* no picture yet: big icon or first letter in the middle of the same box */
.card .shot.lib.blank { background: radial-gradient(circle at 50% 40%, #232836, #0b0c10 70%); }
.card .shot.lib img.big { position: absolute; top: 50%; left: 50%; width: 46%; height: auto; margin: 0; transform: translate(-50%, -50%); border-radius: 16px; background: transparent; object-fit: contain; }
.card .shot.lib .noicon { position: absolute; top: 50%; left: 50%; width: 72px; height: 72px; margin: 0; transform: translate(-50%, -50%); border-radius: 18px; background: var(--card); font-size: 2rem; }
