@font-face
{
    font-family: Fraunces;
    src: url("./fonts/fraunces-latin-wght-normal.woff2") format("woff2");
    font-style: normal;
    font-weight: 600 700;
    font-display: swap;
}
@font-face
{
    font-family: Outfit;
    src: url("./fonts/outfit-latin-wght-normal.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
}
@font-face
{
    font-family: "IBM Plex Mono";
    src: url("./fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}
:root
{
    --basalt: #14110f;
    --glass: #1c1814;
    --copper: #e39b54;
    --copper-deep: #a86b38;
    --parchment: #f3e6d4;
    --clay: #b7a394;
    --sage: #8fb573;
    --ice: #b7d0d6;
    --warning: #e07a5f;
    --line: rgba(227, 155, 84, .19);
    font-family: Outfit, sans-serif;
    color: var(--parchment);
    background: var(--basalt);
    font-synthesis: none;
}
*
{
    box-sizing: border-box;
}
body
{
    margin: 0;
    overflow: hidden;
}
button, a
{
    -webkit-tap-highlight-color: transparent;
}
button
{
    font: inherit;
    cursor: pointer;
    color: inherit;
}
button:disabled
{
    cursor: default;
    opacity: .55;
}
button:focus-visible, a:focus-visible
{
    outline: 2px solid var(--copper);
    outline-offset: 2px;
}
button, a, p, h1, h2, h3
{
    margin: 0;
}
button svg
{
    flex-shrink: 0;
}
button
{
    border: 0;
}
#app
{
    height: 100dvh;
    min-height: 640px;
    position: relative;
    overflow: hidden;
}
#crater
{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: manipulation;
}
.glass
{
    background: rgba(28, 24, 20, .9);
    backdrop-filter: blur(14px);
}
.hud
{
    animation: panel-in 140ms ease both;
}
.left, .right
{
    width: 320px;
    height: 100%;
    padding: 28px 20px 20px;
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 2;
}
.left
{
    left: 0;
    border-right: 1px solid rgba(227, 155, 84, .35);
}
.right
{
    right: 0;
    border-left: 1px solid rgba(227, 155, 84, .35);
}
.eyebrow
{
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .16em;
    color: var(--clay);
    line-height: 1.5;
}
.brand .eyebrow
{
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand .eyebrow img
{
    width: 36px;
    height: 36px;
}
h1, h2, .sol-block strong
{
    font-family: Fraunces, Georgia, serif;
    font-weight: 600;
}
h1
{
    font-size: 46px;
    letter-spacing: -.055em;
    line-height: 1.12;
    margin-top: 20px;
}
.crater-name
{
    color: var(--copper);
    font-size: 15px;
    margin-top: 8px;
    letter-spacing: .015em;
}
.tagline
{
    font-size: 14px;
    color: var(--clay);
    margin-top: 16px;
}
.intro
{
    padding: 20px 0 0;
}
.intro-body
{
    color: var(--clay);
    font-size: 14px;
    line-height: 1.55;
    max-width: 270px;
}
.title-actions
{
    display: grid;
    gap: 8px;
    margin-top: 20px;
}
.primary, .secondary
{
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
}
.primary
{
    background: var(--copper);
    color: #1c120c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.primary:not(:disabled):hover
{
    background: #eaa96c;
}
.primary:not(:disabled):active
{
    background: var(--copper-deep);
}
.secondary
{
    border: 1px solid rgba(227, 155, 84, .45);
    background: transparent;
    color: var(--copper);
}
.credit
{
    display: inline-block;
    color: var(--clay);
    font-size: 11px;
    text-underline-offset: 3px;
    margin-top: 14px;
}
.sol-block
{
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.sol-block .eyebrow
{
    color: var(--copper);
}
.sol-block strong
{
    font-size: 84px;
    line-height: 1.05;
    letter-spacing: -.06em;
}
.sol-line
{
    width: 36px;
    height: 1px;
    background: var(--line);
    margin: 0 0 14px auto;
}
.forecast-pop
{
    margin-top: 12px;
}
.forecast
{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    min-height: 28px;
    padding: 5px 10px;
    color: var(--copper);
    font: 500 10px "IBM Plex Mono", monospace;
}
.weather-dot
{
    width: 5px;
    height: 5px;
    border: 1px solid currentColor;
    border-radius: 50%;
}
.storm .weather-dot
{
    background: currentColor;
}
#population
{
    margin-top: 14px;
    font: 500 10px "IBM Plex Mono", monospace;
    color: var(--clay);
    white-space: nowrap;
}
.stocks
{
    display: grid;
    gap: 22px;
    margin-top: 32px;
}
.stock-head
{
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
    font-size: 14px;
}
.stock-head > span:last-child
{
    display: flex;
    align-items: baseline;
    gap: 7px;
    font-family: "IBM Plex Mono", monospace;
}
.stock-head b
{
    font-weight: 500;
    font-size: 17px;
}
.stock-head small
{
    color: var(--clay);
    font-size: 9px;
}
.track
{
    height: 8px;
    background: #3a2a22;
    border-radius: 999px;
    overflow: hidden;
}
.track i
{
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--copper);
    transition: width 160ms ease;
}
.oxygen .track i { background: var(--sage); }
.water .track i { background: var(--ice); }
.morale .track i { background: #d9896a; }
.low .stock-head small, .low .stock-head b, .danger
{
    color: var(--warning);
}
.field-note
{
    margin-top: auto;
    padding-top: 28px;
}
.field-note p
{
    color: var(--clay);
    line-height: 1.5;
    font-size: 13px;
    margin-top: 8px;
    min-height: 40px;
}
.left-footer
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.utility, .icon-button, .undo
{
    background: transparent;
    color: var(--clay);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 10px;
}
.utility
{
    font-size: 13px;
}
.utility:hover, .icon-button:hover, .undo:hover
{
    color: var(--copper);
    background: rgba(227, 155, 84, .05);
}
kbd
{
    font: 500 10px "IBM Plex Mono", monospace;
    color: var(--clay);
}
.utility kbd
{
    border: 1px solid var(--line);
    padding: 3px 5px;
    border-radius: 4px;
    margin-left: 16px;
}
.operations-heading
{
    padding-bottom: 20px;
}
.operations-heading .eyebrow
{
    color: var(--copper);
}
h2
{
    font-size: 29px;
    line-height: 1.15;
    letter-spacing: -.035em;
}
.operations-heading h2
{
    margin-top: 20px;
}
.operations-heading p
{
    font-size: 12px;
    color: var(--clay);
    margin-top: 12px;
}
.tools
{
    display: grid;
    gap: 8px;
}
.tool
{
    display: flex;
    gap: 12px;
    align-items: center;
    text-align: left;
    min-height: 62px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 3px solid transparent;
    border-radius: 10px;
    background: rgba(255, 255, 255, .018);
}
.tool.selected
{
    border-color: rgba(227, 155, 84, .35);
    border-left: 3px solid var(--copper);
    background: rgba(227, 155, 84, .09);
}
.tool:hover:not(:disabled)
{
    background: rgba(227, 155, 84, .07);
}
.tool > svg
{
    width: 28px;
    height: 28px;
}
.tool-copy
{
    flex: 1;
    min-width: 0;
}
.tool-copy strong
{
    display: block;
    font-size: 14px;
    font-weight: 500;
}
.tool-copy .mobile-label
{
    display: none;
}
.tool-copy small
{
    display: block;
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.4;
    color: var(--clay);
}
.tool kbd
{
    align-self: flex-start;
    padding-top: 2px;
}
.readout
{
    padding: 16px 0;
    min-height: 74px;
}
.readout p
{
    margin-top: 8px;
    color: var(--clay);
    font-size: 11px;
    line-height: 1.5;
}
.planning
{
    margin-top: auto;
}
.hint
{
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    font-size: 12px;
    color: var(--clay);
    line-height: 1.5;
}
.undo
{
    margin-left: auto;
}
.preview
{
    padding: 12px 0;
    margin-top: 8px;
    border-top: 1px solid var(--line);
}
.preview-label
{
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 8px;
    letter-spacing: .07em;
    color: var(--clay);
}
.preview-grid
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-top: 12px;
}
.preview-item
{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px;
    font: 500 10px "IBM Plex Mono", monospace;
}
.preview-item > span
{
    color: var(--clay);
    font-size: 8px;
}
.preview-item b
{
    font-weight: 500;
    white-space: nowrap;
}
.preview-item em
{
    font-style: normal;
    color: #806651;
}
.preview-item small
{
    font-size: 7px;
}
.falling b
{
    color: var(--clay);
}
.advance
{
    width: 100%;
    min-height: 52px;
}
.advance-key
{
    display: flex;
    align-items: center;
    gap: 16px;
    font: 500 10px "IBM Plex Mono", monospace;
    opacity: .8;
}
.advance-key b
{
    font-size: 21px;
    font-weight: 400;
}
.warning
{
    background: var(--warning);
}
.keyboard-hint
{
    font-size: 9px;
    text-align: center;
    color: var(--clay);
    margin-top: 16px;
    line-height: 1.5;
}
.map-caption
{
    position: absolute;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    align-items: center;
    font: 500 8px "IBM Plex Mono", monospace;
    letter-spacing: .12em;
    color: var(--clay);
    white-space: nowrap;
    opacity: .6;
    pointer-events: none;
}
.map-caption i
{
    width: 28px;
    height: 1px;
    background: var(--copper-deep);
}
.toast
{
    position: absolute;
    left: 50%;
    top: 40px;
    transform: translateX(-50%);
    z-index: 4;
    max-width: min(440px, calc(100vw - 680px));
    padding: 12px 16px;
    background: rgba(28, 24, 20, .94);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 140ms ease;
    pointer-events: none;
}
.toast.visible
{
    opacity: 1;
}
dialog
{
    background: rgba(28, 24, 20, .96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(227, 155, 84, .35);
    border-radius: 14px;
    padding: 28px;
    color: var(--parchment);
    width: min(440px, calc(100vw - 24px));
    max-height: 85dvh;
    overflow: auto;
    animation: panel-in 140ms ease both;
}
dialog::backdrop
{
    background: rgba(20, 17, 15, .45);
}
.dialog-top
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.dialog-top .icon-button
{
    margin: -12px -12px -12px 8px;
}
dialog h2
{
    font-size: 34px;
}
.dialog-body
{
    margin-top: 20px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--clay);
}
.dialog-body p + p
{
    margin-top: 12px;
}
.dialog-body h3
{
    font: 500 16px Outfit, sans-serif;
    color: var(--parchment);
    margin: 24px 0 8px;
}
.dialog-actions
{
    display: grid;
    gap: 8px;
    margin-top: 24px;
}
.dialog-actions:empty
{
    display: none;
}
.dialog-tagline
{
    color: var(--copper);
    font-family: Fraunces, serif;
    font-size: 20px;
}
.mono
{
    font: 500 11px "IBM Plex Mono", monospace;
}
.help-dialog
{
    width: min(560px, calc(100vw - 24px));
}
.failure-grid
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}
.failure-value
{
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
#fallback
{
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 40%;
    transform: translateX(-50%);
    padding: 24px;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.sr-only
{
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.topbar, .mobile-label, .mobile-title, .mobile-tagline, .mobile-eyebrow
{
    display: none;
}
.title-screen .sol-block
{
    margin-top: 18px;
    padding-top: 16px;
}
.title-screen .sol-block strong
{
    font-size: 56px;
}
.title-screen .stocks
{
    margin-top: 24px;
    gap: 14px;
}
.title-screen .intro
{
    padding-top: 16px;
}
.title-screen .brand .tagline
{
    margin-top: 12px;
}
.title-screen .field-note
{
    display: none;
}
.title-screen .left-footer
{
    margin-top: auto;
    padding-top: 8px;
}
@keyframes panel-in
{
    from { opacity: 0; }
    to { opacity: 1; }
}
@media (min-width: 1100px) and (max-height: 850px)
{
    .left, .right { padding-top: 20px; }
    .operations-heading { padding-bottom: 18px; }
    .operations-heading h2 { margin-top: 16px; }
    .tool { min-height: 66px; padding: 8px; }
    .readout { padding: 16px 0; min-height: 80px; }
    .title-screen h1 { margin-top: 12px; }
    .title-screen .intro { padding-top: 12px; }
    .title-screen .title-actions { margin-top: 12px; }
    .title-screen .stocks { gap: 12px; margin-top: 16px; }
    .title-screen .stock-head { margin-bottom: 6px; }
    .title-screen .sol-block { margin-top: 14px; padding-top: 12px; }
}
@media (max-width: 1099px)
{
    #app
    {
        display: grid;
        grid-template-rows: 48px minmax(240px, 1fr) auto;
        min-height: 0;
        height: 100dvh;
    }
    .topbar
    {
        display: flex;
        align-items: center;
        padding: 0 12px;
        gap: 8px;
        background: var(--glass);
        grid-row: 1;
        z-index: 2;
        border-bottom: 1px solid var(--line);
    }
    .mobile-name
    {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-right: auto;
    }
    .mobile-name img { width: 26px; height: 26px; }
    .mobile-name strong { font-family: Fraunces, serif; font-size: 20px; font-weight: 600; letter-spacing: -.04em; }
    .mobile-name small { color: var(--clay); font-size: 10px; }
    #mobile-sol { font: 500 10px "IBM Plex Mono", monospace; color: var(--copper); white-space: nowrap; }
    .topbar .icon-button { min-width: 48px; }
    .topbar .icon-button:last-child { margin-right: -12px; }
    #crater { grid-row: 2; position: relative; min-height: 0; }
    .hud
    {
        grid-row: 3;
        z-index: 2;
        padding: 12px 12px max(8px, env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        background: rgba(28, 24, 20, .96);
        border-top: 1px solid rgba(227, 155, 84, .35);
        border-radius: 12px 12px 0 0;
        min-width: 0;
        backdrop-filter: blur(14px);
    }
    .left, .right { display: contents; }
    .brand, .sol-block, .field-note, .left-footer, .operations-heading, .readout, .keyboard-hint { display: none; }
    .intro { order: 0; padding: 0 0 12px; }
    .title-screen .intro { padding-top: 0; }
    .mobile-eyebrow { display: block; font-size: 9px; margin-bottom: 6px; }
    .mobile-title { display: block; font-size: 30px; margin: 0; line-height: 1; }
    .mobile-tagline { display: block; font-size: 12px; color: var(--copper); margin-top: 6px; }
    .intro-body { max-width: 100%; font-size: 12px; line-height: 1.4; margin-top: 8px; }
    .title-actions { grid-template-columns: 1fr 1fr; margin-top: 10px; gap: 8px; }
    .title-actions button { padding: 10px 12px; font-size: 13px; }
    .intro .credit { font-size: 9px; margin-top: 8px; }
    .stocks, .title-screen .stocks
    {
        order: 1;
        grid-template-columns: 1fr 1fr;
        gap: 12px 20px;
        margin: 0;
    }
    .stock-head { font-size: 12px; margin-bottom: 6px; }
    .stock-head b { font-size: 14px; }
    .stock-head small { font-size: 8px; }
    .track { height: 6px; }
    .forecast-pop
    {
        order: 2;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        margin-top: 12px;
    }
    .forecast { padding: 4px 6px; font-size: 8px; min-height: 24px; gap: 5px; }
    #population { font-size: 8px; margin: 0; }
    .planning { order: 3; margin-top: 6px; display: contents; }
    .hint { order: 3; min-height: 28px; margin-top: 6px; font-size: 11px; }
    .hint .undo { min-height: 48px; margin-top: -10px; margin-bottom: -10px; }
    .preview { order: 4; margin: 0 0 8px; padding: 8px 0; border-top: 1px solid var(--line); }
    .preview-label { display: none; }
    .preview-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0; }
    .preview-item { display: block; font-size: 8px; line-height: 1.4; }
    .preview-item > span { display: block; font-size: 7px; margin-bottom: 3px; }
    .preview-item small { font-size: 6px; }
    .advance { order: 5; min-height: 48px; padding: 10px 14px; }
    .advance-key { font-size: 0; }
    .advance-key b { font-size: 20px; }
    .tools { order: 6; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 8px; }
    .tool
    {
        flex-direction: column;
        gap: 3px;
        justify-content: center;
        min-height: 68px;
        padding: 4px 0;
        border: 0;
        border-top: 3px solid transparent;
        border-radius: 0 0 6px 6px;
        text-align: center;
    }
    .tool.selected { border: 0; border-top: 3px solid var(--copper); }
    .tool .tool-copy { flex: 0; }
    .tool-copy .desktop-label, .tool-copy small, .tool kbd { display: none; }
    .tool-copy .mobile-label { display: block; font-size: 9px; font-weight: 400; }
    .tool > svg { width: 28px; height: 28px; }
    .map-caption { display: none; }
    .toast { top: 60px; max-width: calc(100vw - 40px); width: max-content; }
    dialog
    {
        position: fixed;
        margin: auto auto 0;
        width: 100%;
        max-width: 560px;
        max-height: 70dvh;
        border-radius: 14px 14px 0 0;
        padding: 24px 20px max(24px, env(safe-area-inset-bottom));
    }
    .help-dialog { width: 100%; }
    #fallback { width: calc(100% - 32px); top: 110px; }
}
@media (pointer: coarse)
{
    .keyboard-hint { display: none; }
}
@media (prefers-reduced-motion: reduce)
{
    *, *::before, *::after
    {
        transition: none !important;
        animation: none !important;
    }
}
