/*
  PatMan style.css
  Retro neon arcade look, dark blue maze vibe, responsive HUD.
*/

:root {
  --bg-0: #030617;
  --bg-1: #07113a;
  --bg-2: #0b1d5c;
  --panel: rgba(7, 16, 52, 0.82);
  --panel-strong: rgba(9, 23, 76, 0.94);
  --line: rgba(91, 186, 255, 0.36);
  --line-hot: rgba(85, 229, 255, 0.85);
  --text: #e8f7ff;
  --muted: #90b4d4;
  --gold: #ffd35a;
  --pink: #ff4fd8;
  --danger: #ff4e6f;
  --good: #56ffb6;
  --shadow: rgba(0, 0, 0, 0.5);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  font-family: "Trebuchet MS", Verdana, Arial, sans-serif;
  background-image:
    var(--patman-bg-image, none),
    radial-gradient(circle at 50% 0%, rgba(35, 128, 255, 0.2), transparent 34rem),
    radial-gradient(circle at 14% 25%, rgba(255, 79, 216, 0.14), transparent 24rem),
    radial-gradient(circle at 88% 74%, rgba(86, 255, 182, 0.1), transparent 22rem),
    linear-gradient(180deg, #02040f 0%, var(--bg-0) 40%, #01020a 100%);
  background-size:
    var(--patman-bg-size, cover),
    auto,
    auto,
    auto,
    auto;
  background-position:
    var(--patman-bg-position, center center),
    center,
    center,
    center,
    center;
  background-repeat:
    var(--patman-bg-repeat, no-repeat),
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat;
  background-attachment:
    fixed,
    fixed,
    fixed,
    fixed,
    fixed;
  overflow-x: hidden;
  transition: background 0.3s ease;
}

body[data-screen-bg="blue"] {
  background-image:
    var(--patman-bg-image, none),
    radial-gradient(circle at 50% 12%, rgba(85, 229, 255, 0.24), transparent 30rem),
    radial-gradient(circle at 12% 80%, rgba(65, 120, 255, 0.24), transparent 26rem),
    repeating-linear-gradient(135deg, rgba(85,229,255,0.07) 0 2px, transparent 2px 18px),
    linear-gradient(180deg, #031a42 0%, #020816 55%, #01030c 100%);
  background-size:
    var(--patman-bg-size, cover),
    auto,
    auto,
    auto,
    auto;
  background-position:
    var(--patman-bg-position, center center),
    center,
    center,
    center,
    center;
  background-repeat:
    var(--patman-bg-repeat, no-repeat),
    no-repeat,
    no-repeat,
    repeat,
    no-repeat;
  background-attachment:
    fixed,
    fixed,
    fixed,
    fixed,
    fixed;
}

body[data-screen-bg="purple"] {
  background-image:
    var(--patman-bg-image, none),
    radial-gradient(circle at 50% 18%, rgba(255, 79, 216, 0.26), transparent 34rem),
    radial-gradient(circle at 82% 72%, rgba(128, 82, 255, 0.28), transparent 28rem),
    repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(180deg, #21072f 0%, #070315 58%, #020009 100%);
  background-size:
    var(--patman-bg-size, cover),
    auto,
    auto,
    auto,
    auto;
  background-position:
    var(--patman-bg-position, center center),
    center,
    center,
    center,
    center;
  background-repeat:
    var(--patman-bg-repeat, no-repeat),
    no-repeat,
    no-repeat,
    repeat,
    no-repeat;
  background-attachment:
    fixed,
    fixed,
    fixed,
    fixed,
    fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent 80%);
}

body[data-screen-bg="blue"]::before {
  background:
    linear-gradient(rgba(85,229,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85,229,255,0.045) 1px, transparent 1px);
  background-size: 36px 36px;
}

body[data-screen-bg="purple"]::before {
  background:
    linear-gradient(rgba(255,79,216,0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,211,90,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.24;
  mix-blend-mode: screen;
}

.page-shell {
  width: min(1120px, calc(100% - 20px));
  margin: 0 auto;
  padding: 12px 0 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.hidden-hud,
.footer-note {
  display: none !important;
}

/* Old side panels are gone from the new index.php, but never hide the game frame. */
.panel.legacy-panel {
  display: none !important;
}

.health-panel {
  width: min(900px, 100%);
  padding: 12px 14px;
  border: 1px solid rgba(255, 78, 111, 0.58);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(58, 6, 24, 0.92), rgba(12, 6, 28, 0.96));
  box-shadow: 0 0 28px rgba(255, 78, 111, 0.18), inset 0 0 20px rgba(255, 78, 111, 0.08);
}

.health-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: #ffd5dd;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(255, 78, 111, 0.75);
}

.health-bar {
  height: 24px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0,0,0,0.42);
  box-shadow: inset 0 0 16px rgba(0,0,0,0.75);
}

.health-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #7b0017, #ff234d 50%, #ff8aa0),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 8px, transparent 8px 16px);
  box-shadow: 0 0 18px rgba(255, 48, 78, 0.75);
  transition: width 0.18s ease;
}

.hud-strip.compact {
  width: min(900px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.brand-block {
  flex: 1;
  padding: 12px 18px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}

.brand-block::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.08) 45%, transparent 58%);
  transform: translateX(-120%);
  animation: panelShine 8s linear infinite;
  pointer-events: none;
}

.logo-glow {
  font-size: clamp(1.65rem, 4vw, 3.4rem);
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff9cf;
  text-shadow:
    0 0 4px #fff,
    0 0 12px var(--gold),
    0 0 30px var(--pink),
    4px 4px 0 #11193e;
}

.logo-glow span {
  color: #83f7ff;
  text-shadow:
    0 0 4px #fff,
    0 0 18px var(--line-hot),
    0 0 32px #386cff,
    4px 4px 0 #11193e;
}

.tagline {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.98rem;
}

.hud-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 10px;
  align-content: stretch;
}

.hud-card {
  min-width: 130px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(12, 37, 105, 0.78), rgba(4, 12, 42, 0.88));
  box-shadow: inset 0 0 18px rgba(60, 190, 255, 0.08), 0 10px 26px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.hud-card b {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hud-card span {
  display: block;
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(85, 229, 255, 0.55);
}

.game-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 20px;
}

.panel h1,
.panel h2 {
  margin: 0 0 12px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px rgba(85, 229, 255, 0.48);
}

.panel h1 {
  font-size: 2rem;
}

.panel h2 {
  font-size: 1.35rem;
}

.panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.button-stack {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.arcade-button {
  width: 100%;
  border: 1px solid rgba(85, 229, 255, 0.55);
  border-radius: 16px;
  padding: 13px 14px;
  color: #eaffff;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(16, 77, 164, 0.95), rgba(8, 26, 85, 0.95));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -4px 0 rgba(0,0,0,0.32),
    0 0 18px rgba(64, 183, 255, 0.18);
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.arcade-button.small {
  width: auto;
  min-width: 104px;
  align-self: center;
  padding: 11px 16px;
}

.arcade-button:hover,
.arcade-button:focus-visible {
  outline: none;
  filter: brightness(1.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -4px 0 rgba(0,0,0,0.32),
    0 0 24px rgba(64, 183, 255, 0.38);
}

.arcade-button:active {
  transform: translateY(2px) scale(0.99);
}

.arcade-button.is-active {
  border-color: rgba(255, 211, 90, 0.86);
  color: #1b1300;
  background: linear-gradient(180deg, #ffe879, #ffad2f);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.36),
    inset 0 -4px 0 rgba(0,0,0,0.22),
    0 0 24px rgba(255, 211, 90, 0.32);
}

.arcade-button.primary {
  border-color: rgba(255, 211, 90, 0.75);
  color: #1b1300;
  background: linear-gradient(180deg, #ffe879, #ffad2f);
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}

#btnPause {
  display: none !important;
}

.mini-help {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed rgba(85, 229, 255, 0.36);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.16);
}

.mini-help b {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-column {
  width: min(960px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
}

.game-frame {
  position: relative;
  width: min(900px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 30px;
  padding: 12px;
  overflow: hidden;
  border: 2px solid rgba(85, 229, 255, 0.66);
  background:
    radial-gradient(circle at 50% 50%, rgba(35, 84, 190, 0.24), transparent 50%),
    linear-gradient(180deg, rgba(5, 16, 52, 0.98), rgba(1, 4, 18, 0.99));
  box-shadow:
    0 0 0 2px rgba(255, 79, 216, 0.18),
    0 0 38px rgba(85, 229, 255, 0.28),
    0 0 72px rgba(255, 79, 216, 0.16),
    inset 0 0 34px rgba(85, 229, 255, 0.1);
}

.game-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(85, 229, 255, 0.56);
  border-radius: 22px;
  pointer-events: none;
  box-shadow:
    inset 0 0 30px rgba(85, 229, 255, 0.16),
    0 0 22px rgba(255, 79, 216, 0.18);
  z-index: 2;
}

.game-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 30px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: translateX(-120%);
  animation: panelShine 6.5s linear infinite;
  z-index: 3;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #020615;
  box-shadow: inset 0 0 26px rgba(0,0,0,0.72);
}

.center-message {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%) scale(0.95);
  min-width: min(320px, 78%);
  padding: 22px 26px;
  border: 1px solid rgba(255, 211, 90, 0.72);
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(7, 12, 35, 0.92), rgba(15, 27, 80, 0.92));
  box-shadow: 0 0 50px rgba(255, 79, 216, 0.26), inset 0 0 20px rgba(255, 211, 90, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.center-message.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.center-message b {
  display: block;
  font-size: clamp(2rem, 7vw, 4.3rem);
  color: var(--gold);
  letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(255, 211, 90, 0.72), 3px 3px 0 #37194a;
}

.center-message span {
  display: block;
  margin-top: 10px;
  color: #dff7ff;
  font-weight: 700;
}

.stat-list {
  display: grid;
  gap: 10px;
}

.stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(144, 180, 212, 0.18);
}

.stat-list span {
  color: var(--muted);
}

.stat-list b {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(85, 229, 255, 0.45);
}

.sprite-note {
  margin-top: 20px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 211, 90, 0.32);
  background: rgba(255, 211, 90, 0.06);
}

.sprite-note b,
.sprite-note code,
.sprite-note small {
  display: block;
}

.sprite-note b {
  color: var(--gold);
  margin-bottom: 8px;
}

.sprite-note code {
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 10px;
  color: #dff7ff;
  background: rgba(0, 0, 0, 0.26);
  overflow-wrap: anywhere;
}

.sprite-note small {
  color: var(--muted);
  line-height: 1.45;
}

.footer-note {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 20%, rgba(85, 229, 255, 0.22), transparent 28rem),
    radial-gradient(circle at 18% 80%, rgba(255, 79, 216, 0.18), transparent 28rem),
    rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.menu-overlay.is-visible {
  display: grid;
}

.menu-card {
  position: relative;
  width: min(920px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border: 1px solid rgba(85, 229, 255, 0.48);
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(7, 16, 52, 0.92), rgba(3, 8, 28, 0.96));
  box-shadow: 0 0 54px rgba(85, 229, 255, 0.18), inset 0 0 34px rgba(85, 229, 255, 0.06);
  scrollbar-color: rgba(85, 229, 255, 0.65) rgba(0, 0, 0, 0.25);
  scrollbar-width: thin;
}

.menu-card::-webkit-scrollbar {
  width: 10px;
}

.menu-card::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
}

.menu-card::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(85, 229, 255, 0.75), rgba(255, 79, 216, 0.55));
  border-radius: 999px;
}

.logo-glow.big {
  font-size: clamp(3rem, 9vw, 6rem);
  text-align: center;
}

.menu-hero p,
.menu-section p,
.shop-note {
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
  max-width: 680px;
  margin: 0 auto 12px;
}

.menu-section.is-open {
  animation: menuDrop 0.16s ease-out;
}

.menu-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.menu-section {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(85, 229, 255, 0.24);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.18);
}

.menu-section.is-open {
  display: block;
}

.menu-section h2 {
  margin: 0 0 10px;
  color: var(--gold);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 14px rgba(255, 211, 90, 0.45);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.story-card {
  min-height: 150px;
  border: 1px solid rgba(85, 229, 255, 0.32);
  border-radius: 18px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 0%, rgba(85, 229, 255, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(18, 42, 104, 0.86), rgba(5, 10, 34, 0.94));
  box-shadow: inset 0 0 18px rgba(85, 229, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease, border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.story-card:hover,
.story-card:focus-visible {
  outline: none;
  transform: translateY(-1px);
  filter: brightness(1.14);
  border-color: rgba(255, 211, 90, 0.72);
  box-shadow: 0 0 22px rgba(255, 211, 90, 0.16), inset 0 0 18px rgba(85, 229, 255, 0.08);
}

.story-card b,
.story-card span,
.story-card small {
  display: block;
}

.story-card b {
  color: #fff;
  margin-bottom: 8px;
  font-size: 1.02rem;
  line-height: 1.2;
  text-shadow: 0 0 12px rgba(85, 229, 255, 0.42);
}

.story-card span {
  width: fit-content;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #06130d;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #7affc9, #37d98f);
  box-shadow: 0 0 14px rgba(86, 255, 182, 0.28);
}

.story-card small {
  color: var(--muted);
  line-height: 1.42;
}

.story-card.is-locked {
  cursor: not-allowed;
  filter: grayscale(0.7) brightness(0.72);
  border-color: rgba(144, 180, 212, 0.18);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, rgba(20, 24, 50, 0.78), rgba(4, 7, 22, 0.96));
}

.story-card.is-locked span {
  color: #ffe5ea;
  background: linear-gradient(180deg, #7c2338, #40101e);
  box-shadow: 0 0 14px rgba(255, 78, 111, 0.18);
}

.story-menu-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vw, 24px);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(5px);
}

.story-menu-popup-card {
  position: relative;
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: auto;
  padding: clamp(14px, 2vw, 24px);
  border: 1px solid rgba(85, 229, 255, 0.72);
  border-radius: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(85, 229, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(5, 12, 34, 0.98), rgba(12, 18, 58, 0.98));
  box-shadow: 0 0 44px rgba(85, 229, 255, 0.22), 0 0 72px rgba(255, 79, 216, 0.14), inset 0 0 24px rgba(85, 229, 255, 0.08);
}

.story-menu-popup-card h2 {
  margin: 0 64px 14px;
  color: var(--gold);
  font-size: clamp(1.45rem, 3.2vw, 2.35rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(255, 211, 90, 0.55);
}

.story-menu-popup-card p {
  max-width: 900px;
  margin: 14px auto 0;
  color: #dff7ff;
  line-height: 1.62;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  font-weight: 800;
}

.story-menu-popup-close {
  position: absolute;
  right: 18px;
  top: 16px;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(255, 211, 90, 0.72);
  border-radius: 999px;
  color: #1b1300;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  background: linear-gradient(180deg, #fff09a, #ffad2f);
  box-shadow: 0 0 24px rgba(255, 211, 90, 0.42), inset 0 1px 0 rgba(255,255,255,0.42);
}

.story-menu-popup-close:hover,
.story-menu-popup-close:focus-visible {
  outline: none;
  filter: brightness(1.14);
}

.story-popup-img {
  display: block;
  width: auto;
  max-width: min(100%, 980px);
  max-height: min(68vh, 760px);
  object-fit: contain;
  margin: 8px auto 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: 0 0 26px rgba(0,0,0,0.34);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.shop-category-title {
  grid-column: 1 / -1;
  margin: 18px 0 2px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--gold);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(255, 211, 90, 0.12), transparent);
  text-shadow: 0 0 14px rgba(255, 211, 90, 0.5);
}

.shop-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border: 1px dashed rgba(85, 229, 255, 0.3);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.18);
}

.shop-item {
  border: 1px solid rgba(255, 211, 90, 0.36);
  border-radius: 18px;
  padding: 10px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(85, 229, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(30, 28, 92, 0.86), rgba(5, 10, 34, 0.92));
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 0 18px rgba(255, 211, 90, 0.05), 0 10px 26px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease, border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.shop-item-rich {
  min-height: 230px;
  display: grid;
  grid-template-rows: 142px auto;
  gap: 10px;
}

.shop-item:hover {
  transform: translateY(-1px);
  filter: brightness(1.14);
  border-color: rgba(85, 229, 255, 0.55);
  box-shadow: 0 0 22px rgba(85, 229, 255, 0.15), inset 0 0 18px rgba(255, 211, 90, 0.05);
}

.shop-item.is-owned {
  border-color: rgba(86, 255, 182, 0.42);
}

.shop-item.is-selected {
  border-color: rgba(255, 211, 90, 0.95);
  box-shadow: 0 0 24px rgba(255, 211, 90, 0.22), inset 0 0 18px rgba(255, 211, 90, 0.08);
}

.shop-item b,
.shop-item span {
  display: block;
}

.shop-preview {
  position: relative;
  width: 100%;
  min-height: 142px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 50% 20%, rgba(85, 229, 255, 0.28), transparent 55%),
    linear-gradient(135deg, rgba(255,79,216,0.24), rgba(4,10,36,0.95));
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.42);
}

.bg-preview-small {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.bg-preview-small::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.42), transparent 58%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.04) 0 1px, transparent 1px 4px);
  pointer-events: none;
}

.bg-preview-small.is-css-bg::before {
  content: "CSS";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.84);
  font-weight: 900;
  letter-spacing: 0.2em;
  text-shadow: 0 0 14px rgba(85, 229, 255, 0.8);
}

.maze-preview-small {
  min-height: 142px;
  background:
    linear-gradient(90deg, var(--maze-wall, #092b8e) 0 23%, var(--maze-floor, #07183f) 23% 38%, var(--maze-wall-inner, #071d63) 38% 61%, var(--maze-floor, #07183f) 61% 75%, var(--maze-wall, #092b8e) 75% 100%),
    linear-gradient(180deg, var(--maze-floor, #07183f), #020615);
}

.maze-preview-small::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid var(--maze-stroke, #4ecfff);
  box-shadow: 0 0 18px var(--maze-stroke, #4ecfff);
  opacity: 0.75;
}

.maze-preview-small::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  mix-blend-mode: screen;
  opacity: 0.75;
}

.shop-info {
  display: grid;
  gap: 4px;
}

.shop-item b,
.shop-title {
  color: #fff;
  margin-bottom: 4px;
  font-size: 1.05rem;
  line-height: 1.18;
  text-shadow: 0 0 12px rgba(85, 229, 255, 0.38);
}

.shop-item span,
.shop-meta {
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 900;
}

.shop-file-label {
  color: rgba(182, 214, 255, 0.72) !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  overflow-wrap: anywhere;
}

.shop-item.is-owned .shop-meta {
  color: var(--good);
}

.shop-item.is-selected .shop-meta {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 211, 90, 0.55);
}

.shop-item.is-selected::after {
  content: "EQUIPPED";
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 999px;
  color: #211400;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fff09a, #ffb634);
  box-shadow: 0 0 18px rgba(255, 211, 90, 0.45);
}

.shop-item {
  position: relative;
}

@media (max-width: 720px) {
  .menu-actions,
  .shop-grid,
  .story-grid {
    grid-template-columns: 1fr;
  }

  .menu-card {
    padding: 16px;
    width: min(100%, 94vw);
  }

  .shop-item-rich {
    min-height: 210px;
    grid-template-rows: 126px auto;
  }

  .shop-preview,
  .maze-preview-small {
    min-height: 126px;
  }
}

@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panelShine {
  0% { transform: translateX(-130%); }
  38% { transform: translateX(140%); }
  100% { transform: translateX(140%); }
}

@media (max-width: 1160px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .hud-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 12px, 1120px);
    padding-top: 8px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .arcade-button.small {
    width: 100%;
  }

  .hud-strip.compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .hud-card {
    min-width: 0;
    padding: 9px 10px;
  }

  .hud-card span {
    font-size: 1.2rem;
  }

  .game-frame {
    border-radius: 20px;
    padding: 7px;
  }

  #gameCanvas {
    border-radius: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
