@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap");

:root {
    --bg: #0b1a2b;
    --panel: rgba(10, 28, 48, 0.8);
    --panel-border: rgba(103, 184, 255, 0.28);
    --text: #e9f3ff;
    --muted: #9db4cf;
    --accent: #67b8ff;
    --raise: #53c7b8;
    --call: #ffad66;
    --fold: #ff7b73;
    --neutral: #84a4c3;
}

body.holdem-page,
body.blackjack-page,
body.gaming-page,
body.poker-methodology-page,
body.blackjack-methodology-page,
body.gambling-legal-page {
    --bg: #0d1b14;
    --panel: rgba(12, 34, 24, 0.78);
    --panel-border: rgba(243, 210, 124, 0.2);
    --text: #f4ecd6;
    --muted: #b8ae95;
    --accent: #f3d27c;
    --raise: #54c07a;
    --call: #f0c75e;
    --fold: #df6b57;
    --neutral: #8aa295;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Lato", "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 0%, rgba(103, 184, 255, 0.24), transparent 36%),
        radial-gradient(circle at 88% 8%, rgba(255, 173, 102, 0.14), transparent 28%),
        linear-gradient(160deg, #071424 0%, #10233a 48%, #0a1a2d 100%);
}

body.holdem-page,
body.blackjack-page,
body.gaming-page,
body.poker-methodology-page,
body.blackjack-methodology-page,
body.gambling-legal-page {
    background:
        radial-gradient(circle at top, rgba(243, 210, 124, 0.16), transparent 30%),
        linear-gradient(160deg, #08110d 0%, #102419 45%, #09150f 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(170, 210, 255, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(170, 210, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(circle at center, black, transparent 85%);
    pointer-events: none;
}

body.holdem-page::before,
body.blackjack-page::before,
body.gaming-page::before,
body.poker-methodology-page::before,
body.blackjack-methodology-page::before,
body.gambling-legal-page::before {
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.layout {
    width: min(1240px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 1rem 0 4rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
    gap: 1rem;
}

.layout>.results {
    grid-column: 2;
}

.layout> :not(.results):not(.hero) {
    grid-column: 1;
}

.street-header h2,
.results-header h2 {
    margin: 0;
    font-family: "Lato", "Segoe UI", sans-serif;
    letter-spacing: 0.02em;
}

.best-hand-line {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
}

.best-hand-line strong {
    color: var(--text);
    font-size: 1.25rem;
}

.nuts-summary {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    min-height: 1.2rem;
    line-height: 1.2;
}

.hero {
    padding: 1rem 0 0.25rem;
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.hero-mark {
    display: flex;
    align-items: center;
    min-height: 2.2rem;
    padding-top: 0.05rem;
}

.hero-copy {
    display: grid;
    gap: 0.15rem;
}

.hero-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

h1 {
    font-family: "Lato", "Segoe UI", sans-serif;
    margin: 0 0 0.4rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 1.25rem;
}

.eyebrow {
    font-family: "Lato", "Segoe UI", sans-serif;
    margin: 0 0 0.4rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 1.25rem;
}

.intro {
    max-width: 56rem;
    color: var(--muted);
    line-height: 1;
}

.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;
}

.settings-toggle {
    display: inline-block;
    margin: 0;
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.settings-collapse {
    display: grid;
    gap: 0.55rem;
}

.settings-collapse[hidden] {
    display: none;
}

.hero .settings-collapse .defaults-panel {
    margin-top: 0.2rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 1.00rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
}

.main-panel {
    max-width: none;
    width: 100%;
}

.table-grid {
    display: grid;
    gap: 1rem;
}

.leaderboard-panel {
    display: grid;
    justify-items: center;
}

.leaderboard-ad {
    width: 728px;
    height: 90px;
    border: 1px dashed rgba(243, 210, 124, 0.35);
    border-radius: 14px;
    background: rgba(7, 18, 13, 0.55);
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.15rem;
    text-align: center;
}

.leaderboard-title,
.leaderboard-copy {
    margin: 0;
}

.leaderboard-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.leaderboard-copy {
    color: var(--muted);
    font-size: 0.86rem;
}

.card-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.shared-inputs,
.card-row,
.stats {
    display: grid;
    gap: 1rem;
}

.shared-inputs {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.field-group,
.card-input,
.stat {
    display: grid;
    gap: 0.45rem;
}

.voice-controls {
    margin-top: 0.85rem;
    padding: 0.65rem;
    border-radius: 14px;
    border: 1px solid rgba(243, 210, 124, 0.2);
    background: rgba(7, 18, 13, 0.55);
    display: grid;
    gap: 0.45rem;
}

.voice-actions {
    display: flex;
    gap: 0.5rem;
}

.voice-btn {
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.voice-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.voice-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.voice-controls[data-state="listening"] {
    border-color: rgba(84, 192, 122, 0.6);
    box-shadow: inset 0 0 0 1px rgba(84, 192, 122, 0.22);
}

.voice-controls[data-state="success"] .voice-status {
    color: var(--raise);
}

.voice-controls[data-state="error"] .voice-status,
.voice-controls[data-state="unsupported"] .voice-status {
    color: #ffb1a4;
}

.street {
    display: none;
    border-top: 1px solid rgba(243, 210, 124, 0.14);
    padding-top: 1rem;
    animation: lift 240ms ease;
}

/* Remove the top border for the first street (Hole Cards) */
.table-grid .street:first-child {
    border-top: none;
    padding-top: 0;
}

.street.visible {
    display: grid;
    gap: 1rem;
}

.street-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
}

/* Stack hole cards vertically (one per row) */
.street[data-street="pre-flop"] .card-row {
    grid-template-columns: 1fr;
}

.card-row {
    display: flex;
    gap: 0.75rem;
    margin: 0.75rem 0 0;
    min-height: 48px;
}

.card-input.focused {
    outline: 2px solid var(--accent);
    border-radius: 10px;
}

/* Hole cards display */
.hole-row {
    display: flex;
    gap: 0.75rem;
    margin: 0.75rem 0 0;
    min-height: 40px;
}

.hole-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
}

.hole-slot.focused {
    outline: 3px solid rgba(243, 210, 124, 0.6);
}

.hole-tile {
    font-weight: 800;
    color: var(--text);
}

label,
.stat span {
    color: var(--muted);
    font-size: 0.92rem;
}

input,
select,
button {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 0.85rem 1rem;
    font: inherit;
}

input,
select {
    color: var(--text);
    background: rgba(7, 18, 13, 0.82);
}

button {
    background: linear-gradient(135deg, #f0d38a, #b98d35);
    color: #201507;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(243, 210, 124, 0.18);
}

/* Compact button groups for card inputs */
.rank-buttons,
.suit-buttons {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.rank-btn,
.suit-btn {
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.rank-btn.selected,
.suit-btn.selected {
    background: linear-gradient(135deg, #f0d38a, #b98d35);
    color: #201507;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

/* Compact button groups for card inputs */
.rank-buttons,
.suit-buttons {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.rank-btn,
.suit-btn {
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    font-weight: 700;
    font-size: 1rem;
    min-width: 3rem;
    min-height: 3rem;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.rank-btn.selected,
.suit-btn.selected {
    background: linear-gradient(135deg, #f0d38a, #b98d35);
    color: #201507;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.results {
    display: grid;
    gap: 1.25rem;
    position: relative;
    top: auto;
    align-self: stretch;
    height: 100%;
    max-height: none;
    overflow: visible;
    z-index: 3;
}

.ads {
    display: grid;
    gap: 1rem;
    align-self: stretch;
    height: 100%;
    align-content: start;
}

.ads h2 {
    margin: 0;
    font-family: "Lato", "Segoe UI", sans-serif;
    letter-spacing: 0.02em;
}

.ad-placeholder-300-250 {
    width: 300px;
    height: 250px;
    border: 1px dashed rgba(243, 210, 124, 0.35);
    border-radius: 16px;
    background: rgba(7, 18, 13, 0.55);
    padding: 1rem;
    display: grid;
    gap: 0.7rem;
    align-content: start;
    justify-self: center;
}

.ad-placeholder-300-100 {
    width: 300px;
    height: 100px;
    border: 1px dashed rgba(243, 210, 124, 0.35);
    border-radius: 16px;
    background: rgba(7, 18, 13, 0.55);
    padding: 1rem;
    display: grid;
    gap: 0.7rem;
    align-content: start;
    justify-self: center;
}

.ad-tag {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(243, 210, 124, 0.2);
    color: var(--accent);
}

.ad-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.ad-copy {
    margin: 0;
    color: var(--muted);
}

.ad-cta {
    justify-self: start;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.results .results-inputs {
    display: grid;
    gap: 0.75rem;
}

.results .separator {
    height: 1px;
    background: rgba(243, 210, 124, 0.12);
    margin: 0.75rem 0;
}

.reset-btn {
    margin-left: 0.75rem;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 10px;
}

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

.stat {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(7, 18, 13, 0.78);
}

.stat strong {
    font-size: clamp(1.5rem, 4vw, 2.3rem);
    display: block;
    line-height: 1;
    min-height: 2.4rem;
}

.recommendation-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

/* Make the three controls share the row evenly */
.recommendation-wrap>.recommendation,
.recommendation-wrap>.reset-btn,
.recommendation-wrap>.voice-btn {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recommendation-wrap .voice-btn {
    margin-left: 0;
}

.recommendation {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.9rem 1.2rem;
    font-weight: 700;
    letter-spacing: 0.00em;
}

.recommendation.raise {
    background: rgba(84, 192, 122, 0.16);
    color: var(--raise);
}

.recommendation.call {
    background: rgba(240, 199, 94, 0.16);
    color: var(--call);
}

.recommendation.fold {
    background: rgba(223, 107, 87, 0.16);
    color: var(--fold);
}

.recommendation.neutral {
    background: rgba(138, 162, 149, 0.16);
    color: var(--neutral);
}

/* Make recommendation lozenge and action buttons visually match height */
.recommendation,
.reset-btn,
.voice-btn {
    height: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.9rem;
}

.error {
    margin: 0;
    color: #ffb1a4;
}

.status {
    margin: 0;
    color: var(--accent);
    font-weight: 700;
    min-height: 1.25rem;
}

.results .status[hidden] {
    display: block;
    visibility: hidden;
}

.results-voice-controls {
    margin-top: 0.2rem;
    padding: 0 0.5rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-voice-controls .voice-status {
    margin: 0;
}

.results-voice-controls[data-state="listening"],
.results-voice-controls[data-state="success"],
.results-voice-controls[data-state="error"],
.results-voice-controls[data-state="unsupported"] {
    border: none;
    box-shadow: none;
}

.legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0 0.2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.deck-legal-links {
    grid-column: 1 / -1;
}

.legal-links a {
    color: var(--accent);
}

.legal-layout {
    width: min(980px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

.legal-panel {
    overflow: hidden;
}

.legal-panel h1 {
    margin-top: 0;
    margin-bottom: 0.7rem;
}

.legal-panel pre {
    margin: 0;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-family: "Lato", "Segoe UI", sans-serif;
    line-height: 1.45;
    font-size: 0.95rem;
}

.legal-back {
    display: inline-block;
    margin-bottom: 0.8rem;
    color: var(--accent);
}

.cookie-consent {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1200;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(7, 18, 13, 0.95);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
}

.cookie-consent[hidden] {
    display: none;
}

.cookie-consent__content h2 {
    margin: 0 0 0.3rem;
    font-size: 1.05rem;
    color: var(--accent);
}

.cookie-consent__content p {
    margin: 0;
    color: var(--muted);
    max-width: 62ch;
    line-height: 1.35;
}

.cookie-consent__content a {
    color: var(--accent);
}

.cookie-consent__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.consent-btn {
    min-height: 38px;
    border-radius: 10px;
    font-weight: 700;
    padding: 0.45rem 0.8rem;
}

.consent-btn--primary {
    background: linear-gradient(135deg, #f0d38a, #b98d35);
    color: #201507;
}

.consent-btn--secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(2, 7, 5, 0.7);
}

.consent-modal[hidden] {
    display: none;
}

.consent-modal__card {
    width: min(620px, 100%);
    display: grid;
    gap: 0.85rem;
}

.consent-modal__card h2 {
    margin: 0;
    color: var(--accent);
}

.consent-modal__intro {
    margin: 0;
    color: var(--muted);
}

.consent-option {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.consent-option strong {
    display: block;
}

.consent-option small {
    color: var(--muted);
}

.consent-modal__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.consent-manage-floating {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1100;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    min-height: 36px;
    background: rgba(7, 18, 13, 0.9);
    color: var(--accent);
    border: 1px solid var(--panel-border);
}

.consent-manage-floating[hidden] {
    display: none;
}

/* ============================================================
   HOLDEM PAGE — overflow-safe responsive behavior
   ============================================================ */

.holdem-page .main-panel,
.holdem-page .table-grid,
.holdem-page .deck-panel,
.holdem-page .settings-panel,
.holdem-page .card-panels,
.holdem-page .card-panels>.panel {
    width: 100%;
    min-width: 0;
}

.holdem-page .shared-inputs {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.holdem-page .hand-inputs-panel .shared-inputs {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.holdem-page .hand-inputs-panel input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.holdem-page .card-row {
    flex-wrap: wrap;
}

.holdem-page .card-input {
    flex: 1 1 56px;
    min-width: 56px;
}

@media (max-width: 1180px) {
    .holdem-page .layout {
        grid-template-columns: 1fr;
        width: min(100vw - 1rem, 1120px);
    }

    .holdem-page .layout>.results,
    .holdem-page .layout> :not(.hero) {
        grid-column: 1;
    }

    .holdem-page .card-panels {
        grid-template-columns: 1fr;
    }

    .holdem-page .deck-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (max-width: 900px) {
    .holdem-page .deck-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

body.calculating .deck-grid,
body.calculating .card-input,
body.calculating .hole-slot,
body.calculating .rank-btn,
body.calculating .suit-btn {
    pointer-events: none;
}

@keyframes lift {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .layout {
        grid-template-columns: 1fr;
        width: min(100vw - 1rem, 1120px);
        padding-top: 1rem;
    }

    .layout> :not(.hero),
    .layout>.results {
        grid-column: 1;
    }

    .panel {
        padding: 1rem;
        border-radius: 20px;
    }

    .street-header {
        align-items: stretch;
        flex-direction: column;
    }

    /* Disable sticky behavior on small screens */
    .results {
        position: static;
        max-height: none;
        overflow: visible;
        grid-column: 1;
    }

    .card-panels {
        grid-template-columns: 1fr;
    }

    .leaderboard-ad {
        width: min(100%, 728px);
        height: auto;
        min-height: 90px;
        aspect-ratio: 728 / 90;
        padding: 0.5rem;
    }

    .ad-placeholder {
        width: min(100%, 300px);
    }

    .cookie-consent {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-consent__actions {
        justify-content: stretch;
    }

    .cookie-consent__actions .consent-btn {
        flex: 1 1 0;
    }
}

/* Deck grid: 13 columns x 4 rows */
.deck-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 0.45rem;
    margin: 0.75rem 0 0;
}

.card-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0 0.5rem;
    border-radius: 6px;
    font-weight: 700;
    height: 44px;
    min-height: 44px;
    cursor: pointer;
}

.card-tile.selected {
    background: linear-gradient(135deg, rgba(243, 210, 124, 0.95), rgba(185, 141, 53, 0.95));
    color: #201507;
}

.card-tile.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.card-tile:not(button) {
    cursor: default;
}

.card-display,
.hole-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    height: 40px;
    min-height: 40px;
    font-weight: 800;
    color: var(--text);
}

.card-display img,
.hole-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 720px) {
    .deck-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .card-tile {
        min-height: 44px;
    }

    .card-display,
    .hole-tile {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .layout {
        width: calc(100vw - 0.75rem);
        gap: 0.6rem;
        padding: 0.5rem 0 11.5rem;
    }

    .holdem-page .layout {
        /* Keep all Holdem content scrollable above the fixed mobile results tray. */
        padding-bottom: calc(36vh + 0.1rem);
    }

    .hero {
        padding: 0.5rem 0 0.2rem;
        gap: 0.6rem;
        align-items: flex-start;
    }

    .hero img {
        width: 56px;
        height: 56px;
    }

    h1,
    .eyebrow {
        font-size: 1rem;
        letter-spacing: 0.1em;
    }

    .intro {
        font-size: 0.9rem;
        line-height: 1.25;
    }

    .panel {
        padding: 0.8rem;
        border-radius: 16px;
    }

    .table-grid {
        gap: 0.75rem;
    }

    .defaults-panel {
        order: 1;
    }

    .card-panels {
        order: 2;
        gap: 0.5rem;
        grid-template-columns: 1fr 1.2fr;
    }

    .hand-inputs-panel {
        order: 3;
    }

    .deck-panel {
        order: 4;
    }

    .defaults-panel .shared-inputs,
    .hand-inputs-panel .shared-inputs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .voice-actions {
        flex-wrap: wrap;
    }

    .defaults-panel .field-group,
    .hand-inputs-panel .field-group {
        min-width: 0;
    }

    .defaults-panel input,
    .hand-inputs-panel input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .card-panels .panel {
        padding: 0.65rem;
    }

    .hole-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem;
        margin-top: 0.4rem;
    }

    .community-panel .card-row {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.25rem;
        margin-top: 0.4rem;
    }

    .card-input,
    .hole-slot {
        min-width: 0;
    }

    .shared-inputs {
        gap: 0.65rem;
    }

    .field-group,
    .card-input,
    .stat {
        gap: 0.35rem;
    }

    input,
    select,
    button {
        padding: 0.75rem 0.85rem;
    }

    .defaults-panel label,
    .hand-inputs-panel label {
        overflow-wrap: anywhere;
    }

    .rank-btn,
    .suit-btn {
        min-width: 2.8rem;
        min-height: 2.8rem;
        padding: 0.35rem 0.5rem;
    }

    .results {
        position: fixed;
        top: auto;
        left: 0.375rem;
        right: 0.375rem;
        bottom: 0.375rem;
        order: 99;
        gap: 0.6rem;
        z-index: 20;
        border-radius: 14px;
        max-height: 45vh;
        overflow-y: auto;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.48);
        background: rgba(7, 18, 13, 0.92);
    }

    .holdem-page .results {
        gap: 0.4rem;
        padding: 0.65rem;
        max-height: 38vh;
    }

    .holdem-page .results-header h2 {
        font-size: 1rem;
    }

    .holdem-page .best-hand-line,
    .holdem-page .nuts-summary,
    .holdem-page .status,
    .holdem-page .error {
        margin: 0.15rem 0 0;
        font-size: 0.82rem;
        min-height: 0;
    }

    .holdem-page .stats {
        gap: 0.35rem;
    }

    .holdem-page .stat {
        padding: 0.55rem;
        border-radius: 12px;
        gap: 0.2rem;
    }

    .holdem-page .stat span {
        font-size: 0.75rem;
    }

    .holdem-page .stat strong {
        font-size: 1rem;
        min-height: 1.2rem;
    }

    .holdem-page .recommendation,
    .holdem-page .reset-btn,
    .holdem-page .voice-btn {
        height: 34px;
        min-height: 34px;
        font-size: 0.8rem;
        padding: 0 0.6rem;
    }

    .holdem-page .results-voice-controls {
        height: 36px;
        min-height: 36px;
        margin-top: 0;
        padding: 0 0.2rem;
    }

    .holdem-page .results-voice-controls .voice-status {
        font-size: 0.8rem;
    }

    .deck-legal-links {
        order: 5;
        padding-top: 0.2rem;
        padding-bottom: 0.35rem;
    }

    .stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .stat {
        padding: 0.75rem;
        border-radius: 14px;
    }

    .stat span {
        font-size: 0.82rem;
    }

    .stat strong {
        font-size: 1.15rem;
    }

    .recommendation-wrap {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .reset-btn {
        margin-left: 0;
    }

    .deck-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.4rem;
    }

    .card-tile,
    .card-display,
    .hole-tile {
        min-height: 40px;
        padding: 0.2rem 0.3rem;
        font-size: 0.78rem;
    }

    .holdem-page .card-panels {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   SITE NAV — shown on calculator pages (poker, blackjack)
   ============================================================ */

.site-nav {
    width: 100%;
    background: rgba(7, 18, 13, 0.82);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.site-nav__brand img {
    border-radius: 6px;
}

.site-nav__links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav__links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    transition: color 140ms ease, background 140ms ease;
}

.site-nav__links a:hover {
    color: var(--text);
    background: rgba(243, 210, 124, 0.08);
}

.site-nav__links a.active {
    color: var(--accent);
    background: rgba(243, 210, 124, 0.12);
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

.landing-layout {
    width: min(1200px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 3rem 0 3rem;
    display: grid;
    gap: 2.5rem;
}

.landing-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: min(100%, calc(800px + 1.25rem));
    margin: 0 auto;
}

.landing-hero__mark img {
    border-radius: 16px;
}

.landing-hero__copy {
    display: grid;
    gap: 0.4rem;
}

.landing-title {
    font-family: "Lato", "Segoe UI", sans-serif;
    margin: 0;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 2rem;
}

.landing-tagline {
    margin: 0;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 600;
}

.landing-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.55;
    max-width: 50rem;
}

.landing-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 400px));
    justify-content: center;
    gap: 1.25rem;
}

.landing-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    width: 100%;
    transition: transform 180ms ease, box-shadow 180ms ease;
    cursor: pointer;
}

.landing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

.landing-card__icon {
    font-size: 2.2rem;
    line-height: 1;
    grid-column: 1;
    grid-row: 1;
    align-self: center;
}

.landing-card__title {
    margin: 0;
    font-family: "Lato", "Segoe UI", sans-serif;
    font-size: 1.2rem;
    color: var(--accent);
    letter-spacing: 0.02em;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
}

body.landing-page .landing-card__title {
    color: var(--text);
}

.landing-card__desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
    grid-column: 1 / -1;
}

.landing-card__cta {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.2rem;
    grid-column: 1 / -1;
}

.landing-footer {
    padding-top: 0.5rem;
}

/* Keep landing pages inside viewport at phone sizes */
body.landing-page {
    overflow-x: hidden;
}

body.gaming-page {
    overflow-x: hidden;
}

.landing-page .landing-layout,
.gaming-page .landing-layout {
    max-width: 100%;
}

.landing-page .landing-card,
.gaming-page .landing-card {
    min-width: 0;
}

.landing-page .landing-card__title,
.landing-page .landing-card__desc,
.gaming-page .landing-card__title,
.gaming-page .landing-card__desc {
    overflow-wrap: anywhere;
}

.landing-page .legal-links,
.gaming-page .legal-links {
    flex-wrap: wrap;
    text-align: center;
}

.landing-page .legal-links p,
.gaming-page .legal-links p {
    width: 100%;
    margin: 0.35rem 0 0;
}

@media (max-width: 768px) {

    .landing-page .landing-layout,
    .gaming-page .landing-layout {
        width: min(100%, calc(100vw - 1rem));
        padding: 1.25rem 0 1.75rem;
        gap: 1.25rem;
    }

    .landing-page .landing-hero,
    .gaming-page .landing-hero {
        width: 100%;
        gap: 0.9rem;
    }

    .landing-page .landing-cards,
    .gaming-page .landing-cards {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .landing-page .landing-card,
    .gaming-page .landing-card {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .landing-page .landing-layout {
        padding: 1.5rem 0 2rem;
        gap: 1.75rem;
    }

    .landing-page .landing-hero {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        text-align: center;
    }

    .landing-page .landing-hero__mark img {
        width: min(44vw, 170px);
        height: auto;
    }

    .landing-page .landing-title {
        font-size: 1.5rem;
        letter-spacing: 0.12em;
    }

    .landing-page .landing-tagline {
        font-size: 1rem;
    }

    .landing-page .landing-sub {
        font-size: 0.92rem;
        line-height: 1.5;
    }

    .landing-page .landing-cards {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .landing-page .landing-card {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        padding: 0.9rem;
    }

    .landing-page .landing-card__icon,
    .landing-page .landing-card__title,
    .landing-page .landing-card__desc,
    .landing-page .landing-card__cta {
        grid-column: 1;
        grid-row: auto;
    }

    .landing-page .landing-footer {
        text-align: center;
        line-height: 1.8;
    }
}

/* ============================================================
   BLACKJACK PAGE — bj-specific components
   ============================================================ */

.bj-card-row {
    margin-top: 0.75rem;
}

.bj-player-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.bj-card-field select {
    width: 100%;
}

.bj-hand-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.bj-mod-btn {
    flex: 1 1 0;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.bj-mod-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 480px) {
    .bj-player-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
    }
}

/* ============================================================
   PORTFOLIO MODELER PAGE
   ============================================================ */

.portfolio-page .table-grid {
    grid-template-columns: 1fr;
}

.portfolio-page .layout {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.75rem clamp(0.5rem, 1.2vw, 1.25rem) 1rem;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0.5rem;
    overflow: hidden;
}

.portfolio-page .main-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.65rem;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.portfolio-page .main-panel>.street-header,
.portfolio-page .portfolio-actions,
.portfolio-page #portfolio-draft-status,
.portfolio-page .main-panel>div:last-of-type {
    grid-column: 1 / -1;
}

.portfolio-page .portfolio-workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) minmax(320px, 360px);
    gap: 0.65rem;
    align-items: stretch;
}

.portfolio-page .fp-tabs {
    align-self: stretch;
}

.portfolio-page .portfolio-results {
    min-height: 0;
    overflow: auto;
    padding: 0.65rem;
    border-radius: 14px;
    align-self: stretch;
}

.portfolio-page .portfolio-primary {
    display: grid;
    gap: 0.65rem;
    min-width: 0;
}

.portfolio-page .portfolio-primary .portfolio-table {
    min-width: 0;
}

.portfolio-page .portfolio-primary .portfolio-table-wrap {
    overflow-x: auto;
}

.portfolio-page .portfolio-span {
    grid-column: 1 / -1;
}

.portfolio-page .site-nav {
    background: rgba(7, 20, 37, 0.84);
    border-bottom-color: var(--panel-border);
}

.portfolio-page .site-nav__links a:hover {
    background: rgba(103, 184, 255, 0.12);
}

.portfolio-page .site-nav__links a.active {
    background: rgba(103, 184, 255, 0.18);
}

.portfolio-page button,
.financial-planner-page button {
    height: 40px;
    min-height: 40px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portfolio-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portfolio-page .settings-panel .field-group {
    min-width: 0;
}

.portfolio-page .settings-panel input,
.portfolio-page .settings-panel select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.portfolio-page .settings-panel label {
    overflow-wrap: anywhere;
}

.portfolio-actions {
    margin-top: 0.15rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.portfolio-actions .voice-btn {
    width: auto;
    flex: 0 0 auto;
}

.portfolio-results {
    gap: 0.55rem;
    align-content: start;
}

.portfolio-page .portfolio-results .results-header {
    display: grid;
    gap: 0.15rem;
}

.portfolio-page .portfolio-results .best-hand-line {
    margin-top: 0;
    min-height: 0;
    font-size: 0.9rem;
}

.portfolio-page .portfolio-results .status {
    min-height: 1rem;
}

.portfolio-stats {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.portfolio-page .portfolio-stats .stat,
.financial-planner-page .fp-kpis .stat {
    min-width: 0;
}

.portfolio-page .portfolio-stats .stat span,
.financial-planner-page .fp-kpis .stat span {
    overflow-wrap: anywhere;
}

.portfolio-page .portfolio-stats .stat strong,
.financial-planner-page .fp-kpis .stat strong {
    font-size: clamp(1rem, 1.2vw + 0.65rem, 1.65rem);
    line-height: 1.15;
    min-height: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.portfolio-chart-panel h2,
.portfolio-table-panel h2 {
    margin: 0 0 0.8rem;
}

.chart-surface {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.6rem;
    width: 100%;
    height: 100%;
    min-height: 320px;
}

.chart-surface svg {
    width: 100%;
    height: 100%;
    display: block;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    overflow: hidden;
}

.portfolio-page #portfolio-panel-chart,
.portfolio-page #portfolio-panel-chart .portfolio-chart-panel {
    min-height: 0;
    height: 100%;
}

.portfolio-page #portfolio-panel-chart .portfolio-chart-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.chart-gridline {
    stroke: rgba(157, 180, 207, 0.25);
    stroke-width: 1;
}

.chart-axis {
    stroke: rgba(233, 243, 255, 0.9);
    stroke-width: 1.2;
}

.chart-axis-tick {
    fill: var(--muted);
    font-size: 16px;
}

.chart-axis-label {
    fill: var(--text);
    font-size: 18px;
    font-weight: 700;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.chart-legend-item i {
    width: 14px;
    height: 3px;
    border-radius: 999px;
    display: inline-block;
}

.chart-range {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.financial-planner-page .portfolio-chart-panel {
    overflow: visible;
}

.financial-planner-page .chart-surface {
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto;
}

.financial-planner-page .chart-surface svg {
    height: 450px;
    max-height: 450px;
}

.portfolio-table-wrap {
    overflow-x: auto;
}

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

@media (max-width: 1200px) {
    .portfolio-page .portfolio-workspace {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .portfolio-page .portfolio-results {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .portfolio-page .layout {
        height: auto;
        min-height: calc(100vh - 96px);
        grid-template-rows: auto;
        overflow: visible;
    }

    .portfolio-page .main-panel {
        height: auto;
        min-height: calc(100vh - 96px);
        overflow: visible;
    }

    .portfolio-page .portfolio-workspace {
        grid-template-columns: 1fr;
        grid-template-areas:
            "tabs"
            "content"
            "results";
        align-items: start;
    }

    .portfolio-page .portfolio-workspace>.fp-tabs {
        grid-area: tabs;
    }

    .portfolio-page .portfolio-workspace>.portfolio-primary {
        grid-area: content;
        overflow: auto;
    }

    .portfolio-page .portfolio-workspace>.portfolio-results {
        grid-area: results;
        grid-column: 1 / -1;
        justify-self: stretch;
        align-self: start;
        width: 100%;
        max-width: 100%;
        margin: 0;
        position: static;
    }

    .portfolio-page .portfolio-grid {
        grid-template-columns: repeat(4, minmax(180px, 1fr));
        min-width: 760px;
    }
}

.portfolio-table th,
.portfolio-table td {
    text-align: left;
    padding: 0.52rem 0.6rem;
    border-bottom: 1px solid var(--panel-border);
    white-space: nowrap;
    font-size: 0.9rem;
}

.portfolio-table th {
    color: var(--accent);
    font-weight: 700;
}

.portfolio-table td {
    color: var(--text);
}

/* ============================================================
   FINANCIAL PLANNER PAGE
   ============================================================ */

.financial-planner-page .site-nav {
    background: rgba(7, 20, 37, 0.84);
    border-bottom-color: var(--panel-border);
}

.fp-layout {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.75rem clamp(0.5rem, 1.2vw, 1.25rem) 1rem;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0.5rem;
    overflow: hidden;
}

.fp-shell {
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: start;
    gap: 0.65rem;
    overflow: hidden;
}

.fp-header {
    display: grid;
    gap: 0.2rem;
}

.fp-header .intro {
    margin: 0;
    line-height: 1.25;
}

.fp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.fp-actions .status {
    min-height: 0;
    font-size: 0.9rem;
}

.fp-action-link {
    width: auto;
    min-width: 0;
    text-decoration: none;
}

.fp-workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) minmax(320px, 360px);
    gap: 0.65rem;
}

.fp-tabs,
.fp-content {
    min-height: 0;
    overflow: auto;
}

.fp-tabs {
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(7, 18, 13, 0.35);
    padding: 0.5rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(157, 180, 207, 0.55) transparent;
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.fp-tab-btn {
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.fp-tab-btn.active {
    color: var(--text);
    border-color: var(--panel-border);
    background: rgba(103, 184, 255, 0.14);
}

.fp-content {
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(7, 18, 13, 0.35);
    padding: 0.65rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(157, 180, 207, 0.55) transparent;
    display: grid;
    gap: 0.65rem;
    align-content: start;
}

.fp-results {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(157, 180, 207, 0.55) transparent;
}

.fp-tabs::-webkit-scrollbar,
.fp-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.fp-results::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.fp-tabs::-webkit-scrollbar-track,
.fp-content::-webkit-scrollbar-track {
    background: transparent;
}

.fp-results::-webkit-scrollbar-track {
    background: transparent;
}

.fp-tabs::-webkit-scrollbar-thumb,
.fp-content::-webkit-scrollbar-thumb {
    background: rgba(157, 180, 207, 0.55);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.fp-results::-webkit-scrollbar-thumb {
    background: rgba(157, 180, 207, 0.55);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.fp-tabs::-webkit-scrollbar-thumb:hover,
.fp-content::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 180, 207, 0.75);
}

.fp-results::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 180, 207, 0.75);
}

.fp-section {
    display: grid;
    gap: 0.5rem;
}

.fp-content [data-tab-panel][hidden] {
    display: none !important;
}

.fp-section h2 {
    margin: 0;
    font-size: 1rem;
}

.fp-section-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.fp-inline-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.fp-delete-btn {
    width: fit-content;
    max-width: 100%;
    justify-self: start;
    white-space: nowrap;
    padding-inline: 0.85rem;
}

.fp-grid {
    display: grid;
    gap: 0.5rem;
}

.fp-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fp-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

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

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

.fp-grid label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.financial-planner-page input,
.financial-planner-page select {
    width: min(100%, 200px);
    max-width: 200px;
}

.financial-planner-page input[type="checkbox"] {
    width: auto;
    max-width: none;
}

.financial-planner-page .fp-plan-setup input {
    text-align: left;
}

.financial-planner-page .fp-plan-setup .fp-grid {
    justify-content: start;
}

.financial-planner-page .fp-plan-setup .fp-grid-4 {
    grid-template-columns: repeat(4, max-content);
    column-gap: 0.65rem;
}

.financial-planner-page .fp-plan-setup .fp-grid-5 {
    grid-template-columns: repeat(5, max-content);
    column-gap: 0.65rem;
}

.financial-planner-page .fp-plan-setup .fp-grid-3 {
    grid-template-columns: repeat(3, max-content);
    column-gap: 0.65rem;
}

.financial-planner-page .fp-plan-setup label {
    justify-items: start;
}

.fp-kpis {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
}

.fp-table-wrap {
    overflow: auto;
}

.fp-results .fp-table-wrap {
    overflow-x: hidden;
}

.fp-results .portfolio-table {
    min-width: 0;
    table-layout: fixed;
}

.fp-results .portfolio-table th,
.fp-results .portfolio-table td {
    white-space: normal;
    overflow-wrap: anywhere;
}

.fp-results {
    padding: 0.65rem;
    border-radius: 14px;
    overflow: visible;
}

.fp-results h2 {
    margin: 0 0 0.45rem;
}

.fp-shortfall-alert {
    margin-top: 0.6rem;
    margin-bottom: 0.6rem;
    display: grid;
    gap: 0.35rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(223, 107, 87, 0.45);
    background: rgba(223, 107, 87, 0.12);
    color: #ffd2cb;
}

.fp-shortfall-alert[hidden] {
    display: none;
}

.fp-shortfall-alert strong {
    color: #ffb1a4;
}

.fp-wizard-layout {
    overflow: hidden;
}

.fp-wizard-shell {
    grid-template-rows: auto minmax(0, 1fr);
}

.fp-wizard-start {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(7, 18, 13, 0.35);
    padding: 1rem;
}

.fp-wizard-choice {
    max-width: 720px;
}

.fp-wizard-app {
    min-height: 0;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0.65rem;
}

.fp-wizard-steps {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(7, 18, 13, 0.35);
    padding: 0.5rem;
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.fp-wizard-steps .fp-tab-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-wizard-main {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.65rem;
}

.fp-wizard-progress {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.fp-wizard-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.fp-wizard-progress-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.fp-wizard-content {
    min-height: 0;
}

.fp-wizard-item {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.fp-wizard-item h3 {
    margin: 0;
    font-size: 0.95rem;
}

.fp-important {
    color: rgb(255, 174, 0);
}

.fp-empty-note {
    margin: 0;
    color: var(--muted);
}

.fp-wizard-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.fp-wizard-actions .status {
    min-height: 0;
    color: #ffd2cb;
}

.fp-wizard-review {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 0.55rem;
}

.fp-wizard-review .stat {
    min-width: 0;
    align-content: start;
    overflow: hidden;
}

.fp-wizard-review .stat span {
    min-width: 0;
    max-width: 100%;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
}

.fp-wizard-review .stat strong {
    min-width: 0;
    max-width: 100%;
    font-size: clamp(0.95rem, 0.55vw + 0.78rem, 1.35rem);
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fp-wizard-resource-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

@media (max-width: 1200px) {
    .fp-workspace {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .fp-results {
        grid-column: 1 / -1;
        max-height: none;
    }

}

@media (min-width: 1700px) {
    .fp-workspace {
        grid-template-columns: 240px minmax(0, 1fr) 300px;
    }
}

@media (max-width: 900px) {
    .fp-layout {
        height: auto;
        min-height: calc(100vh - 96px);
        grid-template-rows: auto;
        overflow: visible;
    }

    .fp-shell {
        height: auto;
        min-height: calc(100vh - 96px);
        overflow: visible;
    }

    .fp-workspace {
        grid-template-columns: 1fr;
    }

    .fp-grid-5,
    .fp-grid-4,
    .fp-grid-3 {
        grid-template-columns: 1fr;
    }

    .fp-wizard-layout {
        overflow: visible;
    }

    .fp-wizard-shell {
        min-height: calc(100vh - 96px);
    }

    .fp-wizard-app {
        grid-template-columns: 1fr;
    }

    .fp-wizard-steps {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        max-height: none;
    }

    .fp-wizard-main {
        min-height: 0;
    }

}

@media (max-width: 700px) {
    .portfolio-table {
        min-width: 620px;
    }
}

@media (min-width: 901px) {

    body.portfolio-page,
    body.financial-planner-page {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
    }

    body.portfolio-page>.layout,
    body.financial-planner-page>.fp-layout {
        min-height: 0;
        height: 100%;
    }

    body.financial-planner-page .fp-results {
        min-height: 0;
        max-height: 100%;
        overflow: auto;
    }
}

/* Nav responsive */
@media (max-width: 600px) {
    .site-nav {
        padding: 0.5rem 0.75rem;
    }

    .site-nav__links {
        gap: 0.5rem;
    }

    .site-nav__links a {
        font-size: 0.82rem;
        padding: 0.25rem 0.45rem;
    }
}

/* ============================================================
   ABOUT PAGE — small helper styles
   ============================================================ */
.about-page .hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 1rem 0 1.5rem;
    /* Restrict hero to the primary content column so it matches content width */
    grid-column: 1;
}

/* Make the about page a single centered column to keep content visually centered */
.about-page .layout {
    /* narrower max width for readable biography */
    width: min(920px, calc(100vw - 2rem));
    grid-template-columns: 1fr;
    /* single column */
    justify-items: center;
}

.about-headshot {
    border-radius: 50%;
    border: 4px solid #e6f4ea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    object-fit: cover;
}

.about-content .about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.about-page .hero,
.about-page .about-content,
.about-page .legal-links {
    width: 100%;
}

/* Keep About page inside viewport on smaller devices */
body.about-page {
    overflow-x: hidden;
}

.about-page .legal-links {
    flex-wrap: wrap;
}

.about-page .legal-links p {
    width: 100%;
    margin: 0.35rem 0 0;
}

.about-page .about-content,
.about-page .about-grid,
.about-page .about-bio,
.about-page .about-resume {
    min-width: 0;
}

.about-page .hero-copy,
.about-page .about-content p,
.about-page .about-content li,
.about-page .about-content h2,
.about-page .about-content h3 {
    overflow-wrap: anywhere;
}

.about-social-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.about-page .linkedin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.about-page .linkedin-link img {
    display: block;
}

.about-md {
    white-space: pre-wrap;
    font-family: inherit;
}

@media (max-width: 900px) {
    .about-content .about-grid {
        grid-template-columns: 1fr;
    }

    .about-page .hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .about-page .layout {
        width: min(100%, calc(100vw - 1rem));
        padding: 0.75rem 0 2rem;
        gap: 1rem;
    }

    .about-page .hero-mark {
        width: 100%;
        justify-content: center;
    }

    .about-page .about-headshot {
        width: min(40vw, 160px);
        height: min(40vw, 160px);
    }

    .about-page .hero-copy {
        width: 100%;
    }

    .about-page .about-content {
        padding: 0.75rem;
    }

    .about-page .about-content .panel {
        padding: 0.85rem;
        min-width: 0;
    }

    .about-page .legal-links {
        text-align: center;
        line-height: 1.8;
    }

    .about-page .site-nav {
        flex-wrap: wrap;
        justify-content: center;
        padding: 0.5rem 0.75rem;
    }

    .about-page .site-nav__brand {
        width: 100%;
        justify-content: center;
    }

    .about-page .site-nav__links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.45rem;
    }
}