:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    color: #26352f;
    background: #bdcdbf;
    --ink: #26352f;
    --muted: #687363;
    --accent: #52795f;
    --accent-soft: #e5eddf;
    --ochre: #b59554;
    --line: #334b3619;
    --surface: #f7f7f0f0;
    --shadow: 0 8px 28px #172c2512, 0 1px 3px #172c2508;
    --radius: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, output { font: inherit; }
button, select { cursor: pointer; }
button {
    color: inherit;
    border: 1px solid var(--line);
    background: #ffffff70;
    border-radius: 10px;
    padding: 9px 12px;
    line-height: 1.35;
    transition: background .16s, border-color .16s, box-shadow .16s, color .16s;
    -webkit-tap-highlight-color: transparent;
}
button:hover { background: #ffffff; border-color: #52795f40; }
button:active { background: #e8eddf; }
button:disabled, button[aria-disabled="true"] { opacity: .4; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
input, select {
    color: var(--ink);
    background: #ffffff80;
    border: 1px solid var(--line);
    border-radius: 9px;
}
input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
input[type="range"] { height: 18px; padding: 0; background: transparent; border: 0; }
input[type="checkbox"] { vertical-align: -2px; margin: 0 6px 0 0; }
select { padding: 9px 11px; max-width: 100%; }
select option { color: var(--ink); background: #f7f7f0; }
[hidden] { display: none !important; }
svg { flex-shrink: 0; }
#world { display: block; width: 100vw; height: 100dvh; outline: none; touch-action: none; }
.panel {
    background: var(--surface);
    border: 1px solid #ffffffa8;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}
.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
    font-weight: 650;
    letter-spacing: 1.45px;
    text-transform: uppercase;
}

/* A small navigation rail leaves the world as the main surface. */
.topbar {
    position: fixed;
    top: 20px;
    left: 22px;
    right: 22px;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 9px 14px;
    color: #324d3a;
    background: var(--surface);
    border: 1px solid #ffffff90;
    border-radius: 14px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}
.brand > svg { width: 25px; height: 29px; color: var(--accent); }
.brand strong { display: block; font-size: 17px; line-height: 1.1; font-weight: 750; letter-spacing: 2.4px; }
.brand span { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; font-weight: 550; letter-spacing: 1.5px; }
.views, .ui-tools {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px;
    min-height: 48px;
    background: var(--surface);
    border: 1px solid #ffffff90;
    border-radius: 14px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}
.views { justify-self: center; }
.views button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    font-size: 11px;
    font-weight: 550;
    white-space: nowrap;
}
.views button:hover { background: #52795f0c; }
.views button.active, .views button[aria-pressed="true"] { color: #fff; background: var(--accent); box-shadow: 0 2px 5px #2f583c20; }
.view-icon, .views button > svg { width: 16px; height: 16px; }
.ui-tools { justify-self: end; }
.ui-tools .icon-button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 0;
    background: transparent;
}
.ui-tools .icon-button > svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ui-tools .icon-button:hover, .ui-tools .icon-button[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }

/* World and settings are occasional drawers, rather than permanent HUD. */
.world-panel, .systems-panel {
    position: fixed;
    z-index: 8;
    left: 22px;
    top: 88px;
    width: 284px;
    max-height: calc(100dvh - 112px);
    padding: 20px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #52795f38 transparent;
}
.systems-panel { width: 306px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -.5px; }
.panel-close { display: grid; place-items: center; flex: none; width: 29px; height: 29px; padding: 5px; border: 0; background: #26352f08; color: var(--muted); }
.panel-close > svg { width: 17px; height: 17px; }
.world-panel > label { display: block; margin-bottom: 7px; }
.field-label { color: var(--muted); font-size: 11px; font-weight: 550; }
.world-panel #planet-select { width: 100%; font-size: 20px; font-weight: 600; padding: 11px 12px; letter-spacing: -.4px; }
.world-panel p { color: #6f7c70; font-size: 12px; line-height: 1.6; margin: 13px 0 22px; }
.world-panel form label { display: block; font-size: 11px; font-weight: 550; color: var(--muted); }
.seed-row { display: flex; gap: 8px; margin-top: 8px; }
.seed-row input { min-width: 0; width: 100%; padding: 10px 11px; font-size: 12px; font-variant-numeric: tabular-nums; }
.seed-row button { width: 39px; flex: none; padding: 5px; font-size: 21px; color: var(--accent); }
.world-info { display: grid; gap: 8px; margin-top: 21px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }
.world-info summary { color: var(--ink); font-size: 11px; cursor: pointer; }
.world-info > span { display: block; margin-top: 9px; }
.world-info > details > span, .world-info > details > div, .world-info > details > p { display: block; margin: 9px 0 0; }
.backend { font-size: 10px; color: var(--muted); }
.backend i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; background: var(--accent); border-radius: 50%; }
.backend > span { margin: 0 4px; opacity: .5; }
.systems-panel #environment-summary { margin: -5px 0 18px; color: var(--accent); font-size: 12px; }
.systems-panel details { border-top: 1px solid var(--line); padding: 15px 0; }
.systems-panel details:last-child { padding-bottom: 0; }
.systems-panel summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.systems-panel details[open] summary { margin-bottom: 15px; }
.systems-panel label { display: block; margin: 12px 0; font-size: 11px; line-height: 1.5; }
.systems-panel select { display: block; width: 100%; margin-top: 6px; font-size: 12px; }
.systems-panel input[type="range"] { display: block; width: 100%; margin-top: 6px; }
.systems-panel button { width: 100%; margin: 4px 0; padding: 9px; font-size: 11px; }
.systems-panel p { margin: 11px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* Selection, intent and commands share one calm, bounded panel. */
.camp-panel {
    position: fixed;
    z-index: 3;
    top: 88px;
    right: 22px;
    width: 282px;
    max-height: calc(100dvh - 224px);
    padding: 19px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #52795f38 transparent;
}
.selection-heading { display: flex; flex-direction: column; gap: 6px; }
.commands-toggle { display: none; }
.camp-panel #selection-summary { display: block; margin: 0; font-size: 18px; line-height: 1.35; font-weight: 650; letter-spacing: -.4px; }
.camp-panel .selection-empty { margin: 13px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.camp-speed { display: flex; align-items: center; gap: 9px; margin-top: 14px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.camp-speed input { min-width: 0; width: 74px; flex: 1; }
.camp-speed output { min-width: 23px; color: var(--ink); text-align: right; font-size: 10px; font-variant-numeric: tabular-nums; }
.selection-status { margin: 16px 0; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.selection-status p { margin: 0; line-height: 1.5; }
.selection-status #worker-state { color: #4b6b51; font-size: 12px; font-weight: 600; }
.selection-status #worker-thought { margin-top: 5px; color: #79816d; font-size: 11px; }
.selection-status #stock { margin-top: 5px; color: var(--muted); font-size: 10px; }
.camp-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin-bottom: 17px; padding: 4px; border-radius: 11px; background: #e8ece2; }
.camp-tabs button { min-width: 0; min-height: 32px; padding: 7px 4px; border: 0; border-radius: 8px; background: transparent; color: #748071; font-size: 11px; font-weight: 550; }
.camp-tabs button.active, .camp-tabs button[aria-selected="true"] { background: #fffefa; color: var(--ink); box-shadow: 0 1px 5px #253c2110; }
.camp-page { min-width: 0; }
.camp-command-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.camp-section { margin-top: 19px; padding-top: 16px; border-top: 1px solid var(--line); }
.camp-page > .camp-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.camp-section h2 { margin: 0; color: var(--muted); font-size: 10px; font-weight: 650; line-height: 1.4; letter-spacing: 1px; text-transform: uppercase; }
.section-hint { margin: 11px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.camp-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.camp-panel button.icon-action { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; min-width: 0; min-height: 49px; padding: 9px 5px; color: #516650; }
.icon-action svg { width: 24px; height: 24px; pointer-events: none; }
.action-name, .action-label { display: block; color: var(--ink); font-size: 10px; font-weight: 500; line-height: 1.25; text-align: center; }
.camp-panel button.icon-action.active, .camp-panel button.icon-action[aria-pressed="true"] { background: var(--accent-soft); border-color: #52795f60; color: #3c6747; }
.camp-panel button.icon-action.active .action-name, .camp-panel button.icon-action[aria-pressed="true"] .action-name { color: #375a3e; }
.camp-command-row #stop-worker { color: #9d7970; }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 11px; }
.resource-grid button.icon-action { min-height: 58px; background: #ffffff5c; }
.resource-grid button:hover { background: #ffffff; }
.resource-grid button.icon-action > svg { width: 25px; height: 25px; }
.resource-more { margin-top: 9px; }
.resource-more summary { width: fit-content; padding: 4px 0; color: var(--muted); cursor: pointer; font-size: 10px; line-height: 1.5; }
.resource-more summary::marker { font-size: 8px; color: #89927c; }
.resource-more summary:hover { color: var(--accent); }
.resource-more .resource-grid { margin-top: 7px; }
.resource-more[open] { margin-bottom: 3px; }
.zone-tools { display: flex; align-items: center; gap: 11px; margin-top: 13px; }
.camp-panel #gather-zone.icon-action { width: 36px; min-height: 36px; flex: none; padding: 6px; border-color: transparent; background: #e8ece2; }
.camp-panel #gather-zone.icon-action > svg { width: 20px; height: 20px; }
.zone-tools label { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; color: var(--muted); font-size: 10px; }
.zone-tools input { min-width: 0; width: 100%; }
.camp-task-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.camp-task-row .icon-action { min-height: 54px; }
.camp-panel .build-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.camp-panel .build-menu .icon-action { min-height: 76px; gap: 8px; }
.camp-panel .build-menu .icon-action > svg { width: 27px; height: 27px; }
.camp-panel #build-open.icon-action { min-height: 29px; padding: 4px 7px; border: 0; background: #e8ece2; }
.camp-panel #build-open.icon-action > svg { width: 18px; height: 18px; }
.camp-population-actions { display: grid; grid-template-columns: 1fr 36px; gap: 7px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.camp-panel #recruit { min-width: 0; min-height: 36px; padding: 8px 10px; background: #e5ecde; border-color: transparent; color: #4e6c4c; font-size: 11px; font-weight: 550; }
.camp-panel #recruit:hover { background: #dbe7d1; }
.camp-population-actions #select-all.icon-action { min-height: 36px; padding: 7px; }
.camp-population-actions #select-all > svg { width: 20px; height: 20px; }
body[data-selection="empty"] .camp-panel { padding-bottom: 17px; }
body[data-selection="empty"] .camp-population-actions { margin-top: 15px; }
.level-panel { display: grid; gap: 13px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 11px; }
.level-panel label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); }
.level-panel input { width: 76px; padding: 8px; color: var(--ink); }
.level-panel output { color: #597059; font-size: 11px; line-height: 1.6; }
.level-panel > div { display: flex; flex-wrap: wrap; gap: 7px; }
.level-panel button { padding: 8px 10px; font-size: 10px; }
.level-panel #level-start, .level-panel #level-resume { background: var(--accent); color: #fff; border-color: transparent; }

/* Recipes and equipped tools use the same compact visual language. */
.craft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.craft-recipe { display: flex; align-items: center; flex-direction: column; gap: 7px; min-width: 0; padding: 14px 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff50; }
.craft-recipe > span { color: var(--ink); font-size: 12px; font-weight: 600; }
.craft-recipe small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.craft-recipe output { color: #8a9387; font-size: 8px; text-align: center; line-height: 1.5; }
.camp-panel .craft-recipe .icon-action, .craft-recipe .icon-action { display: grid; place-items: center; width: 42px; height: 42px; min-height: 42px; margin: 0; padding: 7px; border: 0; background: #e8ece2; }
.craft-recipe .icon-action > svg { width: 28px; height: 28px; }
.equipment-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 19px; color: var(--muted); font-size: 10px; }
.equipment-heading output { color: #59694f; font-size: 10px; font-weight: 550; }
.tool-slots { display: flex; align-items: center; gap: 7px; margin-top: 9px; pointer-events: auto; }
.camp-panel .tool-slots .icon-action, .tool-slots .icon-action { position: relative; display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; margin: 0; padding: 7px; }
.tool-slots .icon-action > svg { width: 25px; height: 25px; }
.tool-slots button[aria-pressed="true"] { color: #3e6246; background: var(--accent-soft); border-color: #52795f5c; }
.equipment-count { position: absolute; bottom: 2px; right: 4px; font-size: 8px; font-weight: 600; color: #647255; }
.equipment-bar { display: none; position: fixed; z-index: 3; right: 22px; top: 88px; padding: 13px; pointer-events: auto; }
.equipment-bar .equipment-heading { margin-top: 0; font-size: 9px; }
.equipment-bar .tool-slots { gap: 6px; }
.equipment-bar .tool-slots .icon-action { width: 36px; height: 36px; min-height: 36px; padding: 6px; }
.equipment-bar .tool-slots .icon-action > svg { width: 23px; height: 23px; }

/* The map is quiet; the character portraits remain the primary shortcut. */
.minimap-panel { display: none; position: fixed; z-index: 4; left: 22px; bottom: 22px; width: 164px; padding: 10px; }
.minimap-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.minimap-heading .eyebrow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
.minimap-heading button { display: grid; place-items: center; width: 23px; height: 23px; flex: none; padding: 4px; border: 0; color: var(--accent); background: #e8ece2; border-radius: 7px; }
.minimap-heading button > svg { width: 15px; height: 15px; pointer-events: none; }
.minimap-heading .minimap-drag { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; width: auto; padding: 3px 0; color: var(--muted); background: transparent; cursor: grab; touch-action: none; user-select: none; }
.minimap-heading .minimap-drag:hover { color: var(--accent); }
.minimap-heading .minimap-drag > svg { width: 9px; height: 15px; opacity: .6; }
.minimap-panel[data-dragging="true"] { z-index: 6; box-shadow: 0 10px 32px #172c2528; }
.minimap-panel[data-dragging="true"] .minimap-drag { cursor: grabbing; }
.minimap-panel canvas { display: block; width: 142px; height: 142px; max-width: 100%; border: 1px solid #334b361c; border-radius: 8px; cursor: crosshair; image-rendering: pixelated; }
.minimap-panel > span:last-child { display: block; margin-top: 8px; text-align: center; color: #87917f; font-size: 8px; }
footer { position: fixed; z-index: 3; bottom: 22px; left: 22px; right: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; pointer-events: none; }
.resident-dock { display: none; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); align-items: center; gap: 9px; width: max-content; max-width: calc(100vw - 464px); pointer-events: none; }
.roster { display: flex; flex: 1 1 auto; align-items: stretch; gap: 7px; min-width: 0; overflow-x: auto; padding: 3px; scrollbar-width: none; pointer-events: auto; }
.roster::-webkit-scrollbar { display: none; }
.resident-dock .roster button { position: relative; flex: none; width: 75px; min-width: 75px; height: 87px; padding: 4px 6px 14px; border: 1px solid #ffffffba; border-radius: 15px; background: var(--surface); box-shadow: 0 3px 12px #18362712; backdrop-filter: blur(18px); }
.resident-dock .roster button:hover { background: #fffdf5; border-color: #b5955470; }
.resident-dock .roster button.selected { border-color: #b59554; background: #fbf3daf2; box-shadow: 0 0 0 2px #b5955420, 0 3px 12px #18362712; }
.resident-dock .roster button > svg { display: block; width: 61px; height: 66px; margin: 0 auto; filter: drop-shadow(0 2px 2px #23382714); }
.resident-dock .roster button > .resident-name { position: absolute; left: 4px; right: 4px; bottom: 5px; color: #5a6655; text-align: center; font-size: 9px; line-height: 12px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resident-dock .roster .resident-activity { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 21px; height: 21px; border: 1px solid #ffffffc0; border-radius: 50%; background: #edf0e5f5; color: #6f7f65; box-shadow: 0 1px 4px #31442b17; }
.resident-dock .roster .resident-activity > svg { width: 13px; height: 13px; margin: 0; filter: none; }
.resident-dock .roster .resident-activity[data-task="1"] { color: #52795f; }
.resident-dock .roster .resident-activity[data-task="2"], .resident-dock .roster .resident-activity[data-task="4"] { color: #a08038; }
.resident-dock .roster .resident-activity[data-activity="0:1"], .resident-dock .roster .resident-activity[data-activity="0:2"], .resident-dock .roster .resident-activity[data-activity="0:3"] { color: #b2785f; }
.roster-recruit { display: grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0; border: 1px solid #ffffffa0; border-radius: 14px; color: #58734e; background: var(--surface); box-shadow: var(--shadow); pointer-events: auto; backdrop-filter: blur(20px); }
.roster-recruit > span:first-child { font-size: 27px; font-weight: 350; line-height: 1; }
.roster-recruit > span:nth-child(2) { display: none; }
.roster-recruit:hover { background: #edf2e5; }
.performance { position: absolute; right: 0; bottom: 0; display: flex; align-items: flex-end; flex-direction: column; gap: 5px; padding: 6px 8px; color: #f7f8ef; background: transparent; border-color: transparent; box-shadow: none; border-radius: 9px; backdrop-filter: none; font-size: 9px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px #2038298c; opacity: .52; pointer-events: auto; transition: background .16s, opacity .16s; }
.performance #position { display: none; font-size: 8px; }
.performance:hover { background: #26352fc9; opacity: 1; text-shadow: none; }
.performance:hover #position { display: block; }

/* A compact inventory stays usable without drawing attention from the scene. */
.hotbar { display: flex; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); gap: 5px; max-width: calc(100vw - 44px); pointer-events: auto; }
.hotbar button { position: relative; display: flex; align-items: center; flex-direction: column; justify-content: flex-end; gap: 5px; flex: 0 1 55px; width: 55px; min-width: 0; height: 65px; padding: 7px 4px 6px; color: #73816a; border: 1px solid #ffffffb5; border-radius: 12px; background: var(--surface); box-shadow: 0 3px 12px #172c2510; backdrop-filter: blur(18px); font-size: 8px; overflow: hidden; }
.hotbar button.selected { border-color: #b59554; color: #5b633d; background: #fbf3daf2; box-shadow: 0 0 0 2px #b5955425; }
.hotbar .tile { width: 29px; height: 29px; flex: none; background-image: url('./Assets/Textures/blocks-atlas.svg'); background-size: 360px 920px; border-radius: 4px; image-rendering: pixelated; }
.hotbar .key { position: absolute; left: 5px; top: 3px; color: #728169; font-size: 8px; font-variant-numeric: tabular-nums; }
.help { position: fixed; bottom: 226px; left: 22px; width: 300px; max-width: calc(100vw - 44px); max-height: calc(100dvh - 340px); padding: 17px 19px; overflow: auto; pointer-events: auto; }
.help > strong { display: block; color: var(--ink); font-size: 12px; font-weight: 650; }
.help .panel-close { position: absolute; top: 10px; right: 10px; }
.help > strong { padding-right: 26px; }
.help p { margin: 8px 0 0; color: #76816e; font-size: 10px; line-height: 1.9; }
kbd { padding: 1px 4px; border: 1px solid #334b3628; border-radius: 4px; font: inherit; font-size: .9em; background: #ffffff60; }
.edit-mode-controls { display: none; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.edit-mode-controls #piece-mode { padding: 5px 7px; border: 1px solid #52795f35; border-radius: 6px; color: var(--accent); background: #e4eddd; font-size: 10px; }
.edit-mode-controls #piece-mode[data-pieces="false"] { color: #78806c; background: #e9ebdf; border-color: var(--line); }
#reticle { position: fixed; z-index: 1; left: 50%; top: 50%; width: 14px; height: 14px; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 0 2px #203829); }
#reticle span { position: absolute; background: #fffbe6cf; }
#reticle span:first-child { width: 12px; height: 1px; left: 1px; top: 6px; }
#reticle span:last-child { height: 12px; width: 1px; top: 1px; left: 6px; }
.fps-resume { display: none; position: fixed; z-index: 3; left: 50%; top: calc(50% + 35px); transform: translateX(-50%); max-width: calc(100vw - 44px); padding: 11px 18px; border-color: #ffffff70; background: var(--surface); color: #4b674a; box-shadow: var(--shadow); font-size: 12px; font-weight: 550; backdrop-filter: blur(18px); }

/* Contextual hints float close to what they describe. */
#notice { position: fixed; z-index: 15; bottom: 133px; left: 50%; transform: translateX(-50%); max-width: min(480px, calc(100vw - 40px)); padding: 12px 18px; color: #eef2e7; background: #2b4235ed; border: 1px solid #ffffff20; border-radius: 12px; box-shadow: 0 4px 20px #0b2d241a; font-size: 12px; line-height: 1.5; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
#notice.visible { opacity: 1; }
.action-tooltip { position: fixed; z-index: 30; max-width: min(250px, calc(100vw - 16px)); padding: 11px 13px; color: #eef2e7; background: #2d4436f5; border: 1px solid #ffffff24; border-radius: 10px; box-shadow: 0 5px 20px #12271e22; font-size: 11px; line-height: 1.45; pointer-events: none; }
.action-tooltip strong, .action-tooltip span { display: block; }
.action-tooltip strong { font-size: 11px; font-weight: 600; }
.action-tooltip span { margin-top: 4px; color: #c2d0bf; font-size: 10px; }
#selection-box { display: none; position: fixed; z-index: 2; border: 1px solid #d9e6bd; background: #deedbd26; pointer-events: none; }
#unit-labels { position: fixed; z-index: 1; inset: 0; pointer-events: none; }
.unit-marker { position: absolute; left: 0; top: 0; padding: 4px 7px; border: 1px solid #ffffff80; border-radius: 6px; color: #526249; background: #f7f7eae0; box-shadow: 0 2px 7px #20382914; font-size: 9px; line-height: 1.2; font-weight: 550; letter-spacing: .1px; white-space: nowrap; pointer-events: auto; }
.unit-marker.selected { z-index: 1; color: #766137; border-color: #d4bb80; background: #fff5d7f0; }
.unit-emotion { position: absolute; left: calc(50% - 19px); bottom: calc(100% + 11px); display: grid; place-items: center; width: 38px; min-height: 35px; padding: 5px; border: 1px solid #ffffffcf; border-radius: 15px; background: #fffdf2f2; box-shadow: 0 3px 12px #20382922; color: var(--ink); font: 23px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; pointer-events: none; transform-origin: 50% 100%; animation: emotion-float 2.8s ease-in-out infinite alternate; transition: opacity .35s; opacity: 1; }
.unit-emotion:before, .unit-emotion:after { content: ''; position: absolute; bottom: -7px; left: 16px; width: 7px; height: 7px; border: 1px solid #ffffffcf; border-radius: 50%; background: #fffdf2f2; }
.unit-emotion:after { bottom: -12px; left: 20px; width: 3px; height: 3px; }
.unit-marker.selected .unit-emotion, .unit-marker.selected .unit-emotion:before, .unit-marker.selected .unit-emotion:after { border-color: #e0cf9e; background: #fff8e0; }
.unit-emotion.fading { opacity: 0; }
.unit-emotion.has-intent { display: flex; align-items: center; gap: 7px; left: 50%; translate: -50% 0; width: max-content; max-width: 170px; min-height: 35px; padding: 7px 10px; }
.unit-emotion.has-intent:before { left: calc(50% - 3px); }
.unit-emotion.has-intent:after { left: calc(50% + 1px); }
.thought-icon { flex: none; font: 23px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.thought-intent { display: -webkit-box; max-width: 115px; overflow: hidden; color: #516347; white-space: normal; font: 550 10px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
@keyframes emotion-float { from { transform: translateY(0) scale(var(--emotion-scale, 1)); } to { transform: translateY(-3px) scale(var(--emotion-scale, 1)); } }
.landing-target { position: fixed; z-index: 1; left: 0; top: 0; color: #ffe7ac; pointer-events: none; }
.landing-target > span { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 0 0 3px #243b2d66, 0 0 12px #ffe8a333; }
.landing-target > span:after { content: ''; position: absolute; left: 8px; top: 8px; width: 4px; height: 4px; background: currentColor; border-radius: 50%; }
.landing-target small { position: absolute; left: 18px; top: -9px; padding: 4px 7px; border-radius: 6px; background: #2d4436df; font-size: 10px; white-space: nowrap; }

.planet-controls { display: none; position: fixed; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(500px, calc(100vw - 44px)); padding: 12px; }
.planet-action-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.planet-action-buttons button { min-height: 36px; padding: 8px 5px; border: 0; background: #e8ece2; color: #53654c; font-size: 11px; }
.planet-action-buttons button:hover { background: #dce7d2; }
.planet-action-buttons button:first-child { color: #fff; background: var(--accent); }
.planet-controls p { margin: 10px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; text-align: center; }
.planet-controls #planet-hint { margin-top: 5px; color: #697b5b; }
.space-controls { display: none; position: fixed; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(500px, calc(100vw - 44px)); padding: 17px 20px; font-size: 11px; }
.space-controls strong { font-size: 13px; font-weight: 650; }
.space-controls p { margin: 9px 0; color: var(--muted); line-height: 1.7; }
.space-controls span { display: block; color: #697b5b; line-height: 1.5; }
.space-controls button { margin: 13px 6px 0 0; padding: 8px 10px; font-size: 11px; }

/* Mode visibility is centralized so the HUD follows the current activity. */
body[data-mode="rts"] .resident-dock, body[data-mode="rts"] .minimap-panel { display: flex; }
body[data-mode="rts"] .minimap-panel { display: block; }
body[data-mode="rts"] #hotbar, body[data-mode="rts"] #reticle { display: none; }
body:not([data-mode="rts"]) #unit-labels { display: none; }
body[data-mode="planet"] #reticle, body[data-mode="planet"] #camp-panel, body[data-mode="planet"] #hotbar { display: none; }
body[data-mode="planet"] .planet-controls { display: block; }
body[data-mode="planet"] .help { bottom: 152px; }
body[data-mode="fps"] #camp-panel, body[data-mode="fps"] .resident-dock, body[data-mode="fps"] .minimap-panel { display: none !important; }
body[data-mode="fps"] #reticle, body[data-mode="fps"] #hotbar, body[data-mode="fps"] .equipment-bar { display: flex; }
body[data-mode="fps"] #reticle { display: block; }
body[data-mode="fps"]:not([data-locked="true"]) .fps-resume { display: block; }
body[data-mode="fps"][data-locked="true"] .world-panel { display: none; }
body[data-mode="fps"] .help, body[data-mode="ground"] .help { bottom: 108px; }
body[data-mode="fps"] .edit-mode-controls, body[data-mode="ground"] .edit-mode-controls { display: flex; }
body[data-mode="space"] .space-controls { display: block; }
body[data-mode="space"] .camp-panel, body[data-mode="space"] .hotbar, body[data-mode="space"] .resident-dock, body[data-mode="space"] .minimap-panel, body[data-mode="space"] #unit-labels { display: none; }
body[data-mode="space"] .help { bottom: 206px; }

.loading { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 26px; background: #eff2e6e8; backdrop-filter: blur(28px); }
.loading-card { width: 100%; max-width: 440px; padding: 30px; text-align: center; }
.loading .eyebrow { margin-top: 24px; color: #718168; }
.loading h1 { margin: 14px 0; color: #354a37; font-size: 27px; font-weight: 600; letter-spacing: -.9px; }
.loading p { margin: 0; color: #7b8872; font-size: 12px; line-height: 1.8; white-space: pre-line; }
.loading #retry { margin-top: 22px; background: var(--accent); color: #fff; border: 0; }
.loader { width: 30px; height: 30px; margin: 0 auto; border: 2px solid #52795f20; border-top-color: var(--accent); border-radius: 9px; animation: turn 2s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
body[data-status="loading"] .topbar, body[data-status="loading"] aside, body[data-status="loading"] footer, body[data-status="loading"] .planet-controls, body[data-status="loading"] .space-controls { visibility: hidden; }
body[data-status="loading"] .fps-resume, body[data-status="error"] .fps-resume { display: none; }
body[data-status="error"] .planet-controls, body[data-status="error"] .space-controls { visibility: hidden; }

@media (max-width: 1100px) {
    .topbar { gap: 12px; }
    .brand { padding: 9px 11px; }
    .brand span { display: none; }
    .views button { padding: 8px 11px; }
    .camp-panel { width: 264px; padding: 17px; }
    .resident-dock { max-width: calc(100vw - 420px); }
    .resident-dock .roster button { width: 67px; min-width: 67px; height: 81px; padding: 4px 5px 13px; }
    .resident-dock .roster button > svg { width: 55px; height: 61px; }
    .hotbar button { width: 49px; flex-basis: 49px; }
}

@media (max-height: 800px) and (min-width: 761px) {
    .camp-panel { padding: 16px; }
    .camp-panel #selection-summary { font-size: 17px; }
    .camp-speed { margin-top: 10px; }
    .selection-status { margin: 12px 0; padding: 10px 0; }
    .camp-tabs { margin-bottom: 13px; }
    .camp-panel button.icon-action { min-height: 45px; padding: 7px 4px; }
    .camp-section { margin-top: 14px; padding-top: 13px; }
    .resource-grid { gap: 6px; margin-top: 9px; }
    .resource-grid button.icon-action { min-height: 53px; }
    .zone-tools { margin-top: 9px; }
    .camp-task-row { margin-top: 9px; }
    .camp-population-actions { margin-top: 13px; padding-top: 12px; }
}

@media (max-width: 760px) {
    .topbar { top: 14px; left: 14px; right: 14px; grid-template-columns: 1fr auto; gap: 10px; }
    .brand { min-height: 38px; gap: 7px; padding: 7px 10px; border-radius: 12px; }
    .brand > svg { width: 20px; height: 23px; }
    .brand strong { font-size: 14px; letter-spacing: 1.7px; }
    .ui-tools { min-height: 38px; padding: 3px; gap: 1px; border-radius: 12px; }
    .ui-tools .icon-button { width: 30px; height: 30px; padding: 7px; border-radius: 8px; }
    .ui-tools .icon-button > svg { width: 17px; height: 17px; }
    .views { grid-column: 1 / -1; grid-row: 2; width: 100%; min-height: 40px; padding: 4px; gap: 2px; border-radius: 12px; }
    .views button { flex: 1; min-width: 0; min-height: 30px; padding: 7px 5px; gap: 5px; font-size: 10px; border-radius: 8px; }
    .view-icon, .views button > svg { width: 15px; height: 15px; }
    .world-panel, .systems-panel { top: 116px; left: 14px; width: min(306px, calc(100vw - 28px)); max-height: calc(100dvh - 140px); padding: 18px; }
    .camp-panel { top: 116px; right: 14px; width: 228px; max-height: calc(100dvh - 246px); padding: 15px; border-radius: 15px; }
    .selection-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 6px; align-items: center; }
    .selection-heading > .eyebrow { grid-column: 1; grid-row: 1; }
    .selection-heading > #selection-summary { grid-column: 1; grid-row: 2; }
    .commands-toggle { display: grid; place-items: center; grid-column: 2; grid-row: 1 / 3; width: 30px; height: 30px; padding: 6px; border: 0; background: #e8ece2; color: var(--accent); border-radius: 9px; }
    .commands-toggle > svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
    .commands-toggle[aria-expanded="true"] { background: var(--accent-soft); }
    body[data-commands="closed"] .camp-panel .camp-speed,
    body[data-commands="closed"] .camp-panel #selection-tools,
    body[data-commands="closed"] .camp-panel .camp-population-actions { display: none; }
    body[data-commands="closed"] .camp-panel { padding-bottom: 15px; }
    .camp-panel #selection-summary { font-size: 16px; }
    .camp-speed { gap: 6px; margin-top: 10px; font-size: 9px; }
    .selection-status { margin: 12px 0; padding: 10px 0; }
    .selection-status #worker-state { font-size: 11px; }
    .selection-status #stock, .selection-status #worker-thought { font-size: 9px; }
    .camp-tabs { margin-bottom: 13px; }
    .camp-tabs button { font-size: 10px; min-height: 29px; }
    .camp-panel button.icon-action { min-height: 43px; padding: 7px 3px; gap: 4px; }
    .icon-action svg { width: 22px; height: 22px; }
    .action-name, .action-label { font-size: 9px; }
    .camp-section { margin-top: 14px; padding-top: 12px; }
    .camp-section h2 { font-size: 9px; }
    .resource-grid { gap: 5px; margin-top: 9px; }
    .resource-grid button.icon-action { min-height: 52px; }
    .resource-grid button.icon-action > svg { width: 22px; height: 22px; }
    .zone-tools { gap: 8px; margin-top: 9px; }
    .camp-panel #gather-zone.icon-action { width: 31px; min-height: 31px; }
    .zone-tools label { font-size: 9px; gap: 5px; }
    .camp-task-row { margin-top: 9px; }
    .camp-population-actions { margin-top: 13px; padding-top: 12px; grid-template-columns: 1fr 33px; }
    .camp-panel #recruit { font-size: 10px; min-height: 33px; padding: 7px; }
    .camp-population-actions #select-all.icon-action { min-height: 33px; }
    .camp-panel .build-menu { gap: 7px; }
    .camp-panel .build-menu .icon-action { min-height: 68px; }
    .craft-grid { gap: 7px; }
    .craft-recipe { padding: 11px 4px; gap: 6px; }
    .craft-recipe > span { font-size: 11px; }
    .craft-recipe small { font-size: 8px; }
    .craft-recipe output { font-size: 7px; }
    .equipment-bar { top: 116px; right: 14px; padding: 11px; }
    .equipment-bar .equipment-heading { font-size: 8px; }
    .equipment-bar .equipment-heading output { font-size: 9px; }
    .equipment-bar .tool-slots .icon-action { width: 32px; height: 34px; min-height: 34px; }
    .equipment-bar .tool-slots .icon-action > svg { width: 22px; height: 22px; }
    .minimap-panel { left: 14px; bottom: 110px; width: 118px; padding: 8px; border-radius: 13px; }
    .minimap-heading { margin-bottom: 6px; }
    .minimap-heading .eyebrow { font-size: 7px; letter-spacing: .7px; }
    .minimap-heading button { width: 20px; height: 20px; padding: 3px; }
    .minimap-heading button > svg { width: 14px; height: 14px; }
    .minimap-panel canvas { width: 100px; height: 100px; border-radius: 6px; }
    .minimap-panel > span:last-child { display: none; }
    footer { bottom: 14px; left: 14px; right: 14px; }
    .resident-dock { max-width: calc(100vw - 28px); gap: 6px; }
    .roster { gap: 5px; }
    .resident-dock .roster button { width: 61px; min-width: 61px; height: 76px; padding: 3px 4px 13px; border-radius: 13px; }
    .resident-dock .roster button > svg { width: 51px; height: 57px; }
    .resident-dock .roster button > .resident-name { bottom: 4px; font-size: 8px; }
    .resident-dock .roster .resident-activity { width: 19px; height: 19px; top: 3px; right: 3px; }
    .resident-dock .roster .resident-activity > svg { width: 12px; height: 12px; }
    .roster-recruit { width: 35px; height: 35px; border-radius: 11px; }
    .roster-recruit > span:first-child { font-size: 24px; }
    .performance { display: none; }
    .hotbar { gap: 3px; max-width: calc(100vw - 28px); }
    .hotbar button { width: 40px; flex-basis: 40px; height: 59px; padding: 7px 2px 5px; border-radius: 9px; font-size: 7px; }
    .hotbar .tile { width: 25px; height: 25px; }
    .hotbar .key { left: 4px; top: 3px; font-size: 7px; }
    .help { bottom: 270px; left: 14px; width: min(290px, calc(100vw - 28px)); max-width: calc(100vw - 28px); max-height: calc(100dvh - 400px); padding: 15px; }
    body[data-mode="fps"] .help, body[data-mode="ground"] .help { bottom: 95px; max-height: calc(100dvh - 220px); }
    .planet-controls, .space-controls { bottom: 14px; width: calc(100vw - 28px); padding: 11px; }
    .planet-action-buttons { gap: 5px; }
    .planet-action-buttons button { min-height: 36px; padding: 7px 3px; font-size: 10px; }
    .planet-controls p { font-size: 8px; }
    body[data-mode="planet"] .help { bottom: 142px; max-height: calc(100dvh - 270px); }
    body[data-mode="space"] .help { bottom: 194px; max-height: calc(100dvh - 318px); }
    .space-controls p, .space-controls span { font-size: 10px; }
    #notice { bottom: 113px; padding: 10px 14px; font-size: 11px; }
    .fps-resume { padding: 10px 14px; font-size: 11px; }
    .unit-marker { font-size: 8px; padding: 3px 6px; }
    .loading-card { padding: 10px; }
    .loading h1 { font-size: 24px; }
}

@media (max-width: 380px) {
    .brand { gap: 5px; padding: 7px 8px; }
    .brand strong { font-size: 13px; letter-spacing: 1.1px; }
    .ui-tools .icon-button { width: 28px; padding: 6px; }
    .camp-panel { width: 212px; padding: 13px; }
    .hotbar button { width: 36px; flex-basis: 36px; font-size: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *:before, *:after { transition-duration: 0s !important; }
    .unit-emotion { animation: none; transform: scale(var(--emotion-scale, 1)); }
    .loader { animation-duration: 4s; }
}

/* Developer readouts stay in the DOM for the game code but are not shown. */
.performance[hidden], .world-info[hidden] { display: none; }

/* Phone: one clear view of the camp. The minimap and the time slider are a tap away in the menus. */
@media (max-width: 760px) {
    .minimap-panel { display: none !important; }
    .camp-panel .camp-speed { display: none; }
    .camp-panel .eyebrow { font-size: 9px; }
}

/* Cookie consent: both choices carry the same weight. */
.consent { position: fixed; z-index: 20; left: 14px; right: 14px; bottom: 14px; max-width: 420px; padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; }
.consent p { margin: 0 0 10px; }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; }
.consent-actions button { padding: 8px 14px; border-radius: 10px; border: 1px solid #00000020; background: #fff; font: inherit; cursor: pointer; }
.consent-actions #consent-accept { background: var(--accent); color: #fff; border-color: transparent; }
.consent[hidden] { display: none; }

/* Commit id, for telling builds apart; it stays out of the way. */
.build-id { position: fixed; right: 8px; bottom: 4px; z-index: 1; font-size: 10px; letter-spacing: .04em; color: #4b674a; opacity: .45; pointer-events: none; }

/* Permanent ad strip: the game area and the bottom controls make room for it. */
:root { --ad-h: 0px; }
body.ads-on { --ad-h: 96px; }
#world { height: calc(100dvh - var(--ad-h)); }
.ad-slot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; height: var(--ad-h); display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface); }
body.ads-on footer { bottom: calc(22px + var(--ad-h)); }
body.ads-on .minimap-panel { bottom: calc(22px + var(--ad-h)); }
body.ads-on .help { bottom: calc(226px + var(--ad-h)); }
