:root {
    color-scheme: light;
    --navy-950: #071629;
    --navy-900: #0b2038;
    --navy-800: #15334f;
    --navy-700: #234965;
    --slate-700: #405368;
    --slate-500: #64748b;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --accent-700: #0f766e;
    --danger-700: #b42318;
    --danger-100: #fee4e2;
    --warning-100: #fef3c7;
    --focus: #0b5fff;
    --border: 2px solid var(--navy-950);
    --shadow: 5px 5px 0 var(--navy-950);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--navy-950);
    background: var(--slate-50);
    line-height: 1.65;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

button,
.button,
.app-nav a {
    min-height: 44px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: var(--border);
    border-radius: 0;
    padding: 0.65rem 1rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    color: var(--slate-700);
    background: var(--slate-200);
    border-color: var(--slate-500);
    box-shadow: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
dialog:focus-visible,
[tabindex]:focus-visible {
    outline: 4px solid var(--focus);
    outline-offset: 3px;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1,
h2,
h3,
h4 {
    line-height: 1.25;
}

h1 {
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.035em;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--white);
    background: var(--navy-950);
    transform: translateY(-180%);
}

.skip-link:focus {
    transform: translateY(0);
}

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

.is-hidden {
    display: none !important;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    color: var(--white);
    background: var(--accent-700);
    border: 2px solid currentColor;
    font-size: 0.82rem;
}

.button-primary {
    color: var(--white);
    background: var(--accent-700);
    box-shadow: var(--shadow);
}

.button-primary:hover {
    background: var(--navy-800);
}

.button-google {
    color: #1f1f1f;
    background: var(--white);
    border: 1px solid #747775;
    font-family: "Google Sans", "Roboto", Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
}

.button-google:hover {
    background: #f8fafd;
}

.google-signin-mark {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
}

.button-secondary {
    color: var(--navy-950);
    background: var(--white);
    box-shadow: 3px 3px 0 var(--navy-950);
}

.button-quiet {
    color: var(--white);
    background: transparent;
    border-color: var(--slate-300);
}

.button-block {
    width: 100%;
}

.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--accent-700);
    font-weight: 800;
    text-underline-offset: 0.25rem;
}

.eyebrow {
    margin-bottom: 0.6rem;
    color: var(--accent-700);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.supporting-text,
.field-help,
.metric-note,
.section-summary {
    color: var(--slate-700);
    font-size: 0.9rem;
}

.public-header,
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 5vw, 5rem);
}

.public-header {
    background: var(--white);
    border-bottom: var(--border);
}

.hero,
.content-section,
.closing-cta,
.public-footer {
    width: min(1180px, calc(100% - 2rem));
    margin-inline: auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
    min-height: 620px;
    padding-block: clamp(4rem, 10vw, 8rem);
}

.hero-lead {
    max-width: 44rem;
    color: var(--slate-700);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin: 2rem 0 1rem;
}

.hero-board {
    display: grid;
    gap: 0.9rem;
    padding: 1.25rem;
    background: var(--navy-900);
    border: var(--border);
    box-shadow: 10px 10px 0 var(--accent-700);
}

.work-step {
    display: grid;
    grid-template-columns: 3.25rem 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    color: var(--navy-950);
    background: var(--white);
    border: 2px solid var(--navy-950);
}

.work-step div,
.work-step span {
    display: block;
}

.work-step div span {
    color: var(--slate-700);
    font-size: 0.88rem;
}

.step-number {
    color: var(--accent-700);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.content-section {
    padding-block: clamp(3rem, 8vw, 6rem);
}

.feature-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.feature-card,
.metric-card,
.panel-section,
.auth-card {
    background: var(--white);
    border: var(--border);
    box-shadow: var(--shadow);
}

.feature-card {
    padding: 1.5rem;
}

.mission-roadmap {
    border-top: 2px solid var(--navy-950);
}

.roadmap-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0;
    list-style: none;
}

.roadmap-list li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.75rem;
    min-width: 0;
    padding: 1rem;
    background: var(--white);
    border: 2px solid var(--slate-300);
}

.roadmap-list strong {
    grid-row: 1 / 3;
    color: var(--accent-700);
}

.roadmap-list span,
.roadmap-list small {
    min-width: 0;
}

.roadmap-list small {
    color: var(--slate-700);
}

.closing-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-block: 2rem 5rem;
    padding: clamp(1.5rem, 5vw, 3rem);
    color: var(--white);
    background: var(--navy-900);
    border: var(--border);
}

.public-footer {
    padding-block: 2rem;
    color: var(--slate-700);
    border-top: 2px solid var(--slate-300);
}

.auth-page {
    min-height: 100vh;
}

.auth-main {
    display: grid;
    min-height: calc(100vh - 180px);
    padding: 2rem 1rem 4rem;
    place-items: center;
}

.auth-card {
    width: min(100%, 32rem);
    padding: clamp(1.5rem, 6vw, 3rem);
}

.auth-card h1 {
    font-size: clamp(2rem, 8vw, 3.25rem);
}

.auth-card .button {
    margin: 1.5rem 0 1rem;
}

.app-page {
    background: var(--slate-100);
}

.app-header {
    color: var(--white);
    background: var(--navy-950);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-company {
    margin: 0;
    font-weight: 700;
}

.app-nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.5rem clamp(1rem, 5vw, 5rem);
    background: var(--white);
    border-bottom: 2px solid var(--navy-950);
}

.app-nav a {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 0.55rem 0.8rem;
    font-weight: 750;
    text-decoration: none;
}

.app-nav a[aria-current="page"] {
    color: var(--white);
    background: var(--navy-800);
}

.app-main {
    width: min(1440px, calc(100% - 2rem));
    margin-inline: auto;
    padding-block: 2rem 5rem;
}

.dashboard-heading,
.section-heading,
.pane-heading,
.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-heading h1 {
    margin-bottom: 1rem;
    font-size: clamp(2rem, 4vw, 3.4rem);
}

.load-state,
.foundation-status,
.global-error,
.form-error {
    padding: 0.8rem 1rem;
    border: 2px solid currentColor;
    font-weight: 750;
}

.load-state,
.foundation-status {
    color: var(--navy-800);
    background: var(--warning-100);
}

.global-error,
.form-error {
    color: var(--danger-700);
    background: var(--danger-100);
}

.global-error {
    position: fixed;
    z-index: 50;
    right: 1rem;
    bottom: 1rem;
    max-width: min(34rem, calc(100% - 2rem));
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    min-width: 0;
    padding: 1.25rem;
}

.metric-card h2 {
    margin-bottom: 0.6rem;
    color: var(--slate-700);
    font-size: 0.9rem;
}

.metric-value {
    margin-bottom: 0.25rem;
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.metric-card-accent {
    border-color: var(--accent-700);
    box-shadow: 5px 5px 0 var(--accent-700);
}

.next-action {
    font-weight: 800;
}

.panel-section {
    margin-bottom: 1.5rem;
    padding: clamp(1rem, 3vw, 1.5rem);
}

.panel-section[id] {
    scroll-margin-top: 1rem;
}

.compact-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.compact-panel .button {
    margin-top: auto;
}

.mission-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.mission-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 1rem;
    background: var(--slate-50);
    border: 2px solid var(--slate-300);
}

.mission-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.mission-code,
.mission-state {
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.mission-code {
    color: var(--accent-700);
}

.mission-state {
    align-self: flex-start;
    margin-top: auto;
    padding: 0.2rem 0.45rem;
    background: var(--slate-200);
    border: 1px solid var(--slate-700);
}

.mission-state[data-state="passed"] {
    background: var(--white);
    border-color: var(--accent-700);
}

.mission-card .text-link {
    margin-top: 0.5rem;
}

.detail-list {
    width: 100%;
    margin: 0 0 1rem;
}

.detail-list div {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 1rem;
    padding-block: 0.55rem;
    border-bottom: 1px solid var(--slate-300);
}

.detail-list dt {
    color: var(--slate-700);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    font-weight: 800;
}

.callout {
    width: 100%;
    padding: 1rem;
    background: var(--slate-100);
    border-left: 5px solid var(--accent-700);
}

.ide-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ide-mobile-tabs {
    display: none;
}

.ide-toolbar button,
.output-tabs button {
    padding: 0.45rem 0.75rem;
}

.ide-grid {
    display: grid;
    grid-template-columns: minmax(14rem, 0.8fr) minmax(20rem, 1.5fr) minmax(18rem, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.ide-pane {
    min-width: 0;
    padding: 1rem;
    background: var(--slate-50);
    border: 2px solid var(--navy-800);
}

.ide-pane h3 {
    font-size: 1rem;
}

.ide-editor label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 800;
}

.ide-editor textarea {
    width: 100%;
    min-height: 22rem;
    resize: vertical;
    padding: 1rem;
    color: var(--navy-950);
    background: var(--white);
    border: 2px solid var(--navy-950);
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    line-height: 1.5;
    tab-size: 4;
}

.save-label {
    color: var(--slate-700);
    font-size: 0.85rem;
    font-weight: 700;
}

.file-list {
    padding-left: 1.25rem;
}

.file-list li {
    margin-bottom: 0.25rem;
}

.file-list [aria-current="page"] {
    font-weight: 900;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 0.25rem;
}

.file-list button {
    width: 100%;
    padding: 0.4rem 0.5rem;
    text-align: left;
    color: inherit;
    background: var(--white);
    border: 2px solid transparent;
}

.file-list button:hover,
.file-list button:focus-visible {
    border-color: var(--navy-950);
}

.preview-frame {
    display: grid;
    width: 100%;
    min-height: 22rem;
    background: var(--white);
    border: 2px solid var(--slate-500);
}

.runner-outer-frame {
    border: 0;
    height: 100%;
    min-height: inherit;
    width: 100%;
}

.ide-output {
    grid-column: 1 / -1;
    min-height: 10rem;
    color: var(--white);
    background: var(--navy-950);
}

.output-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

dialog {
    width: min(36rem, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    color: var(--navy-950);
    background: var(--white);
    border: var(--border);
    box-shadow: 10px 10px 0 var(--navy-950);
}

dialog::backdrop {
    background: rgb(7 22 41 / 72%);
}

dialog form {
    padding: clamp(1.25rem, 4vw, 2rem);
}

.dialog-content {
    padding: clamp(1.25rem, 4vw, 2rem);
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.diff-view {
    max-height: min(55vh, 34rem);
    overflow: auto;
    border: 2px solid var(--slate-500);
    background: var(--slate-50);
}

.diff-file + .diff-file {
    border-top: 2px solid var(--slate-500);
}

.diff-file h3 {
    position: sticky;
    top: 0;
    margin: 0;
    padding: 0.5rem 0.75rem;
    color: var(--white);
    background: var(--navy-900);
}

.diff-lines {
    margin: 0;
    padding: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.diff-line {
    display: block;
}

.diff-line[data-kind="local"] {
    background: var(--warning-100);
}

.diff-line[data-kind="server"] {
    background: var(--danger-100);
}

.form-field {
    margin: 1.25rem 0;
    padding: 0;
    border: 0;
}

.form-field > label,
.form-field legend {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 850;
}

.form-field input[type="text"] {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    border: 2px solid var(--navy-950);
}

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

.choice-grid label {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: var(--slate-50);
    border: 2px solid var(--slate-300);
}

.choice-grid input {
    width: 1.25rem;
    height: 1.25rem;
}

@media (max-width: 1100px) {
    .metric-grid,
    .mission-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ide-grid {
        grid-template-columns: minmax(14rem, 0.75fr) minmax(20rem, 1.25fr);
    }

    .ide-preview,
    .ide-output {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    html {
        scroll-behavior: auto;
    }

    .public-header,
    .app-header {
        align-items: flex-start;
        padding-inline: 1rem;
    }

    .header-actions {
        align-items: flex-end;
        flex-direction: column;
    }

    .header-company {
        max-width: 11rem;
        text-align: right;
    }

    .hero,
    .feature-grid,
    .roadmap-list,
    .dashboard-grid,
    .metric-grid,
    .mission-grid,
    .ide-grid,
    .choice-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-block: 3rem;
    }

    .closing-cta,
    .dashboard-heading,
    .section-heading,
    .pane-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .ide-preview,
    .ide-output {
        grid-column: auto;
    }

    .ide-mobile-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .ide-mobile-tabs [role="tab"][aria-selected="true"] {
        color: var(--white);
        background: var(--navy-900);
    }

    .ide-grid > .ide-pane[hidden] {
        display: none;
    }

    .ide-editor textarea,
    .preview-frame {
        min-height: 16rem;
    }

    .app-main {
        width: min(100% - 1rem, 1440px);
    }
}

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

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
}
