/* Ant Colony Simulator — warm cross-section diorama UI.
   The canvas owns the world; every panel is a translucent layer above it. */

:root {
    --acs-header-h: 64px;
    --acs-ink: #f6ecd6;
    --acs-ink-dim: #c9b695;
    --acs-ink-mute: #96866d;
    --acs-panel: rgba(22, 17, 12, 0.9);
    --acs-panel-2: rgba(34, 27, 19, 0.95);
    --acs-line: rgba(230, 196, 130, 0.18);
    --acs-line-strong: rgba(230, 196, 130, 0.36);
    --acs-gold: #e8b45a;
    --acs-gold-2: #ffd98a;
    --acs-moss: #9bcf72;
    --acs-water: #6fc3d9;
    --acs-soil: #c98a5a;
    --acs-energy: #b7e36a;
    --acs-danger: #e07a5f;
    --acs-good: #8fd17c;
    --acs-shadow: 0 18px 46px rgba(0, 0, 0, 0.5);
    --acs-radius: 14px;
    --acs-font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
    --acs-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    background: #0d0a07;
}

body {
    margin: 0;
    padding: 0;
    background: #0d0a07;
    color: var(--acs-ink);
    font-family: var(--acs-font);
    -webkit-tap-highlight-color: transparent;
}

button,
input {
    font-family: inherit;
}

button {
    touch-action: manipulation;
}

.acs-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 500;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--acs-gold);
    color: #17130d;
    font-weight: 800;
    text-decoration: none;
    transition: top 0.2s ease;
}

.acs-skip:focus {
    top: 12px;
}

.acs-app {
    position: relative;
    width: 100%;
    margin-top: var(--acs-header-h);
    height: calc(100dvh - var(--acs-header-h));
    min-height: 560px;
    overflow: hidden;
    overflow: clip;
    background: #17130d;
    isolation: isolate;
}

.acs-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    outline: none;
}

.acs-app.tool-dig .acs-canvas,
.acs-app.tool-build .acs-canvas {
    cursor: crosshair;
}

.acs-app.is-panning .acs-canvas {
    cursor: grabbing;
}

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

/* ---------- top bar ---------- */

.acs-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px 22px;
    background: linear-gradient(to bottom, rgba(13, 10, 7, 0.94), rgba(13, 10, 7, 0.62) 62%, rgba(13, 10, 7, 0));
    pointer-events: none;
}

.acs-topbar > * {
    pointer-events: auto;
}

.acs-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.acs-brand img {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    flex: 0 0 auto;
}

.acs-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

.acs-brand-text strong {
    font-size: 14px;
    letter-spacing: 0.02em;
    color: var(--acs-ink);
    white-space: nowrap;
}

.acs-brand-text small {
    font-size: 10px;
    color: var(--acs-ink-mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acs-topmeta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 11px;
    color: var(--acs-ink-dim);
}

.acs-day,
.acs-season,
.acs-mode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid var(--acs-line);
    border-radius: 999px;
    background: rgba(16, 12, 8, 0.62);
    white-space: nowrap;
}

.acs-day b {
    color: var(--acs-gold-2);
    font-family: var(--acs-mono);
    font-size: 12px;
}

.acs-season {
    color: var(--acs-moss);
}

.acs-mode {
    color: var(--acs-ink-dim);
}

.acs-topactions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.acs-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    border: 1px solid var(--acs-line);
    border-radius: 10px;
    background: rgba(16, 12, 8, 0.66);
    color: var(--acs-ink);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.acs-iconbtn:hover {
    background: rgba(56, 43, 28, 0.9);
    border-color: var(--acs-line-strong);
}

.acs-iconbtn:active {
    transform: scale(0.96);
}

.acs-iconbtn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acs-iconbtn svg.acs-ico-play {
    fill: currentColor;
    stroke: none;
}

.acs-speed {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--acs-line);
    border-radius: 999px;
    background: rgba(16, 12, 8, 0.66);
}

.acs-speed button {
    min-width: 34px;
    min-height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--acs-ink-mute);
    font-family: var(--acs-mono);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.acs-speed button.is-active {
    background: var(--acs-gold);
    color: #17130d;
}

/* ---------- resources ---------- */

.acs-resourcebar {
    position: absolute;
    top: 64px;
    left: 16px;
    right: 16px;
    z-index: 26;
    display: flex;
    align-items: center;
    gap: 7px;
    pointer-events: auto;
    overflow-x: auto;
    padding: 2px 2px 4px;
    scrollbar-width: none;
}

.acs-resourcebar::-webkit-scrollbar {
    display: none;
}

.acs-res {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid var(--acs-line);
    border-radius: 11px;
    background: rgba(16, 12, 8, 0.76);
    color: var(--acs-ink-dim);
    font-size: 11px;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.acs-res b {
    color: var(--acs-ink);
    font-family: var(--acs-mono);
    font-size: 12px;
    font-weight: 700;
}

.acs-res-cap {
    color: var(--acs-ink-mute);
    font-family: var(--acs-mono);
    font-size: 10px;
    margin-left: -3px;
}

.acs-res-label {
    letter-spacing: 0.02em;
}

.acs-res-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
}

.acs-res-icon--food {
    background: var(--acs-gold);
    border-radius: 50% 50% 45% 45%;
    transform: rotate(-24deg);
}

.acs-res-icon--water {
    background: var(--acs-water);
    border-radius: 50% 50% 50% 0;
    transform: rotate(45deg);
}

.acs-res-icon--soil {
    background: var(--acs-soil);
    border-radius: 2px;
    transform: rotate(12deg);
}

.acs-res-icon--energy {
    background: var(--acs-energy);
    clip-path: polygon(55% 0, 100% 0, 62% 42%, 92% 42%, 35% 100%, 48% 55%, 12% 55%);
}

.acs-res-icon--chitin {
    background: #d9a15e;
    clip-path: polygon(50% 0, 92% 22%, 82% 78%, 50% 100%, 18% 78%, 8% 22%);
}

.acs-res-icon--ant {
    width: 13px;
    height: 9px;
    background: #d7b07a;
    border-radius: 50%;
    box-shadow: -5px 0 0 -1.5px #b78a54, 5px 0 0 -1.5px #b78a54;
}

.acs-bar {
    display: inline-block;
    width: 44px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    flex: 0 0 auto;
}

.acs-bar > i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: var(--acs-gold);
    transition: width 0.35s ease;
}

.acs-res[data-res="water"] .acs-bar > i {
    background: var(--acs-water);
}

.acs-res[data-res="soil"] .acs-bar > i {
    background: var(--acs-soil);
}

.acs-res[data-res="energy"] .acs-bar > i {
    background: var(--acs-energy);
}

.acs-res[data-res="chitin"] .acs-bar > i {
    background: #d9a15e;
}

.acs-res--pop {
    color: var(--acs-ink);
}

/* ---------- event banner ---------- */

.acs-eventbar {
    position: absolute;
    top: 104px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(760px, calc(100vw - 32px));
    padding: 8px 14px;
    border: 1px solid rgba(240, 180, 90, 0.35);
    border-radius: 999px;
    background: rgba(37, 25, 14, 0.92);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color: var(--acs-ink);
    font-size: 11px;
    backdrop-filter: blur(8px);
    animation: acs-slide-down 0.28s ease both;
}

.acs-eventbar[hidden] {
    display: none;
}

.acs-eventbar strong {
    color: var(--acs-gold-2);
    white-space: nowrap;
}

.acs-eventbar #acsEventDesc {
    color: var(--acs-ink-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acs-eventbar.is-danger {
    border-color: rgba(224, 122, 95, 0.55);
    background: rgba(45, 22, 15, 0.94);
}

.acs-eventbar.is-danger strong {
    color: #ffb199;
}

.acs-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--acs-gold);
    box-shadow: 0 0 10px rgba(232, 180, 90, 0.8);
    flex: 0 0 auto;
}

.acs-eventbar.is-danger .acs-event-dot {
    background: var(--acs-danger);
    box-shadow: 0 0 10px rgba(224, 122, 95, 0.8);
}

.acs-event-timer {
    margin-left: auto;
    font-family: var(--acs-mono);
    color: var(--acs-gold-2);
    white-space: nowrap;
}

/* ---------- rival war panel ---------- */

.acs-warpanel {
    position: absolute;
    left: 16px;
    bottom: 84px;
    z-index: 29;
    width: min(292px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px 11px;
    border: 1px solid rgba(181, 42, 50, 0.45);
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(48, 18, 18, 0.94), rgba(20, 13, 12, 0.94));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.acs-objective {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    font-size: 10px;
    line-height: 1.25;
}

.acs-objective-label {
    flex: 0 0 auto;
    color: var(--acs-gold);
    font-family: var(--acs-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.acs-objective b {
    color: var(--acs-ink);
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acs-war-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--acs-ink-dim);
    font-size: 9px;
}

.acs-war-title {
    flex: 0 0 auto;
    color: #f0a090;
    font-weight: 700;
}

.acs-war-phase {
    flex: 0 0 auto;
    color: var(--acs-ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--acs-mono);
    font-size: 8px;
}

.acs-war-bar {
    flex: 1 1 auto;
    height: 5px;
    min-width: 26px;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

.acs-war-bar > i {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #7a1f26, #e05a4e);
    transition: width 0.35s ease;
}

.acs-war-hp {
    flex: 0 0 auto;
    color: #f0b0a0;
    font-family: var(--acs-mono);
    font-size: 9px;
}

.acs-btn--war {
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid rgba(224, 90, 78, 0.55);
    border-radius: 9px;
    background: linear-gradient(180deg, #a42f38, #6f1820);
    color: #ffe9dc;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.acs-btn--war:hover {
    background: linear-gradient(180deg, #bd3a44, #84202a);
}

.acs-btn--war.is-unavailable {
    opacity: 0.55;
}

.acs-btn--war.is-active {
    background: linear-gradient(180deg, #d8a04a, #9a5c1e);
    border-color: rgba(240, 190, 100, 0.6);
    color: #1b1208;
}

/* ---------- sidebar ---------- */

.acs-sidebar {
    position: absolute;
    top: 104px;
    right: 14px;
    bottom: 88px;
    z-index: 24;
    width: 332px;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--acs-line);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(38, 29, 20, 0.94), rgba(19, 15, 10, 0.94));
    box-shadow: var(--acs-shadow);
    backdrop-filter: blur(14px);
    scrollbar-width: thin;
    scrollbar-color: rgba(232, 180, 90, 0.35) transparent;
}

.acs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.acs-sidebar::-webkit-scrollbar-thumb {
    background: rgba(232, 180, 90, 0.3);
    border-radius: 6px;
}

.acs-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.acs-sidebar-head h2 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--acs-gold);
}

.acs-queen-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(232, 180, 90, 0.28);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(232, 180, 90, 0.12), rgba(232, 180, 90, 0.03));
}

.acs-queen-mark {
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: radial-gradient(circle at 50% 40%, rgba(255, 217, 138, 0.28), rgba(120, 76, 30, 0.12));
    color: var(--acs-gold-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.acs-queen-mark svg {
    width: 40px;
    height: 40px;
}

.acs-queen-info {
    flex: 1;
    min-width: 0;
}

.acs-queen-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
}

.acs-queen-row strong {
    color: var(--acs-gold-2);
    font-size: 12px;
}

.acs-queen-row span {
    color: var(--acs-ink-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acs-bar--queen {
    width: 100%;
    height: 6px;
    margin: 6px 0 5px;
    background: rgba(0, 0, 0, 0.4);
}

.acs-bar--queen > i {
    background: linear-gradient(90deg, #e07a5f, #e8b45a, #9bcf72);
    width: 100%;
}

.acs-queen-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--acs-ink-mute);
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.acs-queen-meta b {
    color: var(--acs-ink);
    font-family: var(--acs-mono);
    font-size: 10px;
}

.acs-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--acs-line);
}

.acs-section h3 {
    margin: 0 0 8px;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--acs-gold);
}

.acs-hint {
    margin: 0 0 8px;
    color: var(--acs-ink-mute);
    font-size: 10px;
    line-height: 1.45;
}

.acs-pop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.acs-pop-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 8px;
    border: 1px solid var(--acs-line);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.16);
}

.acs-pop-grid span {
    color: var(--acs-ink-mute);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.acs-pop-grid b {
    font-family: var(--acs-mono);
    font-size: 15px;
    color: var(--acs-ink);
}

.acs-brood-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    color: var(--acs-ink-dim);
    font-size: 10px;
}

.acs-brood-row > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.acs-brood-row b {
    font-family: var(--acs-mono);
    color: var(--acs-ink);
}

.acs-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.acs-dot--egg {
    background: #efe2bd;
}

.acs-dot--larva {
    background: #e8d6a8;
}

.acs-dot--pupa {
    background: #cdbb92;
}

.acs-priorities {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.acs-priority {
    display: grid;
    grid-template-columns: 1fr 96px 16px;
    align-items: center;
    gap: 7px;
    color: var(--acs-ink-dim);
    font-size: 10px;
}

.acs-priority input[type="range"] {
    width: 100%;
    height: 24px;
    accent-color: var(--acs-gold);
    cursor: pointer;
}

.acs-priority b {
    font-family: var(--acs-mono);
    font-size: 11px;
    color: var(--acs-gold-2);
    text-align: right;
}

.acs-quotas {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.acs-quota {
    display: grid;
    grid-template-columns: 1fr 96px 38px;
    align-items: center;
    gap: 7px;
    color: var(--acs-ink-dim);
    font-size: 10px;
}

.acs-quota input[type="range"] {
    width: 100%;
    height: 24px;
    accent-color: var(--acs-moss);
    cursor: pointer;
}

.acs-quota b {
    font-family: var(--acs-mono);
    font-size: 11px;
    color: #b9d89a;
    text-align: right;
}

.acs-chambers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.acs-chamber-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid var(--acs-line);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.14);
}

.acs-chamber-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: rgba(232, 180, 90, 0.14);
    color: var(--acs-gold-2);
}

.acs-chamber-main {
    flex: 1;
    min-width: 0;
}

.acs-chamber-main strong {
    display: block;
    font-size: 10px;
    color: var(--acs-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acs-chamber-main small {
    display: block;
    font-size: 9px;
    color: var(--acs-ink-mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acs-chamber-fill {
    width: 42px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
    flex: 0 0 auto;
}

.acs-chamber-fill i {
    display: block;
    height: 100%;
    background: var(--acs-gold);
}

.acs-chamber-item.is-planned {
    border-style: dashed;
    opacity: 0.8;
}

.acs-eventlog {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 132px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.acs-eventlog-item {
    display: flex;
    gap: 6px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid rgba(230, 196, 130, 0.08);
    color: var(--acs-ink-dim);
    font-size: 9px;
    line-height: 1.35;
}

.acs-eventlog-item:last-child {
    border-bottom: 0;
}

.acs-eventlog-day {
    flex: 0 0 auto;
    color: var(--acs-gold);
    font-family: var(--acs-mono);
    font-size: 8px;
}

.acs-eventlog-empty {
    color: var(--acs-ink-mute);
    font-size: 9px;
    font-style: italic;
}

.acs-sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--acs-line);
}

/* ---------- buttons ---------- */

.acs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--acs-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--acs-ink);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.acs-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--acs-line-strong);
}

.acs-btn:active {
    transform: scale(0.97);
}

.acs-btn--primary {
    background: linear-gradient(180deg, #f2c977, #d89a3d);
    border-color: #f7d794;
    color: #1a130a;
    box-shadow: 0 6px 18px rgba(216, 154, 61, 0.25);
}

.acs-btn--primary:hover {
    background: linear-gradient(180deg, #ffdc94, #e6a94a);
}

.acs-btn--danger {
    border-color: rgba(224, 122, 95, 0.5);
    color: #ffb199;
}

.acs-btn--ghost {
    background: rgba(255, 255, 255, 0.025);
}

.acs-linkbtn {
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: var(--acs-gold-2);
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* ---------- toolbar ---------- */

.acs-toolbar {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    z-index: 32;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px;
    border: 1px solid var(--acs-line);
    border-radius: 999px;
    background: rgba(17, 13, 9, 0.94);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.acs-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 11px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--acs-ink-dim);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.acs-tool svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acs-tool:hover {
    color: var(--acs-ink);
    background: rgba(255, 255, 255, 0.06);
}

.acs-tool.is-active {
    color: #1a130a;
    background: linear-gradient(180deg, #f0c574, #d99c40);
    border-color: #f6d390;
}

.acs-toolbar-sep {
    width: 1px;
    height: 26px;
    background: var(--acs-line);
    margin: 0 2px;
}

.acs-zoombar {
    display: flex;
    align-items: center;
    gap: 2px;
}

.acs-zoombar .acs-iconbtn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-color: transparent;
    background: transparent;
}

.acs-zoombar .acs-iconbtn:hover {
    background: rgba(255, 255, 255, 0.07);
}

.acs-focusbar {
    position: absolute;
    left: 50%;
    bottom: 82px;
    transform: translateX(-50%);
    z-index: 28;
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--acs-line);
    border-radius: 999px;
    background: rgba(17, 13, 9, 0.78);
    backdrop-filter: blur(8px);
}

.acs-focusbar button {
    min-height: 28px;
    padding: 3px 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--acs-ink-mute);
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
}

.acs-focusbar button:hover {
    color: var(--acs-ink);
    background: rgba(255, 255, 255, 0.06);
}

/* ---------- build palette ---------- */

.acs-buildpalette {
    position: absolute;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%);
    z-index: 34;
    width: min(620px, calc(100vw - 24px));
    max-height: 46vh;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--acs-line-strong);
    border-radius: 16px;
    background: rgba(26, 20, 14, 0.97);
    box-shadow: var(--acs-shadow);
    backdrop-filter: blur(14px);
    animation: acs-slide-up 0.2s ease both;
}

.acs-buildpalette[hidden] {
    display: none;
}

.acs-palette-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.acs-palette-head strong {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--acs-gold);
}

.acs-palette-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.acs-palette-item {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 7px 9px;
    border: 1px solid var(--acs-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--acs-ink);
    text-align: left;
    cursor: pointer;
}

.acs-palette-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--acs-line-strong);
}

.acs-palette-item.is-active {
    border-color: var(--acs-gold);
    background: rgba(232, 180, 90, 0.12);
}

.acs-palette-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.acs-palette-item .acs-chamber-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
}

.acs-palette-text strong {
    display: block;
    font-size: 10px;
}

.acs-palette-text small {
    display: block;
    font-size: 9px;
    color: var(--acs-ink-mute);
}

.acs-palette-cost {
    font-family: var(--acs-mono);
    font-size: 9px;
    color: var(--acs-gold-2);
    white-space: nowrap;
}

/* ---------- inspector ---------- */

.acs-inspector {
    position: absolute;
    left: 14px;
    bottom: 90px;
    z-index: 33;
    width: 300px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--acs-line-strong);
    border-radius: 14px;
    background: rgba(26, 20, 14, 0.96);
    box-shadow: var(--acs-shadow);
    backdrop-filter: blur(12px);
    animation: acs-fade-up 0.2s ease both;
}

.acs-inspector[hidden] {
    display: none;
}

.acs-inspector-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-color: transparent;
    background: transparent;
}

.acs-inspector h3 {
    margin: 0 0 6px;
    padding-right: 40px;
    font-size: 12px;
    color: var(--acs-gold-2);
}

.acs-inspector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

.acs-inspector-grid > div {
    padding: 6px 7px;
    border: 1px solid var(--acs-line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.16);
}

.acs-inspector-grid span {
    display: block;
    color: var(--acs-ink-mute);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.acs-inspector-grid b {
    display: block;
    margin-top: 2px;
    color: var(--acs-ink);
    font-family: var(--acs-mono);
    font-size: 10px;
    font-weight: 700;
}

.acs-inspector .acs-bar {
    width: 100%;
    height: 5px;
    margin-top: 3px;
}

/* ---------- toasts ---------- */

.acs-toasts {
    position: absolute;
    top: 148px;
    right: 16px;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(330px, calc(100vw - 32px));
    pointer-events: none;
}

.acs-toast {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--acs-line);
    border-left: 3px solid var(--acs-gold);
    border-radius: 10px;
    background: rgba(24, 18, 12, 0.96);
    color: var(--acs-ink);
    font-size: 10px;
    line-height: 1.4;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
    animation: acs-toast-in 0.24s ease both;
    pointer-events: auto;
}

.acs-toast.is-good {
    border-left-color: var(--acs-good);
}

.acs-toast.is-bad {
    border-left-color: var(--acs-danger);
}

.acs-toast.is-warn {
    border-left-color: var(--acs-gold);
}

.acs-toast.is-leaving {
    animation: acs-toast-out 0.2s ease both;
}

/* ---------- start screen ---------- */

.acs-start {
    position: absolute;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 50% 10%, rgba(255, 214, 140, 0.08), transparent 42%),
        linear-gradient(180deg, rgba(10, 8, 5, 0.42), rgba(10, 8, 5, 0.86));
    backdrop-filter: blur(2px);
}

.acs-start[hidden] {
    display: none;
}

.acs-start-card {
    width: min(680px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 26px 26px 22px;
    border: 1px solid var(--acs-line-strong);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(42, 32, 21, 0.98), rgba(20, 15, 10, 0.98));
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    text-align: center;
    scrollbar-width: thin;
}

.acs-start-logo img {
    display: block;
    margin: 0 auto 8px;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.acs-eyebrow {
    margin: 0;
    color: var(--acs-gold);
    font-size: 9px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.acs-start-card h1 {
    margin: 4px 0 8px;
    font-family: "Arial Black", "Trebuchet MS", Impact, sans-serif;
    font-size: clamp(2rem, 6vw, 3.2rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    color: #fff4dc;
    text-shadow: 0 4px 0 rgba(90, 56, 20, 0.45), 0 10px 30px rgba(0, 0, 0, 0.4);
}

.acs-start-sub {
    max-width: 52ch;
    margin: 0 auto 18px;
    color: var(--acs-ink-dim);
    font-size: 12px;
    line-height: 1.55;
}

.acs-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.acs-mode-card {
    display: grid;
    gap: 3px;
    justify-items: start;
    min-height: 92px;
    padding: 12px;
    border: 1px solid var(--acs-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--acs-ink);
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.acs-mode-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--acs-line-strong);
}

.acs-mode-card.is-active {
    border-color: var(--acs-gold);
    background: linear-gradient(135deg, rgba(232, 180, 90, 0.18), rgba(232, 180, 90, 0.04));
    box-shadow: 0 0 0 1px rgba(232, 180, 90, 0.22) inset;
}

.acs-mode-icon {
    font-size: 22px;
    line-height: 1;
    color: var(--acs-gold-2);
}

.acs-mode-card strong {
    font-size: 13px;
}

.acs-mode-card small {
    color: var(--acs-ink-mute);
    font-size: 10px;
    line-height: 1.35;
}

.acs-start-btn {
    width: 100%;
    min-height: 46px;
    margin-top: 8px;
    font-size: 13px;
}

.acs-save-info {
    margin: 8px 0 0;
    color: var(--acs-ink-mute);
    font-size: 10px;
}

.acs-start-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
}

.acs-start-note {
    margin: 14px 0 0;
    color: var(--acs-ink-mute);
    font-size: 9px;
}

/* ---------- modal ---------- */

.acs-modal-layer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 6, 4, 0.72);
    backdrop-filter: blur(6px);
}

.acs-modal-layer[hidden] {
    display: none;
}

.acs-modal {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: 86%;
    border: 1px solid var(--acs-line-strong);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(42, 32, 21, 0.99), rgba(19, 15, 10, 0.99));
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
    animation: acs-modal-in 0.22s ease both;
}

.acs-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--acs-line);
}

.acs-modal-head h2 {
    margin: 0;
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--acs-gold-2);
}

.acs-modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    color: var(--acs-ink-dim);
    font-size: 11px;
    line-height: 1.55;
    scrollbar-width: thin;
}

.acs-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--acs-line);
}

.acs-modal-actions:empty {
    display: none;
}

/* ---------- modal content ---------- */

.acs-ach-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.acs-ach-item {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 9px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--acs-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.acs-ach-item.is-locked {
    opacity: 0.66;
}

.acs-ach-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(232, 180, 90, 0.12);
    color: var(--acs-gold-2);
    font-size: 15px;
}

.acs-ach-main strong {
    display: block;
    color: var(--acs-ink);
    font-size: 10px;
}

.acs-ach-main small {
    display: block;
    color: var(--acs-ink-mute);
    font-size: 9px;
    line-height: 1.35;
}

.acs-ach-progress {
    width: 100%;
    height: 4px;
    margin-top: 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.acs-ach-progress i {
    display: block;
    height: 100%;
    background: var(--acs-gold);
}

.acs-ach-state {
    color: var(--acs-gold-2);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.acs-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.acs-stats-grid > div {
    padding: 8px;
    border: 1px solid var(--acs-line);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.14);
}

.acs-stats-grid span {
    display: block;
    color: var(--acs-ink-mute);
    font-size: 8px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.acs-stats-grid b {
    display: block;
    margin-top: 2px;
    color: var(--acs-ink);
    font-family: var(--acs-mono);
    font-size: 13px;
}

.acs-research-branch {
    margin: 14px 0 7px;
    color: var(--acs-gold-2);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.acs-tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
}

.acs-tech-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px;
    border: 1px solid var(--acs-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.acs-tech-card.is-done {
    border-color: rgba(155, 207, 114, 0.38);
    background: rgba(155, 207, 114, 0.07);
}

.acs-tech-head {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--acs-ink);
}

.acs-tech-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: rgba(232, 180, 90, 0.13);
    color: var(--acs-gold-2);
    font-size: 15px;
}

.acs-tech-card p {
    margin: 0;
    min-height: 34px;
    font-size: 10px;
    color: var(--acs-ink-mute);
}

.acs-tech-card small {
    color: var(--acs-gold-2);
    font-family: var(--acs-mono);
    font-size: 9px;
}

.acs-tech-card .acs-btn {
    width: 100%;
    min-height: 32px;
    margin-top: 2px;
    padding: 5px 8px;
    font-size: 9px;
}

.acs-tech-card .acs-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.acs-tech-card.is-done .acs-btn {
    border-color: rgba(155, 207, 114, 0.35);
    color: var(--acs-good);
}

/* ---------- expeditions modal ---------- */

.acs-sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.acs-sector-chip {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 9px;
    border: 1px solid var(--acs-line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.025);
}

.acs-sector-chip strong {
    color: var(--acs-ink);
    font-size: 10px;
}

.acs-sector-chip small {
    color: var(--acs-ink-mute);
    font-size: 9px;
}

.acs-poi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
}

.acs-poi-card,
.acs-expedition-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px;
    border: 1px solid var(--acs-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.acs-poi-card.is-done {
    border-color: rgba(155, 207, 114, 0.35);
    opacity: 0.78;
}

.acs-expedition-card.is-active {
    border-color: rgba(232, 180, 90, 0.4);
    background: rgba(232, 180, 90, 0.07);
    margin-bottom: 6px;
}

.acs-expedition-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--acs-ink);
}

.acs-expedition-head span {
    color: var(--acs-gold-2);
    font-family: var(--acs-mono);
    font-size: 9px;
}

.acs-poi-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.acs-poi-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: rgba(232, 180, 90, 0.13);
    color: var(--acs-gold-2);
    font-size: 16px;
}

.acs-poi-head strong {
    display: block;
    color: var(--acs-ink);
    font-size: 11px;
}

.acs-poi-head small {
    color: var(--acs-ink-mute);
    font-size: 9px;
}

.acs-poi-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
    color: var(--acs-ink-mute);
    font-size: 9px;
}

.acs-poi-card .acs-btn {
    width: 100%;
    min-height: 32px;
    padding: 5px 8px;
    font-size: 9px;
}

/* ---------- campaign missions modal ---------- */

.acs-mission-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--acs-line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
}

.acs-mission-card.is-current {
    border-color: rgba(232, 180, 90, 0.4);
    background: rgba(232, 180, 90, 0.06);
}

.acs-mission-card h3 {
    margin: 0;
    color: var(--acs-gold-2);
    font-size: 14px;
}

.acs-mission-card h4 {
    margin: 2px 0 0;
    color: var(--acs-ink-mute);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.acs-mission-card p {
    margin: 0;
    color: var(--acs-ink);
    font-size: 11px;
    line-height: 1.5;
}

.acs-mission-objectives {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.acs-mission-objective {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--acs-ink);
    font-size: 10px;
}

.acs-mission-objective .acs-bar {
    width: 100%;
    height: 5px;
}

.acs-mission-objective.is-done > span:first-child {
    color: var(--acs-good);
}

.acs-mission-objective.is-done .acs-bar > i {
    background: var(--acs-good);
}

.acs-mission-reward {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    padding-top: 7px;
    border-top: 1px solid var(--acs-line);
}

.acs-mission-reward span {
    color: var(--acs-ink-mute);
    font-size: 9px;
}

.acs-mission-reward strong {
    color: var(--acs-gold-2);
    font-family: var(--acs-mono);
    font-size: 9px;
    font-weight: 600;
}

.acs-mission-history {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.acs-mission-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid rgba(155, 207, 114, 0.25);
    border-radius: 9px;
    background: rgba(155, 207, 114, 0.05);
}

.acs-mission-history-item strong {
    color: var(--acs-ink);
    font-size: 10px;
}

.acs-mission-history-item small {
    color: var(--acs-ink-mute);
    font-family: var(--acs-mono);
    font-size: 9px;
}

.acs-help-steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.acs-help-steps li {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 8px;
    align-items: start;
}

.acs-help-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(232, 180, 90, 0.16);
    color: var(--acs-gold-2);
    font-family: var(--acs-mono);
    font-size: 10px;
    font-weight: 700;
}

.acs-help-controls {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--acs-line);
}

.acs-help-controls code {
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--acs-gold-2);
    font-family: var(--acs-mono);
    font-size: 9px;
}

.acs-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--acs-line);
}

.acs-setting-row:last-child {
    border-bottom: 0;
}

.acs-setting-row strong {
    color: var(--acs-ink);
    font-size: 10px;
}

.acs-setting-row select {
    min-height: 34px;
    padding: 4px 8px;
    border: 1px solid var(--acs-line);
    border-radius: 8px;
    background: rgba(16, 12, 8, 0.8);
    color: var(--acs-ink);
    font-size: 10px;
}

.acs-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    border: 1px solid var(--acs-line);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: background 0.18s ease;
}

.acs-toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--acs-ink-mute);
    transition: transform 0.18s ease, background 0.18s ease;
}

.acs-toggle.is-on {
    background: rgba(232, 180, 90, 0.25);
    border-color: var(--acs-gold);
}

.acs-toggle.is-on::after {
    transform: translateX(20px);
    background: var(--acs-gold);
}

.acs-modal-note {
    margin: 10px 0 0;
    color: var(--acs-ink-mute);
    font-size: 9px;
}

/* ---------- tooltip ---------- */

.acs-tooltip {
    position: absolute;
    z-index: 90;
    max-width: 230px;
    padding: 6px 8px;
    border: 1px solid var(--acs-line-strong);
    border-radius: 8px;
    background: rgba(20, 15, 10, 0.96);
    color: var(--acs-ink);
    font-size: 9px;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.acs-tooltip[hidden] {
    display: none;
}

/* ---------- animations ---------- */

@keyframes acs-slide-down {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes acs-slide-up {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes acs-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes acs-toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes acs-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-4px); }
}

@keyframes acs-toast-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes acs-toast-out-down {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(6px); }
}

@keyframes acs-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- responsive ---------- */

.acs-only-mobile {
    display: none;
}

@media (max-width: 980px) {
    .acs-sidebar {
        width: 300px;
        top: 98px;
    }

    .acs-warpanel {
        bottom: 132px;
        width: min(264px, calc(100vw - 32px));
    }

    .acs-brand-text small {
        display: none;
    }

    .acs-topmeta {
        gap: 4px;
    }

    .acs-mode {
        display: none;
    }
}

@media (max-width: 760px) {
    .acs-app {
        min-height: 520px;
    }

    .acs-topbar {
        padding: 8px 10px 18px;
        gap: 8px;
    }

    .acs-brand img {
        width: 30px;
        height: 30px;
    }

    .acs-brand-text strong {
        font-size: 11px;
    }

    .acs-topmeta {
        font-size: 10px;
        margin-left: auto;
    }

    .acs-day,
    .acs-season {
        padding: 4px 7px;
    }

    .acs-topactions {
        gap: 3px;
    }

    .acs-iconbtn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .acs-speed button {
        min-width: 44px;
        min-height: 44px;
        padding: 0 6px;
        font-size: 10px;
    }

    .acs-only-mobile {
        display: inline-flex;
    }

    .acs-resourcebar {
        top: 66px;
        left: 8px;
        right: 8px;
        gap: 5px;
    }

    .acs-res {
        padding: 5px 8px;
        font-size: 10px;
    }

    .acs-res .acs-bar {
        width: 30px;
    }

    .acs-res-label {
        display: none;
    }

    .acs-eventbar {
        top: 104px;
        max-width: calc(100vw - 16px);
        padding: 7px 10px;
        font-size: 10px;
        gap: 6px;
    }

    .acs-eventbar #acsEventDesc {
        display: none;
    }

    .acs-warpanel {
        left: 8px;
        right: 8px;
        bottom: 140px;
        width: auto;
        padding: 8px 10px;
        gap: 5px;
    }

    .acs-objective b {
        font-size: 10px;
    }

    .acs-war-title {
        font-size: 9px;
    }

    .acs-btn--war {
        min-height: 40px;
        font-size: 10px;
    }

    .acs-sidebar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(88vw, 340px);
        max-height: none;
        border-radius: 0;
        border-top: 0;
        border-right: 0;
        border-bottom: 0;
        transform: translateX(105%);
        transition: transform 0.25s ease;
        z-index: 60;
        padding: 14px 14px calc(84px + env(safe-area-inset-bottom));
    }

    .acs-sidebar.is-open {
        transform: translateX(0);
    }

    .acs-sidebar-head h2 {
        font-size: 12px;
    }

    .acs-toolbar {
        bottom: 8px;
        max-width: calc(100vw - 12px);
        padding: 4px;
        gap: 1px;
    }

    .acs-tool {
        min-height: 46px;
        padding: 5px 8px;
        font-size: 9px;
        gap: 4px;
    }

    .acs-tool svg {
        width: 16px;
        height: 16px;
    }

    .acs-toolbar-sep {
        height: 24px;
    }

    .acs-zoombar .acs-iconbtn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .acs-focusbar {
        bottom: 82px;
    }

    .acs-focusbar button {
        min-height: 44px;
        padding: 4px 10px;
    }

    .acs-btn {
        min-height: 44px;
    }

    .acs-priority input[type="range"] {
        height: 34px;
    }

    .acs-buildpalette {
        bottom: 78px;
        max-height: 42vh;
    }

    .acs-palette-grid {
        grid-template-columns: 1fr;
    }

    .acs-inspector {
        left: 8px;
        right: 8px;
        bottom: 78px;
        width: auto;
        max-height: 34vh;
    }

    .acs-toasts {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: calc(246px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-height: 168px;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 6px;
        border: 1px solid rgba(232, 180, 90, 0.22);
        border-radius: 12px;
        background: linear-gradient(180deg, rgba(24, 18, 12, 0.84), rgba(15, 11, 8, 0.92));
        box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        pointer-events: none;
        scrollbar-width: thin;
    }

    .acs-toasts:empty {
        display: none;
    }

    .acs-toasts .acs-toast {
        background: rgba(255, 255, 255, 0.035);
        box-shadow: none;
        pointer-events: none;
        animation-name: acs-toast-in-up;
    }

    .acs-toasts .acs-toast.is-leaving {
        animation-name: acs-toast-out-down;
    }

    .acs-start {
        padding: 10px;
    }

    .acs-start-card {
        padding: 20px 16px 18px;
        border-radius: 18px;
    }

    .acs-mode-grid {
        grid-template-columns: 1fr;
    }

    .acs-mode-card {
        min-height: 76px;
    }

    .acs-modal-layer {
        align-items: flex-end;
        padding: 0;
    }

    .acs-modal {
        width: 100%;
        max-height: 90%;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .acs-modal-head {
        padding: 14px 14px 10px;
    }

    .acs-modal-body {
        padding: 12px 14px;
    }

    .acs-modal-actions {
        padding: 10px 14px 14px;
    }

    .acs-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-height: 780px) {
    .acs-start-logo img {
        width: 64px;
        height: 64px;
    }

    .acs-start-card {
        padding: 18px 20px 16px;
    }

    .acs-start-card h1 {
        font-size: clamp(1.8rem, 5vw, 2.6rem);
    }

    .acs-start-sub {
        margin-bottom: 12px;
    }

    .acs-mode-card {
        min-height: 76px;
    }

    .acs-start-note {
        display: none;
    }
}

@media (max-width: 520px) {
    .acs-brand-text {
        display: none;
    }
}

@media (max-width: 420px) {
    .acs-brand-text strong {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .acs-topmeta .acs-season {
        display: none;
    }

    .acs-tool span {
        display: none;
    }

    .acs-tool {
        width: 44px;
        justify-content: center;
        padding: 5px;
    }

    .acs-focusbar {
        bottom: 76px;
    }

    .acs-focusbar button {
        font-size: 8px;
        padding: 3px 7px;
    }
}

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

.acs-reduce-motion *,
.acs-reduce-motion *::before,
.acs-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

:focus-visible {
    outline: 2px solid #9fe0ff;
    outline-offset: 2px;
}

.game-guide {
    position: relative;
    z-index: 1;
}
