/* Clash of Farming 3.7.1 — Android Game Experience
   Final UI layer. Loaded after all feature styles so gameplay stays intact. */
:root {
    --ag-bg:#030908;
    --ag-bg-2:#071411;
    --ag-panel:#0b1b18;
    --ag-panel-2:#102823;
    --ag-panel-3:#16352d;
    --ag-line:rgba(207,255,228,.12);
    --ag-line-strong:rgba(244,210,119,.34);
    --ag-text:#f4fbf7;
    --ag-text-2:#b4c9c0;
    --ag-text-3:#748d84;
    --ag-mint:#63e1ad;
    --ag-mint-2:#b8f7d9;
    --ag-gold:#f5c85e;
    --ag-gold-2:#ffe7a6;
    --ag-blue:#71cdf4;
    --ag-red:#ff756c;
    --ag-radius:18px;
    --ag-radius-sm:12px;
    --ag-shadow:0 18px 50px rgba(0,0,0,.42);
    --ag-shadow-soft:0 9px 24px rgba(0,0,0,.28);
    --ag-top:66px;
    --ag-resource:66px;
    --ag-bottom:76px;
    --ag-vh:1vh;
    color-scheme:dark;
}

html {
    min-height:100%;
    background:var(--ag-bg);
    overscroll-behavior:none;
    -webkit-text-size-adjust:100%;
}
body {
    -webkit-tap-highlight-color:transparent;
    text-rendering:optimizeLegibility;
}
body.game-page {
    color:var(--ag-text);
    background:
        radial-gradient(circle at 8% -15%,rgba(99,225,173,.16),transparent 34rem),
        radial-gradient(circle at 96% 10%,rgba(245,200,94,.10),transparent 28rem),
        linear-gradient(180deg,#071713 0,#040b09 70%,#020706 100%);
}
body.game-page::before {
    content:"";
    position:fixed;
    inset:0;
    z-index:-1;
    pointer-events:none;
    background:
        linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),
        linear-gradient(90deg,rgba(255,255,255,.018) 1px,transparent 1px);
    background-size:28px 28px;
    mask-image:linear-gradient(180deg,#000,transparent 82%);
}

/* Reusable vector icons */
.ui-icon {
    width:1.45rem;
    height:1.45rem;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
    pointer-events:none;
}
.ui-icon.logo-icon { fill:currentColor; stroke:none; }

/* Android-like tactile controls */
.button,
.map-tool,
.text-button,
.nav-link,
.siege-mobile-nav > *,
.siege-more-grid > *,
button[class*="action"],
button[class*="toggle"] {
    position:relative;
    overflow:hidden;
    touch-action:manipulation;
}
.button {
    min-height:48px;
    padding:.72rem 1.05rem;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.10);
    color:var(--ag-text);
    font-size:.82rem;
    font-weight:900;
    letter-spacing:.01em;
    box-shadow:inset 0 1px rgba(255,255,255,.10),0 7px 16px rgba(0,0,0,.25);
    transform:translateZ(0);
}
.button.primary {
    color:#04120d;
    border-color:rgba(190,255,224,.4);
    background:linear-gradient(180deg,var(--ag-mint-2),var(--ag-mint));
    box-shadow:inset 0 1px rgba(255,255,255,.55),0 8px 20px rgba(44,201,143,.25),0 2px 0 #1b7655;
}
.button.secondary {
    color:#e9fff5;
    border-color:rgba(99,225,173,.25);
    background:linear-gradient(180deg,rgba(33,80,67,.96),rgba(13,42,34,.98));
}
.button.danger {
    color:#fff;
    border-color:rgba(255,170,164,.30);
    background:linear-gradient(180deg,#e66359,#a8322c);
    box-shadow:inset 0 1px rgba(255,255,255,.22),0 8px 20px rgba(188,50,43,.28),0 2px 0 #6c1d19;
}
.button:hover { text-decoration:none; transform:translateY(-1px); }
.button:active { transform:translateY(1px) scale(.985); box-shadow:inset 0 2px 6px rgba(0,0,0,.24); }
.button:disabled { filter:saturate(.45); opacity:.5; }
.ag-ripple {
    position:absolute;
    z-index:20;
    width:12px;
    height:12px;
    border-radius:999px;
    pointer-events:none;
    background:rgba(255,255,255,.30);
    transform:translate(-50%,-50%) scale(0);
    animation:agRipple .48s ease-out forwards;
}
@keyframes agRipple { to { opacity:0; transform:translate(-50%,-50%) scale(16); } }

/* Premium app bar */
.frontier-ui .topbar {
    top:0;
    min-height:var(--ag-top);
    padding:calc(.56rem + env(safe-area-inset-top)) max(.8rem,env(safe-area-inset-right)) .56rem max(.8rem,env(safe-area-inset-left));
    border-bottom:1px solid rgba(245,200,94,.20);
    background:
        linear-gradient(180deg,rgba(13,38,32,.985),rgba(4,17,14,.985)),
        linear-gradient(90deg,rgba(99,225,173,.08),transparent 42%,rgba(245,200,94,.06));
    box-shadow:0 10px 30px rgba(0,0,0,.42),inset 0 -1px rgba(255,255,255,.035);
    backdrop-filter:blur(22px) saturate(1.2);
    -webkit-backdrop-filter:blur(22px) saturate(1.2);
}
.frontier-ui .topbar::after {
    height:1px;
    bottom:0;
    background:linear-gradient(90deg,transparent,var(--ag-mint),var(--ag-gold),transparent);
    opacity:.48;
}
.frontier-brand { gap:.65rem; }
.frontier-brand .brand-emblem {
    width:46px;
    height:46px;
    color:var(--ag-gold-2);
    border:1px solid rgba(255,230,166,.38);
    border-radius:15px;
    background:linear-gradient(150deg,#1a493c,#092019 68%);
    box-shadow:inset 0 1px rgba(255,255,255,.13),0 8px 20px rgba(0,0,0,.32),0 0 22px rgba(245,200,94,.10);
}
.frontier-brand .brand-emblem .ui-icon { width:31px; height:31px; }
.frontier-brand strong { color:#fff7dc; font-size:1.02rem; }
.frontier-brand small { color:#87bca8; font-size:.56rem; letter-spacing:.17em; }
.frontier-ui .topbar-meta {
    min-width:0;
    gap:.42rem;
    scrollbar-width:none;
}
.frontier-ui .topbar-meta::-webkit-scrollbar { display:none; }
.frontier-ui .topbar-meta > span,
.frontier-ui .topbar-meta > button,
.frontier-ui .topbar-meta > form button {
    min-height:40px;
    border-radius:12px;
}
.frontier-ui .farm-name,
.frontier-ui .season-badge,
.frontier-ui .clan-tag,
.frontier-ui .command-power,
.frontier-ui .daily-command-link,
.frontier-ui .frontier-event-link,
.frontier-ui .online-commanders,
.frontier-ui .sound-toggle,
.frontier-ui .radio-topbar-toggle,
.frontier-ui .pwa-install-button,
.frontier-ui .admin-console-launch,
.frontier-ui .topbar-meta form .text-button {
    padding:.45rem .62rem;
    color:#dff7ed;
    text-decoration:none;
    border:1px solid rgba(255,255,255,.085);
    background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.025));
    box-shadow:inset 0 1px rgba(255,255,255,.055);
}
.frontier-ui .online-commanders i { background:var(--ag-mint); box-shadow:0 0 11px var(--ag-mint); }
.frontier-ui .commander-rank {
    min-width:9.8rem;
    min-height:46px;
    border-radius:14px;
    border-color:rgba(245,200,94,.24);
    background:linear-gradient(145deg,rgba(41,64,40,.96),rgba(9,34,28,.98));
}
.frontier-ui .command-power strong { color:var(--ag-gold-2); }

/* Resource HUD */
.frontier-ui .resource-bar {
    top:calc(var(--ag-top) + env(safe-area-inset-top));
    min-height:var(--ag-resource);
    grid-template-columns:repeat(8,minmax(116px,1fr));
    gap:.45rem;
    padding:.45rem clamp(.55rem,1.8vw,1.15rem);
    border-bottom:1px solid rgba(255,255,255,.06);
    background:linear-gradient(180deg,rgba(4,16,13,.98),rgba(5,22,18,.95));
    box-shadow:0 8px 22px rgba(0,0,0,.30);
}
.frontier-ui .resource-chip {
    min-height:54px;
    padding:.5rem .62rem .58rem;
    border:1px solid rgba(255,255,255,.09);
    border-radius:14px;
    background:linear-gradient(145deg,rgba(24,61,50,.98),rgba(9,30,24,.98));
    box-shadow:inset 0 1px rgba(255,255,255,.055),0 5px 13px rgba(0,0,0,.22);
}
.frontier-ui .resource-chip::after {
    inset:-45% -20% auto auto;
    width:75%;
    height:145%;
    background:radial-gradient(circle,rgba(255,255,255,.075),transparent 68%);
}
.frontier-ui .resource-chip .resource-emblem {
    width:36px;
    height:36px;
    border-radius:12px;
    font-size:1.3rem;
    background:linear-gradient(145deg,rgba(255,255,255,.14),rgba(0,0,0,.16));
}
.frontier-ui .resource-chip strong { font-size:.9rem; font-variant-numeric:tabular-nums; }
.frontier-ui .resource-chip small { font-size:.52rem; color:var(--ag-text-3); }
.resource-capacity-meter { height:3px; background:rgba(0,0,0,.38); }

/* Desktop/tablet navigation rail */
.frontier-ui .app-shell { grid-template-columns:92px minmax(0,1fr); }
.frontier-ui .sidebar {
    position:sticky;
    top:calc(var(--ag-top) + var(--ag-resource) + env(safe-area-inset-top));
    align-self:start;
    height:calc(100dvh - var(--ag-top) - var(--ag-resource) - env(safe-area-inset-top));
    padding:.7rem .5rem 1rem;
    border-right:1px solid rgba(255,255,255,.06);
    background:linear-gradient(180deg,rgba(7,28,23,.985),rgba(3,13,11,.99));
    box-shadow:8px 0 25px rgba(0,0,0,.28);
    overflow-y:auto;
    scrollbar-width:none;
}
.frontier-ui .sidebar::-webkit-scrollbar { display:none; }
.frontier-ui .nav-link {
    min-height:62px;
    margin:0 0 .36rem;
    padding:.46rem .3rem;
    display:grid;
    grid-template-rows:28px auto;
    place-items:center;
    gap:.18rem;
    color:#7f9b90;
    font-size:.59rem;
    font-weight:850;
    line-height:1.05;
    text-align:center;
    border:1px solid transparent;
    border-radius:16px;
}
.frontier-ui .nav-link .ui-icon { width:24px; height:24px; }
.frontier-ui .nav-link:hover {
    color:#dff9ee;
    transform:none;
    border-color:rgba(255,255,255,.08);
    background:rgba(255,255,255,.045);
}
.frontier-ui .nav-link.active {
    color:#06140f;
    border-color:rgba(189,255,224,.32);
    background:linear-gradient(180deg,var(--ag-mint-2),var(--ag-mint));
    box-shadow:inset 0 1px rgba(255,255,255,.55),0 7px 16px rgba(35,190,132,.20),0 2px 0 #1c7956;
}
.frontier-ui .nav-link.active::after {
    content:"";
    position:absolute;
    left:-.5rem;
    top:19px;
    width:3px;
    height:24px;
    border-radius:0 4px 4px 0;
    background:var(--ag-gold);
    box-shadow:0 0 12px var(--ag-gold);
}

/* Main game surface */
.frontier-ui .content {
    min-width:0;
    padding:clamp(.6rem,1.5vw,1.15rem);
    background:transparent;
}
.frontier-ui .content > section,
.frontier-ui .content > .panel,
.frontier-ui .content > .card-grid { max-width:1680px; margin-inline:auto; }
.frontier-ui .page-heading,
.frontier-map-heading,
.world-page-heading {
    margin-bottom:.75rem;
    padding:1rem 1.15rem;
    border:1px solid rgba(255,255,255,.075);
    border-radius:18px;
    color:var(--ag-text);
    background:linear-gradient(135deg,rgba(18,55,45,.94),rgba(7,24,20,.97));
    box-shadow:var(--ag-shadow-soft);
}
.frontier-ui .page-heading h1,
.frontier-map-heading h1,
.world-page-heading h1 { color:#fff7de; letter-spacing:-.035em; }
.frontier-ui .page-heading p,
.frontier-map-heading p,
.world-page-heading p { color:var(--ag-text-2); }
.frontier-ui .eyebrow { color:var(--ag-mint)!important; }
.frontier-ui .score-box {
    border:1px solid rgba(245,200,94,.22);
    border-radius:14px;
    background:linear-gradient(145deg,#403317,#151c17);
}

/* Cards and data pages */
.frontier-ui .panel,
.frontier-ui .game-card,
.frontier-ui .stat-card,
.frontier-ui .season-card,
.frontier-ui fieldset {
    color:var(--ag-text);
    border:1px solid rgba(255,255,255,.085);
    border-radius:var(--ag-radius);
    background:linear-gradient(150deg,rgba(17,47,39,.97),rgba(7,25,21,.98));
    box-shadow:var(--ag-shadow-soft);
}
.frontier-ui .panel { padding:1rem; }
.frontier-ui .panel-heading { padding-bottom:.72rem; border-bottom:1px solid rgba(255,255,255,.07); }
.frontier-ui .panel-heading h2 { color:#fff4d7; }
.frontier-ui .stat-card { min-height:82px; padding:.85rem; }
.frontier-ui .stat-card > span,
.frontier-ui .game-card-icon {
    color:#fff;
    border:1px solid rgba(255,255,255,.08);
    background:linear-gradient(145deg,rgba(99,225,173,.18),rgba(245,200,94,.08));
}
.frontier-ui .game-card { min-height:290px; overflow:hidden; }
.frontier-ui .game-card-body p,
.frontier-ui .muted,
.frontier-ui small { color:var(--ag-text-3); }
.frontier-ui table { color:var(--ag-text); border-color:rgba(255,255,255,.08); }
.frontier-ui th { color:#bfe7d5; background:rgba(255,255,255,.045); }
.frontier-ui td { border-color:rgba(255,255,255,.065); }
.frontier-ui table tbody tr:hover td { background:rgba(99,225,173,.06); }
.frontier-ui input,
.frontier-ui select,
.frontier-ui textarea {
    min-height:48px;
    color:var(--ag-text);
    border:1px solid rgba(255,255,255,.12);
    border-radius:13px;
    background:rgba(2,14,11,.72);
    box-shadow:inset 0 2px 5px rgba(0,0,0,.20);
}
.frontier-ui input:focus,
.frontier-ui select:focus,
.frontier-ui textarea:focus {
    border-color:var(--ag-mint);
    box-shadow:0 0 0 3px rgba(99,225,173,.14),inset 0 2px 5px rgba(0,0,0,.16);
}
.frontier-ui option { color:#eaf9f2; background:#10231e; }
.frontier-ui .cost-item { border-radius:8px; }

/* Alerts appear as game notifications */
.frontier-ui .content > .alert {
    position:sticky;
    z-index:150;
    top:.5rem;
    max-width:min(720px,calc(100vw - 2rem));
    margin:.25rem auto .75rem;
    padding:.82rem 1rem;
    color:#fff;
    border-radius:15px;
    box-shadow:0 14px 38px rgba(0,0,0,.38),inset 0 1px rgba(255,255,255,.10);
    backdrop-filter:blur(18px);
}
.frontier-ui .alert.success { border-color:rgba(99,225,173,.38); background:rgba(18,85,64,.94); }
.frontier-ui .alert.error { border-color:rgba(255,117,108,.45); background:rgba(122,39,34,.96); }

/* Command ticker: thin live-status strip instead of a large banner */
.frontier-command-ticker {
    min-height:56px;
    padding:.4rem clamp(.65rem,1.5vw,1rem);
    border-block-color:rgba(255,255,255,.06);
    background:linear-gradient(90deg,rgba(3,14,12,.98),rgba(10,37,31,.96),rgba(3,14,12,.98));
    box-shadow:0 7px 18px rgba(0,0,0,.28);
}
.command-avatar { width:42px; height:42px; border-radius:13px; }
.command-ticker-copy small { color:var(--ag-mint); }
.command-ticker-stats > span { min-width:66px; border-radius:11px; }

/* Main map frame — edge-to-edge, cinematic, but gameplay hit areas untouched */
.world-console,
.global-world-shell {
    border:1px solid rgba(255,255,255,.09)!important;
    border-radius:20px!important;
    background:#06110e!important;
    box-shadow:0 24px 64px rgba(0,0,0,.52),inset 0 1px rgba(255,255,255,.04)!important;
}
.world-console::before,
.global-world-shell::before {
    border-radius:inherit;
    opacity:.32;
}
.world-toolbar,
.global-world-toolbar {
    min-height:58px;
    padding:.46rem .62rem!important;
    gap:.42rem!important;
    border-bottom:1px solid rgba(255,255,255,.065)!important;
    background:linear-gradient(180deg,rgba(18,52,43,.985),rgba(5,23,19,.985))!important;
    box-shadow:0 8px 19px rgba(0,0,0,.28);
}
.world-toolbar .map-tool,
.global-world-toolbar .map-tool {
    min-height:43px;
    padding:.48rem .68rem!important;
    color:#a9c4b9!important;
    border:1px solid rgba(255,255,255,.085)!important;
    border-radius:12px!important;
    background:linear-gradient(180deg,rgba(255,255,255,.07),rgba(255,255,255,.025))!important;
    box-shadow:inset 0 1px rgba(255,255,255,.045);
}
.world-toolbar .map-tool.active,
.global-world-toolbar .map-tool.active,
.world-toolbar .map-tool:hover,
.global-world-toolbar .map-tool:hover {
    color:#06130e!important;
    border-color:rgba(189,255,224,.35)!important;
    background:linear-gradient(180deg,var(--ag-mint-2),var(--ag-mint))!important;
    box-shadow:0 7px 17px rgba(42,196,140,.21),0 2px 0 #1d7756!important;
}
.world-grid-layout { grid-template-columns:minmax(0,1fr) minmax(300px,340px); min-height:clamp(600px,72dvh,920px); }
.world-viewport,
.global-world-viewport {
    min-height:clamp(600px,72dvh,920px);
    background-color:#07130f!important;
    overscroll-behavior:contain;
}
.world-inspector,
.world-action-panel {
    color:var(--ag-text)!important;
    border-color:rgba(255,255,255,.07)!important;
    background:linear-gradient(180deg,#10241f,#071511)!important;
    box-shadow:-10px 0 30px rgba(0,0,0,.34)!important;
}
.frontier-ui .world-inspector::before { margin:-1rem -1rem .9rem; }
.world-action-empty h2,
.world-target-head h2 { color:#fff4d6!important; }
.world-target-head { border-bottom-color:rgba(255,255,255,.08)!important; }
.world-target-head > span {
    display:grid;
    place-items:center;
    width:54px;
    height:54px;
    border-radius:16px;
    background:linear-gradient(145deg,rgba(99,225,173,.18),rgba(245,200,94,.09));
}

/* Side action rails become floating game controls */
.siege-task-rail > *,
.siege-action-rail > * {
    width:58px;
    min-height:58px;
    color:#dff7ed;
    border:1px solid rgba(255,255,255,.11);
    border-radius:17px;
    background:linear-gradient(145deg,rgba(20,58,48,.97),rgba(5,20,17,.98));
    box-shadow:0 9px 22px rgba(0,0,0,.38),inset 0 1px rgba(255,255,255,.07);
}
.siege-task-rail > *:active,
.siege-action-rail > *:active { transform:scale(.96); }
.siege-alert-strip {
    border-radius:12px;
    background:rgba(4,18,15,.90);
    backdrop-filter:blur(14px);
}

/* Dialogs / bottom sheets */
.construction-center-backdrop,
.fortification-dialog::before,
.map-command-dialog::before { background:rgba(0,6,5,.72); backdrop-filter:blur(8px); }
.construction-center-dialog,
.fortification-command-card,
.map-command-card,
.admin-cheat-dialog,
.admin-update-dialog {
    color:var(--ag-text);
    border:1px solid rgba(255,255,255,.11)!important;
    border-radius:22px!important;
    background:linear-gradient(155deg,#122b25,#06130f 72%)!important;
    box-shadow:0 30px 100px rgba(0,0,0,.62)!important;
}
.construction-center-head,
.fortification-command-head {
    color:#fff;
    background:linear-gradient(135deg,#1b5c49,#0a2a22)!important;
}
.construction-center-toolbar,
.construction-center-list,
.fortification-components,
.fortification-overview { color:var(--ag-text); background:transparent!important; border-color:rgba(255,255,255,.07)!important; }
.construction-center-card,
.fortification-component {
    color:var(--ag-text);
    border-color:rgba(255,255,255,.09)!important;
    background:rgba(255,255,255,.038)!important;
}
.construction-center-job-title strong,
.construction-center-timer time,
.fortification-component-copy h3 { color:#effff8!important; }

/* Bottom navigation — Android game dock */
.siege-mobile-nav { display:none; }
.siege-more-panel {
    color:var(--ag-text);
    background:linear-gradient(155deg,#15362e,#05110e 72%);
}
.siege-more-grid > * {
    color:#ebfff6;
    border-color:rgba(255,255,255,.09);
    border-radius:16px;
    background:linear-gradient(145deg,rgba(255,255,255,.065),rgba(255,255,255,.025));
}
.siege-more-grid .ui-icon { grid-row:1/3; width:26px; height:26px; color:var(--ag-mint); }

/* Landing and security screens */
body.landing-page,
body.install-page {
    color:var(--ag-text);
    background:
        radial-gradient(circle at 72% 12%,rgba(245,200,94,.18),transparent 27rem),
        radial-gradient(circle at 8% 85%,rgba(99,225,173,.20),transparent 32rem),
        linear-gradient(135deg,#04100d,#0d3127 54%,#261f0e);
}
.landing-shell { max-width:1320px; }
.hero-panel { position:relative; }
.hero-panel::before {
    content:"";
    position:absolute;
    z-index:-1;
    inset:-12% -8% -8%;
    border-radius:50%;
    background:radial-gradient(circle,rgba(99,225,173,.10),transparent 65%);
}
.brand-large .brand-emblem {
    display:grid;
    place-items:center;
    width:62px;
    height:62px;
    color:var(--ag-gold-2);
    border:1px solid rgba(255,230,166,.34);
    border-radius:20px;
    background:linear-gradient(145deg,#215747,#09221b);
    box-shadow:0 14px 35px rgba(0,0,0,.30);
}
.brand-large .brand-emblem .ui-icon { width:42px; height:42px; }
.landing-page .hero-panel h1 { max-width:840px; font-size:clamp(3rem,7vw,6.3rem); }
.landing-page .hero-panel > p { max-width:760px; color:#c1d8cf; }
.landing-page .feature-row span {
    min-height:42px;
    display:inline-flex;
    align-items:center;
    border-radius:13px;
    border-color:rgba(255,255,255,.10);
    background:rgba(255,255,255,.055);
}
.auth-card {
    color:#effaf5;
    border:1px solid rgba(255,255,255,.12)!important;
    border-radius:24px!important;
    background:linear-gradient(155deg,rgba(20,58,48,.985),rgba(4,18,15,.985))!important;
    box-shadow:0 30px 90px rgba(0,0,0,.46)!important;
}
.auth-tabs { background:rgba(0,0,0,.25); }
.auth-tab { min-height:45px; color:#829f94; }
.auth-tab.active { color:#06130e; background:linear-gradient(180deg,var(--ag-mint-2),var(--ag-mint)); box-shadow:0 5px 14px rgba(27,184,126,.22); }
.auth-card input,
.auth-card select,
.auth-card textarea {
    min-height:50px;
    color:#f2fff9;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(0,0,0,.24);
}
.auth-card label { color:#d6e9e1; }
.legal-note { color:#779087; }
.farm-illustration { filter:drop-shadow(0 14px 16px rgba(0,0,0,.34)); }

.footer {
    color:#617a71!important;
    border-top-color:rgba(255,255,255,.055)!important;
    background:#030a08!important;
}

/* Mobile phones and small Android tablets */
@media (max-width:900px) {
    :root { --ag-top:58px; --ag-resource:58px; --ag-bottom:76px; }
    body.game-page { padding-bottom:calc(var(--ag-bottom) + env(safe-area-inset-bottom)); }
    .frontier-ui .topbar {
        min-height:var(--ag-top);
        padding:calc(.38rem + env(safe-area-inset-top)) max(.5rem,env(safe-area-inset-right)) .38rem max(.5rem,env(safe-area-inset-left));
    }
    .frontier-brand .brand-emblem { width:42px; height:42px; border-radius:13px; }
    .frontier-brand .brand-emblem .ui-icon { width:28px; height:28px; }
    .frontier-brand strong { max-width:34vw; overflow:hidden; font-size:.86rem; text-overflow:ellipsis; white-space:nowrap; }
    .frontier-brand small { display:none; }
    .frontier-ui .topbar-meta { flex:1 1 auto; justify-content:flex-end; overflow:visible; }
    .frontier-ui .topbar-meta > * { display:none!important; }
    .frontier-ui .topbar-meta .commander-rank,
    .frontier-ui .topbar-meta .sound-toggle,
    .frontier-ui .topbar-meta .radio-topbar-toggle { display:flex!important; }
    .frontier-ui .topbar-meta .commander-rank { min-width:0; width:44px; padding:.35rem; grid-template-columns:1fr; place-items:center; }
    .frontier-ui .topbar-meta .commander-rank > span { display:none; }
    .frontier-ui .topbar-meta .commander-rank > i { margin:0; }
    .frontier-ui .sound-toggle,
    .frontier-ui .radio-topbar-toggle { width:42px; min-width:42px; padding:0!important; display:grid!important; place-items:center; font-size:0; }
    .frontier-ui .sound-toggle .ui-icon,
    .frontier-ui .radio-topbar-toggle .ui-icon { width:21px; height:21px; font-size:initial; }
    .frontier-ui .radio-topbar-toggle span { display:none; }

    .frontier-ui .resource-bar {
        top:calc(var(--ag-top) + env(safe-area-inset-top));
        min-height:var(--ag-resource);
        display:flex;
        gap:.36rem;
        padding:.34rem max(.4rem,env(safe-area-inset-right)) .34rem max(.4rem,env(safe-area-inset-left));
        overflow-x:auto;
        scroll-snap-type:x proximity;
        scrollbar-width:none;
    }
    .frontier-ui .resource-bar::-webkit-scrollbar { display:none; }
    .frontier-ui .resource-chip {
        flex:0 0 104px!important;
        min-height:50px;
        padding:.35rem .42rem;
        scroll-snap-align:start;
        border-radius:12px;
    }
    .frontier-ui .resource-chip .resource-emblem { width:31px; height:31px; font-size:1.05rem; }
    .frontier-ui .resource-chip strong { font-size:.73rem; }
    .frontier-ui .resource-chip small { font-size:.45rem; }

    .frontier-ui .app-shell { display:block; }
    .frontier-ui .sidebar { display:none!important; }
    .frontier-ui .content { padding:.45rem .42rem .65rem!important; }
    .frontier-ui .content > section,
    .frontier-ui .content > .panel,
    .frontier-ui .content > .card-grid { margin-inline:0; }
    .frontier-command-ticker { min-height:50px; padding:.3rem .45rem; }
    .command-avatar { width:39px; height:39px; }
    .command-ticker-copy small { font-size:.48rem; }
    .command-ticker-copy strong { font-size:.73rem; }
    .command-ticker-copy span { font-size:.57rem; }
    .command-ticker-stats { display:none; }

    .page-map .frontier-map-heading,
    .page-world .world-page-heading,
    .frontier-ui .page-heading {
        margin-bottom:.42rem;
        padding:.62rem .72rem!important;
        border-radius:14px;
    }
    .page-map .frontier-map-heading h1,
    .page-world .world-page-heading h1,
    .frontier-ui .page-heading h1 { font-size:1.25rem!important; }
    .page-map .frontier-map-heading p:not(.eyebrow),
    .page-world .world-page-heading p:not(.eyebrow),
    .frontier-ui .page-heading p:not(.eyebrow) { display:none; }

    .world-console,
    .global-world-shell { border-radius:16px!important; }
    .world-toolbar,
    .global-world-toolbar { min-height:52px; overflow-x:auto; scrollbar-width:none; }
    .world-toolbar::-webkit-scrollbar,
    .global-world-toolbar::-webkit-scrollbar { display:none; }
    .world-toolbar .map-tool,
    .global-world-toolbar .map-tool { flex:0 0 auto; min-height:42px; padding:.42rem .58rem!important; font-size:.62rem!important; }
    .world-grid-layout { display:block; min-height:0; }
    .world-viewport,
    .global-world-viewport {
        min-height:calc((var(--ag-vh) * 100) - var(--ag-top) - var(--ag-resource) - var(--ag-bottom) - 116px)!important;
        height:calc((var(--ag-vh) * 100) - var(--ag-top) - var(--ag-resource) - var(--ag-bottom) - 116px)!important;
        max-height:720px;
    }
    .world-inspector {
        min-height:0;
        max-height:42dvh;
        border-left:0!important;
        border-top:1px solid rgba(255,255,255,.08)!important;
        box-shadow:0 -12px 32px rgba(0,0,0,.30)!important;
    }
    .global-world-shell .world-action-panel {
        z-index:6200;
        max-height:min(84dvh,760px);
        border-radius:24px 24px 0 0!important;
        padding:12px max(14px,env(safe-area-inset-right)) calc(18px + var(--ag-bottom) + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));
    }
    .siege-task-rail { left:.3rem; }
    .siege-action-rail { right:.3rem; }
    .siege-task-rail > *,
    .siege-action-rail > * { width:48px; min-height:48px; border-radius:14px; }
    .siege-task-rail small,
    .siege-action-rail small { display:none; }
    .siege-alert-strip { bottom:.35rem; max-width:calc(100% - 110px); }

    .siege-mobile-nav {
        position:fixed;
        z-index:6500;
        left:max(.42rem,env(safe-area-inset-left));
        right:max(.42rem,env(safe-area-inset-right));
        bottom:max(.38rem,env(safe-area-inset-bottom));
        display:grid;
        grid-template-columns:repeat(5,minmax(0,1fr));
        min-height:68px;
        padding:.32rem;
        border:1px solid rgba(255,255,255,.11);
        border-radius:22px;
        background:linear-gradient(180deg,rgba(17,45,38,.97),rgba(4,16,13,.985));
        box-shadow:0 16px 45px rgba(0,0,0,.55),inset 0 1px rgba(255,255,255,.075);
        backdrop-filter:blur(22px) saturate(1.25);
        -webkit-backdrop-filter:blur(22px) saturate(1.25);
    }
    .siege-mobile-nav > * {
        min-height:58px;
        gap:.18rem;
        color:#718c82;
        border:0;
        border-radius:16px;
        background:transparent;
    }
    .siege-mobile-nav > *::before { display:none; }
    .siege-mobile-nav .ui-icon { width:24px; height:24px; }
    .siege-mobile-nav small { font-size:.5rem; font-weight:900; letter-spacing:.02em; }
    .siege-mobile-nav > *.active {
        color:#06140f;
        background:linear-gradient(180deg,var(--ag-mint-2),var(--ag-mint));
        box-shadow:inset 0 1px rgba(255,255,255,.55),0 5px 13px rgba(31,187,131,.18),0 2px 0 #1b7654;
    }
    .siege-mobile-nav > *:nth-child(3) {
        margin-top:-17px;
        min-height:68px;
        color:#211906;
        border:4px solid #071813;
        border-radius:21px;
        background:linear-gradient(180deg,var(--ag-gold-2),var(--ag-gold));
        box-shadow:inset 0 1px rgba(255,255,255,.58),0 10px 24px rgba(245,200,94,.28),0 3px 0 #977326;
    }
    .siege-mobile-nav > *:nth-child(3) .ui-icon { width:27px; height:27px; }
    .siege-mobile-nav b { right:10%; top:1px; }

    .siege-more-drawer.is-open { z-index:7200; }
    .siege-more-panel {
        border-radius:26px 26px 0 0;
        padding:1rem max(.85rem,env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) max(.85rem,env(safe-area-inset-left));
    }
    .siege-more-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .siege-more-grid > * {
        min-height:88px;
        padding:.65rem .4rem;
        display:grid;
        grid-template-columns:1fr;
        grid-template-rows:29px auto auto;
        place-items:center;
        gap:.12rem;
        text-align:center;
    }
    .siege-more-grid .ui-icon { grid-row:auto; width:25px; height:25px; }
    .siege-more-grid strong { font-size:.67rem; }
    .siege-more-grid small { font-size:.5rem; }

    .construction-center,
    .fortification-dialog,
    .map-command-dialog { align-items:end!important; padding:0!important; }
    .construction-center-dialog,
    .fortification-command-card,
    .map-command-card {
        width:100%!important;
        max-height:90dvh!important;
        border-radius:25px 25px 0 0!important;
        border-bottom:0!important;
    }
    .construction-center-head,
    .fortification-command-head { padding:.85rem 1rem; }

    .frontier-ui .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; }
    .frontier-ui .card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem; }
    .frontier-ui .game-card { min-height:0; }
    .frontier-ui .game-card-icon { min-height:74px; font-size:2.5rem; }
    .frontier-ui .game-card-body { padding:.75rem; }
    .frontier-ui .overview-grid,
    .frontier-ui .two-column { grid-template-columns:1fr; }

    .footer { display:none!important; }
}

@media (max-width:560px) {
    .frontier-ui .topbar-meta .radio-topbar-toggle { display:none!important; }
    .frontier-ui .resource-chip { flex-basis:96px!important; }
    .world-viewport,
    .global-world-viewport {
        min-height:max(360px,calc((var(--ag-vh) * 100) - var(--ag-top) - var(--ag-resource) - var(--ag-bottom) - 104px))!important;
        height:max(360px,calc((var(--ag-vh) * 100) - var(--ag-top) - var(--ag-resource) - var(--ag-bottom) - 104px))!important;
    }
    .siege-more-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:.45rem; }
    .frontier-ui .card-grid { grid-template-columns:1fr; }
    .landing-shell { width:min(100% - 1rem,1180px); padding:1rem 0 2rem; }
    .hero-panel { padding:1rem .35rem 0; }
    .landing-page .hero-panel h1 { font-size:clamp(2.5rem,15vw,4.2rem); }
    .auth-card { padding:1.15rem; }
}

/* Compact landscape game mode */
@media (max-width:980px) and (orientation:landscape) and (max-height:620px) {
    :root { --ag-top:52px; --ag-resource:52px; --ag-bottom:66px; }
    .frontier-ui .topbar { min-height:var(--ag-top); }
    .frontier-brand .brand-emblem { width:38px; height:38px; }
    .frontier-ui .resource-chip { min-height:44px; }
    .frontier-command-ticker,
    .page-map .frontier-map-heading,
    .page-world .world-page-heading { display:none!important; }
    .frontier-ui .content { padding:.28rem!important; }
    .world-viewport,
    .global-world-viewport {
        min-height:calc((var(--ag-vh) * 100) - var(--ag-top) - var(--ag-resource) - 8px)!important;
        height:calc((var(--ag-vh) * 100) - var(--ag-top) - var(--ag-resource) - 8px)!important;
    }
    .siege-mobile-nav {
        left:auto;
        right:max(.3rem,env(safe-area-inset-right));
        bottom:max(.3rem,env(safe-area-inset-bottom));
        width:min(420px,62vw);
        min-height:60px;
        border-radius:18px;
    }
    .siege-mobile-nav > * { min-height:50px; }
    .siege-mobile-nav > *:nth-child(3) { min-height:60px; margin-top:-12px; }
}

@media (min-width:1500px) {
    .frontier-ui .app-shell { grid-template-columns:104px minmax(0,1fr); }
    .frontier-ui .nav-link { min-height:66px; }
    .world-grid-layout { grid-template-columns:minmax(0,1fr) 360px; }
}

@media (hover:none) {
    .button:hover,
    .frontier-ui .nav-link:hover,
    .frontier-ui .resource-chip:hover,
    .frontier-ui .game-card:hover,
    .frontier-ui .stat-card:hover { transform:none; }
}

@media (prefers-reduced-motion:reduce) {
    .ag-ripple { display:none!important; }
    *,*::before,*::after { scroll-behavior:auto!important; }
}

.sr-only {
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    padding:0!important;
    margin:-1px!important;
    overflow:hidden!important;
    clip:rect(0,0,0,0)!important;
    white-space:nowrap!important;
    border:0!important;
}
.ag-pressed { transform:translateY(1px) scale(.985)!important; }
