/* ============================================================
   GeoFrance — feuille de style (équivalent web de l'app mobile)
   Thèmes clair/sombre via variables CSS, sans dépendance externe.
   ============================================================ */

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #1d4ed8;
    --primary-soft: #dbeafe;
    --primary-contrast: #ffffff;
    --accent: #ef4444;
    --good: #16a34a;
    --bad: #dc2626;
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .25);
    --radius: 16px;
    --map-land: #e2e8f0;
    --map-stroke: #94a3b8;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0b1220;
    --surface: #131c2e;
    --surface-2: #1b2740;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #25304a;
    --primary: #3b82f6;
    --primary-soft: #1e3a8a;
    --primary-contrast: #ffffff;
    --accent: #f87171;
    --good: #22c55e;
    --bad: #ef4444;
    --shadow: 0 12px 36px -14px rgba(0, 0, 0, .6);
    --map-land: #334155;
    --map-stroke: #0f172a;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--text-muted); font-weight: 400; }
.loading { color: var(--text-muted); padding: 3rem 0; text-align: center; }

/* ---------- Coquille applicative ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem clamp(1rem, 4vw, 2.5rem);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.app-header__brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; color: var(--text); font-size: 1.15rem; }
.app-header__logo { font-size: 1.4rem; }
.app-header__name { letter-spacing: -.02em; }

.app-nav { display: flex; gap: .35rem; margin-left: auto; }
.app-nav__link {
    padding: .45rem .8rem; border-radius: 999px; color: var(--text-muted);
    font-weight: 600; font-size: .95rem; transition: background .15s, color .15s;
}
.app-nav__link:hover { background: var(--surface-2); color: var(--text); }
.app-nav__link.active { background: var(--primary-soft); color: var(--primary); }

.theme-toggle {
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 1.05rem;
    display: grid; place-items: center; transition: transform .12s, background .15s;
}
.theme-toggle:hover { transform: translateY(-1px); background: var(--surface-2); }

.app-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(1.25rem, 4vw, 2.75rem); }

.app-footer {
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 1.5rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: .9rem;
}
.app-footer__meta { display: inline-flex; align-items: center; gap: .75rem; }
.app-footer__domain { font-weight: 700; color: var(--primary); }
.app-footer__version { color: var(--text-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }

/* ---------- Menu sandwich (mobile) ---------- */
.hamburger { display: none; }
.hamburger {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); cursor: pointer; padding: 0;
    flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

.menu-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.25); }
.menu-panel {
    position: fixed; z-index: 41; top: calc(.5rem + env(safe-area-inset-top)); right: .75rem;
    min-width: 200px; display: flex; flex-direction: column; gap: .15rem; padding: .4rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow); animation: pop .15s ease;
}
.menu-panel__link {
    display: block; width: 100%; text-align: left; padding: .7rem .85rem; border-radius: 10px;
    color: var(--text); font-weight: 600; font-size: 1rem; background: none; border: none;
    cursor: pointer; font-family: inherit;
}
.menu-panel__link:hover { background: var(--surface-2); }
.menu-panel__link.active { background: var(--primary-soft); color: var(--primary); }
.menu-panel__theme { border-top: 1px solid var(--border); margin-top: .15rem; border-radius: 0 0 10px 10px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    border: 1px solid transparent; border-radius: 12px; padding: .65rem 1.1rem;
    font-weight: 700; font-size: 1rem; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s;
    font-family: inherit; text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn--lg { padding: .85rem 1.6rem; font-size: 1.05rem; border-radius: 14px; }
.btn--primary { background: var(--primary); color: var(--primary-contrast); box-shadow: var(--shadow); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn--danger-ghost:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* ---------- Accueil ---------- */
.hero {
    display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center;
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border); border-radius: 24px; padding: clamp(1.5rem, 4vw, 3rem);
    box-shadow: var(--shadow); margin-bottom: 2rem;
}
.hero__eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--primary); margin: 0 0 .5rem; }
.hero__title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; }
.hero__lead { color: var(--text-muted); font-size: 1.1rem; max-width: 46ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero__stats { display: flex; gap: 1.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.hero__stat { display: flex; flex-direction: column; }
.hero__stat-value { font-size: 1.4rem; font-weight: 800; }
.hero__stat-label { color: var(--text-muted); font-size: .85rem; }
.hero__map { display: grid; place-items: center; }
.hero__map-emoji { font-size: clamp(6rem, 16vw, 12rem); filter: drop-shadow(0 12px 24px rgba(0,0,0,.18)); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.feature-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.4rem; transition: transform .15s, box-shadow .15s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-card__icon { font-size: 2rem; }
.feature-card h2 { font-size: 1.15rem; margin: .6rem 0 .3rem; }
.feature-card p { color: var(--text-muted); margin: 0; font-size: .95rem; }

/* ---------- Assistant de configuration ---------- */
.setup { max-width: 760px; margin: 0 auto; }
.setup__header { text-align: center; margin-bottom: 1.75rem; }
.setup__progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.setup__progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }
.setup__step-count { color: var(--text-muted); font-size: .85rem; margin: 0 0 .25rem; }
.setup__title { font-size: clamp(1.5rem, 3vw, 2rem); }
.setup__subtitle { color: var(--text-muted); margin: 0; }

.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.option {
    display: flex; flex-direction: column; gap: .35rem; text-align: left;
    background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
    padding: 1.1rem 1.2rem; cursor: pointer; font-family: inherit; color: var(--text);
    transition: transform .12s, border-color .15s, box-shadow .15s;
}
.option:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.option--selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface)); }
.option__icon { font-size: 1.7rem; }
.option__label { font-weight: 700; font-size: 1.05rem; }
.option__caption { color: var(--text-muted); font-size: .88rem; }

.setup__actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1.75rem; gap: 1rem; }
.setup__actions .btn--primary { margin-left: auto; }

/* ---------- Jeu ---------- */
.game { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.game__hud {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .65rem 1rem;
    font-weight: 700;
}
.game__progress { color: var(--primary); }
.game__score { color: var(--text); }
.game__streak { color: var(--accent); }
.game__timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.game__map {
    position: relative;
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border); border-radius: 20px; padding: .5rem;
    box-shadow: var(--shadow); overflow: hidden;
}
.game__map--locate { touch-action: none; }
.map-recenter {
    position: absolute; top: .75rem; right: .75rem; z-index: 2;
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px);
    color: var(--text); font-size: 1.1rem; cursor: pointer; display: grid; place-items: center;
}
.map-recenter:hover { background: var(--surface-2); }

/* Étiquette volante (révélation des pastilles) */
.fly-label {
    position: absolute; z-index: 3; pointer-events: none; white-space: nowrap;
    font-weight: 800; font-size: .9rem; padding: .15rem .55rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    transform: translate(-50%, -100%);
    animation: fly-away 1.3s ease-out forwards;
}
.fly-label--correct { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.fly-label--wrong { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
@keyframes fly-away {
    0% { opacity: 0; transform: translate(-50%, -90%) scale(.92); }
    18% { opacity: 1; transform: translate(-50%, -125%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -260%) scale(1); }
}

/* Cartes interactives (modes localisation) */
.geo-map--clickable .feature { cursor: pointer; }
.geo-map--clickable .feature:hover { fill: color-mix(in srgb, var(--primary) 28%, var(--map-land)); }
.geo-map--interactive .marker { cursor: pointer; }

.game__locate { text-align: center; display: flex; flex-direction: column; gap: .15rem; }
.game__locate .game__prompt { font-size: 1rem; color: var(--text-muted); font-weight: 600; margin: 0; }
.game__locate-target { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; margin: 0; letter-spacing: -.01em; }
.game__locate-hint { font-size: .85rem; color: var(--text-muted); margin: .1rem 0 0; }

.game__prompt { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 800; text-align: center; margin: .25rem 0; }

.game__choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.choice {
    background: var(--surface); border: 2px solid var(--border); border-radius: 14px;
    padding: .9rem 1rem; font-size: 1.05rem; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--text);
    transition: transform .12s, border-color .15s, background .2s;
}
.choice:not(:disabled):hover { transform: translateY(-2px); border-color: var(--primary); }
.choice--correct { background: color-mix(in srgb, var(--good) 22%, var(--surface)); border-color: var(--good); color: var(--text); }
.choice--wrong { background: color-mix(in srgb, var(--bad) 22%, var(--surface)); border-color: var(--bad); }
.choice--dimmed { opacity: .5; }

.game__toast {
    position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%);
    background: var(--text); color: var(--bg); padding: .6rem 1.2rem; border-radius: 999px;
    font-weight: 700; box-shadow: var(--shadow); z-index: 30; animation: pop .25s ease;
}
@keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- Carte SVG ---------- */
.geo-map { width: 100%; height: auto; display: block; max-height: 60vh; }
.geo-map .feature {
    fill: var(--map-land); stroke: var(--map-stroke); stroke-width: .6;
    stroke-linejoin: round; transition: fill .35s ease;
}
.geo-map .feature--highlight { stroke: #ffffff; stroke-width: 1.8; paint-order: stroke; pointer-events: none; filter: drop-shadow(0 0 3px rgba(0,0,0,.5)); }
.geo-map .marker { stroke: rgba(255,255,255,.9); stroke-width: 1.1; }

/* ---------- Bilan ---------- */
.result-overlay {
    position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
    background: color-mix(in srgb, var(--bg) 78%, rgba(0,0,0,.5)); backdrop-filter: blur(6px); padding: 1rem;
    animation: pop .25s ease;
}
.result-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
    padding: clamp(1.5rem, 4vw, 2.5rem); max-width: 460px; width: 100%; text-align: center; box-shadow: var(--shadow);
}
.result-card__emoji { font-size: 3.5rem; margin: 0; }
.result-card__score { font-size: 3rem; font-weight: 800; margin: .2rem 0 0; }
.result-card__detail { color: var(--text-muted); margin: .25rem 0 1rem; }
.result-card__xp { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.result-card__xp-gain { font-weight: 800; color: var(--primary); font-size: 1.2rem; }
.result-card__levelup { font-weight: 700; color: var(--good); }
.result-card__achievements { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem; }
.result-card__achievements-title { font-weight: 700; margin: 0; }
.result-card__actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

.badge { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .35rem .8rem; font-weight: 600; font-size: .9rem; }

/* ---------- Statistiques ---------- */
.stats { display: flex; flex-direction: column; gap: 1.75rem; }
.stats__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.stat-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; text-align: center; }
.stat-tile__value { display: block; font-size: 1.6rem; font-weight: 800; }
.stat-tile__label { color: var(--text-muted); font-size: .85rem; }

.stat-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.stat-section h2 { font-size: 1.2rem; }
.stat-section__hint { color: var(--text-muted); font-size: .9rem; margin: 0 0 .75rem; }
.stat-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

.stat-bars { display: flex; flex-direction: column; gap: .55rem; }
.stat-bar { display: grid; grid-template-columns: minmax(120px, 1fr) 3fr auto; align-items: center; gap: .75rem; font-size: .92rem; }
.stat-bar__label { font-weight: 600; }
.stat-bar__track { background: var(--border); height: 10px; border-radius: 999px; overflow: hidden; }
.stat-bar__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; }
.stat-bar__value { font-variant-numeric: tabular-nums; color: var(--text-muted); }

.stat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.stat-list li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.stat-list li:last-child { border-bottom: none; }
.stat-list__badge { display: inline-grid; place-items: center; min-width: 2rem; height: 1.7rem; padding: 0 .4rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-weight: 700; font-size: .82rem; }
.stat-list__rate { margin-left: auto; font-weight: 800; }
.stat-list__rate--good { color: var(--good); }
.stat-list__rate--bad { color: var(--bad); }

.sparkline { width: 100%; height: 64px; }
.sparkline polyline { fill: none; stroke: var(--primary); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

.stat-heatmap { background: var(--surface-2); border-radius: var(--radius); padding: .5rem; }

/* ---------- Profil ---------- */
.profile { display: flex; flex-direction: column; gap: 1.75rem; }
.level-card { display: flex; align-items: center; gap: 1.25rem; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); border: 1px solid var(--border); border-radius: 20px; padding: 1.5rem; }
.level-card__badge { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); font-size: 1.8rem; font-weight: 800; box-shadow: var(--shadow); }
.level-card__body { flex: 1; }
.level-card__title { font-weight: 800; font-size: 1.3rem; margin: 0 0 .5rem; }
.level-card__bar { height: 12px; background: var(--border); border-radius: 999px; overflow: hidden; }
.level-card__fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s ease; }
.level-card__xp { color: var(--text-muted); font-size: .85rem; margin: .4rem 0 0; }

.achiev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.achiev-score { text-align: right; }
.achiev-score__points { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.achiev-score__sub { display: block; color: var(--text-muted); font-size: .85rem; }
.achiev-progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin: .5rem 0 1.25rem; }
.achiev-progress__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--good)); border-radius: 999px; transition: width .4s ease; }
.achiev-category { margin-top: 1.25rem; }
.achiev-category__title { display: flex; align-items: baseline; gap: .5rem; font-size: 1rem; margin: 0 0 .6rem; text-transform: uppercase; letter-spacing: .04em; }
.achiev-category__title .muted { font-size: .85rem; text-transform: none; letter-spacing: 0; }

.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .85rem; }
.achievement { position: relative; display: flex; flex-direction: column; gap: .25rem; align-items: center; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius); padding: 1rem .75rem; }
.achievement--locked { opacity: .6; }
.achievement--locked .achievement__icon { filter: grayscale(1); }
.achievement__icon { font-size: 1.8rem; }
.achievement__title { font-weight: 700; font-size: .95rem; }
.achievement__desc { color: var(--text-muted); font-size: .78rem; }
.achievement__points { font-size: .72rem; font-weight: 800; color: var(--text-muted); letter-spacing: .03em; }
.achievement__bar { width: 100%; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: .35rem; }
.achievement__bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.achievement__progress { font-size: .72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Rareté : liseré coloré */
.achievement--common { border-left-color: #94a3b8; }
.achievement--rare { border-left-color: #3b82f6; }
.achievement--epic { border-left-color: #a855f7; }
.achievement--legendary { border-left-color: #f59e0b; }
.achievement--mythic { border-left-color: #ef4444; }
.achievement--unlocked.achievement--legendary { box-shadow: 0 0 0 1px #f59e0b33; }
.achievement--unlocked.achievement--mythic { box-shadow: 0 0 0 1px #ef444433; }

/* ---------- Compte (en-tête) ---------- */
.app-header__account { display: flex; align-items: center; }
.btn--sm { padding: .4rem .75rem; font-size: .9rem; border-radius: 10px; }
.account-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; max-width: 180px; }
.account-chip:hover { background: var(--surface-2); }
.account-chip__avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; font-size: .9rem; }
.account-chip__avatar--initial { line-height: 30px; text-align: center; }
.account-chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Connexion ---------- */
.auth-card { max-width: 440px; margin: 2rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(1.5rem, 4vw, 2.25rem); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.6rem; }
.auth-card__intro { color: var(--text-muted); margin-bottom: 1.25rem; }
.auth-card__links { display: flex; justify-content: space-between; margin-top: 1rem; gap: 1rem; }
.auth-card__message { margin-top: 1rem; padding: .6rem .9rem; border-radius: 10px; background: color-mix(in srgb, var(--good) 14%, var(--surface)); color: var(--text); font-weight: 600; }
.auth-card__message--error { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field__label { font-weight: 600; font-size: .9rem; color: var(--text-muted); }
.field__row { display: flex; gap: .5rem; align-items: center; }
.field__row .field__input { flex: 1; }
.field__input { width: 100%; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 1rem; font-family: inherit; }
.field__input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.field__input--code { letter-spacing: .5em; text-align: center; font-size: 1.4rem; font-weight: 800; }
.link-btn { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; font-family: inherit; padding: 0; }
.link-btn:disabled { opacity: .5; cursor: default; }

/* ---------- Panneau compte (profil) ---------- */
.account-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.5rem; }
.account-panel__head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.account-panel__avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--primary); color: #fff; font-size: 1.6rem; font-weight: 800; display: grid; place-items: center; }
.account-panel__name { font-weight: 800; font-size: 1.2rem; margin: 0; }
.account-panel__email { color: var(--text-muted); margin: 0; font-size: .9rem; }
.account-panel__logout { margin-left: auto; }
.account-form { display: flex; flex-direction: column; gap: .5rem; }
.field__hint { font-size: .8rem; color: var(--text-muted); }
.field__fixed { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.1rem; }
.field__lock { font-size: .75rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .55rem; }

.account-cta { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); border: 1px solid var(--border); border-radius: 20px; padding: 1.5rem; }
.account-cta__icon { font-size: 2.5rem; }
.account-cta__title { font-weight: 800; font-size: 1.1rem; margin: 0; }
.account-cta__text { color: var(--text-muted); margin: .2rem 0 0; max-width: 52ch; }
.account-cta .btn { margin-left: auto; }

/* ---------- Partage ---------- */
.share { display: flex; flex-wrap: wrap; gap: .6rem; }
.share-btn { border: none; border-radius: 12px; padding: .65rem 1.1rem; font-weight: 700; font-size: .95rem; cursor: pointer; color: #fff; font-family: inherit; transition: transform .12s, filter .15s; }
.share-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.share-btn--link { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.share-btn--whatsapp { background: #25d366; }
.share-btn--facebook { background: #1877f2; }
.share-btn--instagram { background: linear-gradient(45deg, #f09433, #e6683c 30%, #dc2743 50%, #cc2366 70%, #bc1888); }
.share__feedback { margin: .6rem 0 0; font-weight: 600; color: var(--good); }

/* ---------- Profil public partagé ---------- */
.public-profile { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }
.pub-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: clamp(1.5rem, 4vw, 2.25rem); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1.25rem; }
.pub-card__head { display: flex; align-items: center; gap: 1rem; }
.pub-card__avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--primary); color: #fff; font-size: 1.8rem; font-weight: 800; display: grid; place-items: center; }
.pub-card__name { font-weight: 800; font-size: 1.6rem; margin: 0; }
.pub-card__level { color: var(--text-muted); margin: .15rem 0 0; }
.pub-card__cta { display: flex; justify-content: center; }

/* ---------- État vide / 404 ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.empty-state__emoji { font-size: 3rem; margin: 0; }
.empty-state .btn { margin-top: 1rem; }

/* ---------- Adaptatif ---------- */
@media (max-width: 820px) {
    /* Navigation : menu sandwich en haut à droite */
    .app-nav { display: none; }
    .theme-toggle--header { display: none; }   /* le thème passe dans le menu */
    .hamburger { display: flex; }

    /* En-tête compact + zone sûre (encoche) */
    .app-header { padding: max(.55rem, env(safe-area-inset-top)) 1rem .55rem; gap: .5rem; }
    .app-header__account { margin-left: auto; }
    .account-chip__name { max-width: 88px; }

    /* Coquille fixée à l'écran : le contenu défile à l'intérieur, le jeu peut remplir. */
    .app-shell { height: 100dvh; }
    .app-main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 1rem; }
    .app-footer { flex-direction: column; gap: .25rem; text-align: center; padding: .7rem 1rem; }

    /* Accueil */
    .hero { grid-template-columns: 1fr; padding: 1.5rem 1.25rem; }
    .hero__map { display: none; }
    .hero__actions { width: 100%; }
    .hero__actions .btn { flex: 1; }

    /* Jeu : tout doit tenir sur l'écran (pas de défilement) */
    .game { height: 100%; gap: .5rem; }
    .game__hud { padding: .5rem .75rem; font-size: .9rem; }
    .game__map { flex: 1 1 auto; min-height: 0; border-radius: 16px; display: flex; }
    .geo-map { height: 100%; max-height: none; }
    .game__prompt { font-size: 1.1rem; margin: 0; }
    .game__choices { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .choice { padding: .8rem .6rem; font-size: 1rem; }
    .game__toast { bottom: 1.25rem; }

    /* Assistant de configuration */
    .option-grid { grid-template-columns: 1fr 1fr; }
    .setup { padding-bottom: .5rem; }

    /* Statistiques */
    .stat-bar { grid-template-columns: minmax(78px, 1fr) 2fr auto; gap: .5rem; font-size: .85rem; }
    .stat-columns { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .option-grid { grid-template-columns: 1fr; }
    .hero__title { font-size: 1.7rem; }
    .account-chip__name { display: none; }
    .result-card__actions .btn { flex: 1; }
}

/* Hauteur dynamique (barre d'URL mobile) — le jeu peut remplir l'écran */
@supports (min-height: 100dvh) {
    .app-shell { min-height: 100dvh; }
}
