:root {
    color-scheme: dark;
    --bg: #050505;
    --fg: #ffffff;
    --accent: #f5f5f5;
    --muted: #9c9c9c;
    --border: rgba(255, 255, 255, 0.2);
    --panel: rgba(255, 255, 255, 0.05);
    --danger: #ff4d4d;
    --success: #45ffb2;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

body {
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
}

#app-root {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
}

.page-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: clamp(1.5rem, 3vw, 4rem);
    gap: clamp(1.5rem, 2vw, 3rem);
    overflow: hidden;
}

.hero-title {
    font-size: clamp(2.25rem, 4vw, 4.5rem);
    letter-spacing: 0.35rem;
    text-transform: uppercase;
    margin: 0;
    text-align: center;
}

.hud-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.stat-block {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    min-width: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    overflow: hidden;
}

.stat-block.primary {
    flex: 2;
}

.stat-heading {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.85rem;
    color: var(--muted);
}

.stat-value {
    font-size: 1.35rem;
    margin: 0 0 0.5rem;
}

.meter {
    width: 100%;
    height: 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.4s ease;
}

.effect-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: clamp(0.85rem, 1.1vw, 0.95rem);
    flex: 1 1 auto;
    min-height: 0;
    max-height: 11rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    scrollbar-gutter: stable;
}

.effect-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.effect-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.effect-value {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
}

.effect-empty {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.scenario-card {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: clamp(1.25rem, 2vw, 2.25rem);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow: auto;
}

.scenario-text {
    font-size: clamp(1rem, 1.3vw, 1.35rem);
    margin: 0;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.cta-button {
    border: 1px solid var(--fg);
    background: var(--fg);
    color: #000;
    padding: 1rem;
    font-size: 1rem;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.cta-button.secondary {
    background: transparent;
    color: var(--fg);
}

.cta-button:is(:hover, :focus-visible) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
}

.site-footer {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: var(--fg);
    margin-top: auto;
    font-family: 'Courier New', monospace;
}

.site-footer a {
    text-decoration: none;
    color: var(--fg) !important;
}

.id-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
    max-height: 7rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    align-content: flex-start;
}

.id-pill {
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: clamp(0.7rem, 1.6vw, 0.85rem);
    white-space: normal;
    overflow-wrap: anywhere;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
    backdrop-filter: blur(6px);
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    width: 60vw;
    max-width: 900px;
    min-height: 40vh;
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    color: var(--fg);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.modal-actions .cta-button {
    flex: 1;
    min-width: 120px;
}

body.modal-open .page-shell {
    filter: blur(6px);
    pointer-events: none;
}

.intro-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: clamp(2rem, 4vw, 5rem);
    gap: 2rem;
    overflow: hidden;
    color: var(--fg);
    text-align: center;
}

.intro-title {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
    letter-spacing: 0.4em;
}

.intro-title[data-stage="pending"] {
    opacity: 0;
    transform: translateY(-25px);
}

.intro-title[data-stage="active"] {
    opacity: 1;
    transform: translateY(0);
}

.intro-sequence {
    width: min(80vw, 1200px);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(1rem, 1.7vw, 1.5rem);
    font-size: clamp(0.9rem, min(1.05vw, 1.5vh), 1.2rem);
    line-height: 1.65;
    color: inherit;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    text-align: left;
    margin: 0 auto;
}

.intro-paragraph {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.9s ease, transform 0.9s ease;
    text-align: left;
    margin: 0;
    width: 100%;
    max-width: 100%;
    align-self: center;
}

.intro-paragraph[data-stage="pending"] {
    opacity: 0;
    transform: translateY(35px);
}

.intro-paragraph[data-stage="active"] {
    opacity: 1;
    transform: translateY(0);
}

.intro-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.intro-footer .site-footer {
    margin-top: 0;
}

.intro-footer[data-stage="pending"] {
    opacity: 0;
    transform: translateY(25px);
}

.intro-footer[data-stage="active"] {
    opacity: 1;
    transform: translateY(0);
}

.intro-cta {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
}

.intro-cta.visible {
    opacity: 1;
    pointer-events: auto;
}

.intro-cta h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.4em;
}

.intro-cta .site-footer {
    margin-top: 2rem;
}

@media (max-height: 760px) {
    .intro-shell {
        padding: clamp(1.5rem, 3vw, 3rem);
    }

    .intro-sequence {
        width: min(86vw, 1200px);
        font-size: clamp(0.8rem, min(1.2vw, 1.8vh), 1.05rem);
        line-height: 1.55;
    }
}

.mobile-wrapper,
.article-wrapper,
.identity-wrapper,
.learnmore-wrapper,
.credits-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: clamp(1.5rem, 3vw, 4rem);
    gap: 1.5rem;
    height: 100vh;
    overflow: hidden;
}

.iframe-doc-shell {
    width: 40vw;
    max-width: 100%;
    min-height: 70vh;
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
    margin: -3vh auto 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.01);
}

.iframe-doc {
    width: 100%;
    height: 125%;
    border: 0;
    transform: scale(0.8);
    transform-origin: top center;
    background: #fff;
}

.learnmore-wrapper .cta-button {
    max-width: 240px;
}

.learnmore-wrapper {
    justify-content: flex-start;
    gap: 1rem;
    padding-top: clamp(1rem, 2vw, 2.5rem);
}

.cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    justify-content: center;
    width: 100%;
}

.cta-group .cta-button {
    flex: 1 1 220px;
    max-width: none;
}

.mobile-wrapper p {
    max-width: 600px;
}

.identity-wrapper .scenario-card {
    width: min(900px, 100%);
}

.credits-card {
    width: min(800px, 100%);
    max-height: 60vh;
    margin: 0 auto;
    text-align: left;
    overflow: auto;
}

.credits-card h2 {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.credits-intro {
    margin: 0.5rem 0 1rem;
    color: var(--muted);
}

.credits-section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.credits-section:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.credits-section-title {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.85rem;
    color: var(--muted);
}

.credits-section p {
    margin: 0;
}

@media (max-width: 640px) {
    .modal-card {
        width: 100%;
        min-height: 50vh;
    }

    .hero-title {
        letter-spacing: 0.2rem;
    }

    .page-shell {
        padding: 1.5rem 1rem 2rem;
    }
}
