:root
{
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    color: #273c33;
    background: #f3f1e8;
    font-synthesis: none;
    --green: #244d3c;
    --gold: #d6a847;
    --muted: #829083;
}
*
{
    box-sizing: border-box;
}
body
{
    margin: 0;
}
button, input
{
    font: inherit;
}
button, a, input
{
    -webkit-tap-highlight-color: transparent;
}
button, a
{
    touch-action: manipulation;
}
button
{
    cursor: pointer;
}
button:disabled
{
    opacity: .48;
    cursor: default;
}
[hidden]
{
    display: none !important;
}
:focus-visible
{
    outline: 3px solid #d6a847;
    outline-offset: 4px;
}
.app-shell
{
    max-width: 1640px;
    margin: auto;
    padding: 0 40px;
}
.topbar
{
    height: 102px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dcded2;
}
.brand
{
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--green);
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 2px;
}
.brand-mark
{
    width: 43px;
    height: 48px;
    display: grid;
    place-items: center;
    background: var(--green);
    color: #f3d482;
    border-radius: 8px 8px 18px 18px;
    font-size: 31px;
}
.brand small
{
    display: block;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 3px;
    margin-top: 5px;
    color: #839080;
}
.top-meta
{
    display: flex;
    gap: 12px;
    align-items: center;
}
.back-link
{
    color: #637466;
    font-size: 12px;
    text-decoration: none;
    margin-right: 12px;
}
.pill
{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid #d5ddcd;
    border-radius: 30px;
    color: #657861;
    font-size: 11px;
    letter-spacing: 1px;
}
.pill i, .connection i, .auto-hint i
{
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #7da574;
    border-radius: 50%;
}
.icon-button
{
    border: 1px solid #d5ddcd;
    background: transparent;
    color: #687c68;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 17px;
}
.icon-button:hover
{
    background: #e4e8d9;
}
.layout
{
    display: grid;
    grid-template-columns: 260px minmax(320px, 1fr) 230px;
    gap: 26px;
    padding: 30px 0;
    align-items: start;
}
.expedition-panel
{
    padding: 16px 2px 0;
}
.eyebrow
{
    font-size: 10px;
    letter-spacing: 3px;
    color: #85927a;
    font-weight: 600;
}
h1
{
    font-size: 35px;
    line-height: 1.55;
    letter-spacing: 2px;
    margin: 15px 0 13px;
    color: #294433;
    font-weight: 800;
}
h1 span
{
    color: var(--gold);
}
.intro
{
    font-size: 12px;
    line-height: 2;
    color: #84917f;
    margin: 0 0 30px;
    max-width: 230px;
}
label
{
    font-size: 11px;
    display: block;
    margin: 0 0 9px;
    color: #6c7c68;
}
input
{
    width: 100%;
    height: 45px;
    border: 1px solid #d5dccd;
    border-radius: 7px;
    background: #fbfaf5;
    color: #35513b;
    padding: 0 12px;
    font-size: 13px;
}
input::placeholder
{
    color: #a2ab9c;
}
.button
{
    border: 0;
    border-radius: 7px;
    min-height: 45px;
    padding: 11px 16px;
    font-size: 12px;
    letter-spacing: .5px;
    font-weight: 600;
}
.primary
{
    width: 100%;
    background: var(--green);
    color: #f3efdd;
    box-shadow: 0 5px 14px #244d3c18;
    margin-top: 12px;
}
.primary:hover:not(:disabled)
{
    background: #356549;
}
.primary > span:first-child
{
    margin-right: 7px;
    color: #e9cc80;
}
.arrow
{
    float: right;
}
.text-button
{
    background: transparent;
    border: 0;
    color: #788975;
    padding: 9px 0;
    font-size: 11px;
}
.text-button:hover
{
    color: #294c36;
}
#practice
{
    display: block;
    width: 100%;
    margin-top: 20px;
    border-top: 1px solid #dde0d3;
    padding-top: 20px;
    text-align: left;
}
#practice span
{
    float: right;
}
.lobby-footer
{
    border-top: 1px solid #dde0d3;
    margin-top: 35px;
    padding-top: 22px;
    display: flex;
    gap: 10px;
    color: #939d8d;
    font-size: 10px;
    line-height: 1.9;
}
.lobby-footer strong
{
    font-weight: 400;
    color: #687f61;
}
.shield-icon
{
    font-size: 27px;
    color: #baad83;
}
.message
{
    margin: 12px 0 0;
    min-height: 20px;
    color: #a16437;
    line-height: 1.8;
    font-size: 12px;
    overflow-wrap: anywhere;
}
.battle-panel
{
    background: #fbfaf5;
    border: 1px solid #dfe3d5;
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 15px 40px #284a2c09;
}
.battle-heading
{
    height: 77px;
    padding: 15px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.battle-heading .eyebrow
{
    font-size: 9px;
}
.battle-heading h2
{
    margin: 5px 0 0;
    font-size: 16px;
    letter-spacing: 2px;
}
.map-badge
{
    font-size: 10px;
    color: #899778;
    border: 1px solid #dde3d1;
    padding: 5px 8px;
    border-radius: 4px;
}
.game-viewport
{
    width: 100%;
    height: clamp(460px, 67vh, 760px);
    position: relative;
    background: #b6cbb0;
    overflow: hidden;
}
canvas
{
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.game-topline
{
    position: absolute;
    inset: 16px 16px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    font-size: 10px;
}
.stage-tag, .connection
{
    background: #153f31c9;
    color: #eff0d5;
    padding: 7px 10px;
    border-radius: 5px;
}
.connection
{
    background: #ffffffc9;
    color: #5b7354;
    font-size: 9px;
}
.connection i
{
    margin-right: 5px;
}
.scene-caption
{
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 55px 25px 25px;
    background: linear-gradient(transparent, #152f2bd9);
    color: #fff8e8;
    pointer-events: none;
}
.scene-caption > span
{
    font-size: 10px;
    letter-spacing: 2px;
    color: #e1d49a;
}
.scene-caption strong
{
    display: block;
    font-size: 23px;
    letter-spacing: 3px;
    margin-top: 9px;
}
.scene-caption p
{
    font-size: 11px;
    opacity: .7;
    line-height: 1.8;
    margin-bottom: 0;
}
.control-strip
{
    min-height: 47px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 9px;
    color: #83917b;
    flex-wrap: wrap;
}
kbd
{
    border: 1px solid #dfe3d5;
    border-bottom-width: 2px;
    padding: 2px 4px;
    border-radius: 3px;
    font: inherit;
}
.auto-hint
{
    white-space: nowrap;
}
.auto-hint i
{
    width: 5px;
    height: 5px;
    margin-right: 4px;
}
.mission-card
{
    border: 1px solid #dde1d3;
    border-radius: 10px;
    padding: 22px 20px 0;
    background: #eceee2;
}
.mission-card h2
{
    font-size: 22px;
    line-height: 1.6;
    letter-spacing: 2px;
    font-weight: 650;
    margin: 14px 0 10px;
}
.mission-card > p
{
    color: #8a937f;
    font-size: 11px;
    line-height: 1.9;
}
.mission-route
{
    padding: 17px 0 15px;
}
.route-stop
{
    display: flex;
    align-items: start;
    gap: 13px;
    padding-bottom: 27px;
    position: relative;
}
.route-stop:not(:last-child)::after
{
    content: '';
    position: absolute;
    height: 23px;
    border-left: 1px dashed #c5ceb5;
    top: 34px;
    left: 14px;
}
.route-stop:last-child
{
    padding-bottom: 0;
}
.route-stop i
{
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border: 1px solid #ced6c1;
    border-radius: 50%;
    font-size: 10px;
    font-style: normal;
    color: #97a186;
    flex-shrink: 0;
}
.route-stop.active i
{
    background: #375641;
    color: #eee6c0;
    border-color: #375641;
}
.route-stop span
{
    font-size: 12px;
    color: #667c5e;
    padding-top: 1px;
}
.route-stop small
{
    display: block;
    color: #9da48d;
    font-size: 10px;
    margin-top: 7px;
}
.mission-footer
{
    border-top: 1px solid #d9dfca;
    padding: 14px 0;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #8c987f;
}
.mission-footer strong
{
    font-weight: 500;
    color: #647657;
}
.tips-card
{
    padding: 25px 2px 0;
}
.tip
{
    display: flex;
    align-items: start;
    gap: 11px;
    padding-top: 20px;
}
.tip-icon
{
    width: 31px;
    height: 31px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 21px;
}
.green { background: #e2e9d7; color: #7d9664; }
.orange { background: #f0e5ca; color: #b0934d; }
.pink { background: #eee0d8; color: #b08b76; }
.tip h3
{
    font-size: 11px;
    margin: 0 0 6px;
    font-weight: 550;
    color: #68805b;
}
.tip p
{
    font-size: 10px;
    margin: 0;
    color: #96a08b;
    line-height: 1.85;
}
.edition
{
    border-top: 1px solid #dce1d1;
    margin-top: 26px;
    padding-top: 15px;
    font-size: 9px;
    letter-spacing: 1px;
    color: #9da68e;
}
.edition span
{
    float: right;
}
.page-footer
{
    border-top: 1px solid #dce0d2;
    padding: 19px 0;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    color: #a0aa94;
    font-size: 9px;
    letter-spacing: 1px;
}
.room-code-box
{
    background: #e9eddf;
    padding: 15px;
    border-radius: 8px;
}
.room-code-box > span
{
    color: #87977a;
    font-size: 10px;
}
.room-code-box strong
{
    display: block;
    font-size: 20px;
    letter-spacing: 2px;
    margin-top: 8px;
}
.squad-heading
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}
.squad-heading h2
{
    font-size: 12px;
}
.squad-heading > span
{
    font-size: 10px;
    color: #93a089;
}
.roster-player
{
    display: flex;
    align-items: center;
    padding: 9px 0;
    gap: 9px;
    font-size: 12px;
    border-bottom: 1px solid #e0e5d7;
}
.roster-player > i
{
    width: 23px;
    height: 26px;
    border-radius: 6px 6px 10px 10px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 15px;
    font-style: normal;
}
.roster-player > small
{
    margin-left: auto;
    font-size: 9px;
    color: #8c9a80;
}
.room-note
{
    color: #8d9a80;
    font-size: 10px;
    line-height: 1.8;
}
.progress-hud
{
    position: absolute;
    top: 59px;
    left: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 9px;
    color: #2c5036;
    pointer-events: none;
}
.progress-track
{
    flex: 1;
    height: 5px;
    background: #ffffff88;
    border-radius: 5px;
    overflow: hidden;
}
.progress-track i
{
    display: block;
    height: 100%;
    width: 0;
    background: #e1b85a;
}
.battle-hud
{
    position: absolute;
    inset: auto 14px 13px;
    border: 1px solid #edf0df35;
    border-radius: 9px;
    background: #173629e8;
    color: #f7efd5;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 23px;
    pointer-events: none;
}
.battle-hud div > span
{
    display: block;
    color: #b5c4a3;
    font-size: 9px;
    margin-bottom: 2px;
}
.battle-hud strong
{
    font-size: 22px;
}
.rescue-hud strong
{
    color: #efc783;
    font-size: 17px;
}
.loadout-hud strong
{
    font-size: 15px;
}
.rescue-hud
{
    margin-left: auto;
}
.hud-hint
{
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    padding: 3px 8px;
    border-radius: 5px;
    background: #173629de;
    font-size: 10px;
    color: #c0cfae;
    max-width: calc(100% - 16px);
    text-align: right;
    line-height: 1.7;
}
.result-overlay
{
    position: absolute;
    inset: 0;
    background: #163b2b8c;
    display: grid;
    place-items: center;
    padding: 24px;
}
.result-card
{
    width: 100%;
    max-width: 310px;
    background: #faf8ed;
    border: 1px solid #dcc48d;
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    box-shadow: 0 15px 55px #10271955;
}
.result-emblem
{
    font-size: 50px;
    color: #b99647;
    display: block;
    margin-bottom: 12px;
}
.result-card h2
{
    font-size: 27px;
    margin: 10px 0;
}
.result-card p
{
    font-size: 12px;
    color: #829076;
    line-height: 1.9;
}
#result-stats
{
    display: flex;
    justify-content: center;
    gap: 26px;
    margin: 18px 0;
    font-size: 10px;
    color: #8b997e;
}
#result-stats strong
{
    display: block;
    font-size: 23px;
    color: #476647;
    margin-bottom: 4px;
}
dialog
{
    border: 1px solid #d3dbc6;
    border-radius: 15px;
    padding: 32px;
    width: min(470px, calc(100% - 30px));
    color: #365239;
    background: #fbf9ef;
}
dialog::backdrop
{
    background: #12332388;
}
dialog h2
{
    margin: 12px 0 20px;
}
dialog ol
{
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.9;
}
dialog li
{
    margin-bottom: 9px;
}
dialog > p
{
    color: #819173;
    font-size: 11px;
    line-height: 1.8;
}
.dialog-close
{
    position: absolute;
    top: 17px;
    right: 17px;
}
@media (min-width: 1450px)
{
    .layout { grid-template-columns: 280px minmax(400px, 1fr) 260px; gap: 40px; }
    .intro { max-width: 260px; }
}
@media (max-width: 1120px)
{
    .app-shell { padding: 0 24px; }
    .layout { grid-template-columns: 230px minmax(300px, 1fr); gap: 24px; }
    .briefing-panel { display: none; }
    .game-viewport { height: min(72vh, 780px); }
}
@media (max-width: 700px)
{
    .app-shell { padding: 0 14px; }
    .topbar { height: 77px; }
    .brand { font-size: 18px; gap: 10px; }
    .brand-mark { width: 32px; height: 39px; font-size: 26px; }
    .brand small { font-size: 8px; letter-spacing: 1px; }
    .pill, .back-link { display: none; }
    .top-meta { gap: 6px; }
    .layout { display: flex; flex-direction: column; padding: 16px 0; gap: 18px; }
    .expedition-panel { width: 100%; padding: 0; }
    .expedition-panel > .eyebrow, .lobby-footer, .intro, .expedition-panel h1 { display: none; }
    #entry-form { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px 12px; align-items: center; }
    #entry-form label { grid-column: 1 / -1; margin: 0; }
    #entry-form .primary { margin: 0; padding: 10px; }
    #entry-form .room-note { grid-column: 1 / -1; margin: 0; }
    #practice { grid-column: 1 / -1; padding: 5px 0; margin: 0; border: 0; font-size: 10px; }
    .message { margin-top: 5px; min-height: 0; }
    .battle-panel { width: 100%; }
    .battle-heading { height: 60px; padding: 11px 16px; }
    .game-viewport { height: min(68svh, 640px); min-height: 380px; }
    .control-strip { padding: 10px 12px; min-height: 39px; }
    .page-footer { justify-content: space-between; font-size: 8px; }
    .page-footer span:nth-child(2) { display: none; }
    .room-code-box { display: flex; gap: 10px; padding: 8px 12px; align-items: center; }
    .room-code-box strong { display: none; }
    .room-code-box .text-button { margin-left: auto; }
    .squad-heading { margin-top: 5px; }
    #roster { display: flex; flex-wrap: wrap; gap: 5px 15px; }
    .roster-player { border: 0; padding: 4px 0; flex: 1 0 43%; }
    #team-panel .room-note { margin: 6px 0; }
    #leave-game { padding: 2px 0; }
    body.playing .room-code-box, body.playing .squad-heading, body.playing #roster, body.playing #room-note { display: none; }
    body.playing .layout { gap: 8px; }
    body.playing .message { display: none; }
    body.playing .game-viewport { height: calc(100svh - 237px); min-height: 310px; }
    body.playing .topbar { height: 63px; }
    .hud-hint { font-size: 9px; }
    .battle-hud { padding: 9px 12px; gap: 18px; }
}
@media (prefers-reduced-motion: reduce)
{
    * { scroll-behavior: auto !important; }
}
