/* ==========================================================================
   Cauldron Castle: shared stylesheet
   Mobile-first. Fonts: Lilita One (titles), Fredoka (body).
   ========================================================================== */

:root {
  --night: #2a1b37;
  --plum: #43295a;
  --violet: #6b4884;
  --gold: #e3a94f;
  --gold-light: #ffd37a;
  --cream: #fff6e8;
  --lilac: #efe2f7;

  --ink: #2a1b37;          /* text on parchment */
  --ink-soft: #5a4570;
  --danger: #b4324a;
  --ok: #2f7a55;

  --font-title: "Lilita One", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Fredoka", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 18px;
  --shadow: 0 18px 50px rgba(10, 4, 18, .55);
  --gutter: 16px;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--cream);
  background-color: var(--night);
  overflow-x: hidden;
}

[hidden] { display: none !important; }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--gold-light); text-underline-offset: 3px; }
a:hover { color: #fff; }

:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--gold-light); color: var(--night);
  padding: 8px 14px; border-radius: 10px; font-weight: 600;
  z-index: 100; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* --------------------------------------------------------------------------
   Night-sky backdrop (shared by every page)
   -------------------------------------------------------------------------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--night);
  background-image: url("../assets/title_bg.jpg");
  background-image: image-set(url("../assets/title_bg.webp") type("image/webp"),
                              url("../assets/title_bg.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: 38% 40%;
  background-repeat: no-repeat;
}
/* soft vignette + colour wash so text stays readable over the low-res art */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(42, 27, 55, 0) 0%, rgba(42, 27, 55, .25) 45%, rgba(20, 10, 30, .85) 100%),
    linear-gradient(180deg, rgba(42, 27, 55, .35) 0%, rgba(42, 27, 55, .1) 35%, rgba(30, 18, 42, .75) 100%);
}
/* inner pages: dimmer and softly blurred so long text reads easily */
.backdrop--dim { filter: blur(3px) saturate(1.1); transform: scale(1.04); }
.backdrop--dim::after {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(42, 27, 55, .55) 0%, rgba(26, 14, 38, .9) 100%);
}

/* --------------------------------------------------------------------------
   Sparkles (decorative, CSS-only)
   -------------------------------------------------------------------------- */
.sparkles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.sparkles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s, 6px);
  height: var(--s, 6px);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--gold-light) 35%, rgba(255, 211, 122, 0) 70%);
  opacity: .0;
  animation: twinkle var(--d, 5s) ease-in-out var(--delay, 0s) infinite;
}
.sparkles span:nth-child(3n) {
  background: radial-gradient(circle, #fff 0%, #c9f5d9 35%, rgba(150, 240, 190, 0) 70%);
}
.sparkles span:nth-child(4n) {
  background: radial-gradient(circle, #fff 0%, var(--lilac) 35%, rgba(239, 226, 247, 0) 70%);
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: translateY(0) scale(.6); }
  45%      { opacity: .95; transform: translateY(-10px) scale(1); }
  70%      { opacity: .35; transform: translateY(-16px) scale(.8); }
}

/* --------------------------------------------------------------------------
   Homepage
   -------------------------------------------------------------------------- */
.home {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px var(--gutter) 24px;
  gap: 8px;
}

/* Framed title: the art sits behind the words */
.title-frame {
  position: relative;
  width: min(94vw, 700px);
  margin: 0 auto;
  container-type: inline-size;
}
.title-frame::before {           /* gentle glow behind the frame */
  content: "";
  position: absolute;
  inset: 12% 8%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 211, 122, .45), rgba(155, 90, 200, .25) 45%, transparent 72%);
  filter: blur(18px);
  z-index: -1;
  animation: glow 6s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { opacity: .65; transform: scale(.97); }
  50%      { opacity: 1;   transform: scale(1.04); }
}
.title-frame img {
  width: 100%;
  filter: drop-shadow(0 10px 22px rgba(10, 4, 18, .6));
}
.title-frame h1 {
  position: absolute;
  left: 15%;
  right: 15%;
  top: 33.5%;
  height: 35%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 30px;               /* fallback if container units unsupported */
  font-size: 9.6cqw;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  color: var(--gold-light);
  background: linear-gradient(180deg, #fff3cf 0%, var(--gold-light) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 2px 0 #6a3c12)
    drop-shadow(0 0 10px rgba(255, 211, 122, .45));
}

.tagline {
  margin: 4px 0 18px;
  font-size: clamp(1.05rem, 4.4vw, 1.4rem);
  font-weight: 500;
  color: var(--cream);
  text-shadow: 0 2px 10px rgba(10, 4, 18, .9), 0 0 2px rgba(10, 4, 18, .9);
  letter-spacing: .01em;
}

/* Big Google Play button */
.play-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px 14px 22px;
  min-height: 64px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--night);
  background: linear-gradient(180deg, #ffe7a8 0%, var(--gold-light) 40%, var(--gold) 100%);
  border: 2px solid #fff0c4;
  box-shadow:
    0 0 0 4px rgba(42, 27, 55, .55),
    0 10px 30px rgba(10, 4, 18, .6),
    0 0 34px rgba(255, 211, 122, .35),
    inset 0 -4px 0 rgba(150, 90, 20, .35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.play-button:hover,
.play-button:focus-visible {
  color: var(--night);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 4px rgba(42, 27, 55, .55),
    0 14px 36px rgba(10, 4, 18, .65),
    0 0 48px rgba(255, 211, 122, .55),
    inset 0 -4px 0 rgba(150, 90, 20, .35);
}
.play-button:active { transform: translateY(1px); }
.play-button svg { width: 32px; height: 32px; flex: none; }
.play-button__text { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.play-button__small { font-size: .82rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.play-button__big { font-family: var(--font-title); font-size: 1.6rem; letter-spacing: .01em; }

/* --------------------------------------------------------------------------
   Footer (all pages)
   -------------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  font-size: .95rem;
  color: var(--lilac);
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 6px;
}
.site-footer nav a {
  color: var(--cream);
  text-decoration: none;
  padding: 8px 6px;           /* comfortable tap target */
  border-radius: 8px;
  text-shadow: 0 1px 6px rgba(10, 4, 18, .9);
}
.site-footer nav a:hover { color: var(--gold-light); text-decoration: underline; }
.site-footer nav a[aria-current="page"] { color: var(--gold-light); }
.site-footer .dot { color: var(--gold); opacity: .8; }
/* four links don't fit on one phone line: drop the dots so none dangle at a line end */
@media (max-width: 520px) {
  .site-footer nav:has(> a:nth-of-type(4)) { gap: 0 14px; }
  .site-footer nav:has(> a:nth-of-type(4)) .dot { display: none; }
}
.site-footer small {
  display: block;
  margin-top: 4px;
  color: rgba(239, 226, 247, .75);
  font-size: .8rem;
  text-shadow: 0 1px 6px rgba(10, 4, 18, .9);
}

/* --------------------------------------------------------------------------
   Inner pages (support / legal)
   -------------------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 880px;
  margin: 0 auto;
  padding: 14px var(--gutter);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 1.35rem;
  color: var(--gold-light);
  text-decoration: none;
  text-shadow: 0 2px 0 #5b3412, 0 0 12px rgba(255, 211, 122, .35);
}
.brand svg { width: 28px; height: 28px; flex: none; }
.brand:hover { color: #fff; }
.header-play {
  font-size: .9rem;
  font-weight: 600;
  color: var(--night);
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.header-play:hover { color: var(--night); filter: brightness(1.08); }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px var(--gutter) 24px;
}
.sheet {
  background: linear-gradient(180deg, rgba(67, 41, 90, .92), rgba(42, 27, 55, .94));
  border: 1px solid rgba(227, 169, 79, .45);
  box-shadow: var(--shadow), inset 0 0 0 4px rgba(42, 27, 55, .6), inset 0 0 0 5px rgba(227, 169, 79, .25);
  border-radius: var(--radius);
  padding: 26px 20px 30px;
}
.sheet h1 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 1.1;
  margin: 0 0 6px;
  color: var(--gold-light);
  text-shadow: 0 2px 0 #5b3412;
}
.sheet .lede { color: var(--lilac); margin: 0 0 18px; font-size: 1.1rem; }
.sheet h2 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--gold-light);
  margin: 32px 0 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(227, 169, 79, .25);
}
.sheet h3 { font-size: 1.1rem; font-weight: 600; color: var(--cream); margin: 20px 0 6px; }
.sheet p, .sheet li { color: var(--cream); }
.sheet ul, .sheet ol { padding-left: 1.3em; }
.sheet li { margin: 4px 0; }
.sheet li::marker { color: var(--gold); }
.sheet strong { color: #fff; font-weight: 600; }
.sheet .updated { color: var(--lilac); font-size: .95rem; margin: 0 0 16px; }

.template-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff3cf;
  color: var(--ink);
  border: 2px dashed var(--gold);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 22px;
  font-size: .98rem;
  line-height: 1.5;
}
.template-banner strong { color: var(--ink); }
.template-banner svg { width: 26px; height: 26px; flex: none; margin-top: 2px; }

.placeholder {
  background: rgba(255, 211, 122, .18);
  color: var(--gold-light);
  border: 1px dashed rgba(255, 211, 122, .6);
  border-radius: 6px;
  padding: 0 5px;
  font-weight: 500;
  white-space: normal;
}

.toc {
  background: rgba(42, 27, 55, .6);
  border: 1px solid rgba(227, 169, 79, .25);
  border-radius: 14px;
  padding: 12px 16px;
  margin: 0 0 8px;
}
.toc p { margin: 0 0 4px; font-weight: 600; color: var(--gold-light); }
.toc ol { margin: 0; columns: 1; }
@media (min-width: 640px) { .toc ol { columns: 2; column-gap: 32px; } }

.table-wrap { overflow-x: auto; margin: 10px 0; }
.sheet table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 520px; }
.sheet th, .sheet td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid rgba(227, 169, 79, .2); }
.sheet th { color: var(--gold-light); font-weight: 600; }

/* FAQ accordion */
.faq-group { margin-top: 26px; }
.faq-group h2 { margin-top: 0; }
.faq {
  background: rgba(42, 27, 55, .55);
  border: 1px solid rgba(227, 169, 79, .3);
  border-radius: 14px;
  margin: 10px 0;
  overflow: hidden;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 46px 14px 16px;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--cream);
  position: relative;
  min-height: 48px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 18px; top: 50%;
  width: 10px; height: 10px;
  border-right: 2.5px solid var(--gold-light);
  border-bottom: 2.5px solid var(--gold-light);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s ease;
}
.faq[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq[open] summary { color: var(--gold-light); }
.faq .faq__body { padding: 0 16px 14px; }
.faq .faq__body p:first-child { margin-top: 0; }

.contact-card {
  margin-top: 30px;
  text-align: center;
  background: rgba(255, 211, 122, .1);
  border: 1px solid rgba(255, 211, 122, .45);
  border-radius: 16px;
  padding: 20px 16px;
}
.contact-card h2 { border: 0; padding: 0; margin: 0 0 6px; }
.contact-card .email-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 600;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   Spellbook / parchment card (password reset + 404)
   -------------------------------------------------------------------------- */
.centered {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.centered main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px var(--gutter) 8px;
}
.parchment {
  position: relative;
  width: 100%;
  max-width: 440px;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .7), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(227, 169, 79, .28), transparent 60%),
    linear-gradient(180deg, #fff8ec 0%, #fbeccf 100%);
  border-radius: 20px;
  padding: 50px 22px 26px;
  margin-top: 30px;
  box-shadow:
    var(--shadow),
    0 0 0 3px var(--gold),
    0 0 0 7px var(--plum),
    0 0 0 8px rgba(227, 169, 79, .6);
  text-align: center;
}
.parchment::before {   /* thin inner gold rule */
  content: "";
  position: absolute;
  inset: 8px;
  border: 1.5px solid rgba(227, 169, 79, .55);
  border-radius: 14px;
  pointer-events: none;
}
.seal {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  width: 68px; height: 68px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #8d63ad, var(--violet) 45%, var(--plum) 100%);
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 6px var(--night), 0 8px 18px rgba(10, 4, 18, .5), 0 0 26px rgba(255, 211, 122, .45);
}
.seal svg { width: 34px; height: 34px; }
.parchment h1 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(1.75rem, 7.4vw, 2.1rem);
  line-height: 1.1;
  color: var(--plum);
  margin: 0 0 8px;
}
.parchment .intro { color: var(--ink-soft); margin: 0 0 20px; }
.parchment a { color: var(--violet); font-weight: 600; }
.parchment a:hover { color: var(--plum); }
.parchment a.btn, .parchment a.btn:hover { color: var(--cream); }
[tabindex="-1"]:focus { outline: none; }

.form { text-align: left; display: grid; gap: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: .88rem; color: var(--ink-soft); margin: 6px 0 0; }
.input-wrap { position: relative; }
.form input[type="email"],
.form input[type="password"],
.form input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;                 /* >=16px avoids iOS zoom */
  color: var(--ink);
  background: #fffdf8;
  border: 2px solid #d9c3a0;
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 50px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(107, 72, 132, .22);
}
.form input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap input { padding-right: 76px; }
.toggle-visibility {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--violet);
  background: transparent;
  border: 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
}
.toggle-visibility:hover { background: rgba(107, 72, 132, .1); }
.field-error {
  color: var(--danger);
  font-size: .92rem;
  font-weight: 500;
  margin: 6px 0 0;
  min-height: 0;
}
.field-error:empty { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  font: inherit;
  font-family: var(--font-title);
  font-size: 1.3rem;
  letter-spacing: .01em;
  color: var(--cream);
  background: linear-gradient(180deg, #8a62a8 0%, var(--violet) 45%, var(--plum) 100%);
  border: 2px solid var(--gold);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(42, 27, 55, .35), inset 0 -3px 0 rgba(20, 10, 30, .35);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.1); color: var(--cream); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { filter: grayscale(.4) brightness(.9); cursor: progress; }
.btn .spinner {
  width: 18px; height: 18px;
  border: 3px solid rgba(255, 246, 232, .35);
  border-top-color: var(--gold-light);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: none;
}
.btn[aria-busy="true"] .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .97rem;
  text-align: left;
  margin: 0 0 14px;
}
.notice--error { background: #fde8ec; border: 1.5px solid #e9a3b0; color: #7a1c30; }
.notice--info  { background: #f3eaf9; border: 1.5px solid #cdb5df; color: var(--plum); }
.notice[hidden] { display: none; }

.state-success h2, .state-error h2 {
  font-family: var(--font-title);
  font-weight: 400;
  color: var(--plum);
  font-size: 1.6rem;
  margin: 0 0 8px;
}
.state-success p, .state-error p { color: var(--ink-soft); }
.state-icon {
  width: 64px; height: 64px;
  margin: 4px auto 10px;
}
.linklike {
  font: inherit; font-weight: 600;
  color: var(--violet);
  background: none; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.linklike:hover { color: var(--plum); }
.card-links {
  margin: 18px 0 0;
  font-size: .95rem;
  color: var(--ink-soft);
}
.strength {
  height: 6px;
  border-radius: 999px;
  background: #eadcc4;
  margin-top: 8px;
  overflow: hidden;
}
.strength span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--danger);
  transition: width .25s ease, background-color .25s ease;
}

.big-404 {
  font-family: var(--font-title);
  font-size: 4.5rem;
  line-height: 1;
  color: var(--violet);
  margin: 0;
  text-shadow: 0 3px 0 rgba(227, 169, 79, .6);
}
.parchment .btn { margin-top: 8px; }

/* --------------------------------------------------------------------------
   Larger screens
   -------------------------------------------------------------------------- */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .sheet { padding: 40px 48px 44px; }
  .hero { gap: 12px; }
  .play-button { padding: 16px 34px 16px 26px; }
  .play-button__big { font-size: 1.85rem; }
  .parchment { padding: 56px 40px 32px; }
}

/* --------------------------------------------------------------------------
   Accessibility: calm everything down for reduced-motion users
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .sparkles span { opacity: .55; }
  .title-frame::before { opacity: .8; }
}

@media print {
  .backdrop, .sparkles, .site-header .header-play, .site-footer nav { display: none; }
  body { background: #fff; color: #000; }
  .sheet { background: none; box-shadow: none; border: 0; padding: 0; }
  .sheet h1, .sheet h2, .sheet p, .sheet li, .sheet strong { color: #000; text-shadow: none; }
}

.play-button.is-soon{cursor:default}
