/* =========================================================
   Shadow Jump — In-game "Sunlit" UI skin
   Mirrors the iOS app's GameTheme / SunlitStone components:
   painted panel frame, faceted capsule buttons, painted icons,
   rounded-black type with cream-outlined maroon headings, and the
   dark home-world backdrop that sits behind every in-game menu.
   Loaded after style.css; overrides only presentation.
   ========================================================= */

:root {
  /* GameTheme.swift colors */
  --g-ink: #471426;
  --g-ink-top: #911f30;
  --g-cream: #fff0c9;
  --g-parchment: #ffd99c;
  --g-amber: #ffa833;
  --g-rust: #c43b29;
  --g-plum: #473054;
  --g-night: #291d38;
  --g-lavender: #997db0;

  /* SwiftUI .rounded .black ≈ SF Pro Rounded; Nunito is the web fallback */
  --font-display: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, sans-serif;
  --font-body: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ui-panel: url('../images/ui/panel.png');
  --ui-orange: url('../images/ui/btn-orange.png');
  --ui-cream: url('../images/ui/btn-cream.png');
  --ui-gold: url('../images/ui/btn-gold.png');
  --panel-frame: 40px;
}

/* ---------- Backdrop: the home world behind every menu ---------- */
body {
  color: var(--g-ink);
  background:
    linear-gradient(rgba(41, 29, 56, 0.62), rgba(41, 29, 56, 0.72)),
    url('../images/ui/home-world.jpg') center top / cover fixed,
    var(--g-night);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4,
.panel-title,
.trophy-name,
.badge,
.btn,
.segmented button,
.nav-logo,
.score-badge,
.trophy-number,
.trophy-tab span,
.review figcaption {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.01em;
}

.nav-logo b { font-weight: 900; }

/* SunlitHeading: maroon gradient fill, cream rim, ink drop */
.section-head h2,
.split-copy h2,
.panel-title,
.trophy-name,
.page-head h1 {
  color: var(--g-ink);
  background: linear-gradient(180deg, var(--g-ink-top), var(--g-ink)) 0 0 / 100% 1.08em repeat-y;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.08;
  text-shadow: none;
  filter:
    drop-shadow(-1px -1px 0 var(--g-cream))
    drop-shadow(1px 0 0 var(--g-cream))
    drop-shadow(0 2px 0 rgba(71, 20, 38, 0.55));
}

.panel-title {
  text-transform: uppercase;
  -webkit-text-fill-color: initial;
  background: none;
  color: var(--g-ink);
}

.section-head p,
.split-copy p,
.tile p,
.review blockquote,
.cta-panel p,
.shot-frame figcaption {
  color: var(--g-plum);
}

strong { color: var(--g-ink); }

/* ---------- Sunlit panel (9-slice of sunlit_panel.png) ---------- */
.panel,
.section:not(#gameplay):not(#download) > .container {
  position: relative;
  background: none;
  border: var(--panel-frame) solid transparent;
  border-image: var(--ui-panel) 75 fill / var(--panel-frame) stretch;
  border-radius: 34px;
  padding: 18px 26px 22px;
  margin: 0 auto;
  box-shadow: 0 14px 34px rgba(20, 10, 30, 0.5);
}

.panel::before { content: none; }

.section { padding: 64px 0; }
.section-tight { padding-top: 24px; }
.section-head { margin-bottom: 36px; }
.split { gap: 48px; }

/* ---------- Faceted capsule controls ---------- */
.btn {
  --bh: 52px;
  min-height: var(--bh);
  padding: 0 calc(var(--bh) * 0.55);
  color: var(--g-ink);
  background: none;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-orange) 51 fill / 50% calc(var(--bh) / 2) stretch;
  border-radius: calc(var(--bh) / 2);
  box-shadow: none;
  text-shadow: none;
  letter-spacing: 0.02em;
}

.btn-gold { border-image-source: var(--ui-gold); }
.btn-ghost { border-image-source: var(--ui-cream); color: var(--g-ink); }

.btn-gold,
.btn-ghost,
.btn-gold:hover,
.btn-ghost:hover,
.btn-gold:active { box-shadow: none; background: none; }

.btn:hover { --press: -2px; filter: brightness(1.06); }
.btn:active { --press: 2px; }

.btn-sm { --bh: 42px; font-size: 1rem; }
.btn-lg { --bh: 60px; font-size: 1.15rem; }

/* Painted PLAY artwork (home_play_painted) used as a real link */
.play-art {
  display: inline-block;
  width: min(300px, 72vw);
  transition: transform 0.12s ease, filter 0.2s;
  filter: drop-shadow(0 8px 14px rgba(20, 10, 30, 0.45));
}

.play-art img { width: 100%; height: auto; }
.play-art:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.05) drop-shadow(0 10px 16px rgba(20, 10, 30, 0.5)); }
.play-art:active { transform: translateY(2px) scale(0.97); }

/* Badges: orange capsule with painted icon + ink label */
.badge,
.badge-dark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 22px;
  color: var(--g-ink);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-orange) 51 fill / 50% 20px stretch;
}

.badge::before,
.badge::after { content: none; }

.badge img,
.ui-ico {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: none;
}

/* Segmented control: cream strip, gold selection (Wardrobe HATS / SUITS) */
.segmented {
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 24px;
  background: none;
  box-shadow: none;
}

.segmented button {
  min-height: 46px;
  padding: 0 24px;
  color: var(--g-ink);
  font-size: 1rem;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-cream) 51 fill / 50% 23px stretch;
  border-radius: 23px;
  margin-left: -6px;
  background: none;
  box-shadow: none;
}

.segmented button:first-child { margin-left: 0; }
.segmented button:hover { background: none; filter: brightness(1.04); }

.segmented button[aria-selected='true'] {
  border-image-source: var(--ui-gold);
  background: none;
  box-shadow: none;
  position: relative;
  z-index: 1;
}

/* ---------- Nav ---------- */
.nav.scrolled {
  background: none;
  border: 22px solid transparent;
  border-image: var(--ui-panel) 75 fill / 22px stretch;
  box-shadow: 0 10px 24px rgba(20, 10, 30, 0.45);
  padding: 0 4px;
}

.nav-logo { color: var(--g-ink); }
.nav-logo b { color: var(--g-rust); }

.nav-links a:not(.btn) {
  color: var(--g-ink);
  font-weight: 900;
}

.nav:not(.scrolled) .nav-links a:not(.btn) {
  color: var(--g-ink);
  text-shadow: -1px -1px 0 var(--g-cream), 1px 1px 0 var(--g-cream);
}

.soundtrack-toggle,
.nav-toggle {
  min-height: 42px;
  color: var(--g-ink);
  background: none;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-cream) 51 fill / 50% 21px stretch;
  border-radius: 21px;
  box-shadow: none;
  padding: 0 16px;
}

.soundtrack-toggle:hover { background: none; }
.soundtrack-toggle.playing { background: none; border-image-source: var(--ui-gold); }

.nav-toggle { width: 48px; padding: 0; }

/* ---------- Hero accents ---------- */
.hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 22px;
  color: var(--g-ink);
  font-family: var(--font-display);
  font-weight: 900;
  background: none;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-cream) 51 fill / 50% 19px stretch;
}

.interactive-tap-btn {
  min-height: 44px;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-cream) 51 fill / 50% 22px stretch;
  border-radius: 22px;
  background: none;
  box-shadow: none;
  color: var(--g-ink);
  font-weight: 900;
}

.hero-actions { align-items: center; }

/* ---------- Tiles (Wardrobe item cells) ---------- */
.tile,
.review {
  background: rgba(255, 217, 156, 0.22);
  border: 1.5px solid rgba(196, 59, 41, 0.24);
  border-radius: 14px;
  box-shadow: none;
}

.tile:hover {
  transform: translateY(-4px);
  background: rgba(255, 217, 156, 0.55);
  border: 2px solid var(--g-amber);
  box-shadow: none;
}

.tile-icon {
  width: 78px;
  height: 78px;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-orange) 51 fill / 39px stretch;
  border-radius: 39px;
  background: none;
  box-shadow: 0 6px 12px rgba(71, 20, 38, 0.25);
}

.tile-icon img,
.tile-img-icon {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.tile h3 { color: var(--g-ink); }

.stars-5 { color: var(--g-amber); text-shadow: 0 2px 0 var(--g-rust); }
.review figcaption span { color: var(--g-rust); }

/* Points pill (Wardrobe "54 pts") */
.pts-pill {
  min-height: 44px;
  padding: 0 22px 0 14px;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-cream) 51 fill / 50% 22px stretch;
  background: none;
  color: var(--g-ink);
}

.coin {
  border: 2px solid var(--g-ink);
  background: radial-gradient(circle at 35% 30%, #ffe9a0, var(--g-amber) 60%, #e3681b);
}

/* ---------- Screenshot frames ---------- */
.framed,
.shot-frame img,
.lightbox img {
  border: 3px solid var(--g-ink);
  border-radius: 16px;
  box-shadow: 0 0 0 6px #f0752f, 0 0 0 9px var(--g-ink), 0 18px 30px rgba(20, 10, 30, 0.4);
}

/* ---------- Trophy Room: the in-game modal ---------- */
.section-dark {
  background: none;
  color: var(--g-ink);
  overflow: visible;
}

.section-dark::before,
.section-dark::after,
.stars { display: none; }

.trophy-gallery-panel {
  background: rgba(255, 217, 156, 0.18);
  border: 1.5px solid rgba(196, 59, 41, 0.24);
  border-radius: 16px;
  box-shadow: none;
  margin-bottom: 30px;
}

.trophy-feature-card { border-bottom: 1px solid rgba(196, 59, 41, 0.16); }
.trophy-disc-wrap { filter: drop-shadow(0 10px 18px rgba(71, 20, 38, 0.35)); }
.trophy-number { color: var(--g-rust); }
.trophy-pairing { color: var(--g-rust); font-weight: 900; }
.trophy-desc { color: var(--g-plum); }

.trophy-status-tag {
  min-height: 36px;
  padding: 0 18px 0 10px;
  color: var(--g-ink);
  background: none;
  border-style: solid;
  border-width: 0;
  border-image: var(--ui-gold) 51 fill / 50% 18px stretch;
  border-radius: 18px;
}

.check-mini {
  width: 20px;
  height: 20px;
  border: 2px solid var(--g-ink);
  background: radial-gradient(circle at 40% 35%, #a6d65e, #6ea32f);
  position: relative;
}

.check-mini::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--g-ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.trophy-tab {
  background: rgba(255, 240, 201, 0.35);
  border: 1.5px solid rgba(196, 59, 41, 0.22);
  border-radius: 12px;
}

.trophy-tab img { filter: none; }
.trophy-tab span { color: var(--g-ink); }

.trophy-tab:hover {
  background: rgba(255, 217, 156, 0.45);
  border-color: rgba(196, 59, 41, 0.45);
}

.trophy-tab.active {
  background: rgba(255, 217, 156, 0.6);
  border: 2px solid var(--g-amber);
  box-shadow: none;
}

.trophy-tab.active span { color: var(--g-ink); }
.shot-card figcaption,
.section-dark .split-copy p { color: var(--g-plum); }
.section-dark strong { color: var(--g-ink); }

/* ---------- CTA: High-score backdrop + podium ---------- */
.cta {
  background:
    linear-gradient(180deg, rgba(41, 29, 56, 0.55), rgba(41, 29, 56, 0) 30%),
    url('../images/ui/high-score-backdrop.jpg') center / cover;
  padding: 90px 0 110px;
}

.cta-panel { padding-top: 10px; }

.cta-podium {
  position: relative;
  width: min(300px, 70%);
  margin: -96px auto 14px;
}

.cta-podium .podium { width: 100%; height: auto; }

.cta-podium .podium-runners {
  position: absolute;
  left: 50%;
  bottom: 52%;
  translate: -50% 0;
  display: flex;
  gap: 14px;
}

.cta-podium .podium-runners img {
  width: 64px;
  height: auto;
  filter: drop-shadow(0 4px 0 rgba(71, 20, 38, 0.35));
  animation: bob 2.4s ease-in-out infinite;
}

.cta-podium .podium-runners img + img { animation-delay: 0.25s; }

/* ---------- Footer ---------- */
.footer {
  background: var(--g-night);
  border-top: 4px solid var(--g-ink);
  color: var(--g-parchment);
}

.footer .nav-logo { color: var(--g-cream); }
.footer .nav-logo b { color: var(--g-amber); }

/* ---------- Lightbox close (painted xmark) ---------- */
.close-x {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.close-x img { width: 100%; height: 100%; filter: drop-shadow(0 3px 0 rgba(71, 20, 38, 0.4)); }

/* ---------- Content pages (support / privacy) ---------- */
.page-head p { color: var(--g-cream); }

.faq details {
  background: rgba(255, 217, 156, 0.22);
  border: 1.5px solid rgba(196, 59, 41, 0.24);
  box-shadow: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .nav { background: none; }

  .nav-links {
    background: none;
    border: 26px solid transparent;
    border-image: var(--ui-panel) 75 fill / 26px stretch;
    box-shadow: 0 16px 30px rgba(20, 10, 30, 0.45);
    padding: 0;
  }

  .nav:not(.scrolled) {
    border: 22px solid transparent;
    border-image: var(--ui-panel) 75 fill / 22px stretch;
    padding: 0 4px;
  }
}

@media (max-width: 600px) {
  :root { --panel-frame: 26px; }

  .panel,
  .section:not(#gameplay):not(#download) > .container {
    padding: 10px 12px 14px;
    width: calc(100% - 20px);
  }

  .section { padding: 44px 0; }

  .segmented button { padding: 0 14px; font-size: 0.88rem; }
}
