:root {
    --bg: #f3f7fb;
    --bg-gradient-start: #eff5fb;
    --bg-gradient-mid: #f8fbfe;
    --bg-gradient-end: #edf3f9;
    --bg-radial: rgba(22, 100, 211, 0.08);
    --panel: #ffffff;
    --panel-soft: #f8fbff;
    --text: #18212f;
    --muted: #637087;
    --line: #d9e3ef;
    --primary: #1664d3;
    --primary-dark: #0d4eae;
    --success: #1f9d63;
    --warning: #c88719;
    --danger: #d44f44;
    --shadow: 0 18px 45px rgba(14, 35, 68, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --card-bg: rgba(255,255,255,0.92);
    --card-border: rgba(217, 227, 239, 0.9);
    --hero-overlay-start: rgba(10, 18, 35, 0.84);
    --hero-overlay-end: rgba(22, 100, 211, 0.52);
    --message-bg: linear-gradient(180deg, #fff8df, #fff2c3);
    --message-border: #f0dd96;
    --message-text: #624b00;
    --input-bg: #ffffff;
    --input-icon: #7c89a0;
    --stat-border: #e5eef7;
    --empty-border: #cad7e5;
    --empty-bg: linear-gradient(180deg, #fafcff, #f5f9fe);
    --table-row-border: #edf2f7;
    --progress-track: #dfeaf7;
    --status-neutral-bg: #f8fbff;
    --status-neutral-border: #e5eef7;
    --theme-toggle-bg: rgba(255,255,255,0.18);
    --theme-toggle-border: rgba(255,255,255,0.25);
    --theme-toggle-color: #ffffff;
}

html[data-theme="dark"] {
    --bg: #020617;
    --bg-gradient-start: #020617;
    --bg-gradient-mid: #061122;
    --bg-gradient-end: #020617;
    --bg-radial: rgba(59, 130, 246, 0.18);
    --panel: #0f172a;
    --panel-soft: #111c31;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #334155;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    --card-bg: rgba(15, 23, 42, 0.94);
    --card-border: rgba(51, 65, 85, 0.9);
    --hero-overlay-start: rgba(2, 6, 23, 0.88);
    --hero-overlay-end: rgba(37, 99, 235, 0.36);
    --message-bg: linear-gradient(180deg, rgba(58, 46, 10, 0.88), rgba(42, 32, 6, 0.94));
    --message-border: #6b5a1f;
    --message-text: #f5e7a4;
    --input-bg: #020617;
    --input-icon: #94a3b8;
    --stat-border: #22314b;
    --empty-border: #334155;
    --empty-bg: linear-gradient(180deg, #0f172a, #0b1326);
    --table-row-border: #1e293b;
    --progress-track: #1e293b;
    --status-neutral-bg: #0b1220;
    --status-neutral-border: #22314b;
    --theme-toggle-bg: rgba(15, 23, 42, 0.52);
    --theme-toggle-border: rgba(255,255,255,0.14);
    --theme-toggle-color: #f8fafc;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at top left, var(--bg-radial), transparent 30%),
        linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 45%, var(--bg-gradient-end) 100%);
    color: var(--text);
    overflow-x: hidden;
}

body,
.card,
input[type="text"],
input[type="number"],
.stat-box,
.summary-row,
.progress-card,
.status-panel,
.message-block,
.expense-share,
.empty-state,
.theme-toggle,
.hero-overlay,
.progress-track,
.progress-bar,
.delete-btn,
.btn-secondary,
.btn-danger {
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.page-shell {
    padding: 28px 18px 48px;
}

.container {
    width: min(1280px, 100%);
    margin: 0 auto;
}

.hero {
    position: relative;
    overflow: hidden;
    min-height: 260px;
    border-radius: 28px;
    background: url('/img/entete.png') center center / cover no-repeat;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, var(--hero-overlay-start), var(--hero-overlay-end));
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
    padding: 36px 40px;
    color: #fff;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--theme-toggle-border);
    border-radius: 14px;
    background: var(--theme-toggle-bg);
    color: var(--theme-toggle-color);
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.05;
}

.hero h1 span {
    color: #bfe0ff;
}

.hero p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.9);
}

.message-block {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--message-bg);
    border: 1px solid var(--message-border);
    color: var(--message-text);
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 28px rgba(98, 75, 0, 0.08);
    margin-bottom: 24px;
}

.message-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.12);
    font-size: 1.2rem;
    flex: 0 0 auto;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 24px;
    backdrop-filter: blur(8px);
    min-width: 0;
    max-width: 100%;
}

.full-width {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: 100%;
}

.section-header {
    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
}

.section-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

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

.stack-lg {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field-grid {
    display: grid;
    gap: 16px;
}

.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-cols {
    grid-template-columns: 1.4fr 0.8fr;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.span-2 {
    grid-column: span 1;
}

label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.input-icon-container {
    position: relative;
}

.input-icon-container i {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--input-icon);
    font-size: 1rem;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    height: 56px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    padding: 0 16px 0 48px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
}

input:focus {
    border-color: rgba(22, 100, 211, 0.7);
    box-shadow: 0 0 0 4px rgba(22, 100, 211, 0.12);
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.split-actions {
    justify-content: space-between;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
    text-decoration: none;
    max-width: 100%;
    white-space: normal;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 12px 24px rgba(22, 100, 211, 0.28);
}

.btn-secondary {
    background: var(--panel-soft);
    color: var(--text);
    border: 1px solid var(--stat-border);
}

.btn-danger {
    background: rgba(212, 79, 68, 0.12);
    color: var(--danger);
}

.btn.ghost {
    box-shadow: none;
}

.quick-stats {
    display: flex;
    flex-direction: column;
}

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

.stat-box {
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
    border-radius: 18px;
    padding: 18px;
}

.stat-box.highlight {
    background: linear-gradient(180deg, rgba(22, 100, 211, 0.12), rgba(22, 100, 211, 0.04));
    border-color: rgba(22, 100, 211, 0.18);
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.stat-box strong {
    font-size: 1.4rem;
}

.pill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(22, 100, 211, 0.08);
    border: 1px solid rgba(22, 100, 211, 0.12);
}

.empty-state {
    padding: 32px 18px;
    border: 1px dashed var(--empty-border);
    border-radius: 18px;
    text-align: center;
    color: var(--muted);
    background: var(--empty-bg);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 12px;
    color: #9fb0c6;
}

.hidden {
    display: none !important;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.expense-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.expense-table thead th {
    text-align: left;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 0 0 14px;
    border-bottom: 1px solid var(--line);
}

.expense-table tbody td {
    padding: 16px 0;
    border-bottom: 1px solid var(--table-row-border);
    vertical-align: middle;
}

.expense-name {
    font-weight: 700;
}

.expense-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(22, 100, 211, 0.08);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.88rem;
}

.delete-btn {
    border: 0;
    background: rgba(212, 79, 68, 0.12);
    color: var(--danger);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    cursor: pointer;
}

.summary-card,
.chart-card {
    align-self: start;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
}

.summary-row span {
    color: var(--muted);
}

.progress-card {
    border: 1px solid var(--stat-border);
    border-radius: 18px;
    padding: 16px;
    background: linear-gradient(180deg, var(--panel-soft), rgba(22, 100, 211, 0.04));
    margin-bottom: 18px;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    font-weight: 700;
}

.progress-track {
    height: 14px;
    border-radius: 999px;
    background: var(--progress-track);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--success), #58b87e);
    transition: width 0.3s ease, background 0.25s ease;
}

.status-panel {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 14px;
    align-items: center;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--status-neutral-border);
    background: var(--status-neutral-bg);
}

.status-panel strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1.05rem;
}

.status-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.status-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-size: 1.4rem;
    background: rgba(22, 100, 211, 0.12);
    color: var(--primary);
}

.status-panel.success {
    background: rgba(31, 157, 99, 0.08);
    border-color: rgba(31, 157, 99, 0.18);
}

.status-panel.success .status-icon {
    background: rgba(31, 157, 99, 0.16);
    color: var(--success);
}

.status-panel.warning {
    background: rgba(200, 135, 25, 0.08);
    border-color: rgba(200, 135, 25, 0.18);
}

.status-panel.warning .status-icon {
    background: rgba(200, 135, 25, 0.16);
    color: var(--warning);
}

.status-panel.danger {
    background: rgba(212, 79, 68, 0.08);
    border-color: rgba(212, 79, 68, 0.18);
}

.status-panel.danger .status-icon {
    background: rgba(212, 79, 68, 0.16);
    color: var(--danger);
}

.chart-wrapper {
    min-height: 360px;
}

#myChart {
    width: 100% !important;
    height: 360px !important;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
    color: var(--muted);
}

.footer-brand a {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

#imageBas {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.layout-grid > *,
.field-grid > *,
.actions-row,
.split-actions,
.expense-form,
.section-header,
.inline-between {
    min-width: 0;
    max-width: 100%;
}


@media (max-width: 980px) {
    .layout-grid,
    .two-cols,
    .three-cols {
        grid-template-columns: 1fr;
    }

    .inline-between,
    .summary-row,
    .progress-meta,
    .split-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero-content {
        padding: 30px 22px;
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 14px 10px 28px;
    }

    .card {
        padding: 18px;
        border-radius: 20px;
    }

    .hero {
        min-height: 220px;
        border-radius: 20px;
    }

    .message-block {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        margin: 0 -6px;
        padding: 0 6px 2px;
    }

    .expense-table {
        min-width: 560px;
    }

    .actions-row,
    .split-actions {
        width: 100%;
    }

    .btn {
        width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .theme-toggle {
        width: 42px;
        height: 42px;
    }
}

@media print {
    .btn,
    .delete-btn,
    .theme-toggle {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .card,
    .hero,
    .message-block {
        box-shadow: none;
    }
}

.top-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    font-weight: 700;
}

.top-back-link:hover {
    color: #ffffff;
}

.site-home {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero-home {
    min-height: 340px;
}

.hero-home-content {
    max-width: 840px;
}

.hero-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.home-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.app-card,
.mini-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.app-card-featured {
    position: relative;
    overflow: hidden;
}

.app-card-featured::after {
    content: '';
    position: absolute;
    inset: auto -80px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(22, 100, 211, 0.14), transparent 68%);
    pointer-events: none;
}

.app-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(22, 100, 211, 0.1);
    color: var(--primary);
    font-size: 1.35rem;
}

.app-card h3,
.mini-card h3 {
    margin: 0;
    font-size: 1.3rem;
}

.app-card p,
.mini-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.feature-list,
.insight-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feature-list li,
.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text);
    line-height: 1.5;
}

.feature-list li::before,
.insight-item::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary);
    margin-top: 2px;
}

.app-card-actions {
    margin-top: auto;
}

.mini-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.disabled-card {
    opacity: 0.92;
}

.card-soon {
    display: inline-flex;
    align-self: flex-start;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(99, 112, 135, 0.12);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.84rem;
}

.footer-brand-home {
    margin-top: 0;
}

.life-grid {
    grid-template-columns: 1.05fr 0.95fr;
}

.life-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.life-bar-row {
    display: grid;
    grid-template-columns: 170px 1fr 86px;
    gap: 14px;
    align-items: center;
}

.life-bar-label {
    font-weight: 700;
}

.life-bar-track {
    height: 16px;
    border-radius: 999px;
    background: var(--progress-track);
    overflow: hidden;
}

.life-bar-fill {
    height: 100%;
    border-radius: inherit;
    min-width: 4px;
}

.life-bar-value {
    text-align: right;
    color: var(--muted);
    font-weight: 700;
}

.emphasis-row {
    background: linear-gradient(180deg, rgba(22, 100, 211, 0.12), rgba(22, 100, 211, 0.04));
    border-color: rgba(22, 100, 211, 0.18);
}

.simulation-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
    margin-bottom: 18px;
}

.simulation-label {
    font-size: 0.95rem;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.simulation-meta {
    margin: 0;
}

.home-intro-block {
    margin-bottom: 0;
}

@media (max-width: 980px) {
    .app-grid,
    .mini-card-grid,
    .life-grid {
        grid-template-columns: 1fr;
    }

    .life-bar-row {
        grid-template-columns: 1fr;
    }

    .life-bar-value {
        text-align: left;
    }
}

@media (max-width: 640px) {
    .hero-home {
        min-height: 300px;
    }

    .hero-home-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .top-back-link {
        margin-right: 56px;
    }
}

.hero-games {
    min-height: 320px;
    background:
        radial-gradient(circle at 18% 25%, rgba(255,255,255,0.18), transparent 22%),
        radial-gradient(circle at 82% 30%, rgba(255,255,255,0.14), transparent 24%),
        linear-gradient(125deg, #061327 0%, #123f8f 52%, #1fb6a6 100%);
}

.hero-game-life {
    min-height: 340px;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18), transparent 18%),
        radial-gradient(circle at 78% 22%, rgba(255,255,255,0.14), transparent 20%),
        radial-gradient(circle at 68% 72%, rgba(255,255,255,0.10), transparent 16%),
        linear-gradient(135deg, #081120 0%, #1a3f87 42%, #6a45d1 72%, #13a189 100%);
}

.hero-game-life-content {
    max-width: 880px;
}

.app-grid-single {
    grid-template-columns: minmax(0, 1fr);
}

.game-card-featured {
    min-height: 280px;
}

.game-life-grid {
    grid-template-columns: 1.05fr 0.95fr;
}

.game-dashboard-card,
.game-step-card,
.game-log-card,
.game-final-card {
    position: relative;
    overflow: hidden;
}

.game-dashboard-card::after,
.game-step-card::after,
.game-final-card::after {
    content: '';
    position: absolute;
    inset: auto -70px -70px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(22, 100, 211, 0.10), transparent 68%);
    pointer-events: none;
}

.age-stage {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.age-ring-wrap {
    display: grid;
    place-items: center;
}

.age-ring {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35), transparent 22%),
        conic-gradient(from 180deg, #1664d3, #6847d6, #1f9d63, #1664d3);
    color: #fff;
    box-shadow: 0 22px 42px rgba(22, 100, 211, 0.26);
    transform-style: preserve-3d;
    transition: transform 0.18s ease;
}

.age-ring::before {
    content: '';
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    background: rgba(7, 13, 28, 0.78);
    backdrop-filter: blur(10px);
}

.age-ring span,
.age-ring small {
    position: relative;
    z-index: 1;
}

.age-ring span {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.age-ring small {
    margin-top: 8px;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.84);
}

.life-avatar-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 18px;
    align-items: center;
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(22, 100, 211, 0.08), rgba(22, 100, 211, 0.03));
    border: 1px solid rgba(22, 100, 211, 0.12);
}

.life-avatar-visual {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at center, rgba(255,255,255,0.14), rgba(255,255,255,0.03));
    overflow: hidden;
}

.avatar-core {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffffff, rgba(255,255,255,0.82));
    box-shadow: 0 0 24px rgba(255,255,255,0.35);
}

.avatar-orbit {
    position: absolute;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
}

.orbit-a {
    width: 108px;
    height: 108px;
    animation: orbitSpin 10s linear infinite;
}

.orbit-b {
    width: 136px;
    height: 136px;
    animation: orbitSpin 14s linear infinite reverse;
}

.orbit-c {
    width: 152px;
    height: 152px;
    animation: orbitSpin 18s linear infinite;
}

@keyframes orbitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.avatar-state-balanced {
    background: radial-gradient(circle at center, rgba(22, 100, 211, 0.22), rgba(255,255,255,0.02));
}

.avatar-state-money {
    background: radial-gradient(circle at center, rgba(240, 178, 74, 0.28), rgba(255,255,255,0.02));
}

.avatar-state-money .avatar-core {
    background: linear-gradient(180deg, #ffe9a8, #f0b24a);
}

.avatar-state-freedom {
    background: radial-gradient(circle at center, rgba(31, 157, 99, 0.25), rgba(255,255,255,0.02));
}

.avatar-state-freedom .avatar-core {
    background: linear-gradient(180deg, #d3ffe4, #58b87e);
}

.avatar-state-relations {
    background: radial-gradient(circle at center, rgba(212, 79, 68, 0.24), rgba(255,255,255,0.02));
}

.avatar-state-relations .avatar-core {
    background: linear-gradient(180deg, #ffd4cf, #ef7a70);
}

.avatar-state-burnout {
    background: radial-gradient(circle at center, rgba(104, 71, 214, 0.25), rgba(255,255,255,0.02));
}

.avatar-state-burnout .avatar-core {
    background: linear-gradient(180deg, #ddd6ff, #8b6bf0);
}

.life-avatar-text strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.life-avatar-text p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.game-stat-grid .stat-box {
    position: relative;
    overflow: hidden;
}

.game-stat-grid .stat-box::after {
    content: '';
    position: absolute;
    inset: auto -28px -38px auto;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    opacity: 0.45;
}

.stat-box-money::after { background: radial-gradient(circle, rgba(240,178,74,0.34), transparent 70%); }
.stat-box-energy::after { background: radial-gradient(circle, rgba(104,71,214,0.28), transparent 70%); }
.stat-box-freedom::after { background: radial-gradient(circle, rgba(31,157,99,0.30), transparent 70%); }
.stat-box-relations::after { background: radial-gradient(circle, rgba(212,79,68,0.28), transparent 70%); }

.game-meters {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}

.meter-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
}

.meter-money { background: linear-gradient(90deg, #d99a1c, #f0b24a); }
.meter-energy { background: linear-gradient(90deg, #6847d6, #8b6bf0); }
.meter-freedom { background: linear-gradient(90deg, #1f9d63, #58b87e); }
.meter-relations { background: linear-gradient(90deg, #d44f44, #ef7a70); }

.timeline-track {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.timeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: var(--muted);
    font-size: 0.86rem;
}

.timeline-dot {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
    font-weight: 800;
}

.timeline-node.done .timeline-dot {
    background: linear-gradient(180deg, rgba(31,157,99,0.18), rgba(31,157,99,0.08));
    border-color: rgba(31,157,99,0.26);
    color: var(--success);
}

.timeline-node.active .timeline-dot {
    background: linear-gradient(180deg, rgba(22,100,211,0.18), rgba(22,100,211,0.08));
    border-color: rgba(22,100,211,0.26);
    color: var(--primary);
    box-shadow: 0 0 0 5px rgba(22,100,211,0.08);
}

.choice-grid {
    display: grid;
    gap: 16px;
}

.choice-card {
    width: 100%;
    text-align: left;
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 18px;
    cursor: pointer;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)),
        var(--card-bg);
    box-shadow: var(--shadow);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.choice-card:hover {
    transform: translateY(-2px);
    border-color: rgba(22, 100, 211, 0.24);
    box-shadow: 0 24px 38px rgba(14, 35, 68, 0.14);
}

.choice-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.choice-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(22, 100, 211, 0.10);
    color: var(--primary);
    font-size: 1.25rem;
    flex: 0 0 auto;
}

.choice-card p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.6;
}

.choice-effects,
.final-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.effect-chip,
.final-tag,
.final-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.effect-positive {
    background: rgba(31,157,99,0.10);
    color: var(--success);
}

.effect-negative {
    background: rgba(212,79,68,0.10);
    color: var(--danger);
}

.game-actions-row {
    margin-top: 18px;
}

.game-log-list {
    display: grid;
    gap: 14px;
}

.game-log-item {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 16px;
    align-items: start;
    padding: 16px;
    border-radius: 18px;
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
}

.game-log-age {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(22,100,211,0.10);
    color: var(--primary);
    font-weight: 800;
}

.game-log-content strong {
    display: block;
    margin-bottom: 8px;
}

.game-log-content p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.6;
}

.final-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.final-main-card,
.final-summary-row {
    padding: 20px;
    border-radius: 22px;
    background: var(--panel-soft);
    border: 1px solid var(--stat-border);
}

.final-main-card {
    background:
        radial-gradient(circle at top right, rgba(22,100,211,0.10), transparent 32%),
        var(--panel-soft);
}

.final-badge {
    background: rgba(22,100,211,0.10);
    color: var(--primary);
    margin-bottom: 14px;
}

.final-main-card h3 {
    margin: 0 0 12px;
    font-size: 1.55rem;
}

.final-main-card p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.7;
}

.final-summary-list {
    display: grid;
    gap: 14px;
}

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

.final-summary-row strong {
    display: block;
    margin-bottom: 6px;
}

.final-summary-row p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.final-summary-row span {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}

@media (max-width: 980px) {
    .game-life-grid,
    .final-grid,
    .age-stage,
    .life-avatar-card {
        grid-template-columns: 1fr;
    }

    .timeline-track {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .age-ring {
        width: 160px;
        height: 160px;
    }

    .age-ring span {
        font-size: 2.4rem;
    }

    .timeline-track {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-log-item,
    .final-summary-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }
}
