/* Sero design tokens + shared base for every non-game page (games keep quests.css).
   One place for colours, shapes, shadows and type, so the pages read as one design:
   a calm sky-to-sand canvas, white cards, navy-tinted text, and game-like accents
   (gold rewards, mint progress, lavender "new", pressable buttons). */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Noto+Sans+Hebrew:wght@100..900&display=swap');

:root {
    /* canvas */
    --bg-top: #dfeefa;
    --bg-mid: #eef3f9;
    --bg-bottom: #f9f5ee;
    --sheet-bg: #f3f6fa;           /* popups and the pages shown inside them */

    /* text */
    --ink: #22324a;                /* titles */
    --ink-2: #4a5a70;              /* body */
    --ink-3: #7b889c;              /* secondary */
    --ink-4: #a9b3c2;              /* hints, inactive */

    /* surfaces */
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.86);
    --surface-2: #f2f5f9;          /* insets, tracks */
    --surface-3: #e5ebf2;
    --line: #e6ebf1;
    --edge: rgba(255, 255, 255, 0.9);

    /* brand + accents (each: main, light, ink for text on soft, soft background) */
    --brand: #3a8ada;  --brand-2: #5ea7ec;  --brand-ink: #1f5e9c;  --brand-soft: #e4f0fc;
    --mint: #36ab82;   --mint-2: #5cc59e;   --mint-ink: #1d7454;   --mint-soft: #e0f4eb;
    --gold: #f0ad35;   --gold-2: #f8ca5f;   --gold-ink: #8a5f0e;   --gold-soft: #fff3d6;
    --lav: #8a7ae8;    --lav-2: #a597f2;    --lav-ink: #5445b3;    --lav-soft: #eeebfe;
    --coral: #ec8164;  --coral-2: #f4a086;  --coral-ink: #ab4b31;  --coral-soft: #fdebe4;
    --danger: #d64f4b; --danger-soft: #fce8e7;

    /* on the brand colour: text, the pressable edge under a button, and its glow (dark mode swaps all three) */
    --on-brand: #ffffff; --brand-edge: var(--brand-ink); --brand-glow: rgba(31, 94, 156, 0.6);

    /* the "Sero" word next to the cube: a soft top-to-bottom gradient and a glow */
    --wordmark: #4788e6; --wordmark-2: #74a2e6; --wordmark-glow: #4788e633;

    /* shape */
    --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;

    /* elevation: soft, navy-tinted */
    --sh-1: 0 1px 2px rgba(31, 52, 82, 0.06), 0 3px 10px -4px rgba(31, 52, 82, 0.12);
    --sh-2: 0 1px 2px rgba(31, 52, 82, 0.05), 0 10px 26px -10px rgba(31, 52, 82, 0.2);
    --sh-3: 0 2px 6px rgba(31, 52, 82, 0.06), 0 26px 50px -18px rgba(31, 52, 82, 0.35);

    /* type */
    --font: "Montserrat", "Noto Sans Hebrew", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-he: "Noto Sans Hebrew", "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* layout: content width with a 20px gutter (capped on wide screens below) */
    --gutter: 20px;
    --page: calc(100% - 2 * var(--gutter));

    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    /* the page canvas: sky at the top, sand at the bottom, soft light around the edges */
    --canvas:
        radial-gradient(90% 45% at 100% 0%, rgba(232, 226, 253, 0.75), transparent 70%),
        radial-gradient(80% 40% at 0% 8%, rgba(207, 233, 251, 0.9), transparent 70%),
        radial-gradient(100% 45% at 50% 100%, rgba(252, 236, 214, 0.8), transparent 70%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 46%, var(--bg-bottom) 100%);
}

@media (min-width: 584px) {
    :root { --page: 34rem; }
}

/* Dark mode ("Night Sky" colours): html[data-theme="dark"], set from the `theme` cookie by each
   page's first script (Settings > Appearance, or the toggle on the onboarding slides). */
html[data-theme="dark"] {
    color-scheme: dark;
    --bg-top: #121c45;
    --bg-mid: #151c46;
    --bg-bottom: #221f50;
    --sheet-bg: #1b2353;

    --ink: #f0f3ff;
    --ink-2: #c6cdec;
    --ink-3: #939dc8;
    --ink-4: #646e9c;

    --surface: #283270;
    --surface-glass: rgba(255, 255, 255, 0.075);
    --surface-2: rgba(255, 255, 255, 0.07);
    --surface-3: rgba(255, 255, 255, 0.14);
    --line: rgba(255, 255, 255, 0.1);
    --edge: rgba(255, 255, 255, 0.1);

    --brand: #2cc9b4;  --brand-2: #6ff0dc;  --brand-ink: #8ff0e1;  --brand-soft: rgba(44, 201, 180, 0.16);
    --mint: #3ad69b;   --mint-2: #6ce8b6;   --mint-ink: #9af0cb;   --mint-soft: rgba(58, 214, 155, 0.16);
    --gold: #fbc546;   --gold-2: #fdd979;   --gold-ink: #fde3a0;   --gold-soft: rgba(251, 197, 70, 0.16);
    --lav: #a48cff;    --lav-2: #c0afff;    --lav-ink: #d9cffe;    --lav-soft: rgba(164, 140, 255, 0.18);
    --coral: #ff7f96;  --coral-2: #ffa3b4;  --coral-ink: #ffc2cd;  --coral-soft: rgba(255, 127, 150, 0.16);
    --danger: #ff6b6b; --danger-soft: rgba(255, 107, 107, 0.15);
    --on-brand: #052e2a; --brand-edge: #128877; --brand-glow: rgba(44, 201, 180, 0.45);
    --wordmark: #aad4ff; --wordmark-2: #dbedff; --wordmark-glow: #FFFFFF33;

    --sh-1: 0 2px 10px -2px rgba(4, 8, 30, 0.45);
    --sh-2: 0 14px 34px -14px rgba(4, 8, 30, 0.7);
    --sh-3: 0 30px 60px -20px rgba(2, 4, 20, 0.8);

    /* the dark canvas: a few star layers over an aurora glow */
    --canvas:
        radial-gradient(circle at 30px 40px, rgba(255, 255, 255, 0.85) 0 1px, transparent 1.6px) 0 0 / 230px 230px,
        radial-gradient(circle at 160px 110px, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.6px) 0 0 / 230px 230px,
        radial-gradient(circle at 95px 185px, rgba(255, 255, 255, 0.7) 0 1.3px, transparent 1.9px) 0 0 / 230px 230px,
        radial-gradient(circle at 205px 25px, rgba(255, 255, 255, 0.4) 0 1px, transparent 1.6px) 0 0 / 230px 230px,
        radial-gradient(70% 38% at 88% 0%, rgba(122, 92, 240, 0.45), transparent 70%),
        radial-gradient(60% 34% at 0% 10%, rgba(40, 190, 205, 0.26), transparent 70%),
        radial-gradient(90% 40% at 50% 100%, rgba(255, 140, 120, 0.1), transparent 70%),
        linear-gradient(180deg, var(--bg-top), var(--bg-mid) 50%, var(--bg-bottom));
}
html[data-theme="dark"] .s-btn.ghost { color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28); }

html { background: var(--bg-mid); }

body {
    font-family: var(--font);
    color: var(--ink-2);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
html[dir="rtl"] body { font-family: var(--font-he); }
button, input, select, textarea { font-family: inherit; }

/* The canvas stays still while the page scrolls. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--canvas);
}
/* Pages shown inside a popup sit on the popup's own plain surface. */
body.sheet { background: var(--sheet-bg) !important; }
body.sheet::before { display: none; }

/* Loading screen, the same one the games have (quests.css): the Sero cube fills with colour from
   the bottom until the page shows itself. Every page hides its body while it loads, then sets
   body visibility to visible. The hidden body hides the canvas anyway, so until then ::before
   is the grey cube instead. */
html body:not([style*="visible"])::before,
html body:not([style*="visible"])::after {
    content: "";
    display: block;
    position: fixed;
    inset: auto;
    left: 50%;
    top: 50%;
    width: 170px;
    height: 187px;
    margin-left: -85px;
    margin-top: -104px;
    background: url(logo-cube.webp) no-repeat center / contain;
    visibility: visible;
    pointer-events: none;
    z-index: 2147483000;
}
html body:not([style*="visible"])::before {
    filter: grayscale(1);
    opacity: 0.3;
}
html body:not([style*="visible"])::after {
    -webkit-clip-path: inset(100% 0 0 0);
    clip-path: inset(100% 0 0 0);
    animation: cubefill 1.5s ease-in-out infinite;
}
@keyframes cubefill {
    0% { -webkit-clip-path: inset(100% 0 0 0); clip-path: inset(100% 0 0 0); }
    70%, 100% { -webkit-clip-path: inset(0 0 0 0); clip-path: inset(0 0 0 0); }
}
html[data-theme="dark"] body:not([style*="visible"])::before { opacity: 0.16; }

/* ---------- shared pieces (s- prefix: safe next to the older page classes) ---------- */

/* Section heading: title + optional detail on the other side */
.s-section {
    width: var(--page);
    margin: 26px auto 10px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.s-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.005em;
}
.s-meta {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Card */
.s-card {
    width: var(--page);
    box-sizing: border-box;
    margin-inline: auto;
    padding: 16px;
    background: var(--surface-glass);
    border: 1px solid var(--edge);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-2);
}
.s-cardhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-block-end: 12px;
}

/* Round tinted icon holder */
.s-ibub {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
}
.s-ibub img { width: 26px; height: 26px; object-fit: contain; }

/* Pill chip */
.s-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--ink-2);
    white-space: nowrap;
}

/* Popup header (title of a sheet) */
.s-sheet-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
    text-align: center;
    margin: 22px 56px 4px;
}
.s-sheet-sub {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-3);
    text-align: center;
    margin: 0 24px 10px;
}

/* Buttons for pages that do not use main.css */
.s-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 24px;
    box-sizing: border-box;
    border: 0;
    border-radius: var(--r-md);
    background: linear-gradient(180deg, var(--brand-2), var(--brand));
    color: var(--on-brand);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 0 var(--brand-edge), 0 12px 20px -10px var(--brand-glow);
    transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.s-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-edge); }
.s-btn.ghost {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 3px 0 var(--surface-3), 0 10px 18px -12px rgba(31, 52, 82, 0.4);
}
.s-btn.ghost:active { box-shadow: 0 1px 0 var(--surface-3); }
