:root {
    --ink: #14231d;
    --muted: #5f6f67;
    --paper: #f4f2ea;
    --card: #fffdf8;
    --line: #ddd9cc;
    --green: #0f6047;
    --green-dark: #0a3f30;
    --green-soft: #e3efe8;
    --lime: #c9f06b;
    --gold: #b7892f;
    --red: #ad3b2a;
    --red-soft: #f8e6e2;
    --amber: #9a6a12;
    --shadow: 0 14px 40px rgba(18, 40, 31, .08);
    --radius: 14px;
    --serif: Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 .5rem;
    letter-spacing: -.01em;
}

h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }
small { color: var(--muted); }

.container {
    width: min(1180px, calc(100% - 2.5rem));
    margin: 0 auto;
}

.narrow { width: min(860px, calc(100% - 2.5rem)); margin: 0 auto; }

/* ---------------- Navigation ---------------- */
.site-header {
    background: var(--green-dark);
    color: #f5f1e4;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .85rem 0;
}
.brand {
    font-family: var(--serif);
    font-size: 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .55rem;
    letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    background: var(--lime);
    color: var(--green-dark);
    border-radius: 8px;
    font-weight: 800;
    font-family: var(--sans);
    font-size: .9rem;
}
.nav-links { display: flex; gap: 1.25rem; align-items: center; margin-left: auto; flex-wrap: wrap; }
.nav-links a { color: #d9e5dc; font-size: .92rem; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-user { color: #9fb7aa; font-size: .85rem; }

/* ---------------- Buttons & badges ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: .62rem 1.1rem;
    font-family: var(--sans);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--green);
    color: #fff;
    transition: transform .12s ease, background .12s ease;
    text-decoration: none;
}
.btn:hover { background: var(--green-dark); text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-lime { background: var(--lime); color: var(--green-dark); }
.btn-lime:hover { background: #d8ff7d; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #efede4; color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #eccfc8; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 7px; }
.btn-block { width: 100%; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--green-soft);
    color: var(--green);
}
.badge-easy { background: #e2f2e6; color: #1f6b3c; }
.badge-normal { background: #f4eeda; color: var(--amber); }
.badge-hard { background: var(--red-soft); color: var(--red); }
.badge-muted { background: #ecebe3; color: var(--muted); }
.badge-win { background: #d9f0c8; color: #2c6b1f; }
.badge-loss { background: var(--red-soft); color: var(--red); }
.badge-bankrupt { background: #2d2a26; color: #f2d6cf; }

/* ---------------- Layout blocks ---------------- */
main { padding: 2.2rem 0 4rem; }

.hero {
    background: radial-gradient(1200px 500px at 15% -10%, #1b6b50 0%, var(--green-dark) 55%, #072a20 100%);
    color: #f6f2e6;
    padding: 4rem 0 3.5rem;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: "";
    position: absolute;
    inset: auto -10% -60% 50%;
    height: 380px;
    background: radial-gradient(circle, rgba(201,240,107,.18), transparent 65%);
}
.hero .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; max-width: 780px; }
.hero .lede { color: #c6d8cd; max-width: 640px; font-size: 1.08rem; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    font-weight: 700;
    color: var(--lime);
    margin-bottom: .8rem;
}
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.5rem; }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 2.5rem;
}
.stat-strip > div { background: var(--card); padding: 1rem 1.2rem; }
.stat-strip .num { font-family: var(--serif); font-size: 1.6rem; display: block; }
.stat-strip .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.section { margin-top: 3rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.section-head p { margin: 0; color: var(--muted); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow);
}
.card-flat { box-shadow: none; }
.card h3 { margin-bottom: .35rem; }
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; border-color: var(--green); transform: translateY(-2px); }
.card-link { transition: transform .15s ease, border-color .15s ease; }
.card .meta { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 .8rem; }
.card .desc { color: var(--muted); font-size: .9rem; margin-bottom: 0; }

.game-card-top { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.game-card .category { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }

.chip-row { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
    padding: .35rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    font-size: .8rem;
    color: var(--ink);
}
.chip:hover { text-decoration: none; border-color: var(--green); }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

/* ---------------- Forms ---------------- */
.form-row { margin-bottom: 1rem; }
label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.hint { font-size: .76rem; color: var(--muted); margin-top: .25rem; display: block; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: .92rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,96,71,.35); border-color: var(--green); }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 600; }
.check input { width: 18px; height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; }
.fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.fieldset legend {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0;
    margin-bottom: .8rem;
    border-bottom: 1px solid var(--line);
    width: 100%;
    padding-bottom: .4rem;
}

.alert {
    border-radius: 10px;
    padding: .8rem 1rem;
    margin-bottom: 1rem;
    font-size: .9rem;
    border: 1px solid;
}
.alert-success { background: #e5f3e6; border-color: #bfe0c3; color: #205c2b; }
.alert-error { background: var(--red-soft); border-color: #eccfc8; color: var(--red); }
.alert-info { background: #e8eef3; border-color: #ccdae5; color: #2b4d68; }
.alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.num-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.positive { color: #237a3f; font-weight: 600; }
.negative { color: var(--red); font-weight: 600; }

/* ---------------- Play screen ---------------- */
.play-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.play-head .company { color: var(--muted); font-size: .9rem; }
.turn-pill {
    background: var(--green-dark);
    color: #fff;
    border-radius: 999px;
    padding: .5rem 1rem;
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; }
.kpi .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kpi .val { font-family: var(--serif); font-size: 1.3rem; display: block; line-height: 1.2; }
.kpi .sub { font-size: .72rem; color: var(--muted); }

.progress { height: 12px; background: #e8e5d9; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #4c9b5f); }
.progress-label { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-bottom: .35rem; }

.play-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .9fr); gap: 1.2rem; align-items: start; }
@media (max-width: 980px) { .play-grid { grid-template-columns: 1fr; } }

.report-headline { font-size: 1.02rem; font-weight: 600; margin-bottom: .2rem; }
.report-summary { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }

.lines { list-style: none; padding: 0; margin: 0 0 .8rem; }
.lines li { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.lines li:last-child { border-bottom: 0; }
.lines .total { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; margin-top: .3rem; padding-top: .55rem; }

.event-card { background: #fbf6ea; border: 1px solid #eadfc2; border-radius: 10px; padding: .75rem .9rem; margin-bottom: .6rem; }
.event-card .name { font-weight: 700; font-size: .88rem; }
.event-card p { margin: .15rem 0 0; font-size: .84rem; color: var(--muted); }

.alert-box { background: var(--red-soft); border: 1px solid #eccfc8; color: #7d2a1d; border-radius: 8px; padding: .5rem .7rem; font-size: .82rem; margin-bottom: .4rem; }
.note-box { background: #eef4f0; border: 1px solid #d3e3da; border-radius: 8px; padding: .5rem .7rem; font-size: .82rem; margin-bottom: .4rem; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button {
    background: none; border: 0; padding: .55rem .8rem; font-size: .85rem; font-weight: 600;
    color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--green); border-bottom-color: var(--green); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.side-card { margin-bottom: 1rem; }
.side-card h3 { font-size: 1rem; }
.side-card .small-list { font-size: .84rem; }

.outcome-banner {
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.2rem;
    background: var(--green-dark);
    color: #f4f1e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.outcome-banner.loss { background: #4a2b24; }
.outcome-banner.bankrupt { background: #262321; }
.outcome-banner .grade { font-family: var(--serif); font-size: 2.6rem; line-height: 1; color: var(--lime); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

footer.site-footer { border-top: 1px solid var(--line); padding: 1.6rem 0; color: var(--muted); font-size: .8rem; }
footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.how-list { padding-left: 1.1rem; color: var(--muted); font-size: .9rem; }
.how-list li { margin-bottom: .4rem; }

.split-hero { display: grid; grid-template-columns: 1.3fr .7fr; gap: 2rem; align-items: center; }
@media (max-width: 900px) { .split-hero { grid-template-columns: 1fr; } }

.mini-table { font-size: .8rem; }
.mini-table th, .mini-table td { padding: .4rem .3rem; }

.pill-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

@media (max-width: 640px) {
    .nav-links { gap: .75rem; }
    .nav-user { display: none; }
    main { padding-top: 1.4rem; }
    .hero { padding: 2.6rem 0; }
    .card { padding: 1.1rem; }
}

/* ---------------- Accessibility & account ---------------- */
.skip-link {
    position: absolute;
    left: -999px;
    top: .5rem;
    background: var(--lime);
    color: var(--green-dark);
    padding: .6rem 1rem;
    border-radius: 8px;
    z-index: 100;
    font-weight: 700;
}
.skip-link:focus { left: 1rem; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
}

.nav-account { display: inline-flex; align-items: center; gap: .4rem; }
.avatar-dot {
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-grid; place-items: center;
    color: #fff; font-weight: 700; font-size: .75rem;
}
.avatar-lg {
    width: 62px; height: 62px; border-radius: 18px;
    display: inline-grid; place-items: center;
    color: #fff; font-family: var(--serif); font-size: 1.8rem;
}
.color-row { display: flex; gap: .55rem; flex-wrap: wrap; }
.color-choice { cursor: pointer; }
.color-choice input { position: absolute; opacity: 0; }
.color-choice span {
    display: block; width: 34px; height: 34px; border-radius: 10px;
    border: 3px solid transparent;
}
.color-choice input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 2px var(--card) inset; }
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .6rem; }
.achievement {
    display: flex; gap: .65rem; align-items: start;
    border: 1px solid var(--line); border-radius: 10px; padding: .7rem;
}
.achievement p { margin: .1rem 0 0; font-size: .78rem; color: var(--muted); }
.achievement-mark {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    background: #ecebe3; color: var(--muted); font-weight: 800; flex: 0 0 auto;
}
.achievement.earned { border-color: #bfe0c3; background: #f2f9f1; }
.achievement.earned .achievement-mark { background: var(--green); color: #fff; }
.achievement.locked { opacity: .65; }

[data-theme="dark"] {
    --paper: #0e1512;
    --card: #16201b;
    --line: #2a3a31;
    --ink: #e8efe9;
    --muted: #9db1a5;
    --green-soft: #1d332a;
    --red-soft: #3a201b;
    --shadow: 0 14px 40px rgba(0, 0, 0, .35);
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: #0f1713; color: var(--ink); }
[data-theme="dark"] .progress { background: #24332b; }
[data-theme="dark"] .achievement.earned { background: #15281d; border-color: #2f5a3c; }
[data-theme="dark"] .achievement-mark { background: #24332b; }
[data-theme="dark"] .chip { background: var(--card); color: var(--ink); }
[data-theme="dark"] .note-box,
[data-theme="dark"] .event-card { background: #1d2418; border-color: #3a3f24; }
[data-theme="dark"] .event-card p { color: var(--muted); }
[data-theme="dark"] .alert-success { background: #16281b; border-color: #2f5a3c; color: #bfe0c3; }
[data-theme="dark"] .alert-error { background: #3a201b; border-color: #6b362b; color: #f0bdb1; }
[data-theme="dark"] .alert-box { background: #3a201b; border-color: #6b362b; color: #f0bdb1; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ---------------- Visual polish ---------------- */
.game-cover {
    --accent: #0f6047;
    position: relative;
    height: 96px;
    border-radius: 10px;
    margin-bottom: .85rem;
    background:
        radial-gradient(140px 90px at 85% 15%, rgba(255,255,255,.28), transparent 60%),
        linear-gradient(135deg, var(--accent), #0a3f30);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: .8rem;
}
.game-cover::after {
    content: "";
    position: absolute;
    width: 120px; height: 120px;
    border: 18px solid rgba(255,255,255,.12);
    border-radius: 50%;
    right: -42px; top: -46px;
}
.game-cover span {
    font-family: var(--serif);
    font-size: 2rem;
    color: rgba(255,255,255,.92);
    letter-spacing: .04em;
}
.card-link:hover .game-cover { filter: brightness(1.06); }
.game-hero-band {
    --accent: #0f6047;
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    background:
        radial-gradient(420px 200px at 90% -10%, rgba(255,255,255,.18), transparent 60%),
        linear-gradient(125deg, var(--accent), #0a3f30);
    color: #fff;
    margin-bottom: 1.2rem;
}
.game-hero-band .eyebrow { color: var(--lime); }
.game-hero-band h1 { color: #fff; margin-bottom: .2rem; }
.game-hero-band p { color: rgba(255,255,255,.78); margin-bottom: 0; }
.sparkline { width: 100%; height: 56px; display: block; }
.sparkline-card {
    display: flex; align-items: center; gap: 1rem;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    padding: .7rem .9rem;
}
.sparkline-card .meta { min-width: 110px; }
.sparkline-card .num { font-family: var(--serif); font-size: 1.2rem; display: block; }
.sparkline-card .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.category-pill { border-left: 4px solid var(--accent, var(--green)); padding-left: .5rem; }
.report-badge {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--green-soft); color: var(--green);
    font-weight: 800; font-family: var(--serif);
}
.kpi-accent { border-left: 4px solid var(--accent, var(--green)); }

.game-hero-band .play-head { margin-bottom: 0; }
.game-hero-band .badge-muted { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
