/* One final layout contract for the arena, controls, and responsive panels. */
.tracker-viewport { min-height: 100dvh; height: 100dvh; }
.tracker-device-frame {
  min-width: 0;
  min-height: 0;
  /* The clawed shell places the screen in row 2 and the footer in row 4. */
  grid-template-rows: 76px minmax(0, 1fr) 19px 50px 7px;
}
.frame-main-content { min-width: 0; min-height: 0; }
.action-rpg-screen { min-height: 0; grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
.action-combat-stage { min-height: 0; }
.action-combat-stage { background: url('../assets/spideytracker/rooftop-arena.svg') center bottom / cover no-repeat #0b1935 !important; }
.arena-turn-banner { position:absolute; top:12%; left:50%; transform:translateX(-50%); z-index:4; display:grid; justify-items:center; gap:4px; width:min(45%, 230px); padding:10px 12px; border:2px solid #06101d; background:rgba(4,17,34,.88); box-shadow:inset 0 0 0 1px #54b6d0,3px 4px 0 #02060b; text-align:center; pointer-events:none; }
.arena-turn-banner small { color:#54b6d0; font:700 9px/1 'Silkscreen',monospace; }
.arena-turn-banner strong { color:#f2c06b; font:700 20px/1 'Press Start 2P',monospace; }
.arena-turn-banner span { color:#d9e0df; font:700 10px/1.3 'Silkscreen',monospace; }
.game-hud-strip, .hud-bars, .quest-directive, .combat-action-bar { min-width: 0; }
.game-primary-nav { z-index: 100; }
.hud-mask img { width: 100%; height: 100%; object-fit: cover; }
.notion-badge-icon { display: block; width: 64px; height: 64px; object-fit: contain; margin: 8px 0; border-radius: 8px; }
.field-focus-card { display:grid; justify-items:center; gap:10px; margin:12px 0 24px; padding:clamp(16px,3vw,28px); border:3px solid #54b6d0; background:radial-gradient(circle at 50% 0%,rgba(240,100,92,.18),transparent 55%),#071426; text-align:center; }
.field-focus-card > span,.field-focus-card > small { color:#9ed9e7; font:700 10px/1.4 'Silkscreen',monospace; }
.field-focus-card > strong { color:#f2c06b; font:700 clamp(12px,2vw,18px)/1.4 'Press Start 2P',monospace; }
.field-focus-card output { color:#fff; font:700 clamp(36px,7vw,72px)/1.2 'Silkscreen',monospace; font-variant-numeric:tabular-nums; }
.field-focus-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
.quest-create-form { display:grid; grid-template-columns:minmax(0,1fr) minmax(140px,.3fr) auto; gap:8px; margin:18px 0 0; padding:16px; border:2px solid #397c9b; background:#071426; }
.quest-create-form label { grid-column:1/-1; color:#f2c06b; font:700 10px/1.4 'Silkscreen',monospace; }
.quest-create-form input,.quest-create-form select { min-width:0; min-height:44px; padding:10px 12px; border:2px solid #397c9b; background:#020b16; color:#fff; font:500 14px/1.4 'Be Vietnam Pro',sans-serif; }
.quest-create-form input:focus-visible,.quest-create-form select:focus-visible { outline:3px solid #f2c06b; outline-offset:2px; }
.game-primary-nav button, .combat-action-bar button, #game-panel-tabs button {
  touch-action: manipulation;
}
.game-primary-nav button:focus-visible, .combat-action-bar button:focus-visible,
#game-panel-tabs button:focus-visible, .pixel-action-btn:focus-visible {
  outline: 3px solid #f2c06b;
  outline-offset: 2px;
}

/* The atlas uses 256px cells but the figure occupies only about a quarter of one.
   Scale the cell and its offsets together so every animation frame stays aligned. */
.action-fighter--hero .hero-sprite-actor {
  --hero-scale: 0.96;
  top: auto !important;
  right: auto !important;
  width: calc(256px * var(--hero-scale)) !important;
  height: calc(256px * var(--hero-scale)) !important;
  margin-left: calc(-128px * var(--hero-scale)) !important;
  margin-bottom: calc(-27px * var(--hero-scale)) !important;
  background-size: calc(2560px * var(--hero-scale)) calc(2816px * var(--hero-scale)) !important;
  background-position: calc(var(--sprite-x, 0px) * var(--hero-scale)) calc(var(--sprite-y, 0px) * var(--hero-scale)) !important;
}
.action-fighter--hero { bottom: 28% !important; }
.action-fighter--enemy { bottom: 28% !important; right: 31% !important; }
.action-fighter--enemy .combat-placeholder {
  width: 230px !important;
  height: 230px !important;
  max-width: none;
  margin-bottom: -26px !important;
}
.combat-info-panel { max-width: min(28%, 232px); }

@media (max-width: 800px) {
  .tracker-device-frame {
    height: 100dvh;
    grid-template-rows: 62px minmax(0, 1fr) 14px 40px 5px;
  }
  .frame-main-content { margin-bottom: 0; }
  .action-rpg-screen {
    inset: 0 0 58px;
    min-height: 0;
    overflow: hidden;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  }
  .action-combat-stage { min-height: 0; }
  .action-fighter--hero { bottom: 28% !important; }
  .action-fighter--enemy { bottom: 28% !important; }
  .combat-info-panel { max-width: none; }
  .combat-action-bar button { min-height: 48px; }
  .game-primary-nav { bottom: 5px; }
  .game-primary-nav button { min-height: 48px; }
  .game-panel-content { max-height: none; }
}

@media (max-width: 500px) {
  .action-rpg-screen { grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
  .action-combat-stage { min-height: 0; }
  .action-fighter--hero { left: 0 !important; }
  .action-fighter--enemy { right: 0 !important; }
  .action-fighter--hero .hero-sprite-actor { --hero-scale: 0.94; }
  .combat-action-bar button { min-height: 48px; }
  .combat-action-bar strong { font-size: 7px; line-height: 1.1; }
  .combat-action-bar small { font-size: 6px; }
  .game-primary-nav button { font-size: 7px; }
  .game-primary-nav button svg { width: 20px; height: 20px; }
  .game-panel-backdrop { padding: 0; }
  .game-panel > header button { min-width: 44px; min-height: 44px; }
  #game-panel-tabs button { min-height: 44px; }
}

/* Gambit-inspired game screens: compact decks, stage rails, and clear system identity. */
.game-panel-backdrop {
  --screen-accent: #54b6d0;
  --screen-accent-rgb: 84, 182, 208;
}
body[data-game-section="QUESTS"] .game-panel-backdrop {
  --screen-accent: #f0645c;
  --screen-accent-rgb: 240, 100, 92;
}
body[data-game-section="HERO"] .game-panel-backdrop {
  --screen-accent: #54b6d0;
  --screen-accent-rgb: 84, 182, 208;
}
body[data-game-section="HABITS"] .game-panel-backdrop {
  --screen-accent: #83b96b;
  --screen-accent-rgb: 131, 185, 107;
}
body[data-game-section="FIELD"] .game-panel-backdrop {
  --screen-accent: #f2c06b;
  --screen-accent-rgb: 242, 192, 107;
}

.game-panel {
  background:
    linear-gradient(120deg, rgba(var(--screen-accent-rgb), .08), transparent 28%),
    repeating-linear-gradient(135deg, transparent 0 38px, rgba(84, 182, 208, .025) 38px 40px),
    #071426;
}

/* Spider Life Reset: final navigation, arena balance and full screen app layouts. */
.system-signal--spider-apps {
  top: 10px;
  right: 12px;
  width: 72px;
  height: 62px;
  display: grid;
  place-items: end center;
  padding: 0 6px 7px;
  overflow: visible;
  border: 3px solid #03070d;
  background: linear-gradient(145deg, #f0645c 0 52%, #9f2733 53% 100%);
  box-shadow: inset 0 0 0 2px #ffaaa0, 4px 5px 0 rgba(0,0,0,.58);
}
.system-signal--spider-apps::before,
.system-signal--spider-apps::after {
  content: '';
  position: absolute;
  inset: 6px;
  opacity: .32;
  background: repeating-linear-gradient(38deg, transparent 0 7px, #071426 8px 9px);
  pointer-events: none;
}
.system-signal--spider-apps::after { transform: scaleX(-1); }
.system-signal--spider-apps .system-signal-label {
  position: relative;
  z-index: 2;
  display: block;
  color: #fff;
  font: 700 7px/1 "Press Start 2P", monospace;
  text-shadow: 2px 2px 0 #071426;
}
.top-hanging-spidey {
  position: absolute;
  z-index: 3;
  top: -9px;
  left: 50%;
  display: block !important;
  width: 38px;
  height: 45px;
  transform: translateX(-50%);
  background: url('../assets/spideytracker/SpiderMan_web.png') no-repeat 0 0 / 2343px 45px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,.65));
}
.pixel-orb--menu {
  border: 0 !important;
  background: url('../assets/spideytracker/hub-ui/spidey_head_spritesheet.png') no-repeat 0 0 / auto 64px !important;
  box-shadow: none !important;
  image-rendering: pixelated;
}

.frame-bottom-bar {
  grid-template-columns: 62px minmax(0, 1fr) 62px !important;
  gap: 7px !important;
  padding: 5px 7px !important;
}
.frame-bottom-bar .spidey-head-turn-sprite {
  position: absolute !important;
  inset: auto auto 0 8px !important;
  display: block;
  width: 71px;
  height: 105px;
  background-image: url('../assets/spideytracker/SpiderMan_web.png') !important;
  background-size: 5467px 105px !important;
  background-repeat: no-repeat;
  transform: none;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.65));
  animation: footer-spidey-web 4.2s steps(77) infinite !important;
}
@keyframes footer-spidey-turn { to { background-position-x: var(--footer-sprite-shift, -2363px); } }
.frame-bottom-bar { grid-template-columns: 76px minmax(0, 1fr) 76px !important; }
.frame-bottom-bar .ticker-wrap { grid-column: 2; margin: 0; }
@keyframes footer-spidey-web { to { background-position-x: -5467px; } }
.footer-spidey-counterpart {
  position: absolute;
  right: 11px;
  bottom: 0;
  width: 46px;
  height: 74px;
  margin: 0;
  background: url('../assets/spideytracker/SpiderMan_HeadTurn.png') no-repeat 0 0 / 3492px 74px;
  image-rendering: pixelated;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,.65));
  animation: footer-spidey-head 5.6s steps(76) infinite;
}
@keyframes footer-spidey-head { to { background-position-x: -3492px; } }
.footer-enemy-counterpart {
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: end center;
  min-width: 0;
  overflow: visible;
}
.footer-enemy-counterpart::before {
  content: 'THREAT';
  position: absolute;
  right: 0;
  bottom: 2px;
  padding: 3px;
  color: #f0645c;
  background: #071426;
  border: 1px solid #f0645c;
  font: 700 5px/1 "Press Start 2P", monospace;
}
.footer-enemy-counterpart img { display: none; }
.footer-enemy-counterpart.has-art img {
  display: block;
  width: 42px;
  height: 50px;
  object-fit: contain;
  object-position: center bottom;
  transform: scaleX(-1);
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,.6));
}
.footer-enemy-counterpart.has-art::before { display: none; }

.action-fighter--hero { left: 12% !important; width: 170px !important; }
.action-fighter--enemy { right: 27% !important; width: 170px !important; }
.action-fighter--hero > span,
.action-fighter--enemy > span,
.hero-animation-state { display: none !important; }
.action-fighter--enemy #combat-enemy-image.has-notion-art {
  width: clamp(132px, 17vw, 220px) !important;
  height: clamp(132px, 17vw, 220px) !important;
  margin-bottom: -25px !important;
  border: 0 !important;
  clip-path: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.action-fighter--enemy #combat-enemy-image.has-notion-art::before { display: none !important; }
.action-fighter--enemy #combat-enemy-image.has-notion-art img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(5px 7px 0 rgba(0,0,0,.62)) !important;
  transform: none !important;
}

.life-reset-sync {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 2px solid #31516a;
  background: #050d18;
  box-shadow: 3px 3px 0 #02060b;
}
.life-reset-sync span,
.life-reset-sync b { font: 700 8px/1.4 "Press Start 2P", monospace; }
.life-reset-sync span { color: #83b96b; }
.life-reset-sync span i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 9px currentColor; }
.life-reset-sync b { color: #9ed9e7; }

.life-reset-hero,
.life-66-campaign {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 34%);
  align-items: end;
  gap: 20px;
  min-height: 210px;
  padding: clamp(20px, 4vw, 42px);
  border: 4px solid #03070d;
  background:
    linear-gradient(110deg, rgba(3,7,13,.98) 0 42%, rgba(7,20,38,.55) 70%),
    radial-gradient(circle at 85% 30%, rgba(240,100,92,.52), transparent 34%),
    repeating-linear-gradient(35deg, transparent 0 20px, rgba(84,182,208,.12) 21px 23px),
    #9f2733;
  box-shadow: inset 0 0 0 2px #f0645c, 6px 7px 0 #02060b;
}
.life-reset-hero::after,
.life-66-campaign::after {
  content: '🕷';
  position: absolute;
  right: clamp(18px, 6vw, 70px);
  top: 20px;
  color: rgba(255,255,255,.14);
  font-size: clamp(82px, 16vw, 180px);
  line-height: 1;
  transform: rotate(-14deg);
}
.life-reset-hero > div:first-child,
.life-66-campaign > div:first-child { position: relative; z-index: 1; }
.life-reset-hero small,
.life-66-campaign small { color: #54b6d0; font: 700 8px/1.5 "Press Start 2P", monospace; }
.life-reset-hero h3,
.life-66-campaign h3 { margin: 12px 0 8px; color: #fff; font: 700 clamp(28px, 7vw, 72px)/.95 "Silkscreen", monospace; letter-spacing: -3px; text-shadow: 5px 5px 0 #02060b; }
.life-reset-hero h3 span,
.life-66-campaign h3 span { color: #f2c06b; font-size: .42em; letter-spacing: 0; }
.life-reset-hero p,
.life-66-campaign p { max-width: 620px; margin: 0; color: #d7e6ef; font-size: 13px; line-height: 1.65; }
.life-reset-meter {
  position: relative;
  z-index: 2;
  height: 48px;
  overflow: hidden;
  border: 3px solid #02060b;
  background: #102c45;
  box-shadow: inset 0 0 0 2px #31516a;
}
.life-reset-meter span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #e9434d, #f2c06b); }
.life-reset-meter b { position: absolute; inset: 0; display: grid; place-items: center; color: white; font: 700 12px/1 "Press Start 2P", monospace; text-shadow: 2px 2px 0 #02060b; }

.habit-filter-row { display: flex; gap: 8px; margin: 20px 0 12px; overflow-x: auto; }
.habit-filter-row button {
  min-height: 42px;
  padding: 0 15px;
  color: #9ed9e7;
  border: 2px solid #31516a;
  background: #071426;
  font: 700 8px/1 "Press Start 2P", monospace;
  white-space: nowrap;
}
.habit-filter-row button.active { color: #05070b; border-color: #02060b; background: #54b6d0; box-shadow: 3px 3px 0 #02060b; }
.life-reset-card-list { display: grid; gap: 11px; padding-bottom: 24px; }
.life-reset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  min-height: 128px;
  overflow: hidden;
  border: 3px solid #03070d;
  background: linear-gradient(100deg, rgba(240,100,92,.16), transparent 45%), #0b2034;
  box-shadow: inset 6px 0 0 #e9434d, 4px 5px 0 #02060b;
}
.life-reset-card.is-bad { box-shadow: inset 6px 0 0 #a68be8, 4px 5px 0 #02060b; }
.life-reset-card.is-done { opacity: .68; filter: saturate(.55); box-shadow: inset 6px 0 0 #83b96b, 3px 3px 0 #02060b; }
.life-reset-card-copy { padding: 15px 18px; }
.life-reset-card-copy > div { display: flex; gap: 8px; }
.life-reset-card-copy span,
.life-reset-card-copy em { padding: 4px 6px; color: #05070b; background: #54b6d0; font: 700 7px/1 "Press Start 2P", monospace; font-style: normal; }
.life-reset-card-copy em { color: #071426; background: #f2c06b; }
.life-reset-card h3 { margin: 12px 0 6px; color: #fff; font: 700 clamp(14px, 2.3vw, 21px)/1.2 "Silkscreen", monospace; }
.life-reset-card p { margin: 0 0 9px; color: #b9cfdb; font-size: 12px; line-height: 1.5; }
.life-reset-card-copy > small { color: #f2c06b; font: 700 7px/1.4 "Press Start 2P", monospace; }
.life-reset-card > button,
.habit-square-check {
  border: 0;
  border-left: 3px solid #03070d;
  color: white;
  background: #e9434d;
  font: 700 28px/1 "Silkscreen", monospace;
}
.life-reset-card > button:disabled { color: #071426; background: #83b96b; }

.habit-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 20px;
  margin-bottom: 14px;
  border: 3px solid #02060b;
  background: linear-gradient(110deg, rgba(84,182,208,.22), transparent), #0b2034;
  box-shadow: inset 5px 0 0 #54b6d0, 4px 5px 0 #02060b;
}
.habit-progress-head small,
.habit-progress-head span { display: block; color: #9ed9e7; font: 700 8px/1.6 "Press Start 2P", monospace; }
.habit-progress-head strong { display: block; margin: 8px 0; color: #fff; font: 700 42px/1 "Silkscreen", monospace; }
.habit-progress-head strong em { color: #7d99aa; font-size: .45em; font-style: normal; }
.habit-progress-ring { width: 104px; height: 104px; flex: 0 0 104px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #071426 0 55%, transparent 57%), conic-gradient(#54b6d0 var(--habit-progress), #17334b 0); box-shadow: 0 0 0 3px #02060b; }
.habit-progress-ring b { color: #fff; font: 700 13px/1 "Press Start 2P", monospace; }
.habit-square-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-bottom: 24px; }
.habit-square {
  aspect-ratio: 1;
  min-height: 170px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  gap: 10px;
  padding: 14px;
  text-align: left;
  color: #fff;
  border: 3px solid #02060b;
  background: linear-gradient(145deg, rgba(84,182,208,.18), transparent 55%), #102c45;
  box-shadow: inset 0 0 0 1px #31516a, 4px 5px 0 #02060b;
}
.habit-square:disabled { opacity: .78; background: linear-gradient(145deg, rgba(131,185,107,.28), transparent 55%), #102c45; }
.habit-square-check { width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid #02060b; background: #071426; font-size: 20px; }
.habit-square.is-done .habit-square-check { color: #071426; background: #83b96b; }
.habit-square small,
.habit-square em { color: #9ed9e7; font: 700 7px/1.4 "Press Start 2P", monospace; font-style: normal; }
.habit-square strong { align-self: center; font: 700 clamp(12px, 1.6vw, 18px)/1.25 "Silkscreen", monospace; }
.habit-square em { color: #f2c06b; }

.life-66-score { position: relative; z-index: 2; text-align: center; }
.life-66-score strong { display: block; color: #fff; font: 700 46px/1 "Silkscreen", monospace; }
.life-66-score small { color: #f2c06b; }
.life-66-grid { display: grid; grid-template-columns: repeat(11, minmax(34px, 1fr)); gap: 7px; margin-top: 18px; padding-bottom: 24px; }
.life-66-grid span { aspect-ratio: 1; display: grid; place-items: center; color: #6f8998; border: 2px solid #17334b; background: #071426; font: 700 7px/1 "Press Start 2P", monospace; }
.life-66-grid .is-past { color: #071426; border-color: #02060b; background: #83b96b; }
.life-66-grid .is-today { color: #fff; border-color: #f2c06b; background: #e9434d; box-shadow: 0 0 0 2px #02060b, 0 0 15px rgba(240,100,92,.55); transform: scale(1.08); }

.quest-board-list { display: grid; gap: 11px; margin: 14px 0 18px; }
.quest-board-card {
  padding: 16px;
  border: 3px solid #02060b;
  background: linear-gradient(110deg, rgba(84,182,208,.11), transparent 48%), #0b2034;
  box-shadow: inset 5px 0 0 var(--screen-accent), 4px 5px 0 #02060b;
}
.quest-board-card h3 { margin: 12px 0 7px; color: #fff; font: 700 clamp(14px, 2vw, 20px)/1.25 "Silkscreen", monospace; }
.quest-board-card p { margin: 0 0 9px; color: #b9cfdb; font-size: 12px; line-height: 1.5; }
.quest-board-card > small { color: #f2c06b; font: 700 7px/1.4 "Press Start 2P", monospace; }
.quest-empty-state { padding: 32px; text-align: center; border: 2px dashed #31516a; background: #071426; }
.quest-empty-state strong,
.quest-empty-state small { display: block; }
.quest-empty-state strong { color: #9ed9e7; font: 700 9px/1.5 "Press Start 2P", monospace; }
.quest-empty-state small { margin-top: 10px; color: #7893a4; }

.place-command-card {
  min-height: 300px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: clamp(24px, 5vw, 54px);
  border: 4px solid #02060b;
  background: radial-gradient(circle at 80% 24%, rgba(84,182,208,.28), transparent 30%), repeating-linear-gradient(45deg, transparent 0 32px, rgba(84,182,208,.06) 33px 35px), #0b2034;
  box-shadow: inset 0 0 0 2px #54b6d0, 6px 7px 0 #02060b;
}
.place-command-card small { color: #54b6d0; font: 700 8px/1.4 "Press Start 2P", monospace; }
.place-command-card strong { display: block; max-width: 680px; margin: 14px 0; color: #fff; font: 700 clamp(22px, 4vw, 46px)/1.1 "Silkscreen", monospace; }
.place-command-card p { max-width: 720px; color: #b9cfdb; line-height: 1.7; }

@media (max-width: 900px) {
  .habit-square-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .life-66-grid { grid-template-columns: repeat(8, minmax(30px, 1fr)); }
}

@media (max-width: 720px) {
  .system-signal--spider-apps { top: 7px; right: 7px; width: 58px; height: 52px; }
  .top-hanging-spidey { width: 31px; height: 37px; background-size: 1926px 37px; }
  .pixel-orb--menu { background-size: auto 51px !important; }
  .frame-bottom-bar { grid-template-columns: 60px minmax(0, 1fr) 52px !important; gap: 3px !important; padding: 3px !important; }
  .frame-bottom-bar .spidey-head-turn-sprite { left: 4px !important; width: 55px; height: 81px; background-size: 4217px 81px !important; animation-name: footer-spidey-web-mobile !important; }
  .footer-spidey-counterpart { right: 5px; width: 36px; height: 58px; background-size: 2736px 58px; animation-name: footer-spidey-head-mobile; }
  .footer-enemy-counterpart.has-art img { width: 36px; height: 48px; }
  .footer-enemy-counterpart::before { display: none; }
  .action-fighter--hero { left: 0 !important; width: 132px !important; }
  .action-fighter--enemy { right: 1% !important; width: 132px !important; }
  .action-fighter--enemy #combat-enemy-image.has-notion-art { width: 120px !important; height: 120px !important; }
  .life-reset-sync { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .life-reset-sync b { display: none; }
  .life-reset-sync .pixel-action-btn { min-width: 88px; }
  .life-reset-hero,
  .life-66-campaign { grid-template-columns: 1fr; min-height: 190px; padding: 21px 18px; }
  .life-reset-hero::after,
  .life-66-campaign::after { right: 8px; top: 12px; font-size: 96px; }
  .life-reset-meter { width: 100%; max-width: 320px; height: 40px; }
  .habit-square-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .habit-square { min-height: 155px; padding: 11px; }
  .life-reset-card { grid-template-columns: minmax(0, 1fr) 50px; min-height: 120px; }
  .life-reset-card-copy { padding: 13px 14px; }
  .life-reset-card p { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .life-66-grid { grid-template-columns: repeat(6, minmax(28px, 1fr)); gap: 5px; }
  .place-command-card { grid-template-columns: 1fr; min-height: 250px; padding: 24px 18px; }
}
@keyframes footer-spidey-web-mobile { to { background-position-x: -4217px; } }
@keyframes footer-spidey-head-mobile { to { background-position-x: -2736px; } }
@media (prefers-reduced-motion: reduce) { .frame-bottom-bar .spidey-head-turn-sprite, .footer-spidey-counterpart { animation: none !important; } }

@media (max-width: 390px) {
  .habit-progress-head { padding: 15px; }
  .habit-progress-ring { width: 82px; height: 82px; flex-basis: 82px; }
  .habit-progress-head strong { font-size: 34px; }
  .habit-square { min-height: 140px; }
  .life-66-grid { grid-template-columns: repeat(6, 1fr); }
}

/* Gambit's twelve daily apps, rebuilt as a Spider field console. */
.spider-system-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 3px solid #02060b;
  box-shadow: inset 0 0 0 2px #397c9b, 4px 4px 0 #02060b;
  background: radial-gradient(circle at 88% 10%, rgba(240,100,92,.22), transparent 30%), #102c45;
}
.spider-system-command div:first-child { display: grid; gap: 7px; }
.spider-system-command span,
.spider-system-command small { color: #9ed9e7; font: 700 8px/1.5 'Silkscreen', monospace; }
.spider-system-command strong { color: #fff; font: 700 clamp(13px,2vw,22px)/1.35 'Press Start 2P', monospace; }
.spider-system-count { display: grid; place-items: center; min-width: 84px; padding: 10px; border: 2px solid #02060b; background: #f0645c; color: #05070b; box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.spider-system-count b { font: 700 28px/1 'Press Start 2P', monospace; }
.spider-system-count span { margin-top: 5px; color: #05070b; }
.spider-app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.spider-app-card {
  --app-accent: #54b6d0;
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  gap: 8px 11px;
  min-width: 0;
  min-height: 176px;
  padding: 15px;
  overflow: hidden;
  border: 3px solid #02060b;
  box-shadow: inset 0 0 0 1px #31516a, inset 5px 0 0 var(--app-accent), 4px 4px 0 #02060b;
  background: linear-gradient(145deg, color-mix(in srgb, var(--app-accent) 13%, transparent), transparent 46%), #091a2c;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.spider-app-card:hover,
.spider-app-card:focus-visible { transform: translateY(-3px); border-color: var(--app-accent); box-shadow: inset 0 0 0 1px var(--app-accent), inset 5px 0 0 var(--app-accent), 5px 7px 0 #02060b; outline: none; }
.spider-app-card--red { --app-accent: #f0645c; }
.spider-app-card--green { --app-accent: #83b96b; }
.spider-app-card--gold { --app-accent: #f2c06b; }
.spider-app-card--violet { --app-accent: #a68be8; }
.spider-app-index { position: absolute; top: 9px; right: 10px; color: #507084; font: 700 8px 'Silkscreen', monospace; }
.spider-app-icon { display: grid; grid-row: 1 / 3; place-items: center; width: 42px; height: 42px; border: 2px solid #02060b; background: var(--app-accent); color: #05070b; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); font: 700 18px 'Press Start 2P', monospace; }
.spider-app-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.spider-app-copy { display: grid; align-content: start; gap: 7px; min-width: 0; }
.spider-app-copy small { color: var(--app-accent); font: 700 7px/1.3 'Silkscreen', monospace; }
.spider-app-copy strong { color: #fff; font: 700 11px/1.5 'Press Start 2P', monospace; }
.spider-app-copy em { color: #abc2ca; font: normal 11px/1.55 'Be Vietnam Pro', sans-serif; }
.spider-app-source { align-self: end; justify-self: start; padding: 5px 7px; border: 1px solid var(--app-accent); color: var(--app-accent); font: 700 7px 'Silkscreen', monospace; }
.spider-app-arrow { align-self: end; justify-self: end; color: var(--app-accent); font: 700 17px/1 'Silkscreen', monospace; }

@media (max-width: 980px) { .spider-app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .spider-system-command { padding: 14px; }
  .spider-system-count { min-width: 64px; }
  .spider-system-count b { font-size: 20px; }
  .spider-app-grid { grid-template-columns: 1fr; gap: 9px; }
  .spider-app-card { min-height: 142px; padding: 13px; }
}

/* Quest cards read as a list of actions inside the tracker frame. */
body[data-game-section="QUESTS"] .quest-source-banner{border-width:0 0 1px;padding:11px 14px;background:#0e293b}
body[data-game-section="QUESTS"] .quest-board-list{gap:1px;background:#31516a}
body[data-game-section="QUESTS"] .quest-board-card{border:0;padding:13px 15px;background:#0b2234}
body[data-game-section="QUESTS"] .quest-board-card h3{font:700 clamp(15px,1.5vw,18px)/1.35 'Be Vietnam Pro',sans-serif}
body[data-game-section="QUESTS"] .quest-board-card p:empty{display:none}
body[data-game-section="QUESTS"] .quest-board-card .pixel-card-footer{border:0}
body[data-game-section="QUESTS"] .quest-board-card .pixel-action-btn{min-height:44px}
body[data-game-section="QUESTS"] .quest-empty-state{min-height:160px;display:grid;align-content:center;justify-items:center;gap:8px;text-align:center}

@media (prefers-reduced-motion: reduce) {
  .spider-app-card { transition: none; }
  .spider-app-card:hover,
  .spider-app-card:focus-visible { transform: none; }
}

/* Keep every destination inside the same tracker frame and screen dimensions. */
.game-panel > header {
  border-bottom: 3px solid var(--screen-accent);
  background: linear-gradient(90deg, rgba(var(--screen-accent-rgb), .15), transparent 42%), #050d18;
  box-shadow: 0 4px 0 #02060b;
}
.game-panel > header small { color: var(--screen-accent); }
.game-panel > header button {
  width: auto;
  padding: 0 14px;
  background: var(--screen-accent);
  color: #05070b;
  font: 700 8px/1 "Press Start 2P", monospace;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 3px 3px 0 #02060b;
}
.game-panel > header button:active { transform: translate(2px, 2px); box-shadow: inset 0 0 0 2px rgba(255,255,255,.2), 1px 1px 0 #02060b; }

#game-panel-tabs {
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: rgba(3, 13, 24, .92);
  border-bottom: 1px solid #31516a;
}
#game-panel-tabs::-webkit-scrollbar { display: none; }
#game-panel-tabs button {
  position: relative;
  border: 2px solid #31516a;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.32);
  transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}
#game-panel-tabs button:hover { border-color: var(--screen-accent); color: #fff; }
#game-panel-tabs button.active {
  border-color: #05070b;
  background: var(--screen-accent);
  color: #05070b;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 2px 3px 0 #02060b;
}

.game-panel-content {
  scrollbar-color: var(--screen-accent) #050d18;
  scrollbar-width: thin;
}
.game-panel-content .sync-online-banner,
.game-panel-content .quest-source-banner {
  border: 2px solid #05070b;
  box-shadow: inset 0 0 0 1px var(--screen-accent), 3px 3px 0 #02060b;
  background: linear-gradient(90deg, rgba(var(--screen-accent-rgb), .16), transparent 60%), #102c45;
}
.game-panel-content .quest-source-banner > span:first-child { background: var(--screen-accent); }

.game-panel-content .pixel-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  align-items: stretch;
  gap: 12px;
  margin-block: 12px 18px;
}
.game-panel-content .pixel-game-card {
  min-height: 166px;
  overflow: hidden;
  border: 2px solid #05070b;
  box-shadow: inset 4px 0 0 var(--screen-accent), inset 0 0 0 1px #31516a, 3px 3px 0 #02060b;
  background:
    linear-gradient(145deg, rgba(var(--screen-accent-rgb), .09), transparent 45%),
    #091a2c;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
  animation: spidey-card-deal .22s ease-out both;
}
.game-panel-content .pixel-game-card:hover {
  z-index: 1;
  transform: translateY(-3px);
  border-color: var(--screen-accent);
  box-shadow: inset 4px 0 0 var(--screen-accent), inset 0 0 0 1px #54b6d0, 4px 6px 0 #02060b;
}
.game-panel-content .pixel-game-card--done {
  opacity: .72;
  filter: saturate(.6);
  box-shadow: inset 4px 0 0 #83b96b, inset 0 0 0 1px #31516a, 3px 3px 0 #02060b;
}
.game-panel-content .pixel-card-header { min-height: 24px; }
.game-panel-content .pixel-card-title { margin-top: 8px; text-wrap: balance; }
.game-panel-content .pixel-card-footer { padding-top: 10px; border-top: 1px solid #31516a; }
.game-panel-content .pixel-action-btn {
  min-width: 132px;
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.game-panel-content .pixel-action-btn:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.game-panel-content .pixel-action-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 #05070b; }
.game-panel-content .pixel-action-btn:disabled { cursor: not-allowed; opacity: .45; filter: grayscale(.5); }

@keyframes spidey-card-deal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .game-panel > header { padding: 10px 12px; }
  .game-panel > header button { padding-inline: 10px; font-size: 7px; }
  #game-panel-tabs { padding: 7px 10px; scroll-snap-type: x proximity; }
  #game-panel-tabs button { min-height: 44px; scroll-snap-align: start; }
  .game-panel-content .pixel-card-grid { grid-template-columns: 1fr; gap: 9px; }
  .game-panel-content .pixel-game-card { min-height: 0; padding: 12px; }
  .game-panel-content .pixel-card-footer { align-items: flex-end; }
  .game-panel-content .pixel-action-btn { min-width: 124px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-panel-content .pixel-game-card { animation: none; transition: none; }
  .game-panel-content .pixel-game-card:hover { transform: none; }
  #game-panel-tabs button,
  .game-panel-content .pixel-action-btn { transition: none; }
}

@media (max-height: 670px) and (max-width: 800px) {
  .action-rpg-screen { gap: 3px; }
  .action-fighter--hero .hero-sprite-actor { --hero-scale: 0.84; }
  .action-fighter--hero, .action-fighter--enemy { bottom: 28% !important; }
  .combat-info-panel { padding: 3px 6px; }
  .combat-location { top: 4px; }
  .combat-location span { display: none; }
  .ultimate-meter { min-height: 18px; }
}

@media (max-width: 360px) {
  .game-hud-strip { grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1.2fr); gap: 3px; }
  .hud-avatar { padding: 2px; }
  .hud-mask { width: 22px; height: 22px; flex-basis: 22px; font-size: 14px; }
  .hud-avatar strong { max-width: 65px; font-size: 5px; }
  .hud-bars { padding: 3px; }
  .hud-bars label { grid-template-columns: 22px minmax(0, 1fr); gap: 2px; }
  .hud-bars label > span { display: none; }
  .hud-stat strong { font-size: 16px; }
  .combat-action-bar button { padding: 2px 1px; }
  .combat-action-bar strong { font-size: 6px; }
  .combat-action-bar small { font-size: 5px; }
  .game-primary-nav button { font-size: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .action-fighter--hero .hero-sprite-actor { animation: none !important; }
}

/* Secondary destinations are complete screens within the original tracker frame. */
.game-panel-backdrop {
  inset: 0 0 72px;
  padding: 0;
  display: block;
  background: #08192b;
  backdrop-filter: none;
  z-index: 70;
}
.game-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 0;
  box-shadow: none;
  background: linear-gradient(145deg,#112f48,#08192b 60%);
}
.game-panel > header { padding: clamp(12px,2vw,20px) clamp(14px,3vw,30px); }
.game-panel h2 { font-size: clamp(11px,1.4vw,18px); line-height: 1.35; }
.game-panel header button { min-width: 44px; min-height: 44px; }
#game-panel-tabs { padding: 8px clamp(12px,3vw,30px); gap: 8px; }
#game-panel-tabs button { min-height: 44px; padding: 10px 14px; font-size: 9px; }
.game-panel-content { min-height: 0; height: auto; max-height: none; overflow: auto; padding: clamp(14px,3vw,30px); padding-bottom: 30px; overscroll-behavior: contain; }
.game-panel-content .pixel-card-title { font-size: clamp(11px, 1.1vw, 14px); line-height: 1.45; }
.game-panel-content .pixel-card-desc { font-size: 12px; line-height: 1.55; }
.game-panel-content .pixel-tag { font-size: 9px; line-height: 1.2; }
.game-panel-content .pixel-action-btn { min-height: 44px; font-size: 10px; line-height: 1.3; }
.game-panel-content .pixel-game-card { padding: clamp(12px, 1.8vw, 20px); }
.game-panel-content.game-panel-content--habit-app { padding: 0 !important; overflow: hidden !important; }
.habit-app-frame { display: block; width: 100%; height: 100%; border: 0; background: #071426; }
.game-primary-nav { z-index: 100; }
@media (max-width: 800px) {
  .game-panel-backdrop { inset: 0 0 58px; }
  .game-panel { width: 100%; height: 100%; }
  .game-panel-content { height: auto; }
}
@media (max-width: 500px) {
  .game-panel-backdrop { padding: 0; }
  .game-panel { width: 100%; height: 100%; }
  .game-panel-content { padding: 12px 12px 24px; }
  .game-panel h2 { font-size: 10px; }
  .game-primary-nav button { font-size: 9px; }
  .game-primary-nav button svg { width: 19px; height: 19px; }
  .game-panel-content .pixel-card-desc { font-size: 12px; }
  .arena-turn-banner { top:19%; width:min(58%,220px); padding:8px; }
  .arena-turn-banner strong { font-size:15px; }
  .arena-turn-banner span { font-size:8px; }
  .quest-create-form { grid-template-columns:1fr; padding:12px; }
  .spidey-skill-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .spidey-skill-summary span { padding: 7px 2px; font-size: 6px; }
  .spidey-skill-summary b { font-size: 10px; }
}

/* Owner-only Notion connection and readable mission controls. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 1000; padding: 10px 14px; background: #f2c06b; color: #071426; font: 700 13px/1.4 "Silkscreen", sans-serif; }
.skip-link:focus-visible { top: 12px; outline: 3px solid #fff; }
.sync-online-banner, .life-reset-sync { flex-wrap: wrap; gap: 10px; }
.notion-access-actions, .notion-auth-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.notion-auth-form label, .notion-access-note { color: #d7e6ef; font: 700 11px/1.4 "Silkscreen", sans-serif; }
.notion-auth-form input { min-width: min(220px, 100%); min-height: 44px; padding: 8px 10px; border: 2px solid #54b6d0; background: #071426; color: #fff; font: 14px/1.3 "Be Vietnam Pro", sans-serif; }
.notion-auth-form input:focus-visible { outline: 3px solid #f2c06b; outline-offset: 2px; }
.notion-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 8px 0 12px; padding: 9px 12px; border: 1px solid #31516a; background: #071426; color: #d7e6ef; font: 11px/1.5 "Be Vietnam Pro", sans-serif; }
.notion-status-line strong { color: #f2c06b; font: 700 10px/1.5 "Silkscreen", sans-serif; }
.notion-status-line small { flex-basis: 100%; color: #ffb2ad; font-size: 11px; }
.notion-status-line .pixel-action-btn { min-height: 36px; margin-left: auto; }
.quest-board-list { gap: 8px; }
.quest-board-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 14px; padding: 11px 14px; }
.quest-board-card .pixel-card-header, .quest-board-card h3, .quest-board-card p, .quest-board-card > small { grid-column: 1; min-width: 0; margin: 0; }
.quest-board-card .pixel-card-header { justify-content: flex-start; flex-wrap: wrap; }
.quest-board-card h3 { font-size: clamp(14px, 1.5vw, 18px); }
.quest-board-card > small { font: 700 10px/1.4 "Silkscreen", sans-serif; }
.quest-board-card .pixel-card-footer { grid-column: 2; grid-row: 1 / span 4; min-width: 132px; padding: 0; border: 0; }
.game-primary-nav button { font: 700 clamp(11px, 1vw, 13px)/1.1 "Silkscreen", sans-serif; }
.hud-bars label { font: 700 11px/1.2 "Silkscreen", sans-serif; }
#game-panel-tabs button { font: 700 11px/1.2 "Silkscreen", sans-serif; }
.arena-turn-banner #arena-open-habits { display: block; min-height: 32px; margin: 7px auto 0; padding: 5px 8px; border: 2px solid #05070b; background: #83b96b; color: #071426; font: 700 11px/1.1 "Silkscreen", sans-serif; cursor: pointer; }
.arena-turn-banner #arena-open-habits[hidden] { display: none !important; }
.arena-turn-banner #arena-open-habits:focus-visible { outline: 3px solid #f2c06b; outline-offset: 2px; }
@media (max-width: 620px) {
  .quest-board-card { grid-template-columns: 1fr; }
  .quest-board-card .pixel-card-footer { grid-column: 1; grid-row: auto; justify-content: flex-end; width: 100%; }
  .game-panel h2 { font-size: 13px; line-height: 1.4; }
  .game-primary-nav button { font-size: 11px; }
  .hud-bars label { font-size: 10px; }
  .arena-turn-banner span { font-size: 10px; }
  .notion-auth-form input { flex: 1 1 180px; }
}

/* Keep the system-specific game texture after the full-screen panel contract above. */
.game-panel {
  background:
    linear-gradient(120deg, rgba(var(--screen-accent-rgb), .08), transparent 28%),
    repeating-linear-gradient(135deg, transparent 0 38px, rgba(84, 182, 208, .025) 38px 40px),
    #071426;
}
