:root {
  color-scheme: light;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --petrol: #2e7180;
  --coral: #e8795b;
  --butter: #e5c05a;
  --sage: #a9c5b6;
  --paper: #eee9df;
  --paper-deep: #e4ded2;
  --ink: #252b2d;
  --muted: #777b76;
  --line: #d4cec2;
  --white: #f8f6f0;
  --aqua: #75cbd7;
  --shadow: rgba(54, 58, 55, .13);
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, select { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #287e8a; outline-offset: 3px; }

.catalogue-shell { min-height: 100svh; padding: 0 clamp(20px, 5vw, 76px); overflow: hidden; background: radial-gradient(ellipse at 70% 18%, rgba(255,255,255,.78), transparent 38%), var(--paper); }
.site-header { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); text-decoration: none; font: 700 24px/1 Georgia, serif; letter-spacing: -.08em; }
.header-right { display: flex; align-items: center; gap: clamp(18px, 3vw, 44px); }
.header-note, .eyebrow, .section-count, .card-category, .card-number, .card-controls, .site-footer, .art-caption, .hero-index, .play-title-kicker, .play-status, .play-hint, .control-center, .hero-device-label { font-family: "Courier New", monospace; text-transform: uppercase; letter-spacing: .12em; }
.header-note { color: var(--muted); font-size: 9px; }
.text-button { border: 0; background: none; cursor: pointer; padding: 10px 0; font: 10px "Courier New", monospace; letter-spacing: .12em; }
.text-button span { margin-left: 8px; font-size: 16px; color: #4a9dab; }

.hero-section { min-height: 480px; display: grid; grid-template-columns: minmax(280px, .88fr) minmax(360px, 1.12fr); align-items: center; gap: clamp(28px, 5vw, 80px); padding: 52px 0 42px; }
.hero-copy { position: relative; z-index: 2; max-width: 510px; }
.eyebrow { margin: 0 0 17px; color: #7b807b; font-size: 9px; }
h1, h2, h3, p { margin-top: 0; }
.hero-copy h1 { margin: 0; font: 400 clamp(42px, 5.1vw, 76px)/.98 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
.hero-copy h1 em { color: #4c9eaa; font-weight: 400; }
.hero-description { max-width: 360px; margin: 23px 0 27px; color: #686d69; font-size: 14px; line-height: 1.65; }
.hero-cta-row { display: flex; align-items: center; gap: 24px; }
.primary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid #252b2d; border-radius: 4px; background: #252b2d; color: #f7f4ed; padding: 0 17px; cursor: pointer; font: 10px "Courier New", monospace; letter-spacing: .12em; transition: transform .2s ease, background .2s ease; }
.primary-button:hover { background: #3c777f; border-color: #3c777f; transform: translateY(-2px); }
.primary-button span { font-size: 17px; }
.hero-index { color: #858982; font-size: 9px; }
.hero-index i { display: inline-block; width: 24px; height: 1px; margin: 0 7px 3px; background: #a7aaa3; }

.hero-art { position: relative; min-height: 390px; display: flex; align-items: center; justify-content: center; isolation: isolate; }
.art-caption { position: absolute; bottom: 7%; color: #898b83; font-size: 8px; }
.caption-left { left: 0; }.caption-right { right: 0; }

.collection-section { padding: 30px 0 60px; border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.section-heading .eyebrow { margin-bottom: 7px; }
.section-heading h2 { margin: 0; font: 400 clamp(25px, 3vw, 37px)/1 Georgia, serif; letter-spacing: -.04em; }
.section-count { padding-bottom: 4px; color: var(--muted); font-size: 9px; }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.game-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: rgba(249,247,241,.72); transition: border-color .2s ease, transform .2s ease; }
.game-card:hover { border-color: #9baea8; transform: translateY(-2px); }
.game-card-main { width: 100%; display: grid; grid-template-columns: minmax(112px, .7fr) minmax(0, 1.3fr); gap: 18px; align-items: stretch; border: 0; background: none; padding: 11px 40px 11px 11px; text-align: left; cursor: pointer; }
.game-card-art { position: relative; min-height: 142px; overflow: hidden; display: flex; align-items: center; justify-content: center; border-radius: 4px; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--game-accent) 30%, #fff), color-mix(in srgb, var(--game-accent) 14%, #e9e5dc) 72%); }
.card-number { position: absolute; top: 9px; left: 10px; color: rgba(45,55,53,.6); font-size: 8px; }
.card-play { position: absolute; right: 9px; bottom: 6px; color: rgba(45,55,53,.6); font: 17px Georgia, serif; }
.game-card-info { align-self: center; padding: 5px 0; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-title-row h3 { margin: 0; font: 400 clamp(17px, 2vw, 22px) Georgia, serif; letter-spacing: -.03em; }
.card-category { color: #82857d; font-size: 7px; white-space: nowrap; }
.game-card-info p { margin: 9px 0 14px; max-width: 330px; color: #727770; font-size: 11px; line-height: 1.45; }
.card-controls { display: flex; flex-wrap: wrap; gap: 6px 14px; color: #878a82; font-size: 7px; letter-spacing: .08em; }
.favorite-button { position: absolute; top: 15px; right: 13px; width: 26px; height: 26px; border: 0; background: transparent; color: #8b9088; cursor: pointer; font-size: 18px; }
.favorite-button.is-favorite { color: #b56b54; }

.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 17px 0 24px; border-top: 1px solid var(--line); color: #8b8e86; font-size: 8px; }

.settings-dialog { width: min(440px, calc(100vw - 28px)); max-width: none; border: 1px solid var(--line); border-radius: 8px; padding: 0; background: #f6f3ec; color: var(--ink); box-shadow: 0 20px 70px rgba(32,42,39,.2); }
.settings-dialog::backdrop { background: rgba(32,39,37,.28); backdrop-filter: blur(3px); }
.settings-panel { padding: 24px; }
.settings-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 16px; }.settings-heading h2 { margin: 0 0 8px; font: 400 29px Georgia, serif; }.close-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 22px; cursor: pointer; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); }.setting-row b { display: block; font: 400 14px Georgia, serif; }.setting-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }.setting-row input { width: 19px; height: 19px; accent-color: #4a9dab; }.setting-select select { max-width: 135px; border: 1px solid var(--line); border-radius: 3px; background: #fffdf8; padding: 8px; font-size: 11px; }.settings-save { width: 100%; margin-top: 15px; }


/* ---------- TB99 brand ---------- */
.hero-art { margin: 0; flex-direction: column; justify-content: center; padding: 18px 0 34px; }
.hero-render { width: min(100%, 520px); height: auto; aspect-ratio: 1000 / 1100; object-fit: cover; border-radius: 10px; background: #d9cfbf; box-shadow: 0 30px 60px -28px rgba(54,48,38,.45), 0 0 0 1px rgba(60,55,45,.08); }
.game-card-art { padding: 0; background: #d9cfbf; }
.card-render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 52%; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.game-card:hover .card-render { transform: scale(1.04); }
.game-card-art .card-number, .game-card-art .card-play { z-index: 1; color: rgba(38,40,36,.7); text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.wordmark { display: inline-flex; align-items: baseline; gap: 1px; font: italic 700 27px/1 Georgia, "Times New Roman", serif; letter-spacing: -.06em; }
.wordmark-tb { color: var(--ink); }
.wordmark-99 { color: var(--petrol); }
.offline-pill { position: relative; display: inline-flex; align-items: center; gap: 9px; margin: 14px 0 0; padding: 8px 12px 8px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: rgba(249,247,241,.8); color: #5d6460; font: 9px "Courier New", monospace; letter-spacing: .1em; }
.offline-pill[hidden] { display: none; }
.offline-dot { width: 7px; height: 7px; border-radius: 50%; background: #c9a24a; box-shadow: 0 0 0 3px rgba(201,162,74,.18); }
.offline-pill[data-status="ready"] .offline-dot { background: #4f9a6a; box-shadow: 0 0 0 3px rgba(79,154,106,.18); }
.offline-pill[data-status="incomplete"] .offline-dot, .offline-pill[data-status="unsupported"] .offline-dot, .offline-pill[data-status="blocked"] .offline-dot { background: var(--coral); box-shadow: 0 0 0 3px rgba(232,121,91,.18); }
.offline-pill[data-status="update"] .offline-dot { background: var(--petrol); }
.offline-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--progress, 0) * 100%); background: var(--petrol); transition: width .3s ease; }
.offline-pill[data-status="ready"] .offline-bar, .offline-pill[data-status="update"] .offline-bar, .offline-pill[data-status="blocked"] .offline-bar, .offline-pill[data-status="unsupported"] .offline-bar { display: none; }
.card-wear { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 9px; color: #7d817a; font: 7px "Courier New", monospace; letter-spacing: .1em; }
.wear-meter, .service-meter { position: relative; display: inline-block; width: 34px; height: 4px; overflow: hidden; border-radius: 4px; background: rgba(46,113,128,.14); }
.wear-meter::after, .service-meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(max(.06, var(--wear)) * 100%); border-radius: inherit; background: linear-gradient(90deg, #5aa477, #d2a64a 55%, var(--coral)); }
.help-section { padding: 34px 0 48px; border-top: 1px solid var(--line); }
.help-section h2 { margin: 0 0 20px; font: 400 clamp(25px, 3vw, 37px)/1 Georgia, serif; letter-spacing: -.04em; }
.help-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 26px; }
.help-grid p { margin: 0; color: #6b706b; font-size: 12px; line-height: 1.6; }
.help-grid b { color: var(--ink); font-weight: 600; }
.site-footer { align-items: center; flex-wrap: wrap; }
.credit { margin: 0; color: #4f5552; font: 13px/1.4 Georgia, serif; letter-spacing: 0; text-transform: none; }
.credit a { color: var(--ink); text-decoration-color: rgba(46,113,128,.5); text-underline-offset: 3px; }
.credit a:hover { color: var(--petrol); }
.setting-range input { width: 140px; accent-color: var(--petrol); }
.setting-data { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.setting-data .eyebrow { margin-bottom: 6px; }
.setting-note { margin: 0 0 10px; color: #737873; font-size: 11px; line-height: 1.5; }
.setting-data-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.secondary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid rgba(37,43,45,.35); border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; font: 9px "Courier New", monospace; letter-spacing: .1em; }
.secondary-button:hover:not(:disabled) { border-color: var(--petrol); color: var(--petrol); }
.secondary-button:disabled { opacity: .4; cursor: default; }
.secondary-button.danger { border-color: rgba(181,107,84,.5); color: #9b543f; }
.file-button { position: relative; }
.service-list { list-style: none; margin: 0 0 12px; padding: 0; }
.service-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.service-row .secondary-button { grid-column: 1 / -1; justify-self: start; text-align: left; }
.service-name b { display: block; font-size: 13px; }
.service-name small { color: #7b807b; font-size: 11px; }
.service-meter { width: 70px; height: 5px; }

/* ---------- Play stage ---------- */
.is-playing { overflow: hidden; overscroll-behavior: none; background: var(--paper); }
.play-stage { position: fixed; z-index: 50; inset: 0; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; isolation: isolate; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; background: radial-gradient(ellipse 120% 70% at 50% 0%, #fbf8f1 0%, #ece6da 58%, #ddd5c6 100%); }
.play-stage[data-plastic="smoke"] { background: radial-gradient(ellipse 120% 70% at 50% 0%, #f1ede5 0%, #e1dbcf 58%, #cfc7b8 100%); }
.stage-floor { position: absolute; z-index: 0; left: 50%; top: calc(var(--shell-bottom, 80vh) - 18px); width: calc(var(--shell-scale, 140) * 3.6px); height: calc(var(--shell-scale, 140) * .55px); transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, rgba(54,58,52,.28), rgba(54,58,52,.1) 45%, transparent 70%); filter: blur(6px); pointer-events: none; }
.play-stage[data-game="aqua-rings"] .stage-floor::after { content: ""; position: absolute; inset: 10% -20% -40%; border-radius: 50%; background: repeating-conic-gradient(from 200deg at 50% 0%, transparent 0deg 6deg, rgba(255,214,170,.5) 7deg, rgba(180,225,240,.45) 8deg, transparent 10deg 14deg); mask-image: radial-gradient(ellipse at 50% 10%, #000 20%, transparent 65%); -webkit-mask-image: radial-gradient(ellipse at 50% 10%, #000 20%, transparent 65%); opacity: .8; }
.device-canvas { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; display: block; }
.screen-hit-area { position: absolute; z-index: 2; touch-action: none; border-radius: 6px; cursor: crosshair; }
.play-stage[data-game="pocket-pinball"] .screen-hit-area { pointer-events: none; }
.hit-layer { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.hit-button { position: absolute; left: 0; top: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; pointer-events: auto; touch-action: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hit-button.hit-dpad { border-radius: 30%; }
.hit-button:focus-visible { outline: 3px solid rgba(46,113,128,.75); outline-offset: 2px; }
.play-topbar { position: absolute; z-index: 5; top: max(12px, var(--sat)); left: max(12px, var(--sal)); right: max(12px, var(--sar)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; pointer-events: none; }
.play-topbar button { pointer-events: auto; }
.play-nav-button, .play-icon-button { min-height: 44px; border: 1px solid rgba(95,108,102,.25); border-radius: 4px; background: rgba(247,245,237,.78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; }
.play-nav-button { justify-self: start; display: inline-flex; align-items: center; gap: 9px; padding: 0 12px; font: 9px "Courier New", monospace; letter-spacing: .08em; }
.play-nav-button span:first-child { font: 17px Georgia, serif; }
.play-title { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.play-title-kicker { color: #858982; font-size: 7px; }
.play-title b { font: 400 17px Georgia, serif; }
.play-icon-button { justify-self: end; width: 44px; font-size: 16px; }
.play-status { position: absolute; z-index: 4; top: calc(max(12px, var(--sat)) + 50px); left: 50%; display: flex; align-items: center; gap: 8px; transform: translateX(-50%); color: #6f766f; font-size: 7px; white-space: nowrap; pointer-events: none; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #67b98a; box-shadow: 0 0 0 3px rgba(103,185,138,.16); }
.tilt-button { pointer-events: auto; min-height: 30px; padding: 0 10px; border: 1px solid rgba(46,113,128,.45); border-radius: 999px; background: rgba(247,245,237,.85); color: var(--petrol); font: 8px "Courier New", monospace; letter-spacing: .1em; cursor: pointer; }
.tilt-button[hidden] { display: none; }
.play-hint { position: absolute; z-index: 2; bottom: max(12px, calc(var(--sab) + 6px)); left: 50%; margin: 0; transform: translateX(-50%); color: rgba(95,104,97,.7); font: 8px "Courier New", monospace; letter-spacing: .08em; white-space: nowrap; text-transform: uppercase; }
.play-error { position: absolute; z-index: 6; left: 50%; top: 50%; width: min(320px, 86vw); transform: translate(-50%, -50%); padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #f6f3ec; font-size: 13px; line-height: 1.5; }
.play-error[hidden] { display: none; }
.pause-layer { position: absolute; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(235,231,221,.6); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.pause-layer[hidden] { display: none; }
.pause-card { width: min(340px, 100%); display: grid; gap: 9px; padding: 26px 24px; border: 1px solid var(--line); border-radius: 8px; background: rgba(248,246,240,.95); box-shadow: 0 24px 60px rgba(42,46,42,.14); }
.pause-card h2 { margin: 0 0 12px; font: 400 32px/1 Georgia, serif; letter-spacing: -.04em; }
.pause-card .eyebrow { margin-bottom: 4px; }

@media (min-width: 1200px) {
  .catalogue-shell { padding-inline: max(76px, calc((100vw - 1280px) / 2)); }
  .hero-section { min-height: 520px; }
}
@media (max-width: 980px) {
  .help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .hero-section { grid-template-columns: 1fr 1fr; gap: 12px; min-height: 410px; }
  .hero-art { min-height: 330px; }
  .hero-copy h1 { font-size: clamp(39px, 6vw, 55px); }
  .game-card-main { grid-template-columns: 112px minmax(0,1fr); gap: 13px; }
  .card-title-row { display: block; }.card-category { display: block; margin-top: 4px; }
}
@media (max-width: 600px) {
  .catalogue-shell { padding: 0 19px; }
  .site-header { height: 66px; }.header-note { display: none; }
  .hero-section { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 37px 0 24px; }
  .hero-copy { max-width: none; }.hero-copy h1 { font-size: clamp(43px, 12vw, 58px); }.hero-description { margin: 16px 0 19px; font-size: 13px; }
  .hero-art { min-height: 0; margin: 0; padding: 8px 0 30px; }.hero-render { width: 100%; }.art-caption { bottom: 6px; font-size: 7px; }
  .collection-section { padding: 24px 0 38px; }.section-heading { align-items: end; gap: 12px; }.section-heading h2 { font-size: 28px; }.section-count { font-size: 7px; white-space: nowrap; }
  .game-grid { grid-template-columns: 1fr; gap: 9px; }.game-card-main { grid-template-columns: 105px minmax(0,1fr); min-height: 128px; gap: 13px; padding: 9px 39px 9px 9px; }.game-card-art { min-height: 108px; }.game-card-info p { margin: 7px 0 9px; font-size: 10px; }.card-controls { font-size: 6px; }.card-title-row h3 { font-size: 18px; }
  .site-footer { font-size: 7px; flex-direction: column; align-items: flex-start; }
  .help-grid { grid-template-columns: 1fr; gap: 14px; }
  .play-topbar { top: max(8px, var(--sat)); left: max(8px, var(--sal)); right: max(8px, var(--sar)); }
  .play-nav-button { min-height: 40px; padding: 0 9px; gap: 6px; font-size: 8px; }
  .play-icon-button { width: 40px; min-height: 40px; }
  .play-title b { font-size: 15px; }
  .play-title-kicker { font-size: 6px; }
  .play-status { top: calc(max(8px, var(--sat)) + 44px); }
  .play-hint { display: none; }
}
@media (max-width: 380px) {
  .catalogue-shell { padding-inline: 15px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-art { min-height: 270px; }
  .game-card-main { grid-template-columns: 92px minmax(0,1fr); gap: 10px; }
  .game-card-art { min-height: 100px; }
  .card-controls { letter-spacing: .03em; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .play-topbar { grid-template-columns: auto 1fr auto; }
  .play-title { display: none; }
  .play-status { left: max(12px, var(--sal)); top: calc(max(12px, var(--sat)) + 52px); transform: none; flex-direction: column; align-items: flex-start; }
  .play-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
