/* Manti Land website. The game's own look (Game/Assets/Game/UI/Mantite/MlBase.uss): cream paper, ink outlines, chunky raised
   buttons, gold for the main action, navy for the night. Fonts: Baloo 2 (display), Nunito (body), Lilita One (the name). */

:root {
  --ink: #2A2238;
  --ink-soft: #5A5170;
  --paper: #FFF8EE;
  --paper-2: #F8EBD3;
  --card: #FFFFFF;
  --gold: #F2C14A;
  --gold-deep: #C98F12;
  --gold-pale: #FFE9A8;
  --night: #221C3E;
  --night-deep: #2E2A5E;
  --night-text: #F4F0FF;
  --night-sub: #D9D2FF;
  --berry: #FF6F91;
  --sky: #8AD7FF;
  --mint: #7BE0B5;
  --lilac: #B9A6F5;
  --good: #2F7D32;

  --bg: var(--paper);
  --bg-2: var(--paper-2);
  --surface: var(--card);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --edge: var(--ink);
  --drop: var(--ink);
  --link: #6A3FC4;
  --rule: rgba(42, 34, 56, 0.14);
  --tint: rgba(42, 34, 56, 0.05);

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --wrap: 1180px;
  --gutter: 16px;

  --font-display: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-logo: "Lilita One", "Baloo 2", system-ui, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15112A;
    --bg-2: #1C1738;
    --surface: #241E44;
    --text: #F4F0FF;
    --muted: #CFC6F2;
    --edge: #0A0716;
    --drop: #07050F;
    --link: #C9B6FF;
    --rule: rgba(255, 255, 255, 0.14);
    --tint: rgba(255, 255, 255, 0.05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15112A;
  --bg-2: #1C1738;
  --surface: #241E44;
  --text: #F4F0FF;
  --muted: #CFC6F2;
  --edge: #0A0716;
  --drop: #07050F;
  --link: #C9B6FF;
  --rule: rgba(255, 255, 255, 0.14);
  --tint: rgba(255, 255, 255, 0.05);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}
img, svg, picture { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; line-height: 1.12; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.3rem, 7vw, 4.4rem); }
h2 { font-size: clamp(1.8rem, 4.6vw, 2.8rem); }
h3 { font-size: clamp(1.25rem, 2.6vw, 1.55rem); }
h4 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
strong, b { font-weight: 800; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin: 0.2em 0; }
small { font-size: 0.85em; }
hr { border: 0; border-top: 2px dashed var(--rule); margin: 2.4rem 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: var(--ink); padding: 8px 14px; border-radius: 999px; border: 3px solid var(--ink); font-weight: 800; }
.skip:focus { left: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.center { text-align: center; }
.lede { font-size: clamp(1.08rem, 2.2vw, 1.3rem); color: var(--muted); max-width: 46em; }
.center .lede { margin-left: auto; margin-right: auto; }

/* ------------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 2px solid var(--rule);
}
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; }
.brand img { width: 40px; height: 40px; border-radius: 11px; border: 2.5px solid var(--edge); }
.brand span { font-family: var(--font-logo); font-size: 1.5rem; letter-spacing: 0.01em; line-height: 1; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 800; padding: 8px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--tint); }
.nav a[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--rule); }
.theme {
  width: 42px; height: 42px; border-radius: 999px; border: 2.5px solid var(--edge); background: var(--surface); color: var(--text);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 0 var(--drop); padding: 0;
}
.theme:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--drop); }
.theme svg { width: 22px; height: 22px; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: block; }
}
.brand span { white-space: nowrap; }
.theme { flex: none; }
@media (max-width: 560px) {
  .top .wrap { gap: 6px; }
  .brand span { font-size: 1.2rem; }
  .nav a { padding: 8px 9px; font-size: 0.98rem; }
  .nav .wide { display: none; }
  .card { padding: 16px; }
  .feature { gap: 14px; grid-template-columns: 96px 1fr; }
}
@media (max-width: 440px) { .brand span { display: none; } }

/* ------------------------------------------------------------------ buttons, chips, cards */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; line-height: 1;
  color: var(--ink); background: var(--gold); text-decoration: none;
  padding: 15px 24px 13px; min-height: 52px; border-radius: 999px;
  border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn--paper { background: var(--paper); }
.btn--night { background: var(--night-deep); color: var(--night-text); }
.btns { display: flex; flex-wrap: wrap; gap: 14px; }
.center .btns { justify-content: center; }

.chip {
  --c: #8A839C;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1;
  padding: 6px 10px 5px; border-radius: 999px; white-space: nowrap;
  color: var(--text);
  background: color-mix(in srgb, var(--c) 26%, var(--surface));
  border: 2px solid color-mix(in srgb, var(--c) 75%, var(--edge));
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip--plain::before { display: none; }
.el-Bloom { --c: #4FB548; } .el-Breeze { --c: #7FD3F5; } .el-Spore { --c: #A46BD9; } .el-Tide { --c: #3687E0; } .el-Stone { --c: #C9A04A; }
.el-Ember { --c: #FF7A2E; } .el-Frost { --c: #6FE3F0; } .el-Prism { --c: #FF7EC8; } .el-Starlight { --c: #F5D04A; }
.r-Common { --c: #A8A1B8; } .r-Uncommon { --c: #6FCF5A; } .r-Rare { --c: #3F8FF0; } .r-Epic { --c: #B06BF0; } .r-Legendary { --c: #F2C14A; } .r-Mythic { --c: #F2C14A; }

.card {
  background: var(--surface); border: 3px solid var(--edge); border-radius: var(--r-lg);
  box-shadow: 0 6px 0 var(--drop); padding: 22px;
}
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-bottom: 0.3em; }
.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }

/* a phone screenshot in a phone */
.phone {
  position: relative; border-radius: 30px; border: 4px solid var(--ink); background: var(--ink);
  box-shadow: 0 8px 0 var(--drop), 0 18px 40px rgba(20, 12, 40, 0.18); overflow: hidden; aspect-ratio: 1170 / 2532;
  width: 100%;
}
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 26px; }
figure { margin: 0; }
figcaption { font-size: 0.92rem; color: var(--muted); margin-top: 12px; line-height: 1.4; }
figure.shot { width: 100%; max-width: 270px; }
figure.shot figcaption { text-align: center; }

/* a strip of phones: scrolls sideways on a phone, a row on a wide screen */
.shots {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 230px); gap: 20px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding: 6px 4px 18px; margin: 20px -4px 8px; scrollbar-width: thin; scrollbar-color: var(--gold) transparent;
}
.shots > * { scroll-snap-align: start; }
.shots::-webkit-scrollbar { height: 8px; }
.shots::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 99px; border: 2px solid var(--ink); }
@media (min-width: 1000px) {
  .shots { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); overflow-x: visible; scroll-snap-type: none; }
  .shots.many { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 200px; overflow-x: auto; }
}

.frame { border-radius: var(--r-lg); border: 3px solid var(--edge); box-shadow: 0 6px 0 var(--drop); overflow: hidden; background: var(--bg-2); }
.frame img { width: 100%; }

/* ------------------------------------------------------------------ sections */
.section { padding: clamp(56px, 9vw, 112px) 0; position: relative; }
.section--alt { background: var(--bg-2); }
.section--night {
  background: radial-gradient(1200px 500px at 70% 0%, #3A2F7A 0%, transparent 60%), linear-gradient(180deg, #1D1838, #120E25);
  color: var(--night-text);
  --text: var(--night-text); --muted: var(--night-sub); --surface: #2A2350; --edge: #08060F; --drop: #08060F; --link: #FFD873; --rule: rgba(255,255,255,0.16); --tint: rgba(255,255,255,0.06);
}
.kicker {
  display: inline-block; font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: var(--gold-pale); border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 14px 2px; margin-bottom: 14px;
}
.section--night .kicker { background: var(--night-deep); color: var(--gold); border-color: var(--gold); }
.split { display: grid; gap: clamp(28px, 5vw, 64px); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .split { grid-template-columns: 1.05fr 0.95fr; } .split--flip > :first-child { order: 2; } }

/* ------------------------------------------------------------------ landing: hero */
.hero { position: relative; padding: 0 0 clamp(48px, 8vw, 96px); overflow: hidden; isolation: isolate; }
.hero-sky { position: absolute; inset: 0 0 auto 0; height: 560px; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 380px at 78% -60px, rgba(138, 215, 255, 0.45), transparent 70%), linear-gradient(180deg, #DDF1FF 0%, transparent 100%); }
:root[data-theme="dark"] .hero-sky { background: radial-gradient(900px 380px at 78% -60px, rgba(110, 90, 220, 0.4), transparent 70%), linear-gradient(180deg, #1F1A44 0%, transparent 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-sky { background: radial-gradient(900px 380px at 78% -60px, rgba(110, 90, 220, 0.4), transparent 70%), linear-gradient(180deg, #1F1A44 0%, transparent 100%); } }
.sky-moon { position: absolute; top: 44px; right: max(6vw, 24px); width: clamp(54px, 7vw, 86px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #FFFDF2 0%, #FFF1BE 48%, #F2D58A 100%);
  box-shadow: 0 0 0 6px rgba(255, 241, 190, 0.25), 0 0 40px 10px rgba(255, 233, 168, 0.55), inset -10px -8px 0 rgba(214, 178, 96, 0.45);
  animation: glow 4.5s ease-in-out infinite; }
.sky-moon::before, .sky-moon::after { content: ""; position: absolute; border-radius: 50%; background: rgba(214, 178, 96, 0.35); }
.sky-moon::before { width: 22%; height: 22%; left: 24%; top: 50%; }
.sky-moon::after { width: 14%; height: 14%; left: 58%; top: 26%; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 6px rgba(255, 241, 190, 0.22), 0 0 34px 8px rgba(255, 233, 168, 0.45), inset -10px -8px 0 rgba(214, 178, 96, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(255, 241, 190, 0.3), 0 0 64px 18px rgba(255, 233, 168, 0.7), inset -10px -8px 0 rgba(214, 178, 96, 0.45); } }
.cloud { position: absolute; height: 26px; border-radius: 99px; background: rgba(255, 255, 255, 0.85); filter: blur(0.3px); animation: drift 38s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 46%; height: 180%; left: 16%; bottom: 20%; }
.cloud::after { width: 34%; height: 150%; right: 14%; bottom: 25%; }
.cloud.c1 { width: 120px; top: 120px; left: -10%; }
.cloud.c2 { width: 86px; top: 210px; left: -20%; animation-duration: 52s; animation-delay: -20s; opacity: 0.8; }
:root[data-theme="dark"] .cloud { background: rgba(160, 150, 230, 0.18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cloud { background: rgba(160, 150, 230, 0.18); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(125vw); } }

/* the title: a cosy wooden board hanging on ropes, swaying gently (as on the game's title screen) */
.sign { position: relative; display: inline-block; margin: 0 0 22px; padding-top: 64px; transform-origin: 50% 0; animation: sway 5.5s ease-in-out infinite; font-weight: 400; }
.sign .rope { position: absolute; top: 0; width: 5px; height: 76px; border-radius: 3px;
  background: repeating-linear-gradient(180deg, #C9A26A 0 6px, #9C7742 6px 9px); box-shadow: 0 0 0 1.5px rgba(42, 34, 56, 0.55); }
.sign .rope.l { left: 18%; } .sign .rope.r { right: 18%; }
.sign .board { position: relative; display: block; padding: 18px clamp(22px, 4vw, 40px) 22px; border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0) 40%),
    repeating-linear-gradient(180deg, transparent 0 calc(33.33% - 3px), rgba(84, 50, 24, 0.55) calc(33.33% - 3px) 33.33%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 23px),
    linear-gradient(180deg, #C58B52, #A86E3C);
  border: 4px solid #4A2E19; box-shadow: 0 8px 0 #3A2414, 0 16px 30px rgba(40, 20, 8, 0.28), inset 0 -6px 0 rgba(60, 34, 14, 0.35); }
.sign .board::before, .sign .board::after { content: ""; position: absolute; top: 12px; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F4E2B8, #8C6A3A 70%); box-shadow: 0 0 0 2px #4A2E19; }
.sign .board::before { left: calc(18% - 4px); } .sign .board::after { right: calc(18% - 4px); }
.sign .word { display: block; font-family: var(--font-logo); font-size: clamp(2.9rem, 10vw, 5.8rem); line-height: 0.98; letter-spacing: 0.01em; text-align: center;
  color: var(--gold); text-shadow: 0 3px 0 #3A2414, 3px 0 0 #3A2414, -3px 0 0 #3A2414, 0 -3px 0 #3A2414, 3px 3px 0 #3A2414, -3px 3px 0 #3A2414, 3px -3px 0 #3A2414, -3px -3px 0 #3A2414, 0 7px 0 #3A2414; }
.sign .word + .word { color: #FFF8EE; }
@keyframes sway { 0%, 100% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg); } }

.hero .tag { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.3rem, 3.2vw, 1.9rem); line-height: 1.2; margin-bottom: 0.6em; max-width: 22em; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
.hero-copy { text-align: left; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1fr 1.2fr; gap: 64px; } }
@media (max-width: 959px) { .hero-copy { text-align: center; } .hero-copy .lede, .hero .tag { margin-left: auto; margin-right: auto; } .hero-copy .btns { justify-content: center; } }
.hero-art { position: relative; margin: 24px 0 0; }
.hero-art .frame { transform: rotate(1.2deg); }
.hero-art .phone { position: absolute; width: 25%; max-width: 180px; right: -4%; bottom: -20%; transform: rotate(5deg); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: rotate(5deg) translateY(0); } 50% { transform: rotate(3.5deg) translateY(-10px); } }
@media (max-width: 959px) { .hero-art { margin: 28px 8% 16% 0; } .hero-art .phone { right: -10%; width: 27%; } }

/* friends hopping round the picture: faces from one strip (img/friends) */
.friend { position: absolute; z-index: 2; width: clamp(48px, 7vw, 76px); aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--ink);
  background-color: var(--paper); background-image: url(../img/friends.jpg); background-image: image-set(url(../img/friends.webp) type("image/webp"), url(../img/friends.jpg) type("image/jpeg"));
  background-size: 1000% 100%; background-position: calc(var(--n) * 100% / 9) 0; box-shadow: 0 4px 0 var(--drop);
  animation: hop 2.6s cubic-bezier(.45, 0, .55, 1) infinite; animation-delay: var(--d, 0s); transform-origin: 50% 100%; }
@keyframes hop { 0%, 55%, 100% { transform: translateY(0) scale(1, 1); } 62% { transform: translateY(0) scale(1.08, .9); } 76% { transform: translateY(-16px) scale(.96, 1.05); } 90% { transform: translateY(0) scale(1.05, .94); } }
.friend.f1 { top: -26px; left: 6%; } .friend.f2 { top: -34px; left: 44%; } .friend.f3 { top: 18%; right: -18px; }
.friend.f4 { bottom: 14%; left: -22px; } .friend.f5 { bottom: -28px; left: 30%; }
@media (max-width: 559px) { .friend.f2, .friend.f5 { display: none; } }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: clamp(40px, 6vw, 72px); }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--surface); border: 3px solid var(--edge); border-radius: var(--r-md); box-shadow: 0 5px 0 var(--drop); padding: 14px 16px 12px; text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1; color: var(--text); }
.stat span { font-size: 0.92rem; color: var(--muted); font-weight: 800; }

/* landing: things to do */
.feature { display: grid; gap: 18px; grid-template-columns: 112px 1fr; align-items: start; }
.feature .phone { border-width: 3px; border-radius: 18px; box-shadow: 0 5px 0 var(--drop); }
.feature .phone img { border-radius: 15px; }
.feature h3 { margin-top: 6px; }
.feature p { margin: 0; color: var(--muted); }
@media (min-width: 700px) { .feature { grid-template-columns: 130px 1fr; } }

/* landing: dragons */
.dragons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 560px) { .dragons { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .dragons { grid-template-columns: repeat(5, 1fr); } }
.dragon { border-radius: var(--r-md); overflow: hidden; border: 3px solid var(--edge); box-shadow: 0 5px 0 var(--drop); background: var(--bg-2); }
.dragon img { width: 100%; aspect-ratio: 1; }

/* landing + guide: maps */
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 200px), 1fr)); gap: 16px; }
.map { margin: 0; }
.map .frame { border-radius: var(--r-md); }
.map img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.map figcaption { margin-top: 8px; text-align: center; font-weight: 800; color: var(--text); font-size: 0.98rem; }
.map figcaption small { display: block; color: var(--muted); font-weight: 700; }

/* ------------------------------------------------------------------ guide layout */
.guide-head { padding: clamp(32px, 6vw, 72px) 0 24px; }
.guide { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); padding-bottom: 80px; }
.chapters { min-width: 0; }
@media (min-width: 1040px) { .guide { grid-template-columns: 250px minmax(0, 1fr); } }
.toc { font-size: 0.98rem; }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc li { margin: 0; counter-increment: toc; }
.toc a { display: flex; gap: 10px; padding: 7px 12px; border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 800; line-height: 1.3; }
.toc a::before { content: counter(toc); font-family: var(--font-display); color: var(--muted); min-width: 1.3em; }
.toc a:hover { background: var(--tint); }
.toc a.on { background: var(--gold-pale); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.toc a.on::before { color: var(--ink); }
@media (min-width: 1040px) {
  .toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
  .toc nav { padding: 4px 4px 12px; }
  .toc details > summary { display: none; }
}
@media (max-width: 1039px) {
  .toc { position: sticky; top: 66px; z-index: 40; }
  .toc details { background: var(--surface); border: 3px solid var(--edge); border-radius: var(--r-md); box-shadow: 0 4px 0 var(--drop); }
  .toc summary { cursor: pointer; padding: 12px 16px; font-family: var(--font-display); font-weight: 800; font-size: 1.08rem; list-style: none; display: flex; justify-content: space-between; align-items: center; }
  .toc summary::-webkit-details-marker { display: none; }
  .toc summary::after { content: "▾"; font-size: 1.1rem; }
  .toc details[open] summary::after { content: "▴"; }
  .toc details nav { max-height: 60vh; overflow: auto; padding: 0 8px 10px; }
}
.chapter { padding-top: 12px; margin-bottom: clamp(56px, 8vw, 96px); }
.chapter > h2 { display: flex; align-items: center; gap: 14px; }
.chapter > h2 .num {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; font-size: 1.4rem;
  background: var(--gold); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.chapter h3 { margin-top: 1.8em; }
.chapter > p, .chapter > ul, .chapter > ol { max-width: 48em; }
.note {
  border-left: 6px solid var(--gold); background: var(--tint); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 12px 16px; margin: 1.2em 0; max-width: 48em;
}
.note > :last-child { margin-bottom: 0; }
.tip::before { content: "Tip · "; font-family: var(--font-display); font-weight: 800; color: var(--gold-deep); }
:root[data-theme="dark"] .tip::before { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tip::before { color: var(--gold); } }

/* tables */
.table { width: 100%; overflow-x: auto; margin: 1.2em 0 1.6em; border: 3px solid var(--edge); border-radius: var(--r-md); box-shadow: 0 5px 0 var(--drop); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.4; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--rule); vertical-align: top; }
th { font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; background: var(--bg-2); white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .chip { margin: 1px 0; }
@media (max-width: 560px) { table { font-size: 0.88rem; } th, td { padding: 8px 10px; } }
.nowrap { white-space: nowrap; }

/* the skill tree */
.tree { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin: 1.4em 0; }
.branch { --bc: #8A839C; border: 3px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 6px 0 var(--drop); overflow: hidden; }
.branch h4 { margin: 0; padding: 12px 18px 10px; background: color-mix(in srgb, var(--bc) 34%, var(--surface)); border-bottom: 3px solid var(--edge); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.branch h4 small { font-family: var(--font-body); font-weight: 800; color: var(--muted); }
.branch ul { list-style: none; margin: 0; padding: 12px 16px 16px; }
.branch li { margin: 0; padding: 8px 0 8px calc(var(--d, 0) * 20px); border-bottom: 1px dashed var(--rule); position: relative; }
.branch li:last-child { border-bottom: 0; }
.branch li[style*="--d"]::before { content: "↳"; position: absolute; left: calc(var(--d) * 20px - 19px); top: 7px; color: var(--muted); font-weight: 800; }
.branch b { display: inline; }
.branch .cost { float: right; margin-left: 8px; font-size: 0.8rem; color: var(--muted); font-weight: 800; white-space: nowrap; }
.branch .what { display: block; color: var(--muted); font-size: 0.92rem; line-height: 1.35; }
.b-explorer { --bc: #F2C14A; } .b-movement { --bc: #5FCB5A; } .b-gathering { --bc: #FFD45E; } .b-friends { --bc: #6FB6F5; } .b-night { --bc: #F0525C; }

/* key facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 1.2em 0 1.6em; }
.fact { border: 2.5px solid var(--edge); border-radius: var(--r-md); background: var(--surface); padding: 12px 14px; box-shadow: 0 4px 0 var(--drop); }
.fact b { display: block; font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.fact span { font-size: 0.92rem; color: var(--muted); font-weight: 700; line-height: 1.35; display: block; }

/* ------------------------------------------------------------------ Mantidex page */
.poster { position: relative; display: block; cursor: zoom-in; border: 0; padding: 0; background: none; width: 100%; text-align: left; }
.poster .frame { display: block; }
.poster .frame img { width: 100%; }
.poster .hint { position: absolute; right: 14px; bottom: 14px; }
.filters { position: relative; z-index: 30; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); padding: 12px 0; margin: 0 0 18px; border-bottom: 2px solid var(--rule); }
@media (min-width: 900px) { .filters { position: sticky; top: 66px; } }
.filters .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 150px; min-width: 0; }
.field label { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.field input, .field select {
  font: inherit; font-weight: 700; color: var(--text); background: var(--surface); border: 2.5px solid var(--edge); border-radius: 14px; padding: 10px 12px; min-height: 46px; width: 100%;
}
.field--search { flex: 2 1 220px; }
.count { font-weight: 800; color: var(--muted); font-size: 0.95rem; flex: 1 0 100%; }
.habitat { margin: 0 0 18px; border: 3px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 6px 0 var(--drop); overflow: hidden; }
.habitat > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--night-deep); color: #FFF8EE; }
.habitat > summary::-webkit-details-marker { display: none; }
.habitat > summary h3 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.6rem); color: #FFF8EE; }
.habitat > summary .meta { margin-left: auto; color: var(--gold); font-weight: 800; font-size: 0.92rem; text-align: right; }
.habitat > summary::after { content: "▾"; color: var(--gold); font-size: 1.2rem; }
.habitat[open] > summary::after { content: "▴"; }
.lines { display: grid; gap: 14px; padding: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.line { border: 2.5px solid var(--rule); border-radius: var(--r-md); padding: 12px; background: var(--bg); }
.line > header { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.line > header .lno { font-family: var(--font-display); font-weight: 800; color: var(--muted); margin-right: auto; }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mon { text-align: center; min-width: 0; }
.sprite { width: 100%; aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--rule); background-repeat: no-repeat; background-color: var(--paper); }
.mon b { display: block; font-family: var(--font-display); font-size: clamp(0.8rem, 3.3vw, 1rem); line-height: 1.15; margin-top: 6px; overflow-wrap: anywhere; }
.mon small { display: block; color: var(--muted); font-weight: 800; font-size: 0.76rem; }
.line details { margin-top: 10px; font-size: 0.9rem; }
.line details summary { cursor: pointer; font-weight: 800; color: var(--link); }
.line .about { margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.line .powers { list-style: none; padding: 0; margin: 8px 0 0; }
.line .powers li { padding: 6px 0; border-top: 1px dashed var(--rule); line-height: 1.35; }
.line .powers li b { font-family: var(--font-display); }
.line .powers .sig { color: var(--gold-deep); font-weight: 800; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
:root[data-theme="dark"] .line .powers .sig { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .line .powers .sig { color: var(--gold); } }
.empty { display: none; text-align: center; padding: 40px 0; color: var(--muted); font-weight: 800; }

/* the zoomable viewer */
.viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: rgba(12, 9, 24, 0.94); color: #FFF8EE; }
.viewer::backdrop { background: rgba(12, 9, 24, 0.7); }
.viewer .bar { position: fixed; top: 0; left: 0; right: 0; z-index: 2; display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: linear-gradient(rgba(12,9,24,0.95), rgba(12,9,24,0)); }
.viewer .bar b { font-family: var(--font-display); font-size: 1.15rem; margin-right: auto; }
.viewer .bar button { font: inherit; font-weight: 800; color: var(--ink); background: var(--gold); border: 3px solid var(--ink); border-radius: 999px; min-width: 46px; min-height: 46px; padding: 0 14px; cursor: pointer; box-shadow: 0 3px 0 #000; }
.viewer .stage { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; padding: 70px 0 20px; }
.viewer .stage img { margin: 0 auto; width: 100%; max-width: none; height: auto; }
.viewer.zoomed .stage img { width: auto; }

/* ------------------------------------------------------------------ footer */
.foot { border-top: 2px solid var(--rule); padding: 40px 0 56px; color: var(--muted); font-size: 0.95rem; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: center; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: 18px; }
.foot a { color: var(--text); font-weight: 800; }

/* little reveal as sections come in: a soft rise, one after another */
.js .rise { opacity: 0; transform: translateY(22px) scale(.985); transition: opacity .6s ease, transform .7s cubic-bezier(.2, .9, .3, 1.2); transition-delay: calc(var(--i, 0) * 70ms); }
.js .rise.in { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ play: things that give when you touch them */
.btn { transition: transform .18s cubic-bezier(.34, 1.6, .64, 1), box-shadow .18s ease, filter .2s ease; }
.btn:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(3px) scale(1.03, .94); box-shadow: 0 2px 0 var(--ink); transition-duration: .06s; }
.btn:hover .arrow { transform: translateX(3px); }
.theme { transition: transform .25s cubic-bezier(.34, 1.6, .64, 1); }
.theme:hover { transform: rotate(-14deg) scale(1.06); }

/* cards lift and tilt a little */
.card.feature, .stat, .map .frame, .branch, .fact { transition: transform .35s cubic-bezier(.34, 1.4, .64, 1), box-shadow .35s ease; }
@media (hover: hover) {
  .card.feature:hover, .fact:hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 12px 0 var(--drop); }
  .card.feature:nth-child(even):hover { transform: translateY(-6px) rotate(.6deg); }
  .stat:hover { transform: translateY(-5px) rotate(-1.2deg); }
  .map:hover .frame { transform: translateY(-6px) rotate(1deg) scale(1.02); }
  .shot .phone { transition: transform .35s cubic-bezier(.34, 1.4, .64, 1); }
  .shot:hover .phone { transform: translateY(-8px) rotate(-1.5deg); }
  .branch:hover { transform: translateY(-4px); }
}
.card.feature:active, .stat:active { transform: scale(.985); }

/* the stats' numbers count up as they come into view (site.js) */
.stat b { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ the Legendaries: cards that flip over */
.flip { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; perspective: 900px; font: inherit; color: inherit; text-align: center; border-radius: var(--r-md); }
.flip .in { position: relative; display: block; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.3, .5, 1); }
.flip.on .in { transform: rotateY(180deg); }
.flip .face { display: block; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r-md); overflow: hidden; border: 3px solid var(--edge); box-shadow: 0 5px 0 var(--drop); background: var(--bg-2); }
.flip .face img { width: 100%; aspect-ratio: 1; }
.flip .back { position: absolute; inset: 0; transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px;
  background: radial-gradient(120% 90% at 50% 0%, #3B3180, #1D1838); color: #FFF8EE; }
.flip .back b { font-family: var(--font-display); font-size: clamp(.92rem, 2.1vw, 1.2rem); line-height: 1.1; overflow-wrap: anywhere; }
.flip .back small { color: #D9D2FF; font-weight: 800; line-height: 1.25; font-size: clamp(.68rem, 1.5vw, .85rem); }
.flip .back .chip { font-size: .66rem; padding: 4px 8px 3px; }
.flip .back .chip { color: #FFF8EE; background: color-mix(in srgb, var(--c) 30%, #1D1838); }
.flip .back::after { content: "★"; position: absolute; top: 8px; right: 12px; color: var(--gold); font-size: 1rem; }
@media (hover: hover) { .flip:hover .face:first-child { transform: translateY(-4px) rotate(-1deg); transition: transform .3s cubic-bezier(.34, 1.4, .64, 1); } }
.flip-hint { text-align: center; color: var(--muted); font-weight: 800; font-size: .92rem; margin: 14px 0 0; }

/* ------------------------------------------------------------------ dusk: the sky turns as you scroll toward the night */
.dusk { position: relative; height: clamp(160px, 24vw, 280px); overflow: hidden; margin-bottom: -2px;
  background: linear-gradient(180deg, var(--bg) 0%, #F6C7A0 30%, #B0659A 52%, #4A3784 72%, #1D1838 96%); }
:root[data-theme="dark"] .dusk { background: linear-gradient(180deg, var(--bg) 0%, #2A2050 45%, #1D1838 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dusk { background: linear-gradient(180deg, var(--bg) 0%, #2A2050 45%, #1D1838 100%); } }
.dusk .sun { position: absolute; left: 50%; bottom: 0; width: clamp(90px, 14vw, 160px); aspect-ratio: 1; margin-left: calc(clamp(90px, 14vw, 160px) / -2); border-radius: 50%;
  background: radial-gradient(circle, #FFE7A8 0%, #FFB878 55%, rgba(255, 140, 110, 0) 72%);
  transform: translateY(calc(5% + var(--p, 0) * 75%)); opacity: calc(1 - var(--p, 0) * .8); }
.dusk .sun { -webkit-mask-image: linear-gradient(180deg, #000 25%, transparent 70%); mask-image: linear-gradient(180deg, #000 25%, transparent 70%); }
:root[data-theme="dark"] .dusk .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dusk .sun { display: none; } }
.dusk .first-stars { position: absolute; inset: 0; opacity: calc(var(--p, 0) * 1.4 - .2); }

/* ------------------------------------------------------------------ night: stars, sparkles, and the moon */
.section--night { overflow: hidden; isolation: isolate; }
.stars, .stars::after { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 72%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 44% 30%, #FFE9A8 50%, transparent 51%), radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 58%, #D9D2FF 50%, transparent 51%), radial-gradient(1px 1px at 90% 26%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 84%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 52% 90%, #FFE9A8 50%, transparent 51%);
  background-size: 420px 420px; animation: twinkle 5s ease-in-out infinite; }
.stars::after { content: ""; background-size: 300px 300px; background-position: 140px 90px; animation-duration: 7s; animation-delay: -2.5s; }
.first-stars.stars { z-index: 0; }
@keyframes twinkle { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.night-moon { position: absolute; top: clamp(24px, 5vw, 56px); right: clamp(16px, 6vw, 80px); z-index: -1; width: clamp(64px, 9vw, 120px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #FFFDF2, #F4E2A6 60%, #D9B866 100%); animation: glow 5s ease-in-out infinite; }
.spark { position: absolute; bottom: -10px; z-index: -1; width: var(--s, 6px); height: var(--s, 6px); pointer-events: none;
  background: radial-gradient(circle, #FFF6CC 0%, #F2C14A 45%, transparent 70%); border-radius: 50%;
  animation: rise var(--t, 9s) linear infinite; animation-delay: var(--d, 0s); opacity: 0; }
@keyframes rise { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 12% { opacity: .9; } 80% { opacity: .7; } 100% { transform: translate(var(--x, 20px), -620px) scale(1.1); opacity: 0; } }

/* ------------------------------------------------------------------ the guide: chapter badges pop in */
.chapter > h2 .num { transition: transform .5s cubic-bezier(.34, 1.8, .64, 1); }
.js .chapter:not(.seen) > h2 .num { transform: scale(.4) rotate(-25deg); }
.toc a { transition: background-color .2s ease, transform .25s cubic-bezier(.34, 1.6, .64, 1); }
.toc a.on { transform: translateX(4px); }

/* ------------------------------------------------------------------ the Mantidex: lines pop in, Mantites hop */
.habitat[open] .line { animation: pop .45s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes pop { from { transform: translateY(16px) scale(.92); } 70% { transform: translateY(-3px) scale(1.01); } to { transform: none; } }      /* no fade: a paused tab still shows them */
.sprite { transition: transform .3s cubic-bezier(.34, 1.8, .64, 1); }
@media (hover: hover) { .mon:hover .sprite { transform: translateY(-8px) rotate(-3deg) scale(1.04); } }
.mon:active .sprite { transform: scale(.94); }
.habitat > summary { transition: background-color .2s ease; }
.habitat > summary:hover { background: #3A3474; }
.poster .hint { animation: nudge 3.2s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-6px) rotate(-3deg); } 86% { transform: translateY(0) rotate(2deg); } }

/* layout: on a phone the guide's contents bar sits under the header, so a jump lands below both */
@media (max-width: 1039px) { html:has(.toc) { scroll-padding-top: 140px; } }
/* layout: the guide's paragraphs keep a comfortable line, and its figures line up with them */
.chapter > p, .chapter > ul, .chapter > ol, .chapter .note { max-width: 46em; }
/* layout: the feature cards get room for their words; the theme switch reads in the dark too */
.features { grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); }
.theme { border-color: color-mix(in srgb, var(--text) 75%, transparent); }
.sky-moon { top: clamp(84px, 9vw, 110px); }

/* the night section after the dusk band carries the dusk's last colour on, with no seam */
.dusk + .section--night { background: radial-gradient(900px 460px at 82% 18%, rgba(96, 76, 200, 0.42), transparent 65%), linear-gradient(180deg, #1D1838 0%, #140F2A 100%); }

/* off screen, nothing animates (site.js marks what's in view) */
.js [data-live]:not(.live), .js [data-live]:not(.live) * { animation-play-state: paused !important; }

/* a calm version for anyone who'd rather not have things move */
@media (prefers-reduced-motion: reduce) {
  .sign, .sky-moon, .friend, .hero-art .phone, .stars, .stars::after, .night-moon, .cloud, .poster .hint { animation: none !important; }
  .spark { display: none; }
  .js .rise, .js .chapter:not(.seen) > h2 .num { opacity: 1; transform: none; }
  .flip .in { transition: none; }
}

/* Plain reading pages (privacy, help) */
.prose { max-width: 760px; }
.prose h1 { margin-bottom: 4px; }
.prose h2 { margin-top: 34px; }
.prose h3 { margin-top: 22px; font-size: 1.1rem; }
.prose p, .prose li { line-height: 1.65; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 6px 0; }
.prose .muted { opacity: .7; }
.prose a:not(.btn) { text-decoration: underline; }
