/*
 * Map Instinct website. Colours are the app's own palette (AppColorPalette);
 * the site is dark only, like the game. Logical properties keep Arabic
 * mirrored without a second stylesheet.
 */
:root {
  color-scheme: dark;
  --bg: #0d1d30;
  --surface: #19334d;
  --surface-2: #203e59;
  --surface-3: #274b68;
  --surface-emphasis: #285c80;
  --border: #354e68;
  --border-strong: #4c6c8c;
  --border-accent: #77a7d9;
  --text: #f4f7fa;
  --text-2: #d7e1e9;
  --muted: #a3afbe;
  --blue: #6fa8d6;
  --teal: #8ac7b8;
  --amber: #f0bd68;
  --amber-light: #f8d797;
  --amber-edge: #b98434;
  --edge: #0b1826;
  --radius: 22px;
  --shadow: 0 18px 40px rgba(0, 7, 16, 0.45);
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Where the decorative light sits and which way the title gradient runs; mirrored for right-to-left. */
  --glow-top: 85% -8%;
  --glow-side: -12% 38%;
  --orb-light: 36% 32%;
  --title-angle: 90deg;
}
html[dir="rtl"] { --glow-top: 15% -8%; --glow-side: 112% 38%; --orb-light: 64% 32%; --title-angle: 270deg; }
:lang(ar) { --font: 'Nunito', system-ui, -apple-system, 'Geeza Pro', 'Segoe UI', 'Noto Sans Arabic', Tahoma, sans-serif; }
:lang(hi) { --font: 'Nunito', 'Kohinoor Devanagari', 'Noto Sans Devanagari', 'Nirmala UI', 'Mangal', sans-serif; }
:lang(ja) { --font: 'Nunito', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic UI', Meiryo, sans-serif; }
:lang(ko) { --font: 'Nunito', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif; }
:lang(zh-Hans) { --font: 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif; }
:lang(zh-Hant) { --font: 'Nunito', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 92px; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-2);
  background:
    radial-gradient(1100px 680px at var(--glow-top), rgba(32, 89, 135, 0.6), transparent 62%),
    radial-gradient(900px 620px at var(--glow-side), rgba(20, 81, 96, 0.38), transparent 62%),
    var(--bg);
  background-repeat: no-repeat;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3 { color: var(--text); line-height: 1.15; margin: 0 0 0.5em; font-weight: 900; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 5.4vw, 4.25rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
p { margin: 0 0 1em; }
strong { color: var(--text); }
.wrap { width: min(100% - 40px, 1180px); margin-inline: auto; }
.narrow { width: min(100% - 40px, 820px); margin-inline: auto; }
.skip {
  position: absolute; inset-inline-start: 12px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 12px; background: var(--amber); color: var(--bg); font-weight: 900;
}
.skip:focus { top: 12px; color: var(--bg); }
.icon { width: 1.25em; height: 1.25em; flex: none; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5em; margin: 0 0 1rem; padding: 0.4em 0.9em;
  border-radius: 999px; background: rgba(111, 168, 214, 0.14); box-shadow: inset 0 0 0 1px rgba(119, 167, 217, 0.35);
  color: var(--blue); font-size: 0.8125rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
:is(:lang(ar), :lang(hi), :lang(ja), :lang(ko), :lang(zh)) :is(h1, h2, h3, .eyebrow, .toc h2, .site-footer h2) { letter-spacing: 0; text-transform: none; }
/* Arabic letters join, so they get no letter-spacing (above). Arabic and Devanagari also reach
   further above and below the line than Latin, so they need taller lines. */
:is(:lang(ar), :lang(hi)) :is(h1, h2, h3) { line-height: 1.4; }
html:lang(ar) body { font-size: 1.125rem; line-height: 1.8; }

/* Buttons: the app's raised, pressable look. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55em; min-height: 52px; padding: 0 1.5em;
  border: 0; border-radius: 18px; font: inherit; font-weight: 900; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary { color: var(--bg); background: linear-gradient(180deg, var(--amber-light), var(--amber)); box-shadow: 0 5px 0 var(--amber-edge), 0 14px 30px rgba(240, 189, 104, 0.22); }
.btn-primary:hover { color: var(--bg); transform: translateY(-2px); filter: brightness(1.04); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--amber-edge); }
.btn-ghost { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong), 0 5px 0 var(--edge); }
.btn-ghost:hover { color: var(--text); transform: translateY(-2px); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 29, 48, 0.8); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(53, 78, 104, 0.6);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 900; font-size: 1.2rem; text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.main-nav { margin-inline-start: auto; }
.main-nav a { padding: 8px 12px; border-radius: 12px; color: var(--text-2); font-weight: 700; text-decoration: none; white-space: nowrap; }
.main-nav a:hover { background: rgba(111, 168, 214, 0.12); color: var(--text); }

.lang-picker { position: relative; }
.lang-picker > summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 14px;
  color: var(--text); font-weight: 700; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
}
.lang-picker > summary:hover, .lang-picker[open] > summary { box-shadow: inset 0 0 0 1px var(--border-accent); }
.lang-picker ul {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; min-width: 250px; max-height: min(70vh, 540px); overflow: auto;
  margin: 0; padding: 8px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow);
}
.lang-picker.up ul { top: auto; bottom: calc(100% + 8px); }
.lang-picker a { display: block; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 700; text-decoration: none; white-space: nowrap; }
.lang-picker a:hover { background: var(--surface-3); color: var(--text); }
.lang-picker a[aria-current] { background: rgba(240, 189, 104, 0.16); color: var(--amber); }
/* Each language name uses its own script's fonts, e.g. Japanese letterforms for 日本語 on a Chinese page. */
.lang-picker a, .chooser-list a { font-family: var(--font); }
@media (max-width: 560px) {
  .header-inner { gap: 8px; }
  .brand span { font-size: 1.05rem; }
  .lang-picker > summary span { display: none; }
  .lang-picker ul { grid-template-columns: 1fr; min-width: 190px; }
}

/* Hero banner */
.hero { position: relative; padding: clamp(40px, 7vw, 96px) 0 clamp(40px, 6vw, 80px); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-bg::before, .hero-bg::after {
  content: ''; position: absolute; top: -140px; inset-inline-end: -240px; width: 920px; height: 920px; border-radius: 50%;
}
.hero-bg::before { background: radial-gradient(circle at var(--orb-light), rgba(111, 168, 214, 0.34), rgba(20, 81, 96, 0.14) 46%, transparent 70%); }
.hero-bg::after {
  background:
    repeating-radial-gradient(circle, transparent 0 58px, rgba(119, 167, 217, 0.11) 59px 60px),
    repeating-conic-gradient(from 0deg, transparent 0 14deg, rgba(119, 167, 217, 0.08) 14deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 70%);
  mask-image: radial-gradient(circle, #000 52%, transparent 70%);
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: center; gap: 48px; }
.hero h1 strong {
  /* The gradient only paints inside the box; the padding keeps tall Arabic and Devanagari letters whole. */
  padding-block: 0.25em; font-weight: 900; color: transparent;
  background: linear-gradient(var(--title-angle), var(--amber-light), var(--amber) 45%, var(--teal));
  -webkit-background-clip: text; background-clip: text;
}
.lead { max-width: 38ch; color: var(--text-2); font-size: clamp(1.125rem, 1.7vw, 1.35rem); }
.hero-visual { display: grid; place-items: center; }
.hero-art {
  width: min(520px, 86vw); border-radius: 22%;
  box-shadow: 0 40px 90px rgba(0, 5, 12, 0.6), 0 0 0 1px rgba(119, 167, 217, 0.22), 0 0 120px rgba(111, 168, 214, 0.25);
  animation: float 7s ease-in-out infinite;
}
.stores { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.store-badge { display: inline-block; border-radius: 12px; }
.store-badge img { width: auto; height: 54px; }
.store-badge.play img { height: 80px; margin: -13px -10px; }
/* A phone or tablet only needs its own store; js/site.js marks the platform,
   so computers and visitors without scripts see both badges. */
[data-platform="ios"] .store-badge.play,
[data-platform="android"] .store-badge.app-store { display: none; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .lead { margin-inline: auto; }
  .stores { justify-content: center; }
  .hero-art { width: min(380px, 80vw); }
}

.section { position: relative; padding: clamp(24px, 5vw, 64px) 0 clamp(56px, 8vw, 96px); }
.about-card {
  padding: clamp(28px, 5vw, 48px); border-radius: 28px; text-align: center;
  background: radial-gradient(620px 300px at 50% 0%, rgba(111, 168, 214, 0.22), transparent 70%), linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: inset 0 0 0 1px var(--border), 0 6px 0 var(--edge);
}
.about-card p { max-width: 60ch; margin: 0 auto; font-size: 1.125rem; }

/* Inner pages */
.page-hero { padding: clamp(44px, 7vw, 84px) 0 28px; text-align: center; }
.page-hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.25rem); }
.page-hero .intro { max-width: 62ch; margin-inline: auto; color: var(--muted); font-size: 1.125rem; }
.updated { color: var(--muted); font-weight: 700; }

.legal-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: start; gap: 48px; padding-bottom: 96px; }
.toc { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; padding: 20px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.toc h2 { margin-bottom: 10px; color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }
.toc ol { display: grid; gap: 6px; margin: 0; padding-inline-start: 1.2em; font-size: 0.9375rem; line-height: 1.4; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--amber); }
.legal { max-width: 780px; }
.legal section { margin-bottom: 36px; padding-top: 12px; }
.legal h2 { font-size: 1.5rem; margin-bottom: 0.6em; }
.legal h3 { margin-top: 1.4em; font-size: 1.125rem; }
.legal ul, .legal ol { display: grid; gap: 0.45em; margin: 0 0 1em; padding-inline-start: 1.3em; }
.legal li::marker { color: var(--blue); }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--border); }
.legal table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.legal th, .legal td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.legal thead th { color: var(--text); background: var(--surface-2); }
.legal tbody th { color: var(--text); font-weight: 800; }
.legal tr:last-child > * { border-bottom: 0; }
.translation-note, .note { padding: 14px 18px; border-radius: 16px; color: var(--text); background: rgba(240, 189, 104, 0.1); box-shadow: inset 0 0 0 1px rgba(240, 189, 104, 0.35); }
@media (max-width: 900px) { .legal-layout { grid-template-columns: 1fr; } .toc { position: static; max-height: none; } }

.support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-bottom: 96px; }
.card { padding: 32px; border-radius: var(--radius); background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: inset 0 0 0 1px var(--border), 0 6px 0 var(--edge); }
.card > .icon { width: 36px; height: 36px; margin-bottom: 14px; color: var(--amber); }
.card .small { margin: 16px 0 0; color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 800px) { .support-grid { grid-template-columns: 1fr; } }

.not-found { padding: 96px 0; text-align: center; }
.not-found .big {
  margin: 0; font-size: clamp(5rem, 16vw, 9rem); font-weight: 900; line-height: 1; color: transparent;
  background: linear-gradient(90deg, var(--amber-light), var(--teal)); -webkit-background-clip: text; background-clip: text;
}
.challenge img { width: 96px; height: 96px; margin: 0 auto 20px; border-radius: 24px; }
.challenge-name { margin: 0 0 8px; font-size: 1.25rem; font-weight: 800; color: var(--amber-light); overflow-wrap: anywhere; }
.challenge .stores { justify-content: center; margin-top: 28px; }
.challenge-open { margin: 24px 0 0; }
.chooser-main { display: grid; place-content: center; min-height: 100vh; padding: 40px 0; text-align: center; }
.chooser-main img { width: 96px; height: 96px; margin: 0 auto 20px; border-radius: 24px; }
.chooser-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.chooser-list a { display: block; padding: 14px; border-radius: 16px; color: var(--text); font-weight: 800; text-decoration: none; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.chooser-list a:hover { box-shadow: inset 0 0 0 1px var(--border-accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: rgba(10, 22, 36, 0.62); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 32px; padding: 56px 0 36px; }
.footer-brand p { max-width: 34ch; margin-top: 14px; color: var(--muted); }
.site-footer h2 { margin-bottom: 14px; color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }
.site-footer nav ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.site-footer a:not(.brand) { color: var(--text-2); text-decoration: none; }
.site-footer a:not(.brand):hover { color: var(--amber); }
.footer-contact address { color: var(--muted); font-size: 0.9375rem; font-style: normal; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0 32px; border-top: 1px solid rgba(53, 78, 104, 0.6); color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .site-header, .site-footer, .toc, .skip { display: none; }
  body { color: #000; background: #fff; }
  h1, h2, h3, strong { color: #000; }
  .legal-layout { display: block; }
}
