@font-face {
    font-family: "Fredoka";
    src: url("../fonts/fredoka-600.ttf") format("truetype");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: "Fredoka";
    src: url("../fonts/fredoka-700.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

:root {
    --fond-1: #fff7dc;
    --fond-2: #def5ff;
    --fond-3: #ffe7da;
    --surface: rgba(255, 252, 246, 0.9);
    --surface-strong: rgba(255, 255, 255, 0.82);
    --ink: #274358;
    --soft: #667888;
    --accent: #f27457;
    --accent-2: #1088ae;
    --good: #33b07a;
    --bad: #ef6d5c;
    --warn: #f6b73c;
    --line: rgba(39, 67, 88, 0.1);
    --shadow: 0 24px 60px rgba(39, 67, 88, 0.16);
    --title-ink: #3d5d74;
    --title-ink-soft: #58788f;
    --title-font: Georgia, "Times New Roman", serif;
    --display-font: "Fredoka", "Trebuchet MS", "Gill Sans", sans-serif;
    --body-font: "Trebuchet MS", "Gill Sans", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    font-family: var(--body-font);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 32%),
        radial-gradient(circle at bottom right, rgba(16, 136, 174, 0.12), transparent 28%),
        linear-gradient(135deg, var(--fond-1), var(--fond-2) 56%, var(--fond-3));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 70%);
}

body.page-jeu {
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    border: none;
    border-radius: 16px;
    padding: 14px 20px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(242, 116, 87, 0.32);
    outline-offset: 3px;
}

.button-with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.button-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.primaire {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #e15d42);
    box-shadow: 0 12px 24px rgba(242, 116, 87, 0.22);
}

.secondaire {
    color: #0b6d8e;
    background: #eaf7fb;
}

.site-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    margin: 0 auto;
}

.site-shell-game {
    width: min(1040px, 100%);
}

.home-shell {
    display: grid;
    gap: 22px;
}

.panel,
.panneau,
.mini-carte,
.ligne-dashboard {
    background: var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.panel {
    border-radius: 32px;
    box-shadow: var(--shadow);
}

.home-header {
    padding: 24px 26px;
}

.home-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.home-header-copy {
    display: grid;
    gap: 10px;
}

.home-title {
    font-family: var(--display-font);
    font-size: clamp(2.4rem, 5vw, 3.5rem);
    line-height: 1;
}

.home-note {
    margin: 0;
    max-width: 34ch;
    line-height: 1.55;
    color: var(--soft);
}

.home-history-button {
    flex: 0 0 auto;
    min-width: 190px;
}

.home-catalogue {
    margin-top: 0;
}

.home-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(33, 51, 70, 0.42);
    backdrop-filter: blur(6px);
}

.home-modal.visible {
    display: flex;
}

.home-modal-card {
    width: min(460px, 100%);
    padding: 24px;
    border-radius: 30px;
    background: linear-gradient(160deg, rgba(255, 253, 247, 0.98), rgba(226, 245, 255, 0.95));
    box-shadow: 0 24px 60px rgba(39, 67, 88, 0.2);
}

.home-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.home-modal-close {
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 50%;
    color: #0b6d8e;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    padding: 26px;
    overflow: hidden;
}

.hero-copy,
.hero-side {
    position: relative;
}

.hero-copy::after {
    content: "";
    position: absolute;
    right: 12%;
    bottom: -36px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(242, 116, 87, 0.28), transparent 68%);
    pointer-events: none;
}

.eyebrow,
.badge,
.card-badge,
#niveau-personnage {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.eyebrow,
.badge {
    color: #cb5439;
    background: rgba(242, 116, 87, 0.12);
}

.hero h1,
h1,
h2,
h3,
.nom {
    margin: 0;
    font-family: var(--title-font);
    color: var(--title-ink);
}

.hero h1 {
    margin-top: 16px;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    line-height: 1.03;
    max-width: 11ch;
}

.page-accueil .hero h1,
.page-accueil .game-card h3,
.page-jeu h1,
.page-jeu h2,
.page-jeu .nom,
.page-jeu .sous-titre,
.page-jeu .name-modal-card h2,
.page-jeu .question-proportion {
    font-family: var(--display-font);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.page-accueil .game-card h3 {
    line-height: 1.08;
}

.hero-intro,
.hero-note,
.intro,
#message-personnage,
.astuce,
.section-note,
.game-card p {
    margin: 14px 0 0;
    line-height: 1.6;
    color: var(--soft);
}

.summary-card {
    height: 100%;
    padding: 24px;
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(248, 252, 255, 0.9));
    border: 1px solid var(--line);
}

.recent-card {
    display: flex;
    flex-direction: column;
}

.summary-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.summary-item {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 0 0 1px rgba(39, 67, 88, 0.06);
}

.summary-item span,
.ligne-dashboard span,
.etiquette {
    display: block;
    margin-bottom: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--soft);
}

.summary-item strong,
.valeur {
    font-size: clamp(1.2rem, 2.8vw, 1.8rem);
    font-weight: 700;
    color: #213346;
}

.storage-status,
.save-status {
    min-height: 24px;
    margin: 16px 0 0;
    font-weight: 700;
}

.recent-players {
    display: grid;
    gap: 12px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.recent-player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 0 0 1px rgba(39, 67, 88, 0.06);
}

.recent-player-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-weight: 700;
    color: #cb5439;
    background: rgba(242, 116, 87, 0.14);
}

.recent-player-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #213346;
}

.recent-players-empty {
    margin: 18px 0 0;
    line-height: 1.5;
    color: var(--soft);
}

.player-message {
    min-height: 24px;
    margin: 0;
    font-weight: 700;
    color: var(--soft);
}

.storage-status[data-tone="success"],
.save-status[data-tone="success"] {
    color: var(--good);
}

.storage-status[data-tone="warn"],
.save-status[data-tone="warn"] {
    color: #9a6507;
}

.storage-status[data-tone="info"],
.save-status[data-tone="info"] {
    color: var(--accent-2);
}

.catalogue {
    margin-top: 28px;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head h2 {
    margin-top: 10px;
    font-size: clamp(1.8rem, 3vw, 2.3rem);
}

.section-note {
    max-width: 28ch;
    text-align: right;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.game-card {
    position: relative;
    display: grid;
    align-content: stretch;
    min-height: 260px;
    padding: 24px;
    overflow: hidden;
    border-radius: 30px;
    background: linear-gradient(155deg, rgba(255, 253, 247, 0.96), rgba(226, 245, 255, 0.94));
    border: 1px solid rgba(39, 67, 88, 0.08);
    box-shadow: 0 18px 36px rgba(39, 67, 88, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.game-card::before {
    content: "";
    position: absolute;
    top: -42px;
    right: -26px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(242, 116, 87, 0.22), transparent 70%);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 42px rgba(39, 67, 88, 0.15);
}

.card-multiplication {
    background: linear-gradient(160deg, #fff39c 0%, #ffd16c 55%, #ff9d74 100%);
}

.card-proportion {
    background: linear-gradient(160deg, #bdf6ff 0%, #7ddfff 50%, #9df3ba 100%);
}

.card-fractions {
    background: linear-gradient(160deg, #ffe6f6 0%, #ffd4b8 55%, #ffd86b 100%);
}

.card-conversions {
    background: linear-gradient(160deg, #d9f8d8 0%, #b7f0ff 52%, #89d4ff 100%);
}

.game-card-placeholder {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.62);
}

.card-badge {
    position: relative;
    z-index: 1;
    width: fit-content;
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.12);
}

.card-badge-soft {
    color: #8d6a12;
    background: rgba(246, 183, 60, 0.2);
}

.game-card h3 {
    position: relative;
    z-index: 1;
    font-size: clamp(1.8rem, 4vw, 2.3rem);
    color: var(--title-ink);
}

.card-body {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 28px;
    height: 100%;
}

.card-visual {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 126px;
    padding: 18px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.card-equation {
    gap: 10px;
    flex-wrap: wrap;
}

.card-equation span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 52px;
    padding: 8px 12px;
    border-radius: 18px;
    font-family: var(--title-font);
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    font-weight: 700;
    color: #213346;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.card-equation .card-sign {
    min-width: 38px;
    background: rgba(242, 116, 87, 0.15);
    color: #c95237;
}

.card-equation .card-answer {
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.14);
}

.card-mini-table {
    display: grid;
    gap: 10px;
}

.card-fraction-visual,
.card-conversion-visual {
    gap: 14px;
    flex-wrap: wrap;
}

.home-fraction-card,
.home-conversion-part {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.home-fraction-card {
    position: relative;
    min-width: 82px;
    flex-direction: column;
    gap: 8px;
}

.home-fraction-top,
.home-fraction-bottom {
    font-family: var(--title-font);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1;
}

.home-fraction-line {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(39, 67, 88, 0.3);
}

.home-fraction-symbol {
    font-family: var(--display-font);
    font-size: clamp(1.8rem, 4vw, 2.3rem);
    font-weight: 700;
    color: #cb5439;
}

.home-conversion-part {
    font-family: var(--display-font);
    font-size: clamp(1.2rem, 3vw, 1.7rem);
    font-weight: 700;
    color: #213346;
}

.card-table-row {
    display: grid;
    grid-template-columns: 0.9fr repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.card-table-row span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 10px 8px;
    border-radius: 18px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #213346;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.card-table-row .card-table-label {
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.14);
}

.retour-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 0 0 1px rgba(39, 67, 88, 0.08);
    font-weight: 700;
    color: #0b6d8e;
}

.mission-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    align-items: start;
}

.mission-column {
    display: grid;
    gap: 20px;
    align-content: start;
}

.mission-side {
    grid-template-rows: auto 1fr;
}

.mission-header {
    margin-top: 10px;
}

.entete,
.zone-principale {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

.entete {
    margin-top: 10px;
}

h1 {
    margin-top: 12px;
    font-size: clamp(2.1rem, 4.6vw, 3.1rem);
    color: var(--title-ink);
}

.stats {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mini-carte {
    padding: 14px;
    border-radius: 18px;
}

.zone-principale {
    margin-top: 20px;
}

.panneau {
    padding: 20px;
    border-radius: 26px;
}

.name-modal {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(33, 51, 70, 0.42);
    backdrop-filter: blur(6px);
}

.name-modal.visible {
    display: flex;
}

.name-modal-card {
    width: min(720px, 100%);
    padding: 24px;
    border-radius: 30px;
    background: linear-gradient(155deg, rgba(255, 253, 247, 0.98), rgba(226, 245, 255, 0.95));
    box-shadow: 0 24px 60px rgba(39, 67, 88, 0.2);
}

.name-modal-card h2 {
    margin-top: 14px;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.name-modal-text {
    margin: 12px 0 0;
    line-height: 1.6;
    color: var(--soft);
}

.companion-picker {
    margin-top: 18px;
}

.companion-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.companion-picker-head strong {
    font-size: 1rem;
}

.companion-picker-head span {
    font-size: 0.92rem;
    color: var(--soft);
}

.companion-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 12px;
}

.companion-option {
    display: grid;
    place-items: center;
    width: 100%;
    padding: 12px;
    border-radius: 22px;
    text-align: center;
    color: #213346;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.companion-option.selected {
    background: rgba(255, 245, 232, 0.96);
    box-shadow: inset 0 0 0 3px rgba(242, 116, 87, 0.24), 0 12px 20px rgba(242, 116, 87, 0.12);
}

.companion-option-thumb {
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 112px;
    padding: 10px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 247, 231, 0.95), rgba(255, 255, 255, 0.92));
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.06);
}

.companion-option-image {
    display: block;
    max-width: 100%;
    max-height: 96px;
    object-fit: contain;
}

.name-modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.name-modal-error {
    min-height: 24px;
    margin: 12px 0 0;
    font-weight: 700;
    color: var(--bad);
}

.evolution-overlay {
    position: fixed;
    inset: 0;
    z-index: 9;
    display: grid;
    place-items: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.evolution-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.evolution-burst {
    --burst-x: 0px;
    --burst-y: -120px;
    --burst-scale: 0.28;
    display: grid;
    justify-items: center;
    gap: 18px;
    width: min(360px, calc(100vw - 48px));
    padding: 26px;
    border-radius: 34px;
    background: linear-gradient(160deg, rgba(255, 250, 239, 0.98), rgba(223, 247, 255, 0.96));
    box-shadow: 0 28px 60px rgba(39, 67, 88, 0.2);
    transform: translate3d(0, 0, 0) scale(0.82);
    opacity: 0;
    transition: transform 0.72s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.34s ease;
}

.evolution-overlay.visible .evolution-burst {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.evolution-overlay.settling .evolution-burst {
    transform: translate3d(var(--burst-x), var(--burst-y), 0) scale(var(--burst-scale));
    opacity: 0;
}

.evolution-burst-figure {
    display: grid;
    place-items: center;
    width: min(250px, 100%);
    min-height: 220px;
    padding: 20px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.evolution-burst-image {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.evolution-burst-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.12);
}

.boite-question {
    padding: 22px;
    border-radius: 24px;
    text-align: center;
    background: linear-gradient(145deg, #fffdf7, #fff4e8);
}

.sous-titre {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--title-ink-soft);
}

#question {
    margin-top: 12px;
    font-family: var(--title-font);
    font-size: clamp(2.6rem, 7vw, 4.6rem);
    color: #df5b3d;
}

.question-proportion {
    margin-top: 12px;
    font-size: clamp(1.6rem, 3.8vw, 2.5rem);
    color: #d5725d;
}

.tableau-proportionnalite {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.tableau-ligne {
    display: grid;
    grid-template-columns: 1.1fr repeat(3, 1fr);
    gap: 10px;
}

.tableau-etiquette,
.tableau-cellule {
    padding: 14px 10px;
    border-radius: 16px;
    font-weight: 700;
}

.tableau-etiquette {
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.12);
}

.tableau-cellule {
    background: rgba(255, 255, 255, 0.88);
    box-shadow: inset 0 0 0 2px rgba(41, 70, 92, 0.08);
}

.tableau-cellule.manquante {
    color: #df5b3d;
    background: rgba(255, 241, 232, 0.92);
    box-shadow: inset 0 0 0 2px rgba(223, 91, 61, 0.2);
}

.player-card {
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: inset 0 0 0 1px rgba(39, 67, 88, 0.08);
}

.player-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #213346;
}

.fraction-stage,
.conversion-stage {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.fraction-compare-board,
.fraction-fill-board,
.conversion-board {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-height: 160px;
    padding: 20px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
    flex-wrap: wrap;
}

.fraction-card-large {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 102px;
    min-height: 120px;
    padding: 14px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.fraction-number {
    font-family: var(--title-font);
    font-size: clamp(2rem, 5vw, 2.9rem);
    font-weight: 700;
    line-height: 1;
    color: #213346;
}

.fraction-divider {
    width: 68px;
    height: 5px;
    margin: 10px 0;
    border-radius: 999px;
    background: rgba(39, 67, 88, 0.26);
}

.fraction-symbol-large,
.conversion-symbol {
    font-family: var(--display-font);
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 700;
    color: #cb5439;
}

.conversion-board {
    gap: 12px;
}

.conversion-value,
.conversion-unit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.conversion-value {
    min-width: 88px;
    font-family: var(--display-font);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    color: #213346;
}

.conversion-unit {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0b6d8e;
}

.conversion-value.missing {
    color: #df5b3d;
    background: rgba(255, 241, 232, 0.92);
    box-shadow: inset 0 0 0 2px rgba(223, 91, 61, 0.2);
}

.choix-reponse {
    margin-top: 18px;
}

.choix-reponse button {
    min-width: 180px;
}

.reponse-tableau[hidden] {
    display: none;
}

.reponse-tableau button {
    min-width: 160px;
}

.ligne-reponse,
.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.ligne-reponse {
    margin-top: 18px;
}

input[type="number"] {
    width: min(220px, 100%);
    padding: 14px 18px;
    border: 3px solid transparent;
    border-radius: 18px;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: #213346;
    background: #fff;
    box-shadow: inset 0 0 0 2px rgba(41, 70, 92, 0.12);
}

input[type="text"] {
    min-width: 220px;
    flex: 1 1 220px;
    padding: 14px 16px;
    border: 3px solid transparent;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #213346;
    background: #fff;
    box-shadow: inset 0 0 0 2px rgba(41, 70, 92, 0.12);
}

input[type="number"]:focus,
input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(242, 116, 87, 0.14);
}

#retour-information {
    min-height: 28px;
    margin-top: 16px;
    font-weight: 700;
}

#resume-serie {
    display: none;
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    line-height: 1.5;
    color: #5a4200;
    background: #fff3bf;
}

.progression {
    margin-top: 18px;
}

.tete-progression {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

#grille-progression {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
}

.case {
    height: 16px;
    border-radius: 999px;
    background: #e6ecf2;
}

.case.actuelle {
    background: var(--warn);
    box-shadow: 0 0 0 4px rgba(246, 183, 60, 0.24);
}

.case.reussie {
    background: var(--good);
}

.case.erreur {
    background: var(--bad);
}

.mascotte {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.character-preview {
    min-height: 220px;
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 20px;
    border-radius: 26px;
    background: linear-gradient(180deg, #dff7ff, #fff8df);
}

.character-preview-figure {
    display: grid;
    place-items: center;
    width: min(180px, 100%);
    min-height: 138px;
    padding: 10px;
    overflow: hidden;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: inset 0 0 0 2px rgba(39, 67, 88, 0.08);
}

.character-preview-image {
    display: block;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
}

.character-preview-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.12);
}

.character-preview.good {
    box-shadow: inset 0 0 0 4px rgba(51, 176, 122, 0.25);
}

.character-preview.focus {
    box-shadow: inset 0 0 0 4px rgba(239, 109, 92, 0.25);
}

.character-preview.super {
    box-shadow: inset 0 0 0 4px rgba(242, 116, 87, 0.3);
}

.nom {
    font-size: 1.4rem;
    font-weight: 700;
}

#niveau-personnage {
    margin-top: 8px;
    color: #0b6d8e;
    background: rgba(16, 136, 174, 0.12);
}

h2 {
    margin-bottom: 16px;
}

.dashboard {
    display: grid;
    gap: 12px;
}

.dashboard-horizontal {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mission-dashboard-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100%;
}

.mission-dashboard-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
}

.dashboard .ligne-dashboard span {
    margin-bottom: 4px;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
}

.dashboard .ligne-dashboard strong {
    font-size: 1rem;
}

.ligne-dashboard {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
}

.dashboard-horizontal .ligne-dashboard {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 110px;
    padding: 18px 16px;
}

.dashboard-horizontal .ligne-dashboard strong {
    font-size: 1.35rem;
}

.actions {
    margin-top: 18px;
}

.actions-sidebar {
    display: grid;
    gap: 10px;
    margin-top: 0;
}

.actions-sidebar button {
    width: 100%;
    justify-content: center;
}

@media (max-width: 920px) {
    .hero,
    .mission-grid,
    .entete,
    .zone-principale,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .home-header-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-note {
        text-align: left;
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .home-header {
        padding: 20px;
    }

    .hero,
    .summary-card,
    .panneau {
        padding: 18px;
    }

    .stats,
    .summary-grid,
    .dashboard-horizontal {
        grid-template-columns: 1fr;
    }

    .home-history-button {
        width: 100%;
    }

    .ligne-reponse input,
    .ligne-reponse button,
    .actions button,
    .choix-reponse button {
        width: 100%;
    }

    .tete-progression,
    .tableau-ligne {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-equation,
    .card-mini-table,
    .card-table-row {
        width: 100%;
    }

    .companion-picker-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .companion-options {
        grid-template-columns: 1fr;
    }

    .tableau-ligne {
        display: grid;
        grid-template-columns: 1fr;
    }

    .evolution-burst {
        width: min(300px, calc(100vw - 32px));
        padding: 22px;
    }

    .evolution-burst-figure {
        min-height: 180px;
    }
}
