/* Planete Karia — single design system */
/* 1 font, 3 text sizes, 5 brand colors, semantic + structural classes. */

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/manrope-variable.woff2') format('woff2');
}

:root {
    --font-family: 'Manrope', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Text sizes — the whole text hierarchy fits on these values. --text-xs is reserved for
       micro-labels that must fit in a tiny fixed space (e.g. a badge pinned on a city grid tile)
       and is never a substitute for --text-sm in ordinary body/caption text. */
    --text-lg: 1.1rem;
    --text-md: 0.875rem;
    --text-sm: 0.7rem;
    --text-xs: 0.5625rem;

    /* Only 2 weights: normal and bold */
    --weight-text: 500;
    --weight-bold: 700;

    /* A single size for decorative glyphs (emoji/icons), outside the 3 text sizes */
    --glyph-size: 1.5rem;

    /* Neutrals — cool paper / near-black ink */
    --bg: #f7f8fb;
    --surface: #ffffff;
    --surface-rgb: 255, 255, 255;
    --text: #12161f;
    --muted: #5c6779;
    --muted-rgb: 92, 103, 121;
    --border: #dde3ea;
    --bg-card: var(--surface);

    /* 5 brand colors maximum — applied everywhere, including category legends (Ville, Zoo) */
    --accent: #e2593f;
    --accent-rgb: 226, 89, 63;
    --secondary: #8b5cf6;
    --secondary-rgb: 139, 92, 246;
    --success: #1b8a5a;
    --success-rgb: 27, 138, 90;
    --warning: #a5690a;
    --warning-rgb: 165, 105, 10;
    --error: #b8264f;
    --error-rgb: 184, 38, 79;

    --btn-text: #ffffff;
    --on-accent: #ffffff;
    --btn-gradient-from: var(--accent);
    --btn-shadow-rgb: var(--accent-rgb);
    --btn-secondary-rgb: var(--muted-rgb);
    --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.25);

    --input-bg: var(--surface);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    /* Small shadow under an emoji glyph laid on an illustration (City map) */
    --shadow-glyph: drop-shadow(0 1px 1px rgba(var(--overlay-ink-rgb), 0.15));
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --shadow-toast: 0 4px 16px rgba(0, 0, 0, 0.18);

    --overlay-white-rgb: 255, 255, 255;
    --overlay-ink-rgb: 0, 0, 0;
    --scrim-navy-rgb: 11, 17, 32;
    --overlay-dark: rgba(var(--overlay-ink-rgb), 0.45);
    --scrollbar-thumb: rgba(var(--overlay-ink-rgb), 0.15);
    --story-found-rgb: var(--success-rgb);
    --story-lost-rgb: var(--error-rgb);

    /* Compagnon: tints the SVG accessories only (star/paws/wings/scar) — fixed regardless of theme,
       not derived from --accent/--warning/--success, because the ball's background is a static image
       independent of light/dark (see assets/css/components/companion.css) */
    --companion-tint-default: #ffd66b;
    /* Compagnon: golden glow of the happy ball, fixed regardless of theme for the same reason */
    --companion-glow-rgb: 255, 197, 66;
    /* Compagnon: white ball (gradient) and dark eyes of the SVG, fixed regardless of theme for the same reason */
    --companion-body-light: #ffffff;
    --companion-body-mid: #eef3f5;
    --companion-body-shade: #c9d6da;
    --companion-eye: #2b2b35;
    --companion-eye-glint: #ffffff;

    /* Ville: grass behind the building illustrations of the Buildings tab — fixed regardless of theme, like the images */
    --city-thumb-grass: #8bc34a;
    /* Ville: dimensions of the map and of the Buildings gallery (mobile values below) */
    --city-island-max: 620px;
    --city-badge-h: 16px;
    --city-avatar-size: 14px;
    --city-card-min: 220px;
    --city-card-media-h: 140px;
    --city-thumb-h: 72px;
    --city-qty-w: 8em;

    /* Sizes of the button loading spinner and click ripple (main.css) */
    --spinner-size: 14px;
    --ripple-size: 40px;

    /* Border widths: hairline, strong (focus outline, active underline), accent (left/bottom marker), thick (card top) */
    --border-w: 1px;
    --border-w-strong: 2px;
    --border-w-accent: 3px;
    --border-w-thick: 4px;

    --radius-xs: 3px;
    --radius-sm: 9px;
    --radius: 13px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --space: 16px;
    --max: 1280px;

    /* Single spacing scale: every padding, margin and gap reads one of these (CssHardcodedValuesTest); --space drives the --pad-* tokens */
    --gap-2xs: 2px;
    --gap-xs: 4px;
    --gap-sm: 6px;
    --gap-md: 10px;
    --gap-lg: 12px;
    --gap-xl: 24px;

    --pad-card: var(--space);
    --pad-hero: var(--space);
    --pad-content-wrap: var(--space);

    /* Menu gauche */
    --sidebar-w: 260px;
    --sidebar-bg: var(--surface);
    --sidebar-shadow: 2px 0 16px rgba(var(--overlay-ink-rgb), 0.06);
    --sidebar-text: var(--muted);
    --sidebar-text-active: var(--text);
    --sidebar-hover: rgba(var(--overlay-ink-rgb), 0.04);
    --sidebar-active-bg: rgba(var(--accent-rgb), 0.12);
    --sidebar-divider: var(--border);
    --topbar-h: 56px;

    --z-dropdown: 100;
    --z-topbar: 190;
    --z-sidebar: 200;
    --z-modal: 500;
    --z-tooltip: 9999;
}

/* Mobile density: the only place where spacing and text tokens are redefined for phones (no component @media for them) */
@media (max-width: 900px) {
    :root {
        --topbar-h: 96px;
        --gap-md: 8px;
        --gap-lg: 10px;
        --gap-xl: 16px;
        --space: 12px;
        --glyph-size: 1.25rem;
        --text-lg: 1rem;
        --city-avatar-size: 12px;
        --city-card-min: 160px;
        --city-card-media-h: 110px;
    }
}

[data-theme="dark"] {
    --bg: #10131a;
    --surface: #1a1e29;
    --surface-rgb: 26, 30, 41;
    --text: #eef1f5;
    --muted: #8b93a3;
    --muted-rgb: 139, 147, 163;
    --border: #262c3a;

    --accent: #f0785c;
    --accent-rgb: 240, 120, 92;
    --secondary: #a78bfa;
    --secondary-rgb: 167, 139, 250;
    --success: #3aa374;
    --success-rgb: 58, 163, 116;
    --warning: #d99a2e;
    --warning-rgb: 217, 154, 46;
    --error: #d65c7c;
    --error-rgb: 214, 92, 124;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --scrollbar-thumb: rgba(var(--overlay-white-rgb), 0.12);

    --sidebar-bg: #171a22;
    --sidebar-shadow: 2px 0 16px rgba(var(--overlay-ink-rgb), 0.3);
    --sidebar-hover: rgba(var(--overlay-white-rgb), 0.04);
    --sidebar-divider: rgba(var(--overlay-white-rgb), 0.05);
}

/* ══════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* The window is the only scroll container: anchors land below the sticky topbar */
html { scroll-padding-top: var(--topbar-h); }

body {
    font-family: var(--font-family);
    font-size: var(--text-md);
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    font-weight: var(--weight-text);
}

h1, h2, h3 {
    margin: 0 0 var(--gap-lg);
    line-height: 1.25;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
h2 { font-size: var(--text-md); font-weight: var(--weight-bold); }
h3 { font-size: var(--text-md); font-weight: var(--weight-bold); }

p {
    margin: var(--gap-sm) 0;
    line-height: 1.6;
}

a, .link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover, .link:hover {
    text-decoration: underline;
}

/* ══════════════════════════════════════════
   TEXTE SEMANTIQUE — Titre / Sous-titre / Description / Texte / Annotation / Valeur
   ══════════════════════════════════════════ */
.title {
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.subtitle {
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    color: var(--text);
    margin-top: 0;
}

.description {
    font-size: var(--text-sm);
    font-weight: var(--weight-text);
    color: var(--muted);
    line-height: 1.5;
}

.text {
    font-size: var(--text-md);
    font-weight: var(--weight-text);
    color: var(--text);
}

.muted {
    font-size: var(--text-sm);
    font-weight: var(--weight-text);
    color: var(--muted);
}

.highlight {
    color: var(--accent);
    font-weight: var(--weight-bold);
    font-variant-numeric: tabular-nums;
}

.mt-half { margin-top: calc(var(--space) / 2); }
.mb-half { margin-bottom: calc(var(--space) / 2); }

/* ══════════════════════════════════════════
   BOUTON
   ══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gap-sm);
    padding: var(--gap-md) var(--gap-xl);
    border-radius: var(--radius);
    border: none;
    background: var(--btn-gradient-from);
    color: var(--btn-text);
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: var(--weight-bold);
    font-size: var(--text-md);
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(var(--btn-shadow-rgb), 0.3);
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

a.btn, .card a.btn,
a.btn:visited, .card a.btn:visited,
a.btn:hover, .card a.btn:hover,
a.btn:focus, .card a.btn:focus {
    color: var(--btn-text);
    text-decoration: none;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(var(--overlay-white-rgb), 0.15), transparent 60%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--btn-shadow-rgb), 0.45);
    text-decoration: none;
}

.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(0) scale(0.98); }

.btn[data-variant] {
    background: rgb(var(--btn-variant-rgb));
    box-shadow: 0 4px 14px rgba(var(--btn-variant-rgb), 0.25);
}
.btn[data-variant]:hover { box-shadow: 0 8px 24px rgba(var(--btn-variant-rgb), 0.4); }
.btn[data-variant="secondary"] { --btn-variant-rgb: var(--btn-secondary-rgb); }
.btn[data-variant="danger"] { --btn-variant-rgb: var(--error-rgb); }
.btn[data-variant="accent"] { --btn-variant-rgb: var(--accent-rgb); }

.btn:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.btn--neutral {
    background: transparent;
    color: var(--text);
    box-shadow: none;
    border: var(--border-w) solid var(--border);
}
.btn--neutral:hover { background: rgba(var(--overlay-ink-rgb), 0.03); box-shadow: none; transform: none; }

.btn--primary { background: var(--btn-gradient-from); }

.btn--small { padding: var(--gap-sm) var(--gap-lg); font-size: var(--text-sm); }

.btn--active {
    background: rgba(var(--accent-rgb), 0.15);
    border: var(--border-w) solid rgba(var(--accent-rgb), 0.3);
    color: var(--accent);
    box-shadow: none;
}
.btn--active:hover { background: rgba(var(--accent-rgb), 0.2); box-shadow: none; }

.btn--full { width: 100%; }

.btn:disabled, button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: var(--surface);
    color: var(--muted);
    border: var(--border-w) solid var(--border);
    box-shadow: none;
    transform: none;
}
.btn:disabled:hover { background: var(--surface); box-shadow: none; transform: none; }
.btn:disabled::after { display: none; }

.btn.btn--loading { opacity: 0.65; pointer-events: none; cursor: wait; }
.btn--loading::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    width: var(--spinner-size);
    height: var(--spinner-size);
    margin-top: calc(var(--spinner-size) / -2);
    border: var(--border-w-strong) solid rgba(var(--overlay-white-rgb), 0.3);
    border-top-color: var(--btn-text);
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   CARD
   ══════════════════════════════════════════ */
.card {
    position: relative;
    overflow: hidden;
    scroll-margin-top: calc(var(--topbar-h) + var(--gap-xl));
    border-radius: var(--radius-lg);
    padding: var(--pad-card);
    margin-bottom: var(--space);
    background: var(--surface);
    border: var(--border-w) solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.grid > .card { margin-bottom: 0; }
.card:last-child { margin-bottom: 0; }

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--accent-rgb), 0.2);
}

.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--gap-lg);
    padding-bottom: var(--gap-md);
    margin-bottom: var(--gap-md);
    border-bottom: var(--border-w) solid var(--border);
}

.card__heading { min-width: 0; flex: 1; }
.card__body { margin-top: 0; }
.card ul { margin: var(--gap-sm) 0 0; padding-left: var(--gap-xl); }
.card li { margin: var(--gap-sm) 0; line-height: 1.55; }
.card a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
.card a:hover { color: var(--text); text-decoration: underline; }

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-lg);
}
.grid + .card { margin-top: var(--space); }

.card--featured {
    border-color: rgba(var(--accent-rgb), 0.5);
    box-shadow: 0 0 0 var(--border-w) rgba(var(--accent-rgb), 0.12), 0 4px 20px rgba(var(--accent-rgb), 0.1);
}

/* Generic surface, badge shape and illustrated scene: added in the HTML next to the class of the block, never a list of
   section classes here */
.panel {
    background: var(--surface);
    border: var(--border-w) solid var(--border);
}

.badge {
    display: inline-flex;
    align-items: center;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    padding: var(--gap-xs) var(--gap-sm);
    border-radius: var(--radius-pill);
}
.badge--success {
    color: var(--success);
    background: rgba(var(--success-rgb), 0.12);
}

.card__badge {
    font-size: var(--text-sm);
    text-transform: uppercase;
    padding: var(--gap-xs) var(--gap-sm);
    vertical-align: middle;
    margin-right: var(--gap-sm);
    letter-spacing: 0.04em;
}
.card__badge--start { background: var(--accent); color: var(--on-accent); }

/* Illustrated scene of a section: same ratio, crop and border everywhere; anchored at the bottom, so only the sky is ever cropped */
.scene {
    width: 100%;
    aspect-ratio: 991 / 200;
    border-radius: var(--radius);
    border: var(--border-w) solid var(--border);
    overflow: hidden;
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
}

/* Section with a sidebar (Alerts, City cards) and a main column; rendered only when the sidebar has content, stacked on mobile */
.section-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--gap-xl);
    align-items: start;
}

.section-layout__sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
    position: sticky;
    top: calc(var(--topbar-h) + var(--gap-xl));
}

.section-layout__main {
    display: flex;
    flex-direction: column;
    gap: var(--space);
    min-width: 0;
}

/* Bulleted list of the "🚨 Alertes" card, no card/border per row, small font size */
.alerts-list {
    list-style: disc;
    padding-left: var(--gap-lg);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
}

.alerts-list__item {
    font-size: var(--text-sm);
    font-weight: var(--weight-text);
    text-align: left;
}

.alerts-list__item--critical { color: var(--error); }
.alerts-list__item--warning { color: var(--warning); }

@media (max-width: 900px) {
    .section-layout {
        grid-template-columns: 1fr;
    }

    .section-layout__sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--gap-md);
    }
}

/* ══════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════ */
.flash-list { display: flex; flex-direction: column; gap: var(--gap-sm); margin-bottom: var(--space); }

/* Admin impersonation banner (pages/_layout.php): shown on every page while an admin browses as another player */
.impersonation-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap-md); padding: var(--gap-md) var(--gap-lg); margin-bottom: var(--space); border: var(--border-w) solid var(--warning); border-radius: var(--radius); background: rgba(var(--warning-rgb), 0.12); color: var(--text); font-size: var(--text-md); }

/* Fallback rendering visible only if JS is disabled — with JS, assets/js/app.js always converts
   each `.flash` into a bottom-right toast (see #toast-container in components/game.css): a single visual system
   for success/error/warning/reward. */
.flash {
    border-radius: var(--radius);
    padding: var(--gap-lg) var(--space);
    border: var(--border-w) solid var(--border);
    background: var(--surface);
    border-left: var(--border-w-thick) solid var(--border);
    animation: flashSlideIn 0.3s ease-out forwards;
    position: relative;
}

.flash-success {
    border-color: rgba(var(--success-rgb), 0.15);
    color: var(--success);
    border-left-color: var(--success);
    background: rgba(var(--success-rgb), 0.06);
}
.flash-error {
    border-color: rgba(var(--error-rgb), 0.15);
    color: var(--error);
    border-left-color: var(--error);
    background: rgba(var(--error-rgb), 0.06);
}
.flash-warning {
    border-color: rgba(var(--warning-rgb), 0.15);
    color: var(--warning);
    border-left-color: var(--warning);
    background: rgba(var(--warning-rgb), 0.06);
}
.flash-reward {
    border-color: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.06);
}

.form { display: grid; gap: var(--gap-lg); }
.form__label { font-weight: var(--weight-bold); font-size: var(--text-md); }
.input { flex: 1; }

select.input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: var(--gap-sm) var(--gap-xl) var(--gap-sm) var(--gap-lg);
    border-radius: var(--radius);
    border: var(--border-w) solid var(--border);
    background-color: var(--input-bg);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}
select.input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

label { display: grid; gap: var(--gap-sm); margin: var(--gap-md) 0; font-weight: var(--weight-text); }

input, textarea {
    width: 100%;
    padding: var(--gap-sm) var(--gap-lg);
    border-radius: var(--radius);
    border: var(--border-w) solid var(--border);
    outline: none;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }

/* ══════════════════════════════════════════
   TABLEAU
   ══════════════════════════════════════════ */
.table { display: grid; gap: var(--gap-sm); }

.table__row {
    display: grid;
    grid-template-columns: 2fr 0.7fr 1fr 1fr 1.6fr;
    gap: var(--gap-lg);
    align-items: center;
    padding: var(--gap-md) var(--gap-lg);
    border-radius: var(--radius);
    background: var(--surface);
    border: var(--border-w) solid var(--border);
    transition: all 0.15s ease;
}
.table__row:hover { border-color: rgba(var(--accent-rgb), 0.2); background: rgba(var(--accent-rgb), 0.03); }

.table__row--current {
    border-color: rgba(var(--accent-rgb), 0.35);
    background: rgba(var(--accent-rgb), 0.08);
    font-weight: var(--weight-bold);
}
.table__row--current:hover { background: rgba(var(--accent-rgb), 0.12); }

.table--two .table__row { grid-template-columns: 2fr 1fr; }

.table__row--head {
    font-weight: var(--weight-bold);
    background: rgba(var(--surface-rgb), 0.7);
    border: none;
    text-transform: uppercase;
    font-size: var(--text-sm);
    letter-spacing: 0.04em;
    color: var(--muted);
}
.table__row--head:hover { transform: none; background: rgba(var(--surface-rgb), 0.7); }

.cell-right { text-align: right; justify-self: end; }

/* ══════════════════════════════════════════
   RESSOURCES / STATS / PROGRESSION / TOOLTIPS
   ══════════════════════════════════════════ */
.ckp__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--gap-lg); margin-bottom: var(--space); }

.ckp__stat {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap-xs);
    padding: var(--space) var(--gap-lg) var(--gap-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    background: var(--surface);
    border: var(--border-w) solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.ckp__stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(var(--accent-rgb), 0.25); }
.ckp__stat-icon { font-size: var(--text-md); filter: drop-shadow(0 2px 6px rgba(var(--accent-rgb), 0.35)); }
.ckp__stat-val { font-size: var(--text-md); font-weight: var(--weight-bold); line-height: 1.2; }
.ckp__stat-val--alert { color: var(--error); }
.ckp__stat-lbl { font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: var(--weight-bold); }

.progress-bar {
    margin: var(--gap-md) 0 var(--gap-lg);
    background: rgba(var(--surface-rgb), 0.5);
    border-radius: var(--radius-pill);
    border: var(--border-w) solid var(--border);
    height: 8px;
    overflow: hidden;
}
.progress-bar__bar { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }

[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--text);
    border: var(--border-w) solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--gap-sm) var(--gap-md);
    font-size: var(--text-md);
    font-weight: var(--weight-text);
    max-width: 240px;
    white-space: normal;
    text-align: center;
    box-shadow: var(--shadow);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    z-index: var(--z-dropdown);
}
[data-tooltip]:hover::before, [data-tooltip].is-tooltip-open::before { opacity: 1; visibility: visible; }
[data-tooltip][data-tooltip-pos="below"]::before { bottom: auto; top: calc(100% + 6px); }

/* ══════════════════════════════════════════
   NOTIFICATIONS / ACTIVITE
   ══════════════════════════════════════════ */
.notifications-list { display: flex; flex-direction: column; gap: var(--gap-sm); }

.notification-item, .activity-item {
    padding: var(--gap-lg) var(--gap-lg);
    border-radius: var(--radius);
    background: var(--surface);
    border: var(--border-w) solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: var(--gap-lg);
    transition: all 0.15s ease;
}
.notification-item:hover, .activity-item:hover { border-color: rgba(var(--accent-rgb), 0.2); }
.notification-item.is-unread { background: rgba(var(--accent-rgb), 0.05); border-left: var(--border-w-accent) solid var(--accent); }

.notification-message { font-weight: var(--weight-text); }
.notification-time { color: var(--muted); font-size: var(--text-md); white-space: nowrap; }

.activity-list { display: flex; flex-direction: column; gap: var(--gap-sm); }
.activity-message { font-weight: var(--weight-text); line-height: 1.5; }

/* ══════════════════════════════════════════
   DIVERS UTILITAIRE
   ══════════════════════════════════════════ */
.cost-line-stacked { display: flex; flex-direction: column; align-items: center; gap: var(--gap-xs); }
.cost-line-label { font-size: var(--text-sm); color: var(--muted); font-weight: var(--weight-bold); line-height: 1.4; }
.cost-line-value { font-size: var(--text-sm); color: var(--text); font-weight: var(--weight-bold); line-height: 1.4; }

.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay-dark);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.confirm-modal { border-radius: var(--radius-lg); padding: var(--gap-xl); max-width: 380px; width: 90%; box-shadow: var(--shadow-lg); animation: scaleIn 0.15s ease; }
.confirm-modal__msg { margin: 0 0 var(--gap-xl); line-height: 1.55; }
.confirm-modal__actions { display: flex; gap: var(--gap-lg); justify-content: flex-end; }

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes flashSlideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
/* Opacity pulse shared by the whole project (cap badge, Zoo badge, Arena critical HP) — a single definition */
@keyframes pulse-fade { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* Hidden before app.js runs (html.js-anim is set in <head>) to avoid a flash; this list mirrors animSelectors in app.js */
html.js-anim .card,
html.js-anim .notification-item,
html.js-anim .flash,
html.js-anim .progress-bar,
html.js-anim h2,
html.js-anim h3 {
    opacity: 0;
}

.anim-in { opacity: 0; }
.anim-in.is-visible { animation: fadeSlideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.anim-in.anim-in--delay-1 { animation-delay: 0.06s; }
.anim-in.anim-in--delay-2 { animation-delay: 0.12s; }
.anim-in.anim-in--delay-3 { animation-delay: 0.18s; }
.anim-in.anim-in--delay-4 { animation-delay: 0.24s; }


@keyframes btn-ripple-expand { to { transform: scale(4); opacity: 0; } }
.btn__ripple {
    position: absolute;
    border-radius: 50%;
    width: var(--ripple-size);
    height: var(--ripple-size);
    margin-top: calc(var(--ripple-size) / -2);
    margin-left: calc(var(--ripple-size) / -2);
    background: rgba(var(--overlay-white-rgb), 0.28);
    transform: scale(0);
    animation: btn-ripple-expand 0.55s ease-out forwards;
    pointer-events: none;
}

@keyframes card-glow-success {
    0%   { box-shadow: var(--shadow); }
    35%  { box-shadow: var(--shadow), 0 0 0 var(--gap-sm) rgba(var(--success-rgb), 0.22); }
    100% { box-shadow: var(--shadow); }
}
.card--action-done { animation: card-glow-success 1.6s ease-out; }

@media (prefers-reduced-motion: reduce) {
    .anim-in, .anim-in.is-visible, .flash,
    html.js-anim .card, html.js-anim .notification-item, html.js-anim .flash,
    html.js-anim .progress-bar, html.js-anim h2, html.js-anim h3 {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .btn__ripple { animation: none; opacity: 0; }
    .card--action-done { animation: none; }
}

/* ══════════════════════════════════════════
   HEADER DE RUBRIQUE (page-hero)
   ══════════════════════════════════════════ */
.page-hero {
    padding: var(--pad-hero);
    background: var(--surface);
    border: var(--border-w) solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: relative;
}
.page-hero__row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap-lg); flex-wrap: wrap; }
.page-hero__main { min-width: 0; flex: 1 1 260px; }
.page-hero__progress { display: flex; flex-direction: column; align-items: flex-end; gap: var(--gap-sm); min-width: 200px; flex-shrink: 0; }
.page-hero__progress-label { font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: var(--weight-bold); }
.page-hero__progress-pct { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text); line-height: 1; }
.page-hero__bar-wrap { width: 220px; height: 8px; border-radius: var(--radius-pill); background: rgba(var(--surface-rgb), 0.5); border: var(--border-w) solid var(--border); overflow: hidden; }
.page-hero__bar { height: 100%; width: var(--ph-pct, 0%); border-radius: var(--radius-pill); background: var(--accent); transition: width 0.6s ease; }
.page-hero h2 { margin-bottom: var(--gap-xs); }
.page-hero .subtitle { margin-bottom: 0; }
.page-hero .description { margin-top: var(--gap-sm); }
.page-hero nav { margin-bottom: var(--gap-sm); }

.page-hero--banner {
    background: linear-gradient(to bottom, rgba(var(--scrim-navy-rgb), 0.25), rgba(var(--scrim-navy-rgb), 0.55)), url('../../_img/home_banner.webp') center/cover no-repeat;
    border: var(--border-w) solid var(--border);
    border-radius: var(--radius-lg);
    padding: calc(var(--gap-xl) * 2) var(--gap-xl);
    text-align: center;
    overflow: hidden;
}
.page-hero--banner h2 { font-size: var(--glyph-size); color: var(--on-accent); text-shadow: 0 2px 12px rgba(var(--overlay-ink-rgb), 0.7), 0 0 4px rgba(var(--overlay-ink-rgb), 0.5); }
.page-hero--banner .subtitle { font-size: var(--text-md); color: rgba(var(--overlay-white-rgb), 0.9); text-shadow: 0 1px 8px rgba(var(--overlay-ink-rgb), 0.6), 0 0 3px rgba(var(--overlay-ink-rgb), 0.4); }

.section-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-lg); }

.page { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 0; }
.page > h2:first-child { margin-top: 0; }
.page > h2 { display: inline-block; padding-bottom: var(--gap-sm); margin-bottom: var(--gap-md); border-bottom: var(--border-w-strong) solid var(--accent); }
.page > .card + .card { margin-top: 0; }

/* ══════════════════════════════════════════
   APP SHELL — menu gauche + topbar + contenu
   ══════════════════════════════════════════ */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: var(--z-tooltip);
    padding: var(--gap-lg) var(--gap-xl);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: var(--weight-bold);
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { top: 0; }

.app { display: flex; min-height: 100vh; }

/* Desktop: the sidebar is part of the document flow and scrolls with the page — only the browser
   window scrollbar is used, no inner scroll zone (the mobile drawer below is the only exception) */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: relative;
    z-index: var(--z-sidebar);
    background: var(--sidebar-bg);
    border-right: var(--border-w) solid var(--sidebar-divider);
    box-shadow: var(--sidebar-shadow);
    display: flex;
    flex-direction: column;
}

.sidebar__header { flex-shrink: 0; padding: var(--gap-xl) var(--space) var(--gap-lg); border-bottom: var(--border-w) solid var(--sidebar-divider); }
.sidebar__brand { display: flex; flex-direction: column; align-items: flex-start; gap: var(--gap-sm); text-decoration: none; color: var(--sidebar-text-active); }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo-img { display: block; width: 100%; max-width: 200px; height: auto; }

.sidebar__nav-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar__nav { flex: 1; padding: var(--gap-lg) var(--gap-lg); display: flex; flex-direction: column; gap: var(--gap-sm); }
.sidebar__divider { height: 1px; background: var(--sidebar-divider); margin: var(--gap-sm) var(--gap-sm); }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--gap-lg);
    padding: var(--gap-md) var(--gap-lg);
    border-radius: var(--radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    white-space: nowrap;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
    position: relative;
}
.sidebar__link[data-section]::before {
    content: '';
    position: absolute;
    left: 0; top: 22%;
    height: 56%;
    width: 3px;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}
.sidebar__link[data-section]:hover::before, .sidebar__link[data-section].is-active::before { opacity: 1; }
.sidebar__link:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); text-decoration: none; }
.sidebar__link.is-active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); font-weight: var(--weight-bold); }
.sidebar__link--locked { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.sidebar__link--locked:hover { opacity: 0.45; }

.sidebar__lock-hint {
    margin-left: auto;
    font-size: var(--text-sm);
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    border-radius: var(--radius-sm);
    padding: var(--gap-2xs) var(--gap-sm);
}
.sidebar__progress { margin-left: auto; font-size: var(--text-sm); white-space: nowrap; flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar__progress--done { color: var(--success); }

.sidebar__bar { position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; border-radius: var(--radius-xs); background: rgba(var(--accent-rgb), 0.12); overflow: hidden; }
.sidebar__bar-fill { display: block; height: 100%; width: var(--sidebar-bar-pct, 0%); border-radius: inherit; background: var(--accent); opacity: 0.7; transition: width 0.4s ease; }

.sidebar__locked-group { margin: 0 0 var(--gap-xs); }
.sidebar__locked-summary {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    padding: var(--gap-md) var(--gap-lg);
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: var(--text-md);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s, color 0.15s;
    font-weight: var(--weight-text);
}
.sidebar__locked-summary::-webkit-details-marker { display: none; }
.sidebar__locked-summary::marker { display: none; }
.sidebar__locked-summary:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); }

.sidebar__locked-count {
    margin-left: auto;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    background: var(--scrollbar-thumb);
    color: var(--sidebar-text);
    padding: var(--gap-2xs) var(--gap-sm);
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}
.sidebar__locked-arrow { font-size: var(--text-sm); color: var(--sidebar-text); flex-shrink: 0; transition: transform 0.2s ease; }
.sidebar__locked-group[open] .sidebar__locked-arrow { transform: rotate(180deg); }
.sidebar__locked-list { padding: var(--gap-xs) 0; }
.sidebar__locked-list .sidebar__link--locked { padding-left: var(--gap-xl); align-items: flex-start; }
.sidebar__locked-item-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sidebar__locked-desc { font-size: var(--text-sm); color: var(--sidebar-text); opacity: .65; line-height: 1.3; white-space: normal; margin-top: var(--gap-xs); }

.sidebar__badge-alert {
    margin-left: auto;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
    animation: pulse-alert 1.8s ease-in-out infinite;
}
@keyframes pulse-alert { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.65; transform: scale(0.8); } }

.sidebar__icon { width: 22px; text-align: center; font-size: var(--text-md); flex-shrink: 0; }
.sidebar__text { overflow: hidden; text-overflow: ellipsis; }

.sidebar__lang { display: flex; justify-content: center; gap: var(--gap-sm); margin-top: var(--gap-md); }
.sidebar__lang-link { color: var(--sidebar-text); text-decoration: none; padding: var(--gap-sm) var(--gap-lg); border-radius: var(--radius-pill); font-size: var(--text-md); font-weight: var(--weight-bold); transition: all 0.2s ease; border: var(--border-w) solid transparent; }
.sidebar__lang-link:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); text-decoration: none; }
.sidebar__lang-link.is-active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }

.app-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(var(--overlay-ink-rgb), 0.5);
    z-index: var(--z-topbar);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.app-overlay.is-visible { display: block; opacity: 1; }

/* Locks background scroll while the mobile menu is open — generic, reusable by
   any future full-screen panel, not specific to the sidebar */
body.no-scroll { overflow: hidden; }

/* The document (html/body) is the only scroll container: the topbar stays sticky against the window */
.app-shell { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    z-index: var(--z-dropdown);
    background: var(--surface);
    border-bottom: var(--border-w) solid var(--border);
    height: var(--topbar-h);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-lg); height: 100%; padding: 0 var(--space); max-width: 100%; }
.topbar__left { display: flex; align-items: center; gap: var(--gap-lg); min-width: 0; flex: 1; }

.topbar__toggle {
    display: none;
    flex-direction: column;
    width: 38px; height: 34px;
    border-radius: var(--radius-sm);
    border: var(--border-w) solid var(--border);
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: var(--gap-sm);
    padding: var(--gap-sm);
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.topbar__toggle:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.2); }
.topbar__bar { display: block; width: 100%; height: 2px; background: var(--text); border-radius: var(--radius-xs); transition: all 0.2s ease; }

.topbar__title { font-size: var(--text-md); font-weight: var(--weight-bold); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.topbar__right { display: flex; align-items: center; gap: var(--gap-lg); flex-shrink: 0; }

.topbar__theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-pill);
    border: var(--border-w) solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: var(--text-md);
    line-height: 1;
    padding: 0;
    transition: all 0.25s ease;
}
.topbar__theme:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.2); transform: rotate(20deg); }

/* Karia weather (purely visual, shared by every player) — icon + temperature, details in the tooltip */
.topbar__weather { display: inline-flex; align-items: center; gap: var(--gap-xs); padding: var(--gap-xs) var(--gap-md); border-radius: var(--radius-pill); border: var(--border-w) solid var(--border); font-size: var(--text-md); color: var(--text); white-space: nowrap; cursor: help; }
.topbar__weather-temp { font-size: var(--text-sm); color: var(--muted); }

.topbar__resources { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: var(--gap-sm) var(--gap-lg); border-radius: var(--radius-pill); background: rgba(var(--surface-rgb), 0.5); font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--text); }
.topbar__resource { white-space: nowrap; }
.topbar__resource--cap { color: var(--warning); animation: pulse-fade 2s ease-in-out infinite; }

/* Topbar drawers (resources, timers, notifications): opened by .is-open on the wrap (initDropdown(), app.js) */
.topbar__resources-wrap, .topbar__timers-wrap, .topbar__notif-wrap { position: relative; display: inline-flex; }
.topbar__icon-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--gap-xs); min-width: 32px; height: 32px; padding: 0 var(--gap-md); border-radius: var(--radius-pill); border: var(--border-w) solid var(--border); background: var(--surface); color: var(--text); font-size: var(--text-md); font-family: inherit; cursor: pointer; transition: all 0.2s ease; }
.topbar__icon-toggle:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.3); }
.topbar__icon-toggle--warning { color: var(--warning); border-color: rgba(var(--warning-rgb), 0.4); animation: pulse-fade 2s ease-in-out infinite; }
.topbar__icon-toggle-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 var(--gap-xs); border-radius: var(--radius-pill); background: rgba(var(--accent-rgb), 0.15); color: var(--accent); font-size: var(--text-sm); font-weight: var(--weight-bold); }

.topbar__timer { display: inline-flex; align-items: center; gap: var(--gap-xs); padding: var(--gap-xs) var(--gap-md); border-radius: var(--radius-pill); border: var(--border-w) solid var(--border); background: rgba(var(--surface-rgb), 0.5); color: var(--muted); font-size: var(--text-sm); font-weight: var(--weight-bold); text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; transition: all 0.2s ease; }
.topbar__timer:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.25); text-decoration: none; }
.topbar__timer-count { color: var(--accent); }

.topbar__notif { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 var(--gap-sm); border-radius: var(--radius-pill); border: none; background: rgba(var(--accent-rgb), 0.1); color: var(--accent); font-weight: var(--weight-bold); font-size: var(--text-md); text-decoration: none; transition: all 0.2s ease; cursor: pointer; font-family: inherit; }
.topbar__notif:hover { background: rgba(var(--accent-rgb), 0.18); text-decoration: none; }

/* The 3 drawers (notifs, secondary resources, chantiers) share the same display mechanism —
   only the width and internal content differ */
.notif-panel, .resources-panel, .timers-panel { display: none; position: absolute; top: calc(100% + 8px); right: 0; max-width: 90vw; background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: var(--gap-md); z-index: var(--z-dropdown); }
.notif-panel { width: 320px; }
.resources-panel, .timers-panel { width: 240px; }
.topbar__notif-wrap.is-open .notif-panel,
.topbar__resources-wrap.is-open .resources-panel,
.topbar__timers-wrap.is-open .timers-panel { display: block; }
.notif-panel__title, .resources-panel__title, .timers-panel__title { font-weight: var(--weight-bold); font-size: var(--text-md); color: var(--text); padding: var(--gap-xs) var(--gap-sm) var(--gap-sm); border-bottom: var(--border-w) solid var(--border); }
.notif-panel__list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.notif-panel__item { display: flex; flex-direction: column; gap: var(--gap-xs); padding: var(--gap-sm) var(--gap-sm); border-bottom: var(--border-w) solid var(--border); font-size: var(--text-sm); color: var(--text); }
.notif-panel__item:last-child { border-bottom: none; }
.notif-panel__item.is-unread { background: rgba(var(--accent-rgb), 0.05); border-radius: var(--radius-sm); }
.notif-panel__msg { line-height: 1.35; }
.notif-panel__time { color: var(--muted); font-size: var(--text-sm); }
.notif-panel__empty { margin: 0; padding: var(--gap-lg) var(--gap-sm); color: var(--muted); font-size: var(--text-sm); }
.notif-panel__all { display: block; text-align: center; padding: var(--gap-sm) var(--gap-sm) var(--gap-xs); color: var(--accent); font-size: var(--text-sm); font-weight: var(--weight-bold); text-decoration: none; border-top: var(--border-w) solid var(--border); }
.notif-panel__all:hover { text-decoration: underline; }

.resources-panel__list, .timers-panel__list { display: flex; flex-direction: column; gap: var(--gap-sm); padding-top: var(--gap-sm); }
.resources-panel__list .topbar__resource { display: flex; align-items: center; gap: var(--gap-sm); padding: var(--gap-xs) var(--gap-sm); }
.timers-panel__list .topbar__timer { justify-content: space-between; }

.topbar__user { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: var(--gap-sm) var(--gap-lg); border-radius: var(--radius-pill); border: var(--border-w) solid var(--border); background: var(--surface); font-weight: var(--weight-bold); font-size: var(--text-md); color: var(--text); }
.topbar__username { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.topbar__logout { display: inline-flex; margin: 0; padding: 0; }
.topbar__logout-btn { display: inline-flex; align-items: center; padding: var(--gap-sm) var(--gap-lg); border-radius: var(--radius-pill); border: var(--border-w) solid var(--border); background: transparent; color: var(--muted); font-size: var(--text-md); font-weight: var(--weight-text); cursor: pointer; font-family: inherit; transition: all 0.2s ease; }
.topbar__logout-btn:hover { color: var(--error); border-color: rgba(var(--error-rgb), 0.3); background: rgba(var(--error-rgb), 0.04); }

.content { flex: 1; overflow-x: clip; background: var(--bg); position: relative; display: flex; flex-direction: column; }
.content__wrap { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: var(--pad-content-wrap); width: 100%; flex: 1; }

.app-footer { border-top: var(--border-w) solid var(--border); background: var(--surface); padding: var(--gap-lg) var(--space); }
.app-footer__inner { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap-lg); font-size: var(--text-md); color: var(--muted); }

.footer-pill { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: var(--gap-xs) var(--gap-md); border-radius: var(--radius-pill); border: var(--border-w) solid var(--border); background: rgba(var(--surface-rgb), 0.4); color: var(--text); text-decoration: none; font-size: var(--text-md); font-weight: var(--weight-text); transition: all 0.2s ease; }
.footer-pill:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.15); color: var(--accent); text-decoration: none; }
.footer-email__text { font-size: var(--text-md); }

.nav-link { display: inline-flex; align-items: center; gap: var(--gap-sm); padding: 7px var(--gap-lg); border-radius: var(--radius-pill); text-decoration: none; color: var(--text); white-space: nowrap; border: var(--border-w) solid var(--border); background: transparent; font-weight: var(--weight-text); font-size: var(--text-md); transition: all 0.2s ease; cursor: pointer; font-family: inherit; }
.nav-link:hover { background: rgba(var(--accent-rgb), 0.06); border-color: rgba(var(--accent-rgb), 0.12); color: var(--accent); text-decoration: none; }
.nav-link.is-active { background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.3); color: var(--accent); font-weight: var(--weight-bold); }

.pager { display: flex; flex-wrap: wrap; gap: var(--gap-sm); align-items: center; }

/* ══════════════════════════════════════════
   RESPONSIVE — single breakpoint of the site (900px)
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
    /* Off-canvas drawer: overlays the page (whose scroll is locked by body.no-scroll), so it scrolls on its own */
    .sidebar { position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; overscroll-behavior: contain; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: none; }
    .sidebar.is-open { transform: translateX(0); box-shadow: 8px 0 30px rgba(var(--overlay-ink-rgb), 0.3); }
    .topbar__toggle { display: inline-flex; }
    .topbar__user { display: none; }
    .topbar__username { display: none; }
    .topbar__weather-temp { display: none; }
    .topbar__resources { padding: var(--gap-xs) var(--gap-sm); gap: var(--gap-sm); font-size: var(--text-sm); }
    /* Two rows: menu, title, theme, weather and logout, then Kii, progress and the drawers */
    .topbar:not(:has(.topbar__notif-wrap)) { height: calc(var(--topbar-h) / 2); }
    .topbar__inner { flex-wrap: wrap; align-content: center; row-gap: var(--gap-sm); }
    .topbar__inner::after { content: ''; order: 1; flex-basis: 100%; }
    .topbar__right { display: contents; }
    .topbar__resources, .topbar__resources-wrap, .topbar__timers-wrap, .topbar__notif-wrap { order: 2; }
    .topbar__resources { margin-right: auto; }
    .topbar__resources-wrap, .topbar__timers-wrap, .topbar__notif-wrap { position: static; }
    .notif-panel, .resources-panel, .timers-panel { left: var(--gap-lg); right: var(--gap-lg); width: auto; max-width: none; }
    .topbar__logout-btn { font-size: 0; padding: var(--gap-sm); width: 32px; height: 32px; border-radius: var(--radius-pill); justify-content: center; }
    .topbar__logout-btn::before { content: '🚪'; font-size: var(--text-md); }
    .topbar__inner { padding: 0 var(--gap-lg); gap: var(--gap-sm); }
    .topbar__left { gap: var(--gap-sm); }
    .content__wrap { padding: var(--space) var(--gap-lg); }
    .app-footer__inner { flex-direction: column; align-items: center; text-align: center; }
    .page-hero { padding: var(--space) var(--space); }
    .page-hero__progress { align-items: flex-start; min-width: 0; width: 100%; }
    .page-hero__bar-wrap { width: 100%; }
    .page-hero--banner { padding: var(--gap-xl) var(--space); }
    .page-hero--banner h2 { font-size: var(--glyph-size); }
    .ckp__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card__header { flex-direction: column; align-items: stretch; }
    .section-page { gap: var(--gap-lg); }
    .grid { grid-template-columns: 1fr; }

    /* Generic table stacked into one column on mobile, each cell keeping its heading from data-label (templates/table.php) */
    .table__row, .table--two .table__row { grid-template-columns: 1fr; gap: var(--gap-xs); padding: var(--gap-md) var(--gap-lg); }
    .table__row--head { display: none; }
    .table__row > div[data-label] { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--gap-sm); text-align: right; }
    .table__row > div[data-label]::before { content: attr(data-label) ' :'; color: var(--muted); font-weight: var(--weight-bold); font-size: var(--text-sm); text-align: left; }
}
