/* Glass theme — the look only (background + panel surfaces). Loaded after
   styles.css; remove the <link> to drop it. No content, layout or behavior
   lives here. Decorative layers are fixed, never take pointer events, and
   stay behind the app (z-index). */

:root {
  --glass-fill: linear-gradient(140deg, rgba(255, 236, 214, 0.075) 0%, rgba(20, 14, 10, 0.35) 45%, rgba(255, 190, 130, 0.04) 100%);
  --glass-fill-strong: linear-gradient(140deg, rgba(255, 236, 214, 0.10) 0%, rgba(20, 14, 10, 0.30) 50%, rgba(255, 190, 130, 0.06) 100%);
  --glass-edge: rgba(255, 222, 186, 0.30);
  --glass-shadow: inset 1px 1px 0 rgba(255, 240, 222, 0.30), inset -1px -1px 0 rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.35), 0 22px 46px rgba(0, 0, 0, 0.6);
  --glass-blur: blur(14px) saturate(130%);
}

/* ---- Page background: photo of glass slabs on dark stone ----------------
   assets-src/bg/glass-background.png, built by tools/build-media.mjs into a
   wide version and a portrait strip for phones. Fixed layers (works on iOS,
   unlike background-attachment: fixed), behind the app, no pointer events. */
html, body { background: #050403; }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #050403 url('/assets/bg/glass-bg.webp') center / cover no-repeat;
}

/* A veil keeps text readable where the content sits (the middle column),
   while the lit edges around it stay bright. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 4, 3, 0.7) 0%, rgba(5, 4, 3, 0) 22%),
    radial-gradient(ellipse 34% 75% at 50% 45%, rgba(5, 4, 3, 0.62), rgba(5, 4, 3, 0.38) 55%, rgba(5, 4, 3, 0.12) 100%);
}

/* Text that sits directly on the photo (outside the glass panels). */
.app-header, .world-progress, .mock-mode-note, .share-status { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.85); }

@media (max-aspect-ratio: 3/4) {
  body::before { background-image: url('/assets/bg/glass-bg-mobile.webp'); }
  body::after { background: linear-gradient(180deg, rgba(5, 4, 3, 0.30), rgba(5, 4, 3, 0.55) 30%, rgba(5, 4, 3, 0.55) 75%, rgba(5, 4, 3, 0.30)); }
}

.app-shell { position: relative; z-index: 1; }
.app-shell:has(#game-view:not([hidden])) { z-index: 1; }
/* During play, a slightly deeper veil behind the conversation. */
body:has(#game-view:not([hidden]))::after { background: rgba(5, 4, 3, 0.58); }

/* ---- Glass panels ---- */
.mission-card,
.end-screen,
.character-card,
.feedback-card,
.offer-card-panel,
.conversation-log {
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* Diagonal reflection on the non-scrolling panels. */
.mission-card,
.end-screen,
.character-card,
.feedback-card {
  position: relative;
}
.mission-card::before,
.end-screen::before,
.character-card::before,
.feedback-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, 0.07) 36%, transparent 44%, transparent 70%, rgba(255, 220, 180, 0.04) 76%, transparent 82%);
}
.mission-card > *,
.end-screen > *,
.character-card > *,
.feedback-card > * { position: relative; }

.character-card { background: var(--glass-fill-strong); }
a.character-card:hover, a.character-card:focus-visible { filter: brightness(1.12); }
.character-card-defeated { border-color: rgba(212, 175, 106, 0.6); }
.character-card-mystery {
  border-style: dashed;
  background: linear-gradient(140deg, rgba(255, 240, 225, 0.05), rgba(255, 240, 225, 0.015));
}
.character-card-image {
  border-color: rgba(255, 214, 170, 0.25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* Intro clip framed like a pane of glass. */
.intro-video {
  border-color: rgba(255, 214, 170, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, 0.2), 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* ---- Game screen ---- */
.character-stage {
  background: radial-gradient(circle at 50% 35%, rgba(255, 170, 100, 0.18), rgba(30, 20, 14, 0.55) 70%);
  border-color: rgba(255, 214, 170, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, 0.25), 0 10px 26px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

.conversation-log { background: linear-gradient(160deg, rgba(255, 240, 225, 0.06), rgba(20, 14, 10, 0.35)); }
.bubble-dragon {
  background: rgba(24, 17, 12, 0.72);
  border-color: rgba(255, 214, 170, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, 0.08);
}

.message-form input,
.feedback-form textarea {
  background: rgba(14, 10, 8, 0.65);
  border-color: rgba(255, 214, 170, 0.22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.item-btn,
.hints-panel button,
.secondary-btn,
.feedback-choice,
.offer-card-toggle {
  background: linear-gradient(140deg, rgba(255, 240, 225, 0.08), rgba(255, 240, 225, 0.02));
  border-color: rgba(255, 214, 170, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, 0.14);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.hints-panel ul {
  background: rgba(20, 14, 10, 0.6);
  border: 1px solid rgba(255, 214, 170, 0.15);
}

/* The primary button keeps its ember glow, with a glass highlight. */
.primary-btn {
  box-shadow: inset 0 1px 0 rgba(255, 245, 230, 0.55), 0 8px 22px rgba(232, 132, 58, 0.28);
}

/* Without backdrop-filter support, keep panels readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mission-card, .end-screen, .character-card, .feedback-card, .conversation-log { background-color: rgba(28, 20, 15, 0.92); }
}

@media (prefers-reduced-transparency: reduce) {
  body::after { background: rgba(5, 4, 3, 0.75); }
  .mission-card, .end-screen, .character-card, .feedback-card, .conversation-log {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #1d1510;
  }
}
