:root {
    color-scheme: light;
    --paper: #f8f4eb;
    --paper-2: #fffaf2;
    --surface: #fffdf8;
    --surface-soft: #eee8dc;
    --ink: #173f37;
    --muted: #66756f;
    --line: #d9d3c8;
    --sage: #dcead8;
    --sage-strong: #2d7a5f;
    --rose: #f2d9d3;
    --blue: #dbeaf3;
    --yellow: #f5df98;
    --red: #e98b7c;
    --shadow: 0 24px 70px rgba(28, 55, 45, .12);
    --shadow-soft: 0 10px 30px rgba(28, 55, 45, .08);
    --radius-lg: 32px;
    --radius-md: 20px;
    --radius-sm: 13px;
    --max: 1180px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --paper: #0f1c19;
    --paper-2: #14231f;
    --surface: #182a25;
    --surface-soft: #223630;
    --ink: #eef5ef;
    --muted: #aebdb7;
    --line: #365047;
    --sage: #294b3f;
    --sage-strong: #83c6a7;
    --rose: #4b3435;
    --blue: #294252;
    --yellow: #705f2e;
    --red: #9d514a;
    --shadow: 0 24px 70px rgba(0, 0, 0, .28);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--rose) 58%, transparent) 0 12rem, transparent 12.1rem),
        radial-gradient(circle at 92% 88%, color-mix(in srgb, var(--sage) 62%, transparent) 0 15rem, transparent 15.1rem),
        var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { max-width: 100%; height: auto; }

.skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 100;
    padding: .75rem 1rem;
    background: var(--ink);
    color: var(--paper);
    border-radius: 10px;
    transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
    width: min(var(--max), calc(100% - 40px));
    min-height: 108px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.brand { display: inline-flex; flex: 0 1 370px; min-width: 210px; }
.brand img { display: block; width: min(370px, 100%); }

.top-nav {
    min-width: 0;
    flex: 1 1 460px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .55rem;
    font-size: .9rem;
}
.nav-form { display: inline-flex; margin: 0; }

.nav-button, .nav-premium, .user-chip {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .58rem .9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    color: var(--ink);
}
.nav-button { cursor: pointer; }
.nav-game { background: var(--sage); border-color: color-mix(in srgb, var(--sage) 64%, var(--ink)); font-weight: 750; }
.nav-button-strong { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
.nav-premium { background: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 60%, var(--ink)); font-weight: 750; }
.user-chip { color: var(--muted); }

.nav-button:hover, .nav-premium:hover, .primary-cta:hover, .primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.nav-button:focus-visible, .nav-premium:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--sage-strong) 45%, transparent); outline-offset: 3px; }

.main-shell {
    width: min(var(--max), calc(100% - 40px));
    min-height: calc(100vh - 230px);
    margin: 1.25rem auto 3rem;
}

.welcome-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
    min-height: 660px;
    padding: clamp(2.25rem, 6vw, 5.5rem);
    border: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: var(--shadow);
}

.welcome-card::after {
    content: "";
    position: absolute;
    width: 430px;
    height: 430px;
    right: -190px;
    top: -210px;
    border: 70px solid color-mix(in srgb, var(--sage) 72%, transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Koriste jää aina tekstin ja nimikorttien taakse myös kapealla pystynäytöllä. */
.welcome-copy, .name-deck { position: relative; z-index: 1; }

.eyebrow {
    margin: 0 0 .8rem;
    color: var(--sage-strong);
    font-size: .78rem;
    font-weight: 850;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.08; letter-spacing: -.035em; }
h1 { max-width: 760px; margin-bottom: 1.2rem; font-size: clamp(2.7rem, 6.5vw, 5.8rem); }
h2 { font-size: clamp(1.65rem, 3.3vw, 2.5rem); }
.lead { max-width: 680px; margin-bottom: 2rem; color: var(--muted); font-size: clamp(1.06rem, 2vw, 1.28rem); }
.fine-print, .save-note { color: var(--muted); font-size: .82rem; }

.how-list { display: grid; gap: .8rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.how-list li { display: flex; align-items: center; gap: .9rem; }
.how-list li > span {
    width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center;
    border-radius: 50%; background: var(--sage); color: var(--ink); font-weight: 850;
}
.how-list strong, .how-list small { display: block; }
.how-list small { color: var(--muted); }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; margin-top: 2rem; }
.primary-cta, .primary-button, .secondary-button, .danger-button, .paypal-button {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    border: 0;
    border-radius: 999px;
    padding: .8rem 1.25rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-cta, .primary-button { background: var(--ink); color: var(--paper-2); box-shadow: 0 9px 22px color-mix(in srgb, var(--ink) 22%, transparent); }
.secondary-button { background: var(--sage); color: var(--ink); border: 1px solid color-mix(in srgb, var(--sage) 70%, var(--ink)); }
.danger-button { background: var(--red); color: #21100d; }
.danger-button.outline { background: transparent; color: var(--ink); border: 1px solid var(--red); }
.paypal-button { width: fit-content; background: #ffc439; color: #15396a; }
button[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }

.name-deck { position: relative; min-height: 430px; perspective: 1200px; }
.name-card {
    position: absolute;
    inset: 8% 2%;
    display: grid;
    place-items: center;
    border-radius: 34px;
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    box-shadow: var(--shadow);
}
.name-card span, .name-card strong { font-family: Georgia, "Times New Roman", serif; }
.card-back { background: var(--blue); transform: rotate(11deg) translate(6%, -1%); }
.card-middle { background: var(--rose); transform: rotate(-8deg) translate(-6%, 2%); }
.card-front { z-index: 2; align-content: center; gap: .8rem; background: var(--surface); transform: rotate(1.5deg); }
.card-back span, .card-middle span { opacity: .25; font-size: 3rem; }
.card-front strong { font-size: clamp(3.5rem, 7vw, 5.4rem); }
.card-front .deck-label { font-family: inherit; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.mini-actions { display: flex; gap: .65rem; margin-top: 1.25rem; }
.mini-actions i { width: 36px; height: 10px; border-radius: 99px; background: var(--sage); }
.mini-actions i:nth-child(2) { background: var(--yellow); }
.mini-actions i:nth-child(3) { background: var(--red); }

.faq-section {
    margin-top: 1.5rem;
    padding: clamp(2rem, 5vw, 4.5rem);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow-soft);
}
.faq-section { width: min(900px, 100%); margin-right: auto; margin-left: auto; }
.faq-section h2 { margin-bottom: 1.5rem; font-size: clamp(2.15rem, 5vw, 4.2rem); }
.faq-section details { border-top: 1px solid var(--line); }
.faq-section details:last-child { border-bottom: 1px solid var(--line); }
.faq-section summary { padding: 1rem 2.2rem 1rem 0; font-weight: 800; cursor: pointer; }
.faq-section details p { max-width: 720px; padding: 0 0 1rem; color: var(--muted); }

.ad-zone { width: min(970px, calc(100% - 40px)); min-height: 78px; margin: .5rem auto 1.25rem; display: grid; place-items: center; }
.ad-zone > .adsbygoogle { width: 100%; min-width: 0; max-width: 100%; justify-self: stretch; }
.ad-placeholder { padding: .55rem .85rem; border: 1px dashed var(--line); border-radius: 999px; color: var(--muted); font-size: .75rem; }
.static-ad { width: min(970px, calc(100% - 40px)); margin: 0 auto 3rem; }
.static-ad picture, .static-ad img { display: block; width: 100%; border-radius: 16px; box-shadow: var(--shadow-soft); }

.site-notice {
    width: min(var(--max), calc(100% - 40px));
    margin: .25rem auto 1rem;
    padding: .85rem 1rem;
    border: 1px solid color-mix(in srgb, var(--sage-strong) 45%, var(--line));
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--sage) 76%, var(--surface));
    color: var(--ink);
    font-weight: 700;
}
.site-notice.error { border-color: var(--red); background: color-mix(in srgb, var(--red) 24%, var(--surface)); }

.app-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.app-toolbar .eyebrow { margin-bottom: .25rem; }
.app-title { margin: 0; font-size: clamp(2rem, 4vw, 3.25rem); }
.icon-actions { display: flex; gap: .55rem; }
.icon-button {
    width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%;
    background: var(--surface); color: var(--ink); font-size: 1.25rem; cursor: pointer; box-shadow: var(--shadow-soft);
}
.theme-button { background: linear-gradient(90deg, #f7e5a6 0 50%, #1d3450 50% 100%); color: #fff; }

.game-root {
    min-height: 560px;
    display: grid;
    place-items: center;
    padding: clamp(1.15rem, 3vw, 2rem);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow);
}
.loading-state, .empty-state { display: grid; place-items: center; text-align: center; color: var(--muted); }
.paused-state { width: min(640px, 100%); display: grid; justify-items: center; gap: .65rem; text-align: center; }
.paused-state .pause-symbol { width: 74px; height: 74px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: #392f13; font-size: 1.8rem; font-weight: 900; }
.paused-state h2 { margin-bottom: .2rem; }
.paused-state p { max-width: 520px; color: var(--muted); }
.loader { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--sage-strong); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.setup-shell, .finish-shell { width: min(860px, 100%); }
.setup-heading { text-align: center; margin-bottom: 2rem; }
.setup-heading h2, .finish-shell h2 { margin-bottom: .8rem; font-size: clamp(2.2rem, 5vw, 4rem); }
.setup-heading p, .finish-shell > p { color: var(--muted); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.choice-card {
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.4rem;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.choice-card.girl { background: var(--rose); }
.choice-card.boy { background: var(--blue); }
.choice-card:hover { border-color: var(--sage-strong); transform: translateY(-2px); }
.choice-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.6rem; }
.choice-card small { color: color-mix(in srgb, var(--ink) 68%, transparent); }
.choice-symbol { font-size: 2.3rem; }
.recommend-badge { display: inline-flex; padding: .25rem .55rem; border-radius: 999px; background: var(--sage); font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.choice-card .warning-note { margin-top: .6rem; font-size: .8rem; line-height: 1.35; }

.upload-panel { margin-top: 1.2rem; padding: 1.15rem; border: 1px dashed var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface-soft) 60%, transparent); }
.upload-panel h3 { margin-bottom: .25rem; }
.upload-panel p { margin-bottom: .8rem; color: var(--muted); font-size: .9rem; }
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.file-input { min-width: 0; max-width: 100%; }

.game-board { width: min(820px, 100%); }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; color: var(--muted); font-size: .85rem; }
.progress-track { height: 8px; flex: 1; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--sage-strong); transition: width .25s ease; }
.play-card {
    min-height: 330px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1rem;
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 30px;
    background: var(--paper-2);
    box-shadow: var(--shadow-soft);
}
.stage-pill { padding: .3rem .7rem; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .75rem; font-weight: 800; }
.current-name { max-width: 100%; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.5rem, 12vw, 7.5rem); line-height: 1; letter-spacing: -.05em; text-align: center; }
.decision-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: 1rem; }
.decision-button {
    min-height: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    border: 0;
    border-radius: 18px;
    color: #13231e;
    font-weight: 850;
    cursor: pointer;
}
.decision-button small { opacity: .65; font-size: .72rem; font-weight: 800; }
.decision-button.undo { background: #d7d9d6; }
.decision-button.keep { background: #91d2ad; }
.decision-button.consider { background: var(--yellow); }
.decision-button.discard { background: var(--red); }
.decision-button:hover:not([disabled]) { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

.game-extras { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.game-stats { display: flex; flex-wrap: wrap; gap: .5rem; }
.stat-chip { padding: .45rem .7rem; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .78rem; }
.more-menu { position: relative; }
.more-menu summary { cursor: pointer; list-style: none; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; font-weight: 800; }
.more-menu summary::-webkit-details-marker { display: none; }
.menu-popover { position: absolute; right: 0; bottom: calc(100% + .5rem); width: 250px; z-index: 5; display: grid; gap: .45rem; padding: .7rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.menu-popover button { width: 100%; border: 0; border-radius: 10px; padding: .65rem .75rem; background: var(--surface-soft); color: var(--ink); text-align: left; cursor: pointer; }

.finish-shell { text-align: center; }
.finish-count { width: 96px; height: 96px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 50%; background: var(--sage); font-family: Georgia, "Times New Roman", serif; font-size: 2.5rem; }
.finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin: 1.6rem 0; }
.finish-list { max-height: 240px; overflow: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-2); }
.finish-list span { padding: .4rem .7rem; border-radius: 999px; background: var(--sage); }
.merge-panel { margin-top: 1.4rem; padding: 1.2rem; border-radius: var(--radius-md); background: var(--surface-soft); text-align: left; }
.merge-panel h3 { margin-bottom: .4rem; }
.merge-panel .stack-form { max-width: none; }
.pending-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.status-message { min-height: 1.2em; color: var(--muted); }
[hidden] { display: none !important; }
#syncStatus { margin: 0 0 1rem; }
#syncMessage { min-height: 1.5em; margin: .25rem 0; }
#syncSignIn { display: block; margin-top: .5rem; }

.form-card {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: clamp(1.5rem, 5vw, 3.5rem);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.compact-card { width: min(600px, 100%); }
.form-card h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
.form-card h2 { margin-bottom: .65rem; }
.stack-form { display: grid; gap: 1rem; max-width: 560px; margin-top: 1.4rem; }
.stack-form label:not(.check-label) { display: grid; gap: .4rem; font-weight: 750; }
.stack-form small { color: var(--muted); font-weight: 450; }
.stack-form input:not([type="checkbox"]), .stack-form select {
    width: 100%; min-height: 50px; padding: .72rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-2); color: var(--ink);
}
.check-label { display: flex; align-items: center; gap: .6rem; color: var(--muted); cursor: pointer; }
.check-label input { width: 19px; height: 19px; accent-color: var(--sage-strong); }
.form-message { min-height: 1.5em; margin: 0; color: var(--sage-strong); font-weight: 700; }
.form-message.error { color: color-mix(in srgb, var(--red) 70%, var(--ink)); }
.form-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.25rem; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.settings-grid .form-card { width: 100%; margin: 0; padding: 1.6rem; border-radius: var(--radius-md); box-shadow: var(--shadow-soft); }
.settings-heading { grid-column: 1 / -1; padding: 1rem; }
.settings-heading h1 { margin-bottom: .5rem; font-size: clamp(2.4rem, 5vw, 4.5rem); }
.danger-card { border-color: color-mix(in srgb, var(--red) 58%, var(--line)); }
.delete-form { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.premium-card { background: linear-gradient(145deg, var(--surface) 0 72%, var(--yellow) 160%); }
.premium-points { display: grid; gap: .6rem; margin: 1.5rem 0 2rem; padding-left: 1.2rem; }
.legal-card { width: min(880px, 100%); }
.legal-copy { display: grid; gap: .4rem; }
.legal-copy h2 { margin: 1.3rem 0 .25rem; font-size: 1.45rem; letter-spacing: -.02em; }
.legal-copy p { color: var(--muted); }
code { padding: .15rem .35rem; border-radius: 6px; background: var(--surface-soft); }

.modal { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 26px; background: transparent; color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(6, 19, 15, .58); backdrop-filter: blur(4px); }
.modal-panel { padding: 1.5rem; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.modal-heading h2 { margin-bottom: 1rem; }
.close-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--ink); font-size: 1.6rem; cursor: pointer; }
.radio-stack { display: grid; gap: .65rem; margin: 0 0 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; }
.radio-stack label { display: flex; gap: .55rem; align-items: center; }
.radio-stack input { accent-color: var(--sage-strong); }
.settings-note { color: var(--muted); font-size: .85rem; }
.settings-dialog .modal-panel > .secondary-button,
.settings-dialog .modal-panel > .danger-button { width: 100%; margin-top: .65rem; }
.confirm-dialog { text-align: center; }
.confirm-mark { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 50%; background: var(--yellow); color: #392f13; font-weight: 900; font-size: 1.5rem; }
.modal-actions { display: flex; justify-content: center; gap: .7rem; margin-top: 1.25rem; }

.site-footer {
    width: min(var(--max), calc(100% - 40px));
    margin: 0 auto;
    padding: 1.8rem 0 2.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .45rem 1.4rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .78rem;
    text-align: center;
}

@media (max-width: 880px) {
    .site-header { align-items: flex-start; padding: 1rem 0; }
    .brand { flex-basis: 300px; }
    .welcome-card { grid-template-columns: 1fr; min-height: 0; }
    .name-deck { min-height: 360px; width: min(420px, 100%); margin: 0 auto; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 660px) {
    .site-header { width: min(100% - 24px, var(--max)); min-height: 0; flex-direction: column; gap: .6rem; }
    .brand { flex: none; width: min(310px, 88vw); }
    .top-nav { width: 100%; flex-basis: auto; justify-content: flex-start; flex-wrap: wrap; overflow: visible; padding-bottom: .35rem; }
    .top-nav > * { white-space: nowrap; }
    .main-shell, .ad-zone, .static-ad, .site-footer, .site-notice { width: calc(100% - 24px); }
    .main-shell { margin-top: .75rem; }
    .welcome-card { padding: 1.4rem; border-radius: 24px; }
    .welcome-copy h1 { font-size: clamp(2.65rem, 14vw, 4.4rem); }
    .name-deck { min-height: 310px; }
    .choice-grid { grid-template-columns: 1fr; }
    .choice-card { min-height: 140px; }
    .game-root { min-height: 520px; padding: .8rem; border-radius: 24px; }
    .play-card { min-height: 280px; }
    .decision-grid { grid-template-columns: repeat(3, 1fr); }
    .decision-button.undo { grid-column: 1 / -1; min-height: 58px; order: 2; }
    .decision-button.keep, .decision-button.consider, .decision-button.discard { order: 1; }
    .decision-button { min-height: 76px; padding: .55rem .25rem; font-size: .85rem; }
    .game-extras { align-items: flex-end; }
    .form-card { padding: 1.35rem; border-radius: 24px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions > * { width: 100%; }
}

@media (max-width: 390px) {
    .current-name { font-size: clamp(3rem, 18vw, 5.5rem); }
    .game-stats .stat-chip:nth-child(n+3) { display: none; }
}

@media (orientation: landscape) and (max-height: 600px) and (min-width: 600px) {
    .site-header { min-height: 74px; }
    .brand { max-width: 270px; }
    .main-shell { margin-top: .35rem; }
    .game-root { min-height: 0; padding: .7rem; }
    .game-board { display: grid; grid-template-columns: 1.35fr 1fr; gap: .8rem; align-items: stretch; }
    .progress-row, .game-extras { grid-column: 1 / -1; margin: 0; }
    .play-card { min-height: 240px; }
    .decision-grid { grid-template-columns: repeat(2, 1fr); margin: 0; }
    .decision-button { min-height: 112px; }
    .site-footer { padding-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
