/* PERIMETER unified UI contract — 2026-08-30.42
   Global contract owns page shell/chrome and baseline controls.
   Route CSS is intentionally later and owns route-specific composition.
   The final chrome layer only reasserts explicitly marked shared chrome. */
@layer reset, tokens, base, components, route, chrome, utilities;

@layer tokens {
  :root{
    color-scheme:dark;
    --ui-page-max:700px;
    --ui-edge:4px;
    --ui-gap:6px;
    --ui-control-h:34px;
    --ui-control-small:28px;
    --ui-local-header-h:34px;
    --ui-status-h:20px;
    --ui-nav-h:40px;
    --ui-radius:4px;
    --ui-bg:#040606;
    --ui-bg-2:#070a08;
    --ui-surface:#080b09;
    --ui-surface-2:#0d120f;
    --ui-surface-active:#141912;
    --ui-line:#20261f;
    --ui-line-strong:#30362f;
    --ui-text:#a8aca2;
    --ui-strong:#d0cec0;
    --ui-muted:#6d736b;
    --ui-accent:#a5aa5d;
    --ui-accent-2:#85894a;
    --ui-good:#768b50;
    --ui-warning:#a86b39;
    --ui-danger:#a96359;
    --ui-info:#5f8992;
    --ui-focus:rgba(165,170,93,.72);
    --ui-font:Arial,Helvetica,sans-serif;
    --ui-sans:var(--ui-font);
    --ui-mono:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;

    /* Canonical typography scale. Smartphones use the same readable tiers as desktop. */
    --ui-font-micro:11px;
    --ui-font-secondary:12px;
    --ui-font-base:13px;
    --ui-font-name:14px;
    --ui-font-section:15px;
    --ui-font-page:16px;
    --ui-font-display:18px;
    --ui-line-compact:1.15;
    --ui-line-base:1.35;
    --ui-line-reading:1.5;
    --map-source-width:2976px;
    --map-source-height:1984px;

    /* Compatibility aliases for migrated route styles. */
    --ui-bg-primary:var(--ui-bg);--ui-bg-secondary:var(--ui-bg-2);--ui-bg-elevated:var(--ui-surface-2);
    --ui-border:var(--ui-line-strong);--ui-border-active:#596142;
    --ui-text-primary:var(--ui-strong);--ui-text-secondary:var(--ui-text);--ui-text-muted:var(--ui-muted);
    --ui-accent-primary:var(--ui-accent);--ui-accent-secondary:var(--ui-accent-2);
    --ui-success:var(--ui-good);--ui-error:var(--ui-danger);
    --ui-radius-sm:3px;--ui-radius-md:4px;--ui-radius-lg:6px;--ui-radius-xl:8px;--ui-radius-full:999px;
    --project-page-width:var(--ui-page-max);--project-gap:8px;--project-control-height:40px;
    --ui-local-header-height:var(--ui-local-header-h);

    --bg:var(--ui-bg);--bg0:var(--ui-bg);--bg2:var(--ui-bg-2);--bg-deep:var(--ui-bg);
    --surface:var(--ui-surface);--surface2:var(--ui-surface-2);--surface-raised:var(--ui-surface-2);--surface-active:var(--ui-surface-active);
    --panel:var(--ui-surface);--panel2:var(--ui-surface-2);--panel-2:var(--ui-surface-2);--field:var(--ui-bg-2);
    --border:var(--ui-line-strong);--border-soft:var(--ui-line);--line:var(--ui-line);--line-hi:var(--ui-line-strong);
    --text:var(--ui-text);--strong:var(--ui-strong);--muted:var(--ui-muted);
    --accent:var(--ui-accent);--accent2:var(--ui-accent-2);--accent-bright:#c0c67c;--accent-dark:#686d3d;
    --good:var(--ui-good);--success:var(--ui-good);--warning:var(--ui-warning);--danger:var(--ui-danger);
    --radius:var(--ui-radius);
    --perimeter-page-width:var(--ui-page-max);--perimeter-ui-max:var(--ui-page-max);--perimeter-ui-gap:8px;
    --perimeter-ui-border:var(--ui-line-strong);--perimeter-page-radius:var(--ui-radius);
    --perimeter-page-nav-height:var(--ui-local-header-h);--perimeter-page-nav-control:var(--ui-control-small);
    --perimeter-local-control:var(--ui-control-small);--perimeter-status-height:var(--ui-status-h);
    --perimeter-status-icon-size:18px;--perimeter-game-nav-height:var(--ui-nav-h);--perimeter-game-nav-control-height:var(--ui-control-small);
  }
}

/* V818 — the secondary command menu must remain above page content instead of
   being clipped by the shared header's legacy overflow contract.  The long
   divider belongs to the page-title cell; it deliberately stops before the
   hamburger cell. */
@layer chrome {
  body[data-ui-theme] .perimeter-global-header:has(.perimeter-secondary-game-location){
    position:relative!important;
    z-index:1000!important;
    isolation:isolate!important;
    overflow:visible!important;
  }
  body[data-ui-theme] .perimeter-secondary-game-location{
    border-bottom:0!important;
  }
  body[data-ui-theme] .perimeter-secondary-game-location::after{
    content:""!important;
    display:block!important;
    position:absolute!important;
    left:0!important;
    right:39px!important;
    bottom:0!important;
    height:1px!important;
    pointer-events:none!important;
    background:color-mix(in srgb,var(--ui-strong) 45%,var(--ui-bg) 55%)!important;
  }
  body[data-ui-theme] .perimeter-secondary-game-location .perimeter-secondary-game-menu{
    z-index:1001!important;
  }
}

/* Legacy pages such as sector inspection render the shared header themselves.
   Keep their actual component geometry independent from the page bootstrap so
   it is pixel-identical to the GAME header. */
html body .perimeter-global-header .perimeter-status-bar{
  box-sizing:border-box!important;height:24px!important;min-height:24px!important;max-height:24px!important;
  padding:0 5px!important;overflow:hidden!important;
}
html body .perimeter-global-header .perimeter-status-item{
  height:23px!important;min-height:23px!important;
}
html body .perimeter-global-header .perimeter-secondary-game-location{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  position:relative!important;z-index:150!important;isolation:isolate!important;
  box-sizing:border-box!important;width:100%!important;min-width:0!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0 0 0 10px!important;gap:0!important;overflow:visible!important;
  border:0!important;border-bottom:1px solid color-mix(in srgb,var(--ui-strong) 45%,var(--ui-bg) 55%)!important;
  background:var(--ui-bg-2)!important;background-image:none!important;box-shadow:none!important;
}
html body .perimeter-global-header .perimeter-secondary-game-location .location-main{
  display:flex!important;align-items:center!important;flex:1 1 auto!important;min-width:0!important;max-width:calc(100% - 39px)!important;
  height:100%!important;gap:5px!important;margin:0!important;padding:0!important;overflow:hidden!important;white-space:nowrap!important;
}
html body .perimeter-global-header .perimeter-secondary-game-location .game-menu-toggle{
  display:grid!important;place-items:center!important;flex:0 0 39px!important;
  position:relative!important;box-sizing:border-box!important;width:39px!important;min-width:39px!important;max-width:39px!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0!important;gap:0!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;
  border-radius:0!important;background:var(--ui-bg-2)!important;color:var(--ui-strong)!important;font-size:0!important;line-height:0!important;
  box-shadow:inset 1px 0 color-mix(in srgb,var(--ui-strong) 42%,var(--ui-bg))!important;
}
html body .perimeter-global-header .perimeter-secondary-game-location .game-menu-toggle svg{
  position:absolute!important;inset:0!important;display:block!important;width:24px!important;height:24px!important;margin:auto!important;
  fill:none!important;stroke:currentColor!important;stroke-width:2!important;stroke-linecap:square!important;transform:none!important;
}

/* V795 — one GAME shell for all player pages.  Every route keeps the same
   700px geometry, while the old per-page title/back/home strip is removed in
   favour of the shared hamburger command header. */
@layer chrome {
  body[data-ui-theme]:not([data-admin-ui="1"]) > main.project-root{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:700px!important;
    min-width:0!important;
    margin:0 auto!important;
  }

  /* Ordinary pages follow their content height. GAME has its own map layout
     and is deliberately excluded. */
  body[data-ui-theme]:not(:has(> main.game)){
    min-height:0;
    display:block;
  }
  body[data-ui-theme]:not(:has(> main.game)) > main.project-root{
    flex:none;
  }
  body[data-ui-theme]:not(:has(> main.game)) > .perimeter-global-footer{
    flex:none;
    margin-top:var(--ui-gap);
  }
  body[data-ui-theme]:not([data-admin-ui="1"]) > main.project-root > .perimeter-global-header,
  body[data-ui-theme]:not([data-admin-ui="1"]) > main.project-root > .perimeter-global-footer{
    width:100%!important;max-width:100%!important;margin-inline:0!important;
  }
  /* V797: legacy per-page headers stay out of flow; their title is promoted
     into the single shared command bar below the resource strip. */
  body[data-ui-theme]:not([data-admin-ui="1"]) .project-root:not(.game) .ui-local-header[data-page-local-header="1"]{
    display:none!important;
  }
  @media(max-width:700px){
    body[data-ui-theme]:not([data-admin-ui="1"]) > main.project-root{width:100%!important;margin:0 auto!important}
  }
}

@layer reset {
  *,*::before,*::after{box-sizing:border-box}
  html,body{margin:0;padding:0;min-width:280px;max-width:100%;overflow-x:hidden}
  /* GAME does not reserve a desktop scrollbar gutter. Apply the same viewport
     width to every player page, so opening another route never shifts the
     common 700px shell horizontally. Scrolling itself remains available. */
  html{width:100%;background:var(--ui-bg);overflow-y:auto;scrollbar-gutter:auto;scrollbar-width:none}
  html::-webkit-scrollbar{display:none;width:0;height:0}
  img,svg,video,canvas{max-width:100%}
  button,input,select,textarea{font:inherit;color:inherit}
}

@layer base {
  body{width:100%;min-width:280px;max-width:none;margin:0;background:var(--ui-bg);color:var(--ui-text);font:var(--ui-font-base)/1.42 var(--ui-font);-webkit-text-size-adjust:100%}
  .project-root{width:100%;max-width:700px;min-width:0;margin:0 auto}
  a{color:var(--ui-accent);text-decoration:none}
  a:hover{color:#c0c67c}
  a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--ui-focus);outline-offset:2px}
  h1,h2,h3,h4,p{margin-top:0}h1,h2,h3,h4{color:var(--ui-strong)}
  h1{font-size:var(--ui-font-page)}h2{font-size:var(--ui-font-section)}h3{font-size:var(--ui-font-name)}h4{font-size:var(--ui-font-base)}
  small{font-size:var(--ui-font-secondary)}
}

/* Opt-in low-memory profile. V503: visuals may be simplified, gameplay markers never disappear. */
@layer utilities {
  body[data-performance-mode="lite"] .map-weather-layer{display:none!important}
  body[data-performance-mode="lite"] .map-photo{filter:none!important;transition:none!important}
  body[data-performance-mode="lite"] .map *,
  body[data-performance-mode="lite"] .game *{animation:none!important;transition-duration:0.01ms!important}
}

@layer components {
  /* Baseline controls only. Route CSS may refine layout and dimensions. */
  :where(button,.btn,.ui-btn,input[type="submit"],input[type="button"],input[type="reset"],a.btn,a.ui-btn){
    min-width:0;min-height:var(--ui-control-h);padding:6px 10px;border:1px solid var(--ui-line-strong);border-radius:var(--ui-radius);background:var(--ui-surface-2);color:var(--ui-strong);font-weight:700;text-decoration:none;box-shadow:none;cursor:pointer;touch-action:manipulation;white-space:nowrap;font-size:var(--ui-font-base);line-height:1.2
  }
  :where(button,.btn,.ui-btn,input[type="submit"],input[type="button"],input[type="reset"],a.btn,a.ui-btn):is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}
  :where(button,input,select,textarea):disabled{opacity:.48;cursor:not-allowed}
  :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){min-width:0;padding:7px 9px;border:1px solid var(--ui-line-strong);border-radius:var(--ui-radius);background:var(--ui-bg-2);color:var(--ui-strong);box-shadow:none;font-size:var(--ui-font-base);line-height:1.25}
  textarea{resize:vertical}

  /* Fallback semantics for routes that intentionally have no dedicated component CSS. */
  .runtime-notice,.runtime-alert,.notice,.alert{border-left:2px solid var(--ui-info);border-bottom:1px solid var(--ui-line);background:var(--ui-surface);color:var(--ui-text)}
  .runtime-alert.success,.runtime-notice.ok{border-left-color:var(--ui-good)}
  .runtime-alert.error,.runtime-notice.error{border-left-color:var(--ui-danger)}
  table,.runtime-table{max-width:100%;border-collapse:collapse}
  .table-wrap,[class*="scroll-wrap"]{max-width:100%;overflow-x:auto}

  /* Shared PDA/page primitives. These are geometry primitives only; route CSS
     owns each screen's content composition. No page-level framed cards. */
  .pda-page{background:transparent;color:var(--ui-text);font-size:var(--ui-font-base);line-height:1.42}
  .pda-page :where(summary){list-style:none}
  .pda-page :where(summary)::-webkit-details-marker{display:none}
  .pda-page :where(.pda-divider,.pda-toolbar,.pda-section-title,.faction-section-title){
    min-height:36px;margin:0;padding:7px 10px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;background:var(--ui-surface);color:var(--ui-strong);box-shadow:none
  }
  .pda-page :where(.pda-divider,.pda-toolbar,.pda-section-title,.faction-section-title){display:flex;align-items:center;justify-content:space-between;gap:10px}
  .pda-page :where(.pda-divider,.pda-toolbar,.pda-section-title,.faction-section-title)>:first-child{min-width:0}
  .pda-page :where(.note,.pda-notice,.faction-alert,.pda-rating-alert){margin:0;padding:10px 12px;border:0;border-bottom:1px solid var(--ui-line);border-left:3px solid var(--ui-info);border-radius:0;background:var(--ui-surface);color:var(--ui-text);font-size:var(--ui-font-secondary)}
  .pda-page :where(.note.success,.faction-alert.success){border-left-color:var(--ui-good)}
  .pda-page :where(.note.error,.faction-alert.error,.pda-rating-alert){border-left-color:var(--ui-danger)}
  .pda-page :where(.empty,.pda-user-empty,.pda-quest-empty,.faction-empty,.pda-rating-empty,.pda-profile-empty){
    display:grid;place-items:center;gap:5px;min-height:84px;margin:0;padding:18px 12px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;background:transparent;color:var(--ui-muted);text-align:center
  }
  .pda-page :where(.empty,.pda-user-empty,.pda-quest-empty,.faction-empty,.pda-rating-empty,.pda-profile-empty) b,
  .pda-page :where(.empty,.pda-user-empty,.pda-quest-empty,.faction-empty,.pda-rating-empty,.pda-profile-empty) strong{color:var(--ui-strong);font-size:var(--ui-font-base)}
  .pda-page .pda-avatar{position:relative;display:block;flex:0 0 auto;width:46px;height:46px;overflow:hidden;background:var(--ui-surface)}
  .pda-page .pda-avatar>img{display:block;width:100%;height:100%;object-fit:cover}
  .pda-page .pda-presence{position:absolute;right:2px;bottom:2px;width:9px;height:9px;border:1px solid var(--ui-bg);border-radius:50%;background:var(--ui-muted)}
  .pda-page .pda-presence.online{background:var(--ui-good)}
  .pda-page .chev{color:var(--ui-muted);font:24px/1 var(--ui-font)}

  /* One segmented-tab language for quests, lists, profile and account-like views. */
  .pda-page :where(.pda-quest-tabs,.pda-user-tabs,.pda-profile-tabs){display:grid;margin:0;border:0;border-bottom:1px solid var(--ui-line);background:var(--ui-bg-2)}
  .pda-page :where(.pda-quest-tab,.pda-user-tab,.pda-profile-tab){
    display:flex;align-items:center;justify-content:center;gap:6px;min-width:0;min-height:42px;margin:0;padding:7px 8px;border:0;border-right:1px solid var(--ui-line);border-radius:0;background:transparent;color:var(--ui-text);font-size:var(--ui-font-base);font-weight:800;line-height:1.15;text-decoration:none;box-shadow:none
  }
  .pda-page :where(.pda-quest-tab,.pda-user-tab,.pda-profile-tab):last-child{border-right:0}
  .pda-page :where(.pda-quest-tab,.pda-user-tab,.pda-profile-tab).active{background:var(--ui-surface-active);color:var(--ui-accent);box-shadow:inset 0 -2px var(--ui-accent)}
  .pda-page :where(.pda-quest-tab,.pda-user-tab,.pda-profile-tab):is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}

  /* Shared PDA popup action menu. The runtime portals row menus to <body>,
     so this belongs to the global component contract instead of one route. */
  .pda-square-menu-toggle,.pda-row-menu-toggle,.pda-stalker-menu-toggle{touch-action:manipulation}
  body .pda-popup-menu{position:fixed;z-index:10050;display:grid;gap:0;min-width:170px;max-width:min(280px,calc(100vw - 10px));padding:0;border:1px solid var(--ui-line-strong);border-radius:0;background:var(--ui-bg-2);box-shadow:0 8px 28px rgba(0,0,0,.42)}
  body .pda-popup-menu[hidden]{display:none}
  body .pda-popup-menu .pda-row-menu-form{display:grid;margin:0}
  body .pda-popup-menu :where(.pda-row-menu-action,.pda-stalker-menu-action){display:flex;align-items:center;justify-content:flex-start;gap:7px;width:100%;min-height:40px;margin:0;padding:8px 10px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;background:transparent;color:var(--ui-text);font-size:var(--ui-font-base);font-weight:800;line-height:1.2;text-align:left;text-decoration:none;text-transform:uppercase;box-shadow:none;white-space:nowrap}
  body .pda-popup-menu :where(.pda-row-menu-action,.pda-stalker-menu-action):last-child{border-bottom:0}
  body .pda-popup-menu :where(.pda-row-menu-action,.pda-stalker-menu-action):is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}
  body .pda-popup-menu :where(.pda-row-menu-action,.pda-stalker-menu-action).accent{color:var(--ui-accent)}
  body .pda-popup-menu :where(.pda-row-menu-action,.pda-stalker-menu-action).danger{color:#c58a82}
  body .pda-popup-menu svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}

  @media(max-width:430px){
    .pda-page{font-size:var(--ui-font-base)}
    .pda-page :where(.pda-quest-tab,.pda-user-tab,.pda-profile-tab){font-size:var(--ui-font-base);padding-inline:5px}
  }
}

@layer chrome {
  /* Page shell: never render the whole route as a framed card. */
  .project-root:not(.toast){
    width:100%;max-width:700px;min-width:0;margin:0 auto;
    border:0;border-radius:0;outline:0;box-shadow:none
  }

  /* One global status/header contract. */
  .perimeter-global-header{display:flex;flex-direction:column;width:100%;min-width:0;margin:0;padding:0;border:0;border-radius:0;background:var(--ui-bg-2);box-shadow:none;overflow:hidden}
  .perimeter-global-header::before,.perimeter-global-header::after{content:none}
  /* XP progress is a thin line inside the unified XP row, which precedes vitals in V734. */
  .perimeter-exp-strip{position:relative;display:block;flex:none;width:100%;height:3px;min-height:3px;margin:0;padding:0;overflow:hidden;background:color-mix(in srgb,var(--ui-accent) 15%,var(--ui-bg-2));border:0;border-radius:0}
  .perimeter-exp-strip[hidden]{display:none}
  .perimeter-exp-strip__fill{position:absolute;left:0;top:0;bottom:0;display:block;max-width:100%;height:100%;background:var(--ui-accent);box-shadow:none;transition:width .2s ease-out}
  @media(prefers-reduced-motion:reduce){.perimeter-exp-strip__fill{transition:none}}
  .perimeter-status-bar{image-rendering:-webkit-optimize-contrast;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;width:100%;height:var(--ui-status-h);min-height:var(--ui-status-h);margin:0;padding:0 5px;border:0;border-radius:0;background:var(--ui-bg-2);background-image:none;overflow:hidden}
  /* V694: optional text XP row. It is independent from the 3px strip and wallet. */
  .perimeter-exp-text{display:flex;justify-content:center;align-items:center;align-content:center;flex-wrap:wrap;column-gap:8px;row-gap:2px;box-sizing:border-box;width:100%;min-height:23px;margin:0;padding:3px 8px;overflow-wrap:anywhere;background:var(--ui-bg-2);border-bottom:1px solid var(--ui-line-strong);color:var(--ui-strong);font:700 12px/1.3 var(--ui-mono);letter-spacing:.035em;text-align:center}
  .perimeter-exp-text[hidden]{display:none}
  .perimeter-exp-text__level,.perimeter-exp-text__value{white-space:normal}
  .perimeter-exp-text__level{flex:none;color:var(--ui-muted)}
  .perimeter-exp-text__separator{flex:none;color:var(--ui-accent)}
  .perimeter-exp-text__separator[hidden]{display:none}
  @media(max-width:360px){.perimeter-exp-text{font-size:11px;column-gap:5px;padding-inline:4px}}

  /* V734: XP text and progress share one compact row ABOVE vitals.
     Respect the two existing independent settings: text-only and bar-only
     must remain usable without adding an empty line. */
  .perimeter-exp-compact{position:relative;display:block;width:100%;min-width:0;margin:0;padding:0;background:var(--ui-bg-2);border:0;border-bottom:1px solid var(--ui-line-strong)}
  .perimeter-exp-compact--has-text .perimeter-exp-text{display:flex;align-items:center;justify-content:center;flex-wrap:nowrap;gap:6px;box-sizing:border-box;min-height:19px;max-height:19px;padding:1px 5px 3px;margin:0;border:0;white-space:nowrap;overflow:hidden;font-size:11px;line-height:1.2;letter-spacing:0}
  .perimeter-exp-compact--has-text .perimeter-exp-text__level,.perimeter-exp-compact--has-text .perimeter-exp-text__value{white-space:nowrap}
  .perimeter-exp-compact--has-text .perimeter-exp-text__level{flex-shrink:0}
  .perimeter-exp-compact--has-text .perimeter-exp-text__value{min-width:0;overflow:hidden;text-overflow:ellipsis}
  .perimeter-exp-compact--has-text .perimeter-exp-strip{position:absolute;left:0;right:0;bottom:0;z-index:1;width:100%;height:2px;min-height:2px;pointer-events:none}
  .perimeter-exp-compact--bar-only{height:3px;min-height:3px;border-bottom:0;overflow:hidden}
  .perimeter-exp-compact--bar-only .perimeter-exp-strip{height:3px;min-height:3px}
  @media(max-width:360px){.perimeter-exp-compact--has-text .perimeter-exp-text{font-size:10px;gap:4px;padding-inline:3px}}
  .perimeter-wallet-strip{display:flex;align-items:center;justify-content:center;width:100%;height:18px;min-height:18px;margin:0;padding:0 6px;gap:7px;box-sizing:border-box;overflow:hidden;white-space:nowrap;background:var(--ui-bg-2);border:0;border-bottom:1px solid var(--ui-line-strong);color:var(--ui-muted);font:700 10px/1 var(--ui-mono);letter-spacing:.025em}
  .perimeter-wallet-strip span{display:inline-flex;align-items:center;min-width:0;gap:4px}
  .perimeter-wallet-strip b{color:var(--ui-strong);font:800 11px/1 var(--ui-mono);letter-spacing:0}
  .perimeter-wallet-strip__sep{color:var(--ui-line-strong);font-weight:900}
  .perimeter-status-item{display:flex;align-items:center;justify-content:center;gap:4px;min-width:0;height:100%;margin:0;padding:0 2px;border:0;background:transparent;white-space:nowrap}
  .perimeter-status-icon{display:block;width:18px;height:18px;min-width:18px;min-height:18px;max-width:18px;max-height:18px;object-fit:contain}
  .perimeter-status-value{color:var(--ui-strong);font:800 var(--ui-font-base)/1 var(--ui-font);white-space:nowrap}

  .perimeter-game-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;width:100%;height:31.2px;min-height:31.2px;margin:0;padding:0;gap:0;border:0;border-radius:0;background:transparent}
  .perimeter-game-nav>a{image-rendering:-webkit-optimize-contrast;display:flex;align-items:center;justify-content:center;min-width:0;height:31.2px;min-height:31.2px;margin:0;padding:0 6px;border:0;border-radius:0;background-color:transparent;background-image:none;color:var(--ui-text);font:700 var(--ui-font-base)/1 var(--ui-mono);letter-spacing:.02em;box-shadow:none;overflow:hidden}
  .perimeter-game-nav>a:is(:hover,:focus-visible,.active){color:var(--ui-accent);filter:brightness(1.12)}
  .perimeter-nav-with-device{gap:5px}.perimeter-nav-device-state{font:700 var(--ui-font-micro)/1 var(--ui-mono);color:var(--ui-muted)}
  .perimeter-gamepad-icon{width:20px;height:20px;min-width:20px;min-height:20px;max-width:20px;max-height:20px;display:block;object-fit:contain;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;image-rendering:pixelated}



  /* GAME uses the same global status/header contract as every authenticated route. */

  /* Only elements explicitly marked as the page-local header participate here. */
  .ui-local-header[data-page-local-header="1"]{
    display:grid;grid-template-columns:minmax(40px,auto) minmax(0,1fr) minmax(40px,auto);align-items:center;width:100%;min-width:0;height:var(--ui-local-header-h);min-height:var(--ui-local-header-h);max-height:var(--ui-local-header-h);margin:0;padding:0;border:0;border-top:1px solid var(--ui-line-strong);border-bottom:1px solid var(--ui-line-strong);border-radius:0;background:var(--ui-surface);box-shadow:0 1px 7px color-mix(in srgb,var(--ui-accent) 7%,transparent),inset 0 -1px 0 color-mix(in srgb,var(--ui-accent) 12%,transparent);overflow:visible
  }
  .ui-local-header[data-page-local-header="1"] > *{min-width:0}
  .ui-local-header[data-page-local-header="1"] :is(.title,.heading,.section-heading,.page-title,.account-pda-title){padding:0 8px;color:var(--ui-strong);font:800 var(--ui-font-name)/1.2 var(--ui-mono);letter-spacing:.03em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}
  .ui-local-header[data-page-local-header="1"] > h1{min-width:0;margin:0;padding:0 8px;color:var(--ui-strong);font:800 var(--ui-font-name)/1.2 var(--ui-mono);letter-spacing:.03em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}
  .ui-local-header[data-page-local-header="1"] :is(.top-title,.topbar-title){min-width:0;padding:0 8px;display:grid;gap:1px;align-content:center}
  .ui-local-header[data-page-local-header="1"] :is(.top-title,.topbar-title)>strong{min-width:0;color:var(--ui-strong);font:800 var(--ui-font-name)/1.15 var(--ui-mono);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ui-local-header[data-page-local-header="1"] :is(.top-title,.topbar-title)>span{min-width:0;color:var(--ui-muted);font-size:var(--ui-font-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  /* Page-local headers always use the same readable page-title tier, even when old route CSS has legacy sizes. */
  .ui-local-header[data-page-local-header="1"] :is(.title,.heading,.section-heading,.page-title,.account-pda-title),
  .ui-local-header[data-page-local-header="1"] > h1,
  .ui-local-header[data-page-local-header="1"] :is(.top-title,.topbar-title)>strong{font-size:var(--ui-font-page) !important}
  .ui-local-header[data-page-local-header="1"] :is(.back,.section-back,.chat-back,.account-pda-back,.game-link,a.game,.account-pda-game,.icon-btn,.admin-menu-button,.look-refresh){
    box-sizing:border-box;position:relative;display:grid;place-items:center;width:var(--ui-control-small);min-width:var(--ui-control-small);max-width:var(--ui-control-small);height:var(--ui-control-small);min-height:var(--ui-control-small);max-height:var(--ui-control-small);margin:0 6px;padding:0;border:0;border-radius:0;background:transparent;color:var(--ui-text);text-decoration:none;box-shadow:none;transform:none
  }
  .ui-local-header[data-page-local-header="1"] :is(.back,.section-back,.chat-back,.account-pda-back,.admin-menu-button):first-child{justify-self:start;border-right:1px solid var(--ui-line-strong)}
  .ui-local-header[data-page-local-header="1"] :is(.game-link,a.game,.account-pda-game,.icon-btn,.look-refresh):last-child{justify-self:end;border-left:1px solid var(--ui-line-strong);color:var(--ui-accent)}
  .ui-local-header[data-page-local-header="1"] :is(.back,.section-back,.chat-back,.account-pda-back,.game-link,a.game,.account-pda-game,.icon-btn,.admin-menu-button,.look-refresh):is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}
  .ui-local-header[data-page-local-header="1"] > a:first-child:not(.top-new-topic){box-sizing:border-box;display:grid;place-items:center;width:var(--ui-control-small);min-width:var(--ui-control-small);max-width:var(--ui-control-small);height:var(--ui-control-small);min-height:var(--ui-control-small);max-height:var(--ui-control-small);margin:0 6px;padding:0;border:0;border-right:1px solid var(--ui-line-strong);border-radius:0;background:transparent;color:var(--ui-text);text-decoration:none;box-shadow:none;justify-self:start}
  .ui-local-header[data-page-local-header="1"] > a:first-child:not(.top-new-topic):is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}
  .ui-local-header[data-page-local-header="1"] > .top-new-topic{justify-self:end;height:var(--ui-control-small);min-height:var(--ui-control-small);margin:0 6px;padding:0 8px;border:0;border-left:1px solid var(--ui-line-strong);border-radius:0;background:transparent;color:var(--ui-accent);display:flex;align-items:center;white-space:nowrap;box-shadow:none}
  .ui-local-header[data-page-local-header="1"] .search-toggle{justify-self:end;width:auto;max-width:min(42vw,170px);height:var(--ui-control-small);min-height:var(--ui-control-small);margin:0 6px;padding:0 8px;border:0;border-left:1px solid var(--ui-line-strong);border-radius:0;background:transparent;color:var(--ui-accent);box-shadow:none;font-size:var(--ui-font-name);font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .ui-local-header[data-page-local-header="1"] .search-toggle:is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}
  .ui-local-header[data-page-local-header="1"] :is(.back,.section-back,.chat-back,.account-pda-back,.game-link,a.game,.account-pda-game,.icon-btn,.admin-menu-button,.look-refresh)>svg{display:block;width:17px;height:17px;min-width:17px;min-height:17px;max-width:17px;max-height:17px;fill:none;stroke:currentColor;stroke-width:1.8;overflow:visible}
  .ui-back-icon{display:block;width:17px;height:17px;min-width:17px;min-height:17px;max-width:17px;max-height:17px;fill:none;stroke:currentColor;overflow:visible}
  .perimeter-gamepad-icon{display:block;width:20px;height:20px;min-width:20px;min-height:20px;max-width:20px;max-height:20px;object-fit:contain;flex:none;overflow:hidden}

  /* Shared footer is an open block separated from page content by one line. */
  .perimeter-global-footer{width:100%;max-width:700px;margin:var(--ui-gap) auto 0;padding:10px 8px;border:0;border-top:1px solid var(--ui-line);border-radius:0;background:transparent;color:var(--ui-muted);font:var(--ui-font-secondary)/1.35 var(--ui-mono);text-align:center;box-shadow:none}
  .perimeter-footer-links,.perimeter-footer-runtime,.perimeter-footer-social{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px 10px}.perimeter-footer-links a{display:inline-flex;align-items:center;min-height:22px;color:var(--ui-text);text-decoration:none}.perimeter-footer-links a:is(:hover,:focus-visible){color:var(--ui-accent)}.perimeter-footer-runtime{margin-top:6px}.perimeter-footer-brand{margin-top:5px;font-size:var(--ui-font-secondary)}
  .perimeter-footer-social{margin-top:8px;padding-top:8px;border-top:1px solid var(--ui-line);gap:8px 16px}
  .perimeter-footer-social-link{display:inline-flex;align-items:center;justify-content:center;min-width:0;min-height:28px;padding:0;color:var(--ui-accent);text-decoration:none;white-space:nowrap}
  .perimeter-footer-social-link:is(:hover,:focus-visible){opacity:.9}
  .perimeter-footer-vk-image{display:block;width:auto;height:30px;max-height:30px;max-width:190px;object-fit:contain}
  .perimeter-footer-social-link--lolka img{display:block;width:auto;height:25px;max-height:25px;max-width:120px;object-fit:contain}
  @media(max-width:700px){
    .perimeter-global-footer{font-size:var(--ui-font-secondary)}
    .perimeter-footer-links{gap:5px 9px}
    .perimeter-footer-social{margin-top:7px;padding-top:7px;gap:7px 12px}
    .perimeter-footer-vk-image{height:28px;max-height:28px;max-width:172px}
    .perimeter-footer-social-link--lolka img{height:23px;max-height:23px;max-width:108px}
  }


  /* Desktop-only artwork for the empty side areas around the 700px UI.
     Real <img> nodes are rendered directly under <body>; the canonical 700px
     interface is raised above them. Mobile widths never render the side artwork. */
  .perimeter-desktop-backdrop-layer{display:none}
  @media (min-width:1024px){
    body[data-desktop-backdrop-enabled="1"]{position:relative;min-height:100vh;background:var(--ui-bg)}
    body[data-desktop-backdrop-enabled="1"]>.perimeter-desktop-backdrop-layer{
      display:block;position:fixed;inset:0;z-index:1;overflow:hidden;pointer-events:none;user-select:none;background:transparent
    }
    body[data-desktop-backdrop-enabled="1"]>.perimeter-desktop-backdrop-layer .perimeter-desktop-backdrop-side{
      position:fixed;top:0;bottom:0;display:block;width:min(418px,calc((100vw - var(--ui-page-max))/2));min-width:0;height:100vh;max-width:418px;max-height:none;margin:0;padding:0;border:0;object-fit:cover;object-position:center center;pointer-events:none;user-select:none;-webkit-user-drag:none;opacity:1;visibility:visible
    }
    body[data-desktop-backdrop-enabled="1"]>.perimeter-desktop-backdrop-layer .perimeter-desktop-backdrop-side--left{left:auto;right:calc(50% + (var(--ui-page-max)/2));-webkit-mask-image:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.16) 12%,#000 38%,#000 100%);mask-image:linear-gradient(90deg,transparent 0%,rgba(0,0,0,.16) 12%,#000 38%,#000 100%)}
    body[data-desktop-backdrop-enabled="1"]>.perimeter-desktop-backdrop-layer .perimeter-desktop-backdrop-side--right{right:auto;left:calc(50% + (var(--ui-page-max)/2));-webkit-mask-image:linear-gradient(90deg,#000 0%,#000 62%,rgba(0,0,0,.16) 88%,transparent 100%);mask-image:linear-gradient(90deg,#000 0%,#000 62%,rgba(0,0,0,.16) 88%,transparent 100%)}
    body[data-desktop-backdrop-enabled="1"]> :not(.perimeter-desktop-backdrop-layer):not(.trade-modal):not(.stash-modal){position:relative;z-index:2}
    body[data-desktop-backdrop-enabled="1"]>footer.perimeter-global-footer{z-index:1}
    body[data-desktop-backdrop-enabled="1"] .project-root:not(.toast){background:#000}
  }
}

@layer utilities {
  .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}
  @media(max-width:700px){:root{--ui-edge:3px;--ui-gap:5px;--ui-control-h:32px;--ui-status-h:20px}.project-root{width:100%;max-width:700px;margin:0 auto}.perimeter-status-bar{height:20px;min-height:20px;max-height:20px}.perimeter-status-icon{width:18px;height:18px;min-width:18px;min-height:18px;max-width:18px;max-height:18px}.perimeter-status-value{font-size:var(--ui-font-base)}.perimeter-wallet-strip{height:17px;min-height:17px;font-size:9px;gap:6px;padding-inline:4px}.perimeter-wallet-strip b{font-size:10px}}
  @media(max-width:360px){.perimeter-game-nav>a{padding-inline:3px;font-size:var(--ui-font-base)}.perimeter-status-item{gap:2px}.perimeter-status-value{font-size:var(--ui-font-base)}}
}


/* UI contract 35 — canonical themes, CSS-only surfaces and restrained gloss. */
@layer tokens {
  body[data-ui-theme="dark"]{
    --ui-bg:#070808;--ui-bg-2:#090a09;--ui-surface:#0d0e0d;--ui-surface-2:#11120f;--ui-surface-active:#171912;
    --ui-line:#24251f;--ui-line-strong:#39382e;--ui-text:#b7b09d;--ui-strong:#d5ccb2;--ui-muted:#77756b;
    --ui-accent:#aaa06f;--ui-accent-2:#77704f;--ui-good:#939b67;--ui-warning:#b18b57;--ui-danger:#b96960;--ui-info:#668894;
    --ui-focus:rgba(170,160,111,.72);--ui-gloss:rgba(255,255,255,.035);--ui-gloss-strong:rgba(255,255,255,.06);--ui-shadow:rgba(0,0,0,.55)
  }
  body[data-ui-theme="pda-green"]{
    --ui-bg:#030805;--ui-bg-2:#050d07;--ui-surface:#08140b;--ui-surface-2:#0b1b0f;--ui-surface-active:#122819;
    --ui-line:#1b3822;--ui-line-strong:#315b39;--ui-text:#9fbea5;--ui-strong:#cae0c9;--ui-muted:#617a67;
    --ui-accent:#9fbd5f;--ui-accent-2:#6e9448;--ui-good:#86ad5c;--ui-warning:#bca25c;--ui-danger:#b56a5f;--ui-info:#5e9aa0;
    --ui-focus:rgba(159,189,95,.72);--ui-gloss:rgba(193,235,174,.04);--ui-gloss-strong:rgba(193,235,174,.075);--ui-shadow:rgba(0,0,0,.60)
  }
  body[data-ui-theme="industrial-amber"]{
    --ui-bg:#060806;--ui-bg-2:#090c08;--ui-surface:#0d120d;--ui-surface-2:#111710;--ui-surface-active:#171d14;
    --ui-line:#293127;--ui-line-strong:#4d5847;--ui-text:#aeb5aa;--ui-strong:#d1d9c7;--ui-muted:#737c71;
    --ui-accent:#a5aa5d;--ui-accent-2:#778253;--ui-good:#7f9a64;--ui-warning:#b09d63;--ui-danger:#a96359;--ui-info:#668994;
    --ui-focus:rgba(165,170,93,.72);--ui-gloss:rgba(223,226,191,.032);--ui-gloss-strong:rgba(223,226,191,.062);--ui-shadow:rgba(0,0,0,.6)
  }
  body[data-ui-theme="electro-breeze"]{
    --ui-bg:#03070c;--ui-bg-2:#050b12;--ui-surface:#08121c;--ui-surface-2:#0b1825;--ui-surface-active:#102337;
    --ui-line:#1b3346;--ui-line-strong:#315b76;--ui-text:#9eb9c9;--ui-strong:#d0e8f4;--ui-muted:#647f90;
    --ui-accent:#6bbde7;--ui-accent-2:#438eb9;--ui-good:#69a998;--ui-warning:#c29a5c;--ui-danger:#bb6c6c;--ui-info:#70c9ee;
    --ui-focus:rgba(107,189,231,.75);--ui-gloss:rgba(165,220,250,.04);--ui-gloss-strong:rgba(165,220,250,.075);--ui-shadow:rgba(0,0,0,.62)
  }
  body[data-ui-theme="grayscale"]{
    --ui-bg:#050505;--ui-bg-2:#080808;--ui-surface:#0d0d0d;--ui-surface-2:#121212;--ui-surface-active:#1a1a1a;
    --ui-line:#242424;--ui-line-strong:#414141;--ui-text:#ababab;--ui-strong:#dddddd;--ui-muted:#727272;
    --ui-accent:#c8c8c8;--ui-accent-2:#8f8f8f;--ui-good:#a9b2a3;--ui-warning:#b6a98c;--ui-danger:#aa7777;--ui-info:#8fa6b0;
    --ui-focus:rgba(205,205,205,.65);--ui-gloss:rgba(255,255,255,.025);--ui-gloss-strong:rgba(255,255,255,.05);--ui-shadow:rgba(0,0,0,.66)
  }
  body[data-ui-theme="new-year-night"]{
    --ui-bg:#03070d;--ui-bg-2:#050b13;--ui-surface:#08131e;--ui-surface-2:#0d1a28;--ui-surface-active:#14293b;
    --ui-line:#1e3b50;--ui-line-strong:#35657c;--ui-text:#a8c3d0;--ui-strong:#e4f4f7;--ui-muted:#6e8a98;
    --ui-accent:#9edff0;--ui-accent-2:#66a9c4;--ui-good:#8fc9a8;--ui-warning:#d1bd78;--ui-danger:#be7277;--ui-info:#82d2eb;
    --ui-focus:rgba(158,223,240,.74);--ui-gloss:rgba(226,247,255,.05);--ui-gloss-strong:rgba(226,247,255,.09);--ui-shadow:rgba(0,0,0,.64)
  }
  body[data-ui-theme="summer-breeze"]{
    --ui-bg:#040a08;--ui-bg-2:#07100d;--ui-surface:#0b1712;--ui-surface-2:#102019;--ui-surface-active:#172c22;
    --ui-line:#254337;--ui-line-strong:#3f6655;--ui-text:#a8c0b3;--ui-strong:#d7e6d9;--ui-muted:#6d8578;
    --ui-accent:#86b989;--ui-accent-2:#5e936d;--ui-good:#79b279;--ui-warning:#c5ae69;--ui-danger:#b66d62;--ui-info:#6fa7a8;
    --ui-focus:rgba(134,185,137,.72);--ui-gloss:rgba(204,238,208,.036);--ui-gloss-strong:rgba(204,238,208,.07);--ui-shadow:rgba(0,0,0,.58)
  }
  body[data-ui-theme="autumn-time"]{
    --ui-bg:#090604;--ui-bg-2:#0f0a06;--ui-surface:#171008;--ui-surface-2:#20160c;--ui-surface-active:#2b1d10;
    --ui-line:#46311f;--ui-line-strong:#6b4b2c;--ui-text:#c0aa91;--ui-strong:#ead5b7;--ui-muted:#89725e;
    --ui-accent:#c78b49;--ui-accent-2:#9c6534;--ui-good:#8f9c63;--ui-warning:#d09a50;--ui-danger:#b8614f;--ui-info:#748f94;
    --ui-focus:rgba(199,139,73,.72);--ui-gloss:rgba(244,199,143,.036);--ui-gloss-strong:rgba(244,199,143,.07);--ui-shadow:rgba(0,0,0,.62)
  }
}

@layer base {
  body[data-ui-theme]{background:radial-gradient(circle at 50% 0,color-mix(in srgb,var(--ui-surface-active) 48%,var(--ui-bg)) 0,var(--ui-bg-2) 30%,var(--ui-bg) 74%);color:var(--ui-text)}
  /* 90% is retained only as a legacy DB/session value and is intentionally clamped to 100%. */
  body[data-ui-font-scale="90"],body[data-ui-font-scale="100"]{font-size:var(--ui-font-base)}
  body[data-ui-font-scale="110"]{--ui-font-micro:12px;--ui-font-secondary:13px;--ui-font-base:14px;--ui-font-name:15px;--ui-font-section:16px;--ui-font-page:18px;--ui-font-display:20px;font-size:var(--ui-font-base)}
  body[data-ui-font-scale="120"]{--ui-font-micro:13px;--ui-font-secondary:14px;--ui-font-base:15px;--ui-font-name:16px;--ui-font-section:18px;--ui-font-page:20px;--ui-font-display:22px;font-size:var(--ui-font-base)}
  body[data-ui-font-scale="125"]{--ui-font-micro:14px;--ui-font-secondary:15px;--ui-font-base:16px;--ui-font-name:18px;--ui-font-section:20px;--ui-font-page:22px;--ui-font-display:24px;font-size:var(--ui-font-base)}

  /* V190 — real-device correction: the old V177 70% mobile tier was too small.
     Smartphones now keep a compact but readable ~90% typography tier.
     Geometry, touch targets and icons keep their approved sizes; only text tiers change. */
  @media(max-width:560px){
    :root{--ui-font-micro:10px;--ui-font-secondary:11px;--ui-font-base:12px;--ui-font-name:13px;--ui-font-section:14px;--ui-font-page:15px;--ui-font-display:17px}
    body[data-ui-font-scale="90"],body[data-ui-font-scale="100"]{--ui-font-micro:10px;--ui-font-secondary:11px;--ui-font-base:12px;--ui-font-name:13px;--ui-font-section:14px;--ui-font-page:15px;--ui-font-display:17px;font-size:var(--ui-font-base)}
    body[data-ui-font-scale="110"]{--ui-font-micro:11px;--ui-font-secondary:12px;--ui-font-base:13px;--ui-font-name:14px;--ui-font-section:15px;--ui-font-page:17px;--ui-font-display:19px;font-size:var(--ui-font-base)}
    body[data-ui-font-scale="120"]{--ui-font-micro:12px;--ui-font-secondary:13px;--ui-font-base:14px;--ui-font-name:15px;--ui-font-section:17px;--ui-font-page:19px;--ui-font-display:21px;font-size:var(--ui-font-base)}
    body[data-ui-font-scale="125"]{--ui-font-micro:13px;--ui-font-secondary:14px;--ui-font-base:15px;--ui-font-name:17px;--ui-font-section:19px;--ui-font-page:21px;--ui-font-display:23px;font-size:var(--ui-font-base)}
  }

  body[data-ui-reduce-motion="1"] *,body[data-ui-reduce-motion="1"] *::before,body[data-ui-reduce-motion="1"] *::after{scroll-behavior:auto;transition-duration:.001ms;animation-duration:.001ms;animation-iteration-count:1}
}

@layer components {
  body[data-ui-theme] :where(button,.btn,.ui-btn,input[type="submit"],input[type="button"],input[type="reset"],a.btn,a.ui-btn){
    border-color:var(--ui-line-strong);background:linear-gradient(180deg,var(--ui-gloss-strong),transparent 45%),linear-gradient(180deg,var(--ui-surface-2),var(--ui-bg-2));color:var(--ui-strong);box-shadow:inset 0 1px var(--ui-gloss),0 1px 0 var(--ui-shadow)
  }
  body[data-ui-theme] :where(button,.btn,.ui-btn,input[type="submit"],input[type="button"],input[type="reset"],a.btn,a.ui-btn):is(:hover,:focus-visible){background:linear-gradient(180deg,var(--ui-gloss-strong),transparent 48%),var(--ui-surface-active);border-color:color-mix(in srgb,var(--ui-accent) 45%,var(--ui-line-strong));color:var(--ui-accent)}
  body[data-ui-theme] :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background:linear-gradient(180deg,var(--ui-gloss),transparent 42%),var(--ui-bg-2);border-color:var(--ui-line-strong);color:var(--ui-strong);box-shadow:inset 0 1px rgba(255,255,255,.018)}
  body[data-ui-theme] :where(.pda-divider,.pda-toolbar,.pda-section-title,.faction-section-title,.collapsible-heading){background:linear-gradient(180deg,var(--ui-gloss),transparent 55%),var(--ui-surface);border-bottom-color:var(--ui-line)}
}

@layer chrome {
  body[data-ui-theme] .perimeter-global-header{background:var(--ui-bg-2);border:0;box-shadow:inset 0 1px var(--ui-gloss)}
  body[data-ui-theme] .perimeter-status-bar{background:linear-gradient(180deg,var(--ui-gloss),transparent 55%),var(--ui-bg-2);border:0;border-bottom:1px solid var(--ui-line-strong)}
  body[data-ui-theme] .perimeter-exp-text{background:linear-gradient(180deg,var(--ui-gloss),transparent 60%),var(--ui-bg-2)}
  body[data-ui-theme] .perimeter-wallet-strip{background:linear-gradient(180deg,var(--ui-gloss),transparent 60%),var(--ui-bg-2);border-bottom:1px solid var(--ui-line-strong)}
  body[data-ui-theme] .perimeter-game-nav{background:var(--ui-surface);border-bottom:1px solid var(--ui-line-strong);box-shadow:inset 0 1px var(--ui-gloss)}
  body[data-ui-theme] .perimeter-game-nav>a{background:linear-gradient(180deg,var(--ui-gloss),transparent 50%),var(--ui-surface);background-image:linear-gradient(180deg,var(--ui-gloss),transparent 50%);border-right:1px solid var(--ui-line);color:var(--ui-text);box-shadow:inset 0 1px rgba(255,255,255,.018)}
  body[data-ui-theme] .perimeter-game-nav>a:last-child{border-right:0}
  body[data-ui-theme] .perimeter-game-nav>a:is(:hover,:focus-visible,.active){background:linear-gradient(180deg,var(--ui-gloss-strong),transparent 48%),var(--ui-surface-active);color:var(--ui-accent)}
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"]{background:linear-gradient(180deg,var(--ui-gloss),transparent 52%),var(--ui-surface);border:0;border-bottom:1px solid var(--ui-line-strong);box-shadow:inset 0 1px var(--ui-gloss)}
  body[data-ui-theme] .perimeter-global-header + *{border-top:0 !important}
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] + *{border-top:0 !important}
  body[data-ui-theme] .perimeter-global-footer{border-top-color:var(--ui-line);color:var(--ui-muted)}

  /* One back button for the whole project. Visible/clickable size: 20x20px. */
  :is(a.ui-back-button,a.back,a.section-back,a.chat-back,a.account-pda-back,a[aria-label^="Назад"],a[title^="Назад"]){
    width:20px !important;
    min-width:20px !important;
    max-width:20px !important;
    height:20px !important;
    min-height:20px !important;
    max-height:20px !important;
    padding:0 !important;
    border-color:transparent !important;
    background-color:transparent !important;
    background-image:url('/assets/ui/back_button.png') !important;
    background-repeat:no-repeat !important;
    background-position:center !important;
    background-size:20px 20px !important;
    box-shadow:none !important;
    color:transparent !important;
    font-size:0 !important;
    line-height:0 !important;
    text-shadow:none !important;
  }
  :is(a.ui-back-button,a.back,a.section-back,a.chat-back,a.account-pda-back,a[aria-label^="Назад"],a[title^="Назад"]) > svg{display:none !important}
  :is(a.ui-back-button,a.back,a.section-back,a.chat-back,a.account-pda-back,a[aria-label^="Назад"],a[title^="Назад"]):is(:hover,:focus-visible){
    background-image:url('/assets/ui/back_button.png') !important;
    filter:brightness(1.12);
  }
}

/* UI contract 40 — shared chrome alignment + game action strip.
   Local-header separators belong to the full header cells, not to shorter controls.
   GAME action controls use the exact same surface/typography contract as the global game navigation. */
@layer chrome {
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"]{
    grid-template-columns:40px minmax(0,1fr) minmax(40px,auto);
  }

  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.title,.heading,.section-heading,.page-title,.account-pda-title),
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > h1{
    box-sizing:border-box;
    display:flex;
    align-items:center;
    align-self:stretch;
    height:100%;
    min-height:0;
    margin:0;
    border-left:1px solid var(--ui-line-strong);
    border-right:1px solid var(--ui-line-strong);
  }

  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.top-title,.topbar-title){
    box-sizing:border-box;
    align-self:stretch;
    height:100%;
    min-height:0;
    margin:0;
    border-left:1px solid var(--ui-line-strong);
    border-right:1px solid var(--ui-line-strong);
  }

  /* The 20x20 back control stays 20x20. Full-height separators are drawn by the title cell. */
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.back,.section-back,.chat-back,.account-pda-back,.admin-menu-button):first-child,
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > a:first-child:not(.top-new-topic){
    border-right:0;
  }

  /* Icon actions on the right occupy the whole local-header cell, so no short/floating divider remains. */
  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.game-link,a.game,.account-pda-game,.icon-btn,.look-refresh):last-child{
    align-self:stretch;
    width:40px;
    min-width:40px;
    max-width:40px;
    height:100%;
    min-height:100%;
    max-height:100%;
    margin:0;
    border:0;
  }

  body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.top-new-topic,.search-toggle,.auth-head-action):last-child{
    align-self:stretch;
    height:100%;
    min-height:100%;
    max-height:100%;
    margin:0;
    border:0;
    border-radius:0;
  }

  /* Main GAME action strip: exact visual contract of КПК / ПЕРСОНАЖ / РЮКЗАК. */
  body[data-ui-theme] .game-action-nav{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:center;
    width:100%;
    height:31.2px;
    min-height:31.2px;
    max-height:31.2px;
    margin:0;
    padding:0;
    gap:0;
    border:0;
    border-bottom:1px solid var(--ui-line-strong);
    border-radius:0;
    background:var(--ui-surface);
    box-shadow:inset 0 1px var(--ui-gloss);
    overflow:hidden;
  }

  body[data-ui-theme] .perimeter-game-nav > a,
  body[data-ui-theme] .game-action-nav > .action{
    box-sizing:border-box;
    appearance:none;
    -webkit-appearance:none;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:5px;
    width:100%;
    min-width:0;
    height:31.2px;
    min-height:31.2px;
    max-height:31.2px;
    margin:0;
    padding:0 6px;
    border:0;
    border-right:1px solid var(--ui-line);
    border-radius:0;
    background:linear-gradient(180deg,var(--ui-gloss),transparent 50%),var(--ui-surface);
    background-image:linear-gradient(180deg,var(--ui-gloss),transparent 50%);
    color:var(--ui-text);
    font:700 var(--ui-font-base)/1 var(--ui-mono);
    letter-spacing:.02em;
    text-align:center;
    text-decoration:none;
    box-shadow:inset 0 1px rgba(255,255,255,.018);
    filter:none;
    overflow:hidden;
    white-space:nowrap;
  }

  body[data-ui-theme] :is(.perimeter-game-nav > a,.game-action-nav > .action):last-child{border-right:0}

  body[data-ui-theme] :is(.perimeter-game-nav > a,.game-action-nav > .action):is(:hover,:focus-visible,.active){
    background:linear-gradient(180deg,var(--ui-gloss-strong),transparent 48%),var(--ui-surface-active);
    color:var(--ui-accent);
    border-color:var(--ui-line);
    filter:none;
  }

  body[data-ui-theme] :is(.perimeter-nav-device-state,.game-action-nav .device-action small){
    display:inline;
    width:auto;
    min-width:0;
    height:auto;
    min-height:0;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    color:var(--ui-muted);
    font:700 var(--ui-font-micro)/1 var(--ui-mono);
    box-shadow:none;
  }

  /* Location-transition control is always geometrically square-edged. */
  body[data-ui-theme] .game .transition-btn{
    border-radius:0;
  }
}


@layer chrome {
/* UI contract 41 — every NPC role icon is exactly 15x15 on smartphones.
   Chrome layer intentionally owns this responsive icon contract so route-specific
   legacy 28px rules cannot override it. */
@media(max-width:480px){
  :where(
    .npc-role-icon,
    .npc-action-icon img,
    .npc-action-button__icon img,
    .npc-action-button__icon svg
  ){
    width:15px;
    height:15px;
    min-width:15px;
    min-height:15px;
    max-width:15px;
    max-height:15px;
    flex:0 0 15px;
    object-fit:contain;
    image-rendering:auto;
  }

  :where(.npc-action-icon,.npc-action-button__icon){
    width:15px;
    height:15px;
    min-width:15px;
    min-height:15px;
    max-width:15px;
    max-height:15px;
    flex:0 0 15px;
  }
}
}


@layer base {
  body[data-ui-theme="new-year-night"]{
    background-image:radial-gradient(circle at 50% 0,rgba(104,181,215,.15),transparent 42%),linear-gradient(180deg,#03070d,#020407 78%);
  }
  body[data-ui-theme="new-year-night"] .project-root{position:relative;isolation:isolate}

  /* Holiday snow: all flakes fall with the same vertical speed, but their
     positions are distributed across several irregular tile sizes and anchor
     points so the eye does not read square clusters or rigid columns. */
  body[data-ui-theme="new-year-night"] .project-root::before,
  body[data-ui-theme="new-year-night"] .project-root::after{
    content:"";position:absolute;inset:-34px -26px;pointer-events:none;mix-blend-mode:screen;overflow:hidden;will-change:background-position,transform;
  }
  body[data-ui-theme="new-year-night"] .project-root::before{
    z-index:40;opacity:.18;filter:blur(.12px);
    background-image:
      radial-gradient(circle at 7px 9px,rgba(248,254,255,.92) 0 .7px,transparent 1.1px),
      radial-gradient(circle at 22px 31px,rgba(225,246,255,.82) 0 .95px,transparent 1.45px),
      radial-gradient(circle at 16px 12px,rgba(214,239,250,.76) 0 1.25px,transparent 1.85px),
      radial-gradient(circle at 43px 18px,rgba(241,251,255,.70) 0 .85px,transparent 1.35px);
    background-size:31px 47px,61px 79px,89px 113px,137px 173px;
    background-position:3px -39px,19px -61px,44px -93px,71px -127px;
    animation:perimeterSnowFallUnified 18s linear infinite,perimeterSnowDriftNear 7.5s ease-in-out infinite alternate;
  }
  body[data-ui-theme="new-year-night"] .project-root::after{
    z-index:41;opacity:.14;filter:blur(.22px);
    background-image:
      radial-gradient(circle at 18px 27px,rgba(250,255,255,.96) 0 1.65px,transparent 2.35px),
      radial-gradient(circle at 63px 41px,rgba(223,245,255,.78) 0 2.15px,transparent 3px),
      radial-gradient(circle at 25px 59px,rgba(235,248,255,.66) 0 1.1px,transparent 1.75px),
      radial-gradient(circle at 94px 22px,rgba(244,252,255,.58) 0 1.55px,transparent 2.2px);
    background-size:131px 167px,191px 229px,83px 109px,149px 197px;
    background-position:28px -123px,92px -181px,14px -72px,57px -146px;
    animation:perimeterSnowFallUnifiedFar 18s linear infinite,perimeterSnowDriftFar 7.5s ease-in-out infinite alternate;
  }
  @keyframes perimeterSnowFallUnified{
    0%{background-position:3px -39px,19px -61px,44px -93px,71px -127px}
    20%{background-position:8px 167px,11px 145px,54px 113px,63px 79px}
    40%{background-position:-2px 373px,24px 351px,35px 319px,80px 285px}
    60%{background-position:10px 579px,13px 557px,57px 525px,60px 491px}
    80%{background-position:1px 785px,28px 763px,38px 731px,77px 697px}
    100%{background-position:7px 991px,17px 969px,49px 937px,67px 903px}
  }
  @keyframes perimeterSnowFallUnifiedFar{
    0%{background-position:28px -123px,92px -181px,14px -72px,57px -146px}
    20%{background-position:20px 83px,100px 25px,21px 134px,49px 60px}
    40%{background-position:36px 289px,84px 231px,7px 340px,66px 266px}
    60%{background-position:18px 495px,108px 437px,26px 546px,45px 472px}
    80%{background-position:33px 701px,87px 643px,11px 752px,61px 678px}
    100%{background-position:24px 907px,96px 849px,19px 958px,52px 884px}
  }
  @keyframes perimeterSnowDriftNear{
    0%{transform:translate3d(-3px,0,0) rotate(-.05deg)}
    18%{transform:translate3d(2px,0,0) rotate(.02deg)}
    43%{transform:translate3d(-6px,0,0) rotate(-.06deg)}
    71%{transform:translate3d(5px,0,0) rotate(.04deg)}
    100%{transform:translate3d(-1px,0,0) rotate(-.02deg)}
  }
  @keyframes perimeterSnowDriftFar{
    0%{transform:translate3d(4px,0,0) rotate(.03deg)}
    22%{transform:translate3d(-5px,0,0) rotate(-.05deg)}
    47%{transform:translate3d(1px,0,0) rotate(.01deg)}
    74%{transform:translate3d(6px,0,0) rotate(.05deg)}
    100%{transform:translate3d(-2px,0,0) rotate(-.02deg)}
  }

  /* Snow must never be painted over the game map itself. */
  body[data-ui-theme="new-year-night"] .game>.map-wrap{position:relative;z-index:50}

  /* Holiday garland replaces the plain separator directly below the status bar. */
  body[data-ui-theme="new-year-night"] .perimeter-status-bar{position:relative;border-bottom:0;overflow:hidden}
  body[data-ui-theme="new-year-night"] .perimeter-status-bar::after{
    content:"";position:absolute;left:0;right:0;bottom:0;height:4px;pointer-events:none;
    background-image:
      radial-gradient(circle at 4px 2px,#ff5c5c 0 1.35px,rgba(255,92,92,.34) 1.6px 2.5px,transparent 2.8px),
      radial-gradient(circle at 13px 2px,#ffd76a 0 1.35px,rgba(255,215,106,.32) 1.6px 2.5px,transparent 2.8px),
      radial-gradient(circle at 22px 2px,#74e59a 0 1.35px,rgba(116,229,154,.32) 1.6px 2.5px,transparent 2.8px),
      radial-gradient(circle at 31px 2px,#70cfff 0 1.35px,rgba(112,207,255,.34) 1.6px 2.5px,transparent 2.8px);
    background-size:36px 4px;background-repeat:repeat-x;
    filter:brightness(.82) saturate(1.05);
    animation:perimeterGarlandModes 3.6s steps(4,end) infinite,perimeterGarlandTravel 8s linear infinite;
  }
  @keyframes perimeterGarlandModes{
    0%{opacity:.72;filter:brightness(.78) saturate(1)}
    25%{opacity:1;filter:brightness(1.45) saturate(1.22)}
    50%{opacity:.82;filter:brightness(.98) saturate(1.12)}
    75%{opacity:1;filter:brightness(1.7) saturate(1.3)}
    100%{opacity:.72;filter:brightness(.78) saturate(1)}
  }
  @keyframes perimeterGarlandTravel{to{background-position:36px 0,36px 0,36px 0,36px 0}}

  body[data-ui-theme="new-year-night"] :where(.perimeter-global-header,.ui-local-header[data-page-local-header="1"],.game>.location){box-shadow:inset 0 1px rgba(234,250,255,.08),inset 0 -1px rgba(98,180,217,.05)}
}


@layer chrome {
  .ui-local-header[data-page-local-header="1"]>.ui-local-header-actions{
    justify-self:end;align-self:stretch;display:flex;align-items:center;justify-content:flex-end;min-width:40px;height:100%;margin:0;padding:0;
  }
  .ui-local-header[data-page-local-header="1"]>.ui-local-header-actions>:is(.game-link,.ui-auto-game-link,.icon-btn,.look-refresh,.search-toggle){flex:0 0 auto}
  .ui-local-header[data-page-local-header="1"] .ui-auto-game-link{box-sizing:border-box;display:grid;place-items:center;width:var(--ui-control-small);min-width:var(--ui-control-small);height:var(--ui-control-small);margin:0 6px;padding:0;border:0;border-left:1px solid var(--ui-line-strong);border-radius:0;background:transparent;color:var(--ui-accent);text-decoration:none}
  .ui-local-header[data-page-local-header="1"] .ui-auto-game-link:is(:hover,:focus-visible){background:var(--ui-surface-active)}
  .ui-auto-game-bar{display:flex;align-items:center;justify-content:flex-end;width:100%;height:31px;margin:0;padding:0 6px;border:0;border-bottom:1px solid var(--ui-line-strong);background:var(--ui-surface)}
  .ui-auto-game-bar .ui-auto-game-link{display:grid;place-items:center;width:28px;height:28px;margin:0;padding:0;border:0;background:transparent;text-decoration:none}
  .ui-auto-game-bar .ui-auto-game-link:is(:hover,:focus-visible){background:var(--ui-surface-active)}
}

@layer chrome {
  /* V25 — compact local headers: decorative secondary subtitles are removed project-wide. */
  .ui-local-header[data-page-local-header="1"] :is(.top-title,.topbar-title){
    gap:0;
    align-content:center;
  }
  .ui-local-header[data-page-local-header="1"] :is(.top-title,.topbar-title) > span{
    display:none !important;
  }
}


@layer chrome {
  /* V31 — one vertical separator per local-header column. Legacy route title
     borders caused the doubled vertical lines seen beside the Home/Game icon. */
  .ui-local-header[data-page-local-header="1"] > :is(.title,.heading,.section-heading,.page-title,.account-pda-title,.top-title,.topbar-title,h1){
    border-left:0 !important;
    border-right:0 !important;
    box-shadow:none;
  }
  .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions{
    border-left:1px solid var(--ui-line-strong);
  }
  .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.search-toggle){
    border-left:0 !important;
    border-right:0 !important;
  }
  .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > * + *{
    border-left:1px solid var(--ui-line) !important;
  }
}

@layer chrome {
  /* V31b — the center column never owns a vertical edge. This catches older
     headers whose title uses a route-specific class not listed by the shared contract. */
  .ui-local-header[data-page-local-header="1"] > :nth-child(2){
    border-left:0 !important;
    border-right:0 !important;
    box-shadow:none;
  }
}


@layer chrome {
/* V43 — admin usability pass: preserve every control, remove card boxes. */
body[data-admin-ui="1"] :where(.section,.panel,.card,.stat,.data-list,.quick-grid,.runtime-card){border-radius:0!important;box-shadow:none!important}
body[data-admin-ui="1"] :where(.section,.panel,.card,.runtime-card){margin:0!important;border:0!important;border-bottom:1px solid var(--ui-line)!important;background:transparent!important}
body[data-admin-ui="1"] :where(.section-title,.panel-title){min-height:32px;padding:0 8px;border:0!important;border-bottom:1px solid var(--ui-line)!important;background:var(--ui-surface)!important}
body[data-admin-ui="1"] .stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(118px,1fr));gap:0!important;border-bottom:1px solid var(--ui-line)}
body[data-admin-ui="1"] .stat{min-height:54px;margin:0!important;padding:7px 8px!important;border:0!important;border-right:1px solid var(--ui-line)!important;border-bottom:1px solid var(--ui-line)!important;background:transparent!important}
body[data-admin-ui="1"] .quick-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:0!important;border:0!important;background:transparent!important}
body[data-admin-ui="1"] .quick-grid>:where(a,form){min-width:0;margin:0!important;border:0!important;border-right:1px solid var(--ui-line)!important;border-bottom:1px solid var(--ui-line)!important;background:transparent!important}
body[data-admin-ui="1"] .quick-grid form .btn{width:100%}
body[data-admin-ui="1"] :where(.data-row,.toolbar,.form-actions){border-radius:0!important;box-shadow:none!important}
body[data-admin-ui="1"] .data-row{margin:0!important;border:0!important;border-bottom:1px solid var(--ui-line)!important;background:transparent!important}
body[data-admin-ui="1"] :where(.btn,button.btn,a.btn){min-height:32px;border:0!important;border-left:1px solid var(--ui-line)!important;border-radius:0!important;background:color-mix(in srgb,var(--ui-accent) 6%,var(--ui-bg))!important;color:var(--ui-accent)!important;box-shadow:none!important;font-weight:900}
body[data-admin-ui="1"] :where(.btn,button.btn,a.btn):is(:hover,:focus-visible){background:color-mix(in srgb,var(--ui-accent) 14%,var(--ui-bg))!important;color:var(--ui-strong)!important}
body[data-admin-ui="1"] :where(.btn.danger,button.btn.danger){background:color-mix(in srgb,var(--ui-danger) 7%,var(--ui-bg))!important;color:var(--ui-danger)!important}
body[data-admin-ui="1"] :where(.input,.select,.textarea,input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea){border-radius:0!important;box-shadow:none!important;background:var(--ui-bg)!important;border-color:var(--ui-line)!important}
body[data-admin-ui="1"] .table-wrap{border:0!important;border-radius:0!important;box-shadow:none!important;overflow:auto}.table-wrap table{border-collapse:collapse}.table-wrap th,.table-wrap td{border-bottom:1px solid var(--ui-line)!important}
body[data-admin-ui="1"] .content{gap:0!important}.route-nav{border-bottom:1px solid var(--ui-line)}
/* Functional map grid cells remain cells; do not flatten them. */
body[data-admin-ui="1"] .admin-map-grid :where(.map-cell,[data-map-cell]){border:0;background:transparent}
@media(max-width:480px){body[data-admin-ui="1"] .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}body[data-admin-ui="1"] .quick-grid{grid-template-columns:1fr 1fr}}
}

@layer chrome {
/* V45 — one NPC dialogue contract for every static NPC.
   Flat hierarchy: identity -> relation -> speech -> actions; separators only. */
.npc-dialog-page .npc-dialog-shell{background:var(--ui-bg-2)}
.npc-dialog-page .npc-head{
  display:grid;
  grid-template-columns:46px minmax(0,1fr);
  gap:9px;
  align-items:center;
  min-height:62px;
  margin:0;
  padding:7px 8px;
  border:0;
  border-bottom:1px solid var(--ui-line);
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.npc-dialog-page .npc-head .avatar{
  width:40px;height:40px;min-width:40px;min-height:40px;
  display:grid;place-items:center;overflow:hidden;
  border:0;border-radius:0;background:transparent;
  color:var(--ui-accent);font:900 var(--ui-font-base)/1 var(--ui-mono);
}
.npc-dialog-page .npc-head .npc-avatar-img{display:block;width:100%;height:100%;object-fit:cover}
.npc-dialog-page .npc-name{color:var(--ui-warning);font-size:var(--ui-font-name);font-weight:900;line-height:1.18}
.npc-dialog-page .npc-role{margin-top:2px;color:var(--ui-muted);font-size:var(--ui-font-secondary);line-height:1.25}
.npc-dialog-page .npc-head .status{
  margin-top:4px;padding:0;border:0;background:transparent;
  color:var(--ui-muted);font-size:var(--ui-font-micro);line-height:1.2
}
.npc-dialog-page .npc-head .status b{margin-left:3px;color:var(--ui-strong)}
.npc-dialog-page .speech{
  margin:0;padding:11px 10px;border:0;border-left:2px solid color-mix(in srgb,var(--ui-accent) 68%,transparent);border-bottom:1px solid var(--ui-line);border-radius:0;
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg)),var(--ui-bg) 84%);color:var(--ui-strong);font-size:calc(var(--ui-font-base) + 2px);font-weight:700;line-height:1.52;box-shadow:none;text-shadow:0 1px 1px rgba(0,0,0,.72)
}
.npc-dialog-page .speech p{margin:0;font-style:italic}
.npc-dialog-page .npc-section-title,
.npc-dialog-page .section-toggle{
  width:100%;height:30px;min-height:30px;display:flex;align-items:center;justify-content:space-between;
  margin:0;padding:0 8px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;
  background:var(--ui-surface);color:var(--ui-strong);font-size:var(--ui-font-section);font-weight:900;
  text-align:left;text-transform:uppercase;box-shadow:none
}
.npc-dialog-page .actions,
.npc-dialog-page .topics{display:block;margin:0;padding:0;border:0;border-bottom:1px solid var(--ui-line);background:transparent}
.npc-dialog-page :is(.action,.topic){
  position:relative;width:100%;min-height:42px;display:grid;grid-template-columns:minmax(0,1fr) 18px;gap:8px;align-items:center;
  margin:0;padding:6px 8px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 8%,var(--ui-bg)),var(--ui-bg) 76%);
  color:var(--ui-text);text-align:left;box-shadow:none
}
.npc-dialog-page :is(.action,.topic):last-child{border-bottom:0}
.npc-dialog-page :is(.action,.topic)::before{content:"";position:absolute;left:0;top:7px;bottom:7px;width:2px;background:color-mix(in srgb,var(--ui-accent) 65%,transparent)}
.npc-dialog-page :is(.action,.topic):is(:hover,:focus-visible){outline:0;background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 15%,var(--ui-bg)),var(--ui-bg) 82%)}
.npc-dialog-page .action strong{display:block;color:var(--ui-accent);font-size:var(--ui-font-base);font-weight:900;line-height:1.2}
.npc-dialog-page .action small{display:block;margin-top:2px;color:var(--ui-muted);font-size:var(--ui-font-secondary);line-height:1.25}
.npc-dialog-page :is(.action,.topic) .arrow{color:var(--ui-accent);font-size:18px;text-align:right}
.npc-dialog-page .runtime-disabled{opacity:.42;cursor:not-allowed}
.npc-dialog-page .close{
  width:100%;height:36px;min-height:36px;display:flex;align-items:center;justify-content:center;
  margin:0;padding:0 8px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;
  background:color-mix(in srgb,var(--ui-warning) 6%,var(--ui-bg));color:var(--ui-warning);
  font-size:var(--ui-font-base);font-weight:900;box-shadow:none
}
.npc-dialog-page .close:is(:hover,:focus-visible){outline:0;background:color-mix(in srgb,var(--ui-warning) 12%,var(--ui-bg));color:var(--ui-strong)}
.npc-dialog-page .runtime-card.npc-service{margin:0;padding:7px 8px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;background:transparent;box-shadow:none}
.npc-dialog-page :is(.actions,.topics)[hidden]{display:none}
@media(max-width:480px){
  .npc-dialog-page .npc-head{grid-template-columns:34px minmax(0,1fr);min-height:52px;padding:6px 7px}
  .npc-dialog-page .npc-head .avatar{width:30px;height:30px;min-width:30px;min-height:30px}
  .npc-dialog-page :is(.action,.topic){min-height:40px;padding:5px 7px}
}
}

@layer chrome {
/* V46 — dialogue readability and question icon contract. */
.npc-dialog-page .speech p{font-style:italic}
.npc-dialog-page .topic{grid-template-columns:20px minmax(0,1fr) 18px;font-size:var(--ui-font-base)}
.npc-dialog-page .topic-icon{width:18px;height:18px;display:grid;place-items:center;color:var(--ui-accent)}
.npc-dialog-page .topic-icon svg{display:block;width:16px;height:16px}
.npc-dialog-page .topic-label{min-width:0;overflow-wrap:anywhere}
.npc-dialog-page .topic.active{background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 16%,var(--ui-bg)),var(--ui-bg) 84%);color:var(--ui-accent)}
@media(max-width:480px){
  .npc-dialog-page .speech{padding:9px 8px;font-size:calc(var(--ui-font-base) + 1px);line-height:1.46}
  .npc-dialog-page .topic{grid-template-columns:18px minmax(0,1fr) 18px;gap:6px;min-height:38px;padding:5px 7px;font-size:var(--ui-font-base)}
  .npc-dialog-page .topic-icon{width:16px;height:16px}.npc-dialog-page .topic-icon svg{width:15px;height:15px}
  .npc-dialog-page .actions .action{grid-template-columns:minmax(0,1fr) 18px;min-height:38px;padding:5px 7px}
  .npc-dialog-page .npc-role{white-space:normal;overflow-wrap:anywhere}
}
}

/* Unified semantic SVG markers for section dividers. */
.ui-section-icon{
  display:inline-grid;
  place-items:center;
  width:15px;
  height:15px;
  margin-right:6px;
  flex:0 0 15px;
  color:var(--ui-accent-bright,var(--ui-accent));
  vertical-align:-2px;
  opacity:.92;
  filter:drop-shadow(0 0 3px color-mix(in srgb,var(--ui-accent) 20%,transparent));
}
.ui-section-icon>svg{display:block;width:100%;height:100%;overflow:visible}
.ui-section-label{display:inline-flex;align-items:center;min-width:0}
:where(.section-head,.section-title,.pda-section-title,.pda-divider,.faction-section-title,.character-window-section-title,.npc-section-title,.block-title,.collapsible-heading,.chat-head,.chat-feed-head,.forum-section-head,.news-section-head,.stash-section-head,.stash-list-title,.base-facilities-head,.sm-head,.guard-dialogue-title,.people-title,.strategic-materials-title,.perks-catalog-title,.pda-profile-split-title,.weapon-group-header,.slot-head,.control-title,.npc-dialog__panel-title,.quest-progress-head) :where(.ui-section-label,span,strong,b,h1,h2,h3,h4){
  min-width:0;
}
:where(.section-head,.section-title,.pda-section-title,.pda-divider,.faction-section-title,.character-window-section-title,.npc-section-title,.block-title,.collapsible-heading,.chat-head,.chat-feed-head,.forum-section-head,.news-section-head,.stash-section-head,.stash-list-title,.base-facilities-head,.sm-head,.guard-dialogue-title,.people-title,.strategic-materials-title,.perks-catalog-title,.pda-profile-split-title,.weapon-group-header,.slot-head,.control-title,.npc-dialog__panel-title,.quest-progress-head) .ui-section-icon{
  vertical-align:middle;
}
body[data-ui-theme="grayscale"] .ui-section-icon{color:var(--ui-text)}
@media(max-width:480px){
  .ui-section-icon{width:14px;height:14px;flex-basis:14px;margin-right:5px}
}



/* Semantic section markers: compact/diverse legacy divider compatibility. */
.chat-head > strong,
.chat-feed-head > strong,
.guard-dialogue-title > .ui-section-label,
.strategic-materials-title > .ui-section-label,
.control-title > .ui-section-label,
.npc-dialog__panel-title > .ui-section-label{
  display:inline-flex;
  align-items:center;
}
.forum-section-head > div > :is(b,strong):first-child,
.news-section-head > div > :is(b,strong):first-child,
.stash-section-head > div > :is(b,strong):first-child{
  display:flex;
  align-items:center;
}


@layer components {
/* Shared NPC dialogue visual contract — same presentation as strategic flag guards. */

.strategic-guard-app{background:var(--ui-bg-2);color:var(--ui-text)}
.strategic-guard-app .guard-tag{color:var(--ui-accent);font-size:var(--ui-font-secondary)}
.guard-identity{display:grid;grid-template-columns:minmax(0,1fr) 30px;gap:8px;align-items:center;min-height:56px;padding:7px 8px;border-bottom:1px solid var(--ui-line);background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 8%,transparent),transparent 72%)}
.guard-identity-copy{min-width:0}.guard-identity-copy strong,.guard-identity-copy span,.guard-identity-copy small{display:block}.guard-identity-copy strong{color:var(--ui-warning);font-size:var(--ui-font-name)}.guard-identity-copy span{margin-top:3px;color:var(--ui-muted);font-size:var(--ui-font-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.guard-identity-copy small{margin-top:4px;color:var(--ui-muted);font-size:var(--ui-font-micro)}
.guard-faction-emblem{width:28px;height:28px;display:block;object-fit:contain;filter:drop-shadow(0 1px 2px #000)}
.guard-dialogue-reply{padding:11px 10px;border-left:2px solid color-mix(in srgb,var(--ui-accent) 68%,transparent);border-bottom:1px solid var(--ui-line);color:var(--ui-strong);font-size:calc(var(--ui-font-base) + 2px);font-weight:700;font-style:italic;line-height:1.52;background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg)),var(--ui-bg) 84%);text-shadow:0 1px 1px rgba(0,0,0,.72)}
.guard-dialogue-title{height:30px;display:flex;align-items:center;padding:0 8px;border-bottom:1px solid var(--ui-line);background:var(--ui-surface);color:var(--ui-strong);font-size:var(--ui-font-section);font-weight:900;text-transform:uppercase}
.npc-dialog-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));min-width:0;border-bottom:1px solid var(--ui-line);background:var(--ui-bg-2)}
.npc-dialog-tab{min-width:0;height:34px;padding:0 8px;border:0;border-right:1px solid var(--ui-line);border-radius:0;background:var(--ui-surface);color:var(--ui-muted);font:900 var(--ui-font-section)/1 var(--ui-mono);text-transform:uppercase;text-align:center;cursor:pointer;box-shadow:none}
.npc-dialog-tab:last-child{border-right:0}
.npc-dialog-tab:is(:hover,:focus-visible){outline:0;color:var(--ui-strong);background:color-mix(in srgb,var(--ui-accent) 7%,var(--ui-surface))}
.npc-dialog-tab.is-active{color:var(--ui-accent);background:linear-gradient(180deg,color-mix(in srgb,var(--ui-accent) 10%,var(--ui-surface)),var(--ui-surface));box-shadow:inset 0 -2px 0 var(--ui-accent)}
.npc-dialog-tab:disabled{opacity:.4;cursor:default;color:var(--ui-muted);background:var(--ui-surface);box-shadow:none}
.npc-dialog-panel{display:block;min-width:0}
.npc-dialog-panel[hidden]{display:none!important}
.npc-dialog-empty{min-height:42px;display:flex;align-items:center;padding:7px 9px;border-bottom:1px solid var(--ui-line);color:var(--ui-muted);font-size:var(--ui-font-secondary)}
.guard-dialogue-topics{display:block;border-bottom:1px solid var(--ui-line)}
.guard-dialogue-topics .guard-topic{width:100%;display:grid;grid-template-columns:20px minmax(0,1fr) 24px;gap:7px;align-items:center;min-height:40px;padding:0 0 0 8px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg)),var(--ui-bg) 80%);color:var(--ui-strong);font-size:var(--ui-font-base);font-weight:800;text-align:left;text-decoration:none;box-shadow:none}
.guard-dialogue-topics .guard-topic:last-child{border-bottom:0}
.guard-dialogue-topics .guard-topic:is(:hover,:focus-visible),.guard-dialogue-topics .guard-topic.active{outline:0;background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 15%,var(--ui-bg)),var(--ui-bg) 82%);color:var(--ui-accent)}
.guard-topic-icon{width:18px;height:18px;display:grid;place-items:center;color:var(--ui-accent)}
.guard-topic-icon svg{width:16px;height:16px;display:block}
.guard-topic-label{min-width:0;overflow-wrap:anywhere}
.guard-dialogue-topics .guard-topic b{height:100%;display:grid;place-items:center;border-left:1px solid var(--ui-line);color:var(--ui-accent);font-size:18px}
.guard-dialogue-close{width:100%;height:36px;display:flex;align-items:center;justify-content:center;border-bottom:1px solid var(--ui-line);background:color-mix(in srgb,var(--ui-warning) 6%,var(--ui-bg));color:var(--ui-warning);font-size:var(--ui-font-base);font-weight:900}
.guard-dialogue-close:is(:hover,:focus-visible){background:color-mix(in srgb,var(--ui-warning) 12%,var(--ui-bg));color:var(--ui-strong)}
@media(max-width:480px){
 .guard-identity{grid-template-columns:minmax(0,1fr) 24px;min-height:50px;padding:6px 7px}
 .guard-faction-emblem{width:22px;height:22px}
 .guard-identity-copy span{white-space:normal;line-height:1.25}
 .guard-dialogue-reply{padding:9px 8px;font-size:calc(var(--ui-font-base) + 1px);line-height:1.46}
 .npc-dialog-tab{height:32px;padding:0 6px;font-size:var(--ui-font-base)}
 .guard-dialogue-topics .guard-topic{grid-template-columns:18px minmax(0,1fr) 22px;gap:6px;min-height:38px;padding-left:7px;font-size:var(--ui-font-base)}
 .guard-topic-icon{width:16px;height:16px}.guard-topic-icon svg{width:15px;height:15px}
}
@media(max-width:360px){
 .guard-dialogue-topics .guard-topic{grid-template-columns:17px minmax(0,1fr) 20px;gap:5px;padding-left:6px}
 .guard-faction-emblem{width:20px;height:20px}
}
.npc-dialog-page .guard-npc-avatar{width:36px;height:36px;display:grid;place-items:center;overflow:hidden;border:1px solid color-mix(in srgb,var(--ui-accent) 35%,var(--ui-line));background:color-mix(in srgb,var(--ui-accent) 5%,var(--ui-bg));color:var(--ui-accent);font:800 var(--ui-font-micro)/1 var(--ui-mono);box-shadow:0 0 8px color-mix(in srgb,var(--ui-accent) 8%,transparent)}
.npc-dialog-page .guard-npc-avatar .npc-avatar-img{display:block;width:100%;height:100%;object-fit:cover;transform:scale(1.05)}
.npc-dialog-page .guard-npc-avatar--emblem{background:color-mix(in srgb,var(--ui-accent) 3%,var(--ui-bg));box-shadow:inset 0 0 8px color-mix(in srgb,var(--ui-accent) 7%,transparent),0 0 8px color-mix(in srgb,var(--ui-accent) 8%,transparent)}
.npc-dialog-page .guard-npc-avatar .npc-avatar-img--emblem{object-fit:contain;padding:2px;transform:none;filter:drop-shadow(0 0 3px color-mix(in srgb,var(--ui-accent) 14%,transparent))}
.npc-dialog-page .guard-topic-label small{display:block;margin-top:2px;color:var(--ui-muted);font-size:var(--ui-font-secondary);font-weight:400;line-height:1.2}
.npc-dialog-page .guard-topic.runtime-disabled{opacity:.42;cursor:not-allowed;pointer-events:none}
.npc-dialog-page .runtime-card.npc-service{margin:0;padding:8px;border:0;border-bottom:1px solid var(--ui-line);border-radius:0;background:transparent;box-shadow:none}
@media(max-width:480px){.npc-dialog-page .guard-npc-avatar{width:30px;height:30px}}
}

@layer chrome {
/* GAME visual contract 2026-08-31 — approved button treatment.
   Global game navigation stays theme-driven and clearly interactive. */
body[data-ui-theme] .perimeter-game-nav{
  height:34px;
  min-height:34px;
  max-height:34px;
  padding:0;
  border-top:1px solid color-mix(in srgb,var(--ui-line-strong) 72%,transparent);
  border-bottom:1px solid var(--ui-line-strong);
  background:var(--ui-bg-2);
  box-shadow:none;
}
body[data-ui-theme] .perimeter-game-nav>a{
  position:relative;
  height:30px;
  min-height:30px;
  max-height:30px;
  margin:2px 1px;
  padding:0 4px;
  border:1px solid color-mix(in srgb,var(--ui-line-strong) 88%,transparent);
  border-right:1px solid color-mix(in srgb,var(--ui-line-strong) 88%,transparent);
  border-bottom-color:color-mix(in srgb,var(--ui-accent) 18%,var(--ui-line-strong));
  background:linear-gradient(180deg,color-mix(in srgb,var(--ui-strong) 3%,var(--ui-surface)) 0%,var(--ui-surface) 46%,color-mix(in srgb,var(--ui-bg) 56%,var(--ui-surface)) 100%);
  box-shadow:inset 0 1px 0 color-mix(in srgb,var(--ui-strong) 4%,transparent),inset 0 -1px 0 color-mix(in srgb,var(--ui-accent) 8%,transparent);
  color:var(--ui-strong);
  font-weight:800;
  text-decoration:none;
  overflow:hidden;
}
body[data-ui-theme] .perimeter-game-nav>a:first-child{margin-left:2px}
body[data-ui-theme] .perimeter-game-nav>a:last-child{margin-right:2px;border-right:1px solid color-mix(in srgb,var(--ui-line-strong) 88%,transparent)}
body[data-ui-theme] .perimeter-game-nav>a::after{
  content:"";
  position:absolute;
  left:22%;
  right:22%;
  bottom:-1px;
  height:1px;
  background:color-mix(in srgb,var(--ui-accent) 22%,transparent);
  opacity:.65;
  pointer-events:none;
}
body[data-ui-theme] .perimeter-game-nav>a:is(:hover,:focus-visible,.active){
  outline:0;
  color:var(--ui-accent);
  border-color:color-mix(in srgb,var(--ui-accent) 34%,var(--ui-line));
  background:linear-gradient(180deg,color-mix(in srgb,var(--ui-accent) 8%,var(--ui-surface-active)),var(--ui-surface-active));
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 8%,transparent),0 0 8px color-mix(in srgb,var(--ui-accent) 7%,transparent);
  filter:none;
}
body[data-ui-theme] .perimeter-game-nav>a:active{
  transform:translateY(1px);
  background:color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg-2));
  box-shadow:inset 0 1px 3px rgba(0,0,0,.35);
}
body[data-ui-theme] .perimeter-nav-device-state{color:var(--ui-muted)}
}

/* v122 tutorial: one compact instruction below the existing unified header. */
.perimeter-tutorial-strip{position:relative;display:flex;align-items:center;flex-wrap:wrap;gap:5px 7px;min-height:27px;padding:4px 8px;border-bottom:1px solid var(--ui-line-strong);background:linear-gradient(180deg,color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg-2)),var(--ui-bg-2));color:var(--ui-text);font-size:var(--ui-font-secondary);line-height:1.25;overflow:hidden}
.perimeter-tutorial-strip::before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:color-mix(in srgb,var(--ui-accent) 68%,transparent);box-shadow:0 0 7px color-mix(in srgb,var(--ui-accent) 18%,transparent)}
.perimeter-tutorial-strip__label{flex:0 0 auto;color:var(--ui-accent);font:900 var(--ui-font-micro)/1 var(--ui-mono);letter-spacing:.05em}
.perimeter-tutorial-strip__text{flex:1 1 260px;min-width:0;overflow-wrap:anywhere}
.perimeter-tutorial-strip__reward{flex:0 1 auto;margin-left:auto;padding:2px 5px;border-left:1px solid color-mix(in srgb,var(--ui-good) 52%,var(--ui-line));color:var(--ui-good);font:900 var(--ui-font-micro)/1.25 var(--ui-mono);letter-spacing:.025em;text-transform:uppercase;text-shadow:0 0 6px color-mix(in srgb,var(--ui-good) 34%,transparent);white-space:normal}
.perimeter-tutorial-strip__reward[hidden]{display:none}
/* Incoming trade: persistent actionable notice directly under PDA/Character/Backpack. */
.perimeter-trade-notice{position:relative;display:flex;align-items:center;gap:7px;min-height:29px;padding:5px 8px;border-bottom:1px solid var(--ui-line-strong);background:linear-gradient(180deg,color-mix(in srgb,var(--ui-warning) 9%,var(--ui-bg-2)),var(--ui-bg-2));color:var(--ui-text);text-decoration:none;overflow:hidden}
.perimeter-trade-notice::before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--ui-warning);box-shadow:0 0 7px color-mix(in srgb,var(--ui-warning) 24%,transparent)}
.perimeter-trade-notice__label{flex:0 0 auto;color:var(--ui-warning);font:900 var(--ui-font-micro)/1 var(--ui-mono);letter-spacing:.05em}
.perimeter-trade-notice__text{min-width:0;overflow:hidden;font:800 var(--ui-font-secondary)/1.2 var(--ui-mono);text-overflow:ellipsis;white-space:nowrap}
.perimeter-trade-notice__action{flex:0 0 auto;margin-left:auto;color:var(--ui-accent);font:900 var(--ui-font-micro)/1 var(--ui-mono);white-space:nowrap}
.perimeter-trade-notice:is(:hover,:focus-visible){outline:0;background:linear-gradient(180deg,color-mix(in srgb,var(--ui-warning) 15%,var(--ui-bg-2)),var(--ui-surface-active));color:var(--ui-strong)}
/* Tutorial attention must never change the target element's positioning.
   In particular, movement arrows are absolutely positioned inside the map. */
.tutorial-attention{
  outline:2px solid color-mix(in srgb,var(--ui-accent) 88%,transparent);
  outline-offset:-2px;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 34%,transparent),
    inset 0 0 12px color-mix(in srgb,var(--ui-accent) 18%,transparent),
    0 0 7px color-mix(in srgb,var(--ui-accent) 56%,transparent),
    0 0 16px color-mix(in srgb,var(--ui-accent) 34%,transparent);
  animation:perimeterTutorialPulse 1s ease-in-out infinite;
}
/* Map arrows keep their approved artwork-only geometry. Glow the artwork, not a moved button box. */
.game .map .dir.tutorial-attention{
  outline:0;
  box-shadow:none;
  filter:
    drop-shadow(0 0 2px color-mix(in srgb,var(--ui-accent) 100%,transparent))
    drop-shadow(0 0 7px color-mix(in srgb,var(--ui-accent) 88%,transparent))
    drop-shadow(0 0 13px color-mix(in srgb,var(--ui-accent) 62%,transparent))
    brightness(1.5);
}
@keyframes perimeterTutorialPulse{
  0%,100%{outline-color:color-mix(in srgb,var(--ui-accent) 72%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 28%,transparent),inset 0 0 9px color-mix(in srgb,var(--ui-accent) 13%,transparent),0 0 6px color-mix(in srgb,var(--ui-accent) 42%,transparent),0 0 12px color-mix(in srgb,var(--ui-accent) 24%,transparent)}
  50%{outline-color:var(--ui-accent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 58%,transparent),inset 0 0 16px color-mix(in srgb,var(--ui-accent) 28%,transparent),0 0 10px color-mix(in srgb,var(--ui-accent) 82%,transparent),0 0 22px color-mix(in srgb,var(--ui-accent) 48%,transparent)}
}
@keyframes perimeterTutorialArrowPulse{
  0%,100%{filter:drop-shadow(0 0 2px color-mix(in srgb,var(--ui-accent) 92%,transparent)) drop-shadow(0 0 6px color-mix(in srgb,var(--ui-accent) 66%,transparent)) brightness(1.28)}
  50%{filter:drop-shadow(0 0 3px var(--ui-accent)) drop-shadow(0 0 10px color-mix(in srgb,var(--ui-accent) 95%,transparent)) drop-shadow(0 0 18px color-mix(in srgb,var(--ui-accent) 68%,transparent)) brightness(1.72)}
}
.game .map .dir.tutorial-attention{animation:perimeterTutorialArrowPulse .9s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){
  .tutorial-attention{animation:none}
  .game .map .dir.tutorial-attention{animation:none;filter:drop-shadow(0 0 3px var(--ui-accent)) drop-shadow(0 0 10px color-mix(in srgb,var(--ui-accent) 82%,transparent)) brightness(1.5)}
}
@media(max-width:480px){.perimeter-tutorial-strip{gap:4px 5px;min-height:26px;padding:4px 6px}.perimeter-tutorial-strip__label{font-size:var(--ui-font-micro)}.perimeter-tutorial-strip__text{flex-basis:calc(100% - 72px)}.perimeter-tutorial-strip__reward{flex-basis:100%;margin-left:0;padding:3px 0 0 0;border-left:0;border-top:1px solid color-mix(in srgb,var(--ui-good) 32%,var(--ui-line));text-align:left}}
@media(max-width:480px){.perimeter-trade-notice{gap:5px;min-height:27px;padding:4px 6px}.perimeter-trade-notice__action{font-size:var(--ui-font-micro)}}


/* V417 tutorial modal: the JS overlay exists, but V412 had no CSS for it. */
body.tutorial-modal-open{overflow:hidden}
body.tutorial-modal-open .perimeter-global-footer{visibility:hidden!important;pointer-events:none!important}
.perimeter-tutorial-modal[hidden]{display:none!important}
.perimeter-tutorial-modal{
  position:fixed;
  inset:0;
  z-index:12000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:clamp(10px,2.4vw,18px);
  background:rgba(0,0,0,.68);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
  opacity:0;
  pointer-events:none;
  transition:opacity .16s ease;
}
.perimeter-tutorial-modal.is-open{opacity:1;pointer-events:auto}
.perimeter-tutorial-modal__dialog{
  width:min(calc(100% - 8px),700px);
  max-height:calc(100dvh - 24px);
  overflow:auto;
  overscroll-behavior:contain;
  margin:0 auto;
  border:1px solid var(--ui-line-strong);
  border-radius:0;
  background:linear-gradient(180deg,var(--ui-bg-2),color-mix(in srgb,var(--ui-bg-2) 78%,black));
  box-shadow:0 12px 38px rgba(0,0,0,.55), inset 0 1px 0 color-mix(in srgb,var(--ui-accent) 16%,transparent);
  color:var(--ui-text);
  padding:12px 14px 14px;
  transform:translateY(10px);
  transition:transform .16s ease, opacity .16s ease;
  opacity:.98;
}
.perimeter-tutorial-modal.is-open .perimeter-tutorial-modal__dialog{transform:translateY(0)}
.perimeter-tutorial-modal__eyebrow{
  margin:0 0 8px;
  color:var(--ui-muted);
  font:900 var(--ui-font-micro)/1.2 var(--ui-mono);
  letter-spacing:.05em;
  text-transform:uppercase;
}
.perimeter-tutorial-modal__title{
  margin:0 0 10px;
  color:var(--ui-strong);
  font:900 clamp(24px,var(--ui-font-title),32px)/1.05 var(--ui-mono);
  letter-spacing:.01em;
}
.perimeter-tutorial-modal__text{
  margin:0;
  color:var(--ui-text);
  font:400 clamp(18px,var(--ui-font-secondary),24px)/1.4 var(--ui-sans);
  overflow-wrap:anywhere;
}
.perimeter-tutorial-modal__reward{
  margin:12px 0 0;
  padding-top:10px;
  border-top:1px solid color-mix(in srgb,var(--ui-good) 32%,var(--ui-line));
  color:var(--ui-good);
  font:900 var(--ui-font-secondary)/1.35 var(--ui-mono);
  letter-spacing:.025em;
  text-transform:uppercase;
}
.perimeter-tutorial-modal__reward[hidden]{display:none}
.perimeter-tutorial-modal__action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:140px;
  min-height:44px;
  margin:14px 0 0;
}
@media(min-width:721px){
  .perimeter-tutorial-modal{align-items:center}
  .perimeter-tutorial-modal__dialog{width:min(calc(100% - 24px),620px)}
}
@media(max-width:480px){
  .perimeter-tutorial-modal{padding:8px;align-items:center}
  .perimeter-tutorial-modal__dialog{width:100%;max-height:calc(100dvh - 16px);padding:11px 12px 13px}
  .perimeter-tutorial-modal__title{font-size:var(--ui-font-title);line-height:1.08}
  .perimeter-tutorial-modal__text{font-size:var(--ui-font-secondary);line-height:1.42}
  .perimeter-tutorial-modal__action{width:100%;min-height:46px}
}

/* Global level-up notification: shown by the unified header after any real level increase. */
.perimeter-level-up-toast{position:fixed;z-index:10050;left:50%;top:max(10px,env(safe-area-inset-top));transform:translate(-50%,-12px);width:min(calc(100% - 20px),680px);box-sizing:border-box;padding:9px 12px;border:1px solid color-mix(in srgb,var(--ui-accent) 68%,var(--ui-line));background:linear-gradient(180deg,color-mix(in srgb,var(--ui-accent) 12%,var(--ui-bg-2)),color-mix(in srgb,var(--ui-bg-2) 96%,#000));color:var(--ui-strong);font:800 var(--ui-font-secondary)/1.35 var(--ui-mono);letter-spacing:.01em;text-align:center;box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-accent) 16%,transparent) inset,0 0 18px color-mix(in srgb,var(--ui-accent) 24%,transparent);opacity:0;pointer-events:none;transition:opacity .22s ease,transform .22s ease}
.perimeter-level-up-toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:480px){.perimeter-level-up-toast{width:calc(100% - 12px);padding:8px 9px;font-size:var(--ui-font-secondary)}}
@media(prefers-reduced-motion:reduce){.perimeter-level-up-toast{transition:none}}


/* Tutorial precision targets: battle attack is danger/red; perk controls use a stronger theme glow. */
.tutorial-attention--strong{
  outline-width:3px;
  outline-color:var(--ui-accent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 64%,transparent),inset 0 0 16px color-mix(in srgb,var(--ui-accent) 28%,transparent),0 0 10px color-mix(in srgb,var(--ui-accent) 90%,transparent),0 0 24px color-mix(in srgb,var(--ui-accent) 58%,transparent);
}
body[data-battle-ui="1"] #enemyAttack.tutorial-attention--danger{
  outline:2px solid var(--ui-danger);
  outline-offset:-2px;
  background:color-mix(in srgb,var(--ui-danger) 10%,transparent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-danger) 72%,transparent),inset 0 0 14px color-mix(in srgb,var(--ui-danger) 24%,transparent),0 0 9px color-mix(in srgb,var(--ui-danger) 96%,transparent),0 0 22px color-mix(in srgb,var(--ui-danger) 64%,transparent);
  animation:perimeterTutorialDangerPulse .82s ease-in-out infinite;
}
body[data-battle-ui="1"] #enemyAttack.tutorial-attention--danger>span:first-child{
  min-width:30px;
  border:1px solid color-mix(in srgb,var(--ui-danger) 90%,var(--ui-line));
  background:color-mix(in srgb,var(--ui-danger) 14%,var(--ui-bg));
  color:var(--ui-strong);
  box-shadow:0 0 8px color-mix(in srgb,var(--ui-danger) 92%,transparent),0 0 17px color-mix(in srgb,var(--ui-danger) 56%,transparent);
}
body[data-battle-ui="1"] .tutorial-battle-enemy{border-color:color-mix(in srgb,var(--ui-danger) 72%,var(--ui-line))}
@keyframes perimeterTutorialDangerPulse{
  0%,100%{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-danger) 58%,transparent),inset 0 0 10px color-mix(in srgb,var(--ui-danger) 17%,transparent),0 0 7px color-mix(in srgb,var(--ui-danger) 72%,transparent),0 0 14px color-mix(in srgb,var(--ui-danger) 42%,transparent)}
  50%{box-shadow:inset 0 0 0 1px var(--ui-danger),inset 0 0 18px color-mix(in srgb,var(--ui-danger) 34%,transparent),0 0 12px var(--ui-danger),0 0 28px color-mix(in srgb,var(--ui-danger) 72%,transparent)}
}
@media(prefers-reduced-motion:reduce){body[data-battle-ui="1"] #enemyAttack.tutorial-attention--danger{animation:none}}


@layer chrome {
/* SERVICE UI V24 — unified Trade / Quests / Personal Stash chrome and item-grid contract. */
.service-ui-page{
  background:var(--ui-bg-2);
  color:var(--ui-text);
}
.service-ui-local-header[data-page-local-header="1"]{
  min-height:var(--ui-local-header-h);
  height:var(--ui-local-header-h);
  max-height:var(--ui-local-header-h);
  background:linear-gradient(180deg,var(--ui-gloss),transparent 55%),var(--ui-surface);
  border-bottom:1px solid var(--ui-line-strong);
  box-shadow:inset 0 1px var(--ui-gloss);
}
.service-ui-local-header[data-page-local-header="1"] :is(.title,h1){
  color:var(--ui-strong);
  font-size:var(--ui-font-page);
  font-weight:900;
}
.service-ui-tabs{
  width:100%;
  height:34px;
  min-height:34px;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  margin:0;
  padding:0;
  border:0;
  border-bottom:1px solid var(--ui-line);
  border-radius:0;
  overflow:visible;
  background:var(--ui-bg-2);
}
.service-ui-tab{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  width:100%;
  height:34px;
  min-height:34px;
  margin:0;
  padding:0 8px;
  border:0;
  border-right:1px solid var(--ui-line);
  border-radius:0;
  background:transparent;
  color:var(--ui-muted);
  font:900 var(--ui-font-base)/1 var(--ui-mono);
  text-transform:uppercase;
  box-shadow:none;
  white-space:nowrap;
}
.service-ui-tab:last-child{border-right:0}
.service-ui-tab > span,
.service-ui-tab-count{
  display:inline;
  min-width:0;
  height:auto;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:inherit;
  font:900 var(--ui-font-micro)/1 var(--ui-mono);
  box-shadow:none;
}
.service-ui-tab.active,
.service-ui-tab[aria-selected="true"]{
  background:color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg));
  color:var(--ui-accent);
  box-shadow:none;
}
.service-ui-tab.active::after,
.service-ui-tab[aria-selected="true"]::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:1px;
  background:var(--ui-accent);
}
.service-ui-tab:is(:hover,:focus-visible){
  outline:0;
  color:var(--ui-strong);
  background:color-mix(in srgb,var(--ui-accent) 9%,var(--ui-bg));
}
.service-ui-notice{
  min-height:30px;
  display:flex;
  align-items:center;
  margin:0;
  padding:5px 8px;
  border:0;
  border-bottom:1px solid var(--ui-line);
  border-radius:0;
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3%,transparent),transparent 82%),var(--ui-bg-2);
  color:var(--ui-muted);
  font:500 var(--ui-font-base)/1.25 var(--ui-font);
  box-shadow:none;
}
.service-ui-notice.success,
.service-ui-notice.ok{color:var(--ui-good);background:color-mix(in srgb,var(--ui-good) 5%,var(--ui-bg-2))}
.service-ui-notice.error{color:var(--ui-danger);background:color-mix(in srgb,var(--ui-danger) 5%,var(--ui-bg-2))}
.service-ui-section-head{
  width:100%;
  height:30px;
  min-height:30px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin:0;
  padding:0 8px;
  border:0;
  border-bottom:1px solid var(--ui-line);
  border-radius:0;
  background:linear-gradient(180deg,var(--ui-gloss),transparent 60%),var(--ui-surface);
  box-shadow:inset 0 1px rgba(255,255,255,.025);
}
.service-ui-section-head > strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--ui-strong);
  font:900 var(--ui-font-section)/1 var(--ui-mono);
  letter-spacing:.035em;
  text-transform:uppercase;
}
.service-ui-section-head > span{
  flex:0 0 auto;
  max-width:58%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--ui-accent);
  font:900 var(--ui-font-base)/1 var(--ui-mono);
  text-align:right;
}
.service-ui-stage{
  position:relative;
  width:100%;
  overflow:visible;
  padding:4px;
  background:var(--ui-bg);
  border-bottom:1px solid var(--ui-line);
}
.service-ui-grid{
  position:relative;
  width:100%;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:4px;
  padding:0;
  background:transparent;
  overflow:hidden;
}
.service-ui-cell{
  position:relative;
  width:100%;
  min-width:0;
  max-width:100%;
  aspect-ratio:1/1;
  margin:0;
  padding:0;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--ui-line-strong) 88%,transparent);
  border-radius:2px;
  background:
    radial-gradient(ellipse at 50% 46%,
      color-mix(in srgb,var(--ui-accent) 7%,transparent) 0%,
      color-mix(in srgb,var(--ui-accent) 3.5%,transparent) 42%,
      transparent 70%),
    radial-gradient(ellipse at center,transparent 48%,rgba(0,0,0,.34) 100%),
    var(--ui-bg-2);
  color:var(--ui-text);
  text-align:left;
  box-shadow:
    inset 0 0 22px rgba(0,0,0,.34),
    inset 0 0 0 1px color-mix(in srgb,var(--ui-line) 24%,transparent),
    inset 0 1px 0 rgba(255,255,255,.025),
    0 0 0 1px rgba(0,0,0,.24);
}
.service-ui-cell::after{
  content:"";
  position:absolute;
  inset:2px;
  z-index:4;
  display:block;
  border:1px solid color-mix(in srgb,var(--ui-line) 20%,transparent);
  pointer-events:none;
}
.service-ui-cell-icon{
  position:absolute;
  inset:12% 13% 25%;
  z-index:1;
  display:grid;
  place-items:center;
  min-width:0;
  overflow:hidden;
  background:
    radial-gradient(circle at center,
      color-mix(in srgb,var(--ui-accent) 11%,transparent) 0%,
      color-mix(in srgb,var(--ui-accent) 6%,transparent) 44%,
      color-mix(in srgb,var(--ui-accent) 2.2%,transparent) 64%,
      transparent 84%);
}
.service-ui-cell-icon::before{display:none;content:none;border:0;background:none}
.service-ui-cell-icon img{
  position:relative;
  z-index:2;
  display:block;
  max-width:88%;
  max-height:88%;
  width:auto;
  height:auto;
  object-fit:contain;
  filter:brightness(.86) saturate(.72) drop-shadow(0 2px 3px rgba(0,0,0,.72));
}
.service-ui-cell-qty,
.service-ui-cell-meta{
  position:absolute;
  top:3px;
  z-index:6;
  padding:1px 3px;
  background:rgba(0,0,0,.68);
  font:900 var(--ui-font-micro)/1 var(--ui-mono);
  white-space:nowrap;
  box-shadow:none;
}
.service-ui-cell-qty{left:3px;color:var(--ui-strong)}
.service-ui-cell-meta{right:3px;color:var(--ui-accent);font-size:var(--ui-font-micro)}
.service-ui-cell-caption{
  position:absolute;
  left:2px;
  right:2px;
  bottom:2px;
  z-index:5;
  height:23%;
  min-height:20px;
  display:flex;
  align-items:center;
  padding:2px 3px;
  background:transparent;
  overflow:hidden;
}
.service-ui-name-window{
  display:block;
  width:100%;
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  color:var(--ui-accent);
  font-family:var(--ui-mono);
  font-size:var(--ui-font-name);
  font-weight:900;
  line-height:1.05;
  letter-spacing:.02em;
  text-shadow:0 1px 2px rgba(0,0,0,1),0 0 5px rgba(0,0,0,.98),0 0 9px rgba(0,0,0,.76);
}
.service-ui-cell:is(:focus-visible,:active),
.service-ui-cell.selected{
  outline:0;
  border-color:color-mix(in srgb,var(--ui-accent) 40%,var(--ui-line-strong));
  box-shadow:
    inset 0 0 24px rgba(0,0,0,.30),
    inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 16%,transparent),
    0 0 7px color-mix(in srgb,var(--ui-accent) 5%,transparent);
}
@media(hover:hover){
  .service-ui-cell:hover{
    border-color:color-mix(in srgb,var(--ui-accent) 28%,var(--ui-line-strong));
    box-shadow:
      inset 0 0 23px rgba(0,0,0,.32),
      inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 12%,transparent),
      0 0 6px color-mix(in srgb,var(--ui-accent) 4%,transparent);
  }
}
@media(max-width:480px){
  .service-ui-local-header[data-page-local-header="1"] :is(.title,h1){font-size:var(--ui-font-page)}
  .service-ui-stage{padding:3px}
  .service-ui-grid{gap:3px}
  .service-ui-cell-icon{inset:14% 14% 26%}
  .service-ui-cell-icon img{max-width:84%;max-height:84%}
  .service-ui-cell-caption{height:24%;min-height:18px;padding:2px}
  .service-ui-section-head{padding-inline:6px;gap:5px}
}
}

@layer chrome {
/* MODAL V30 — every true modal follows the canonical working width (700px max).
   Desktop: exactly the same width as .project-root. Phones: exactly the same
   viewport binding as the project shell, with the current --ui-edge gutters. */
:where(dialog[open],[role="dialog"][aria-modal="true"]){
  box-sizing:border-box;
  width:min(calc(100vw - (var(--ui-edge) * 2)),var(--ui-page-max));
  max-width:var(--ui-page-max);
  min-width:0;
  margin-inline:auto;
}
:where([role="dialog"][aria-modal="true"]){
  max-height:calc(100vh - (var(--ui-edge) * 2));
  max-height:calc(100dvh - (var(--ui-edge) * 2));
}
:where(.trade-modal,.stash-modal,.equipment-modal,.loot-modal){
  padding-left:0;
  padding-right:0;
}
body.route-pages-game-look-sector .loot-modal{
  justify-items:center;
}
@media(max-width:700px){
  :where(dialog[open],[role="dialog"][aria-modal="true"]){
    width:calc(100vw - (var(--ui-edge) * 2));
    max-width:calc(100vw - (var(--ui-edge) * 2));
  }
}
}


@layer chrome {
/* MODAL V31 — action labels never wrap. Hyphenated labels such as КОЛ-ВО
   must stay on one line on desktop and phones; width is allocated by layout,
   not by breaking the word. */
:where(.trade-modal-card,.stash-modal-card,.equipment-modal-card,.loot-modal-panel,.inventory-dialog)
  :where(label,button,.btn,.dialog-btn,.bulk-action,.entity-action,.row-action,.pickup-one){
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
}
:where(.trade-modal-card .trade-stat-row,.stash-modal-card .stash-stat-row)
  > :first-child{
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
}
}

@layer chrome {
/* PERIMETER FIELD UI V1 — shared visual language for Trade / Stash / Backpack.
   This layer only unifies chrome and item-grid presentation; route mechanics stay untouched. */
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-page{
  background:
    linear-gradient(180deg,color-mix(in srgb,var(--ui-accent) 1.8%,transparent),transparent 180px),
    var(--ui-bg-2);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-tabs{
  background:
    linear-gradient(180deg,var(--ui-gloss),transparent 58%),
    var(--ui-bg-2);
  border-bottom-color:var(--ui-line-strong);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-tab{
  background:linear-gradient(180deg,var(--ui-gloss),transparent 62%);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-tab:is(.active,[aria-selected="true"]){
  background:
    linear-gradient(180deg,var(--ui-gloss-strong),transparent 58%),
    color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg));
  box-shadow:inset 0 -2px color-mix(in srgb,var(--ui-accent) 74%,transparent);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-tab:is(.active,[aria-selected="true"])::after{display:none}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-notice{
  position:relative;
  padding-left:11px;
  background:
    linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 4%,transparent),transparent 78%),
    var(--ui-bg-2);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-notice::before{
  content:"";
  position:absolute;
  left:0;top:0;bottom:0;
  width:2px;
  background:color-mix(in srgb,var(--ui-accent) 52%,transparent);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-section-head{
  position:relative;
  padding-left:11px;
  border-bottom-color:var(--ui-line-strong);
  background:
    linear-gradient(180deg,var(--ui-gloss),transparent 58%),
    repeating-linear-gradient(135deg,
      color-mix(in srgb,var(--ui-accent) 5%,var(--ui-surface)) 0 8px,
      var(--ui-surface) 8px 16px);
  box-shadow:inset 0 1px rgba(255,255,255,.025);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-section-head::before{
  content:"";
  position:absolute;
  left:0;top:0;bottom:0;
  width:2px;
  background:color-mix(in srgb,var(--ui-accent) 60%,transparent);
  box-shadow:0 0 6px color-mix(in srgb,var(--ui-accent) 12%,transparent);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-stage{
  padding:4px;
  border-bottom-color:var(--ui-line-strong);
  background:
    radial-gradient(ellipse at 50% 0,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 58%),
    linear-gradient(180deg,var(--ui-bg),var(--ui-bg-2));
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--ui-line) 28%,transparent);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-cell{
  border-radius:0;
  border-color:color-mix(in srgb,var(--ui-line-strong) 94%,transparent);
  background:
    radial-gradient(ellipse at 50% 44%,
      color-mix(in srgb,var(--ui-accent) 8%,transparent) 0%,
      color-mix(in srgb,var(--ui-accent) 3.6%,transparent) 42%,
      transparent 70%),
    linear-gradient(180deg,rgba(255,255,255,.018),transparent 48%),
    radial-gradient(ellipse at center,transparent 47%,rgba(0,0,0,.38) 100%),
    var(--ui-bg-2);
  box-shadow:
    inset 0 0 20px rgba(0,0,0,.32),
    inset 0 1px rgba(255,255,255,.022);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-cell::after{
  inset:3px;
  border-color:color-mix(in srgb,var(--ui-line) 24%,transparent);
}
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-cell:is(:focus-visible,:active,.selected){
  border-color:color-mix(in srgb,var(--ui-accent) 48%,var(--ui-line-strong));
  box-shadow:
    inset 2px 0 color-mix(in srgb,var(--ui-accent) 54%,transparent),
    inset 0 0 22px rgba(0,0,0,.28),
    inset 0 0 0 1px color-mix(in srgb,var(--ui-accent) 12%,transparent),
    0 0 7px color-mix(in srgb,var(--ui-accent) 5%,transparent);
}
@media(hover:hover){
  :is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-cell:hover{
    border-color:color-mix(in srgb,var(--ui-accent) 32%,var(--ui-line-strong));
    background:
      radial-gradient(ellipse at 50% 44%,color-mix(in srgb,var(--ui-accent) 10%,transparent),color-mix(in srgb,var(--ui-accent) 4.5%,transparent) 42%,transparent 72%),
      linear-gradient(180deg,rgba(255,255,255,.022),transparent 48%),
      radial-gradient(ellipse at center,transparent 47%,rgba(0,0,0,.36) 100%),
      var(--ui-bg-2);
  }
}
/* Trade offer/exchange uses a compact fixed five-cell desktop row.
   This lives in chrome because the canonical .service-ui-grid is chrome-owned;
   route-layer rules cannot override the generic four-column contract. */
body.trade-offer-page .trade-slot-board.service-ui-grid,
body.trade-exchange-page :is(.trade-offer-slots,.trade-slot-board).service-ui-grid{
  grid-template-columns:repeat(5,100px);
  justify-content:center;
  gap:4px;
}
body.trade-offer-page .trade-slot.service-ui-cell,
body.trade-exchange-page :is(.trade-offer-slot,.trade-slot).service-ui-cell{
  width:100px;
  max-width:100px;
}
@media(max-width:560px){
  body.trade-offer-page .trade-slot-board.service-ui-grid,
  body.trade-exchange-page :is(.trade-offer-slots,.trade-slot-board).service-ui-grid{
    grid-template-columns:repeat(5,minmax(0,1fr));
    justify-content:stretch;
    gap:3px;
  }
  body.trade-offer-page .trade-slot.service-ui-cell,
  body.trade-exchange-page :is(.trade-offer-slot,.trade-slot).service-ui-cell{
    width:100%;
    max-width:none;
  }
}
@media(max-width:480px){
  :is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-stage{padding:3px}
  :is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-section-head{padding-left:9px}
}
}


/* V162 — unified action notifications, always readable above/inside modals. */
@layer components {
  .ui-notification{display:flex;align-items:flex-start;gap:7px;min-width:0;white-space:pre-line}
  .ui-notification-icon{flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:#e5b93f;filter:drop-shadow(0 1px 1px rgba(0,0,0,.55))}
  .ui-notification-icon svg{display:block;width:18px;height:18px;overflow:visible}
  .ui-notification-icon svg path:first-child{fill:#e5b93f;stroke:#f3d86f;stroke-width:.8;stroke-linejoin:round}
  .ui-notification-icon svg path:nth-child(2),.ui-notification-icon svg circle{fill:none;stroke:#171407;stroke-width:2.2;stroke-linecap:round}
  .ui-notification-text{min-width:0;flex:1 1 auto;overflow-wrap:anywhere;white-space:pre-line}
  .ui-modal-notice{margin:0;padding:7px 9px;border:0;border-bottom:1px solid var(--ui-line-strong);background:linear-gradient(90deg,color-mix(in srgb,#e5b93f 7%,transparent),transparent 72%),var(--ui-bg-2);color:var(--ui-strong);font:800 var(--ui-font-secondary)/1.35 var(--ui-mono)}
  .ui-modal-notice.error,.ui-modal-notice.err{color:var(--ui-danger);border-bottom-color:color-mix(in srgb,var(--ui-danger) 58%,var(--ui-line-strong))}
  .ui-modal-notice.success,.ui-modal-notice.ok{color:var(--ui-strong)}
  .toast.ui-notification{align-items:flex-start;white-space:pre-line}
}

@layer utilities {
/* Global unread indicators: PDA messages and project news. */
.perimeter-nav-alert{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border:0;border-radius:999px;background:var(--ui-danger);color:var(--ui-strong);font:900 var(--ui-font-micro)/1 var(--ui-mono);text-shadow:0 1px 2px rgba(0,0,0,.9);box-shadow:0 1px 3px rgba(0,0,0,.55);flex:0 0 auto}
.perimeter-nav-alert[hidden]{display:none}
.perimeter-footer-news-link{display:inline-flex;align-items:center;gap:4px}
.perimeter-footer-alert{display:inline-grid;place-items:center;min-width:16px;height:16px;padding:0 3px;border:0;border-radius:999px;background:var(--ui-danger);color:var(--ui-strong);font:900 var(--ui-font-micro)/1 var(--ui-mono);text-shadow:0 1px 2px rgba(0,0,0,.9);box-shadow:0 1px 2px rgba(0,0,0,.5)}
.perimeter-footer-alert[hidden]{display:none}
}


/* V176 UI integrity cleanup — readable mobile typography, safe wrapping and motion accessibility. */
@layer utilities {
  .project-root :where(p,li,td,th,label,.runtime-alert,.runtime-notice,.ui-notification-text){overflow-wrap:anywhere;word-break:normal}
  .project-root :where(pre,code){max-width:100%;overflow-wrap:anywhere;white-space:pre-wrap}
  @media(prefers-reduced-motion:reduce){
    body *,body *::before,body *::after{scroll-behavior:auto !important;transition-duration:.001ms !important;animation-duration:.001ms !important;animation-iteration-count:1 !important}
  }
  body[data-ui-reduce-motion="1"] *,body[data-ui-reduce-motion="1"] *::before,body[data-ui-reduce-motion="1"] *::after{scroll-behavior:auto !important;transition-duration:.001ms !important;animation-duration:.001ms !important;animation-iteration-count:1 !important}
}


@layer utilities {
/* V182 — one local page header contract on every route that uses data-page-local-header. */
.ui-local-header[data-page-local-header="1"]{
  box-sizing:border-box!important;
  grid-template-columns:34px minmax(0,1fr) auto!important;
  width:100%!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  overflow:hidden;
}
.ui-local-header[data-page-local-header="1"] > :is(.back,.section-back,.chat-back,.account-pda-back,.admin-menu-button):first-child,
.ui-local-header[data-page-local-header="1"] > a:first-child:not(.top-new-topic){
  box-sizing:border-box!important;align-self:stretch!important;justify-self:stretch!important;
  width:34px!important;min-width:34px!important;max-width:34px!important;
  height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0!important;border:0!important;border-right:1px solid var(--ui-line-strong)!important;
  display:grid!important;place-items:center!important;
}
.ui-local-header[data-page-local-header="1"] > .ui-local-header-actions{
  box-sizing:border-box!important;align-self:stretch!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  min-width:34px!important;margin:0!important;padding:0!important;border-left:1px solid var(--ui-line-strong)!important;
  display:flex!important;align-items:stretch!important;justify-content:flex-end!important;
}
.ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.search-toggle,.look-home){
  box-sizing:border-box!important;width:34px!important;min-width:34px!important;max-width:34px!important;
  height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;border:0!important;
  display:grid!important;place-items:center!important;
}
.ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > * + *{border-left:1px solid var(--ui-line)!important}
.ui-local-header[data-page-local-header="1"] > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.look-home,a.game):last-child{
  box-sizing:border-box!important;align-self:stretch!important;justify-self:stretch!important;width:34px!important;min-width:34px!important;max-width:34px!important;
  height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;
  display:grid!important;place-items:center!important;
}
.ui-local-header[data-page-local-header="1"] > :is(.title,.heading,.section-heading,.page-title,.account-pda-title,.strategic-management-title),
.ui-local-header[data-page-local-header="1"] > h1{
  box-sizing:border-box!important;align-self:stretch!important;height:34px!important;min-height:34px!important;margin:0!important;
  display:flex!important;align-items:center!important;min-width:0!important;padding:0 8px!important;
}
}


/* V188 — FINAL LOCAL HEADER CONTRACT.
   Every route with data-page-local-header uses the same 34px chrome.
   The 34px cell is clickable; the visible back/home glyph remains 20px. */
@layer chrome {
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]{
  box-sizing:border-box!important;display:grid!important;grid-template-columns:34px minmax(0,1fr) auto!important;align-items:stretch!important;
  width:100%!important;height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;gap:0!important;
  border:0!important;border-bottom:1px solid var(--ui-line-strong)!important;border-radius:0!important;
  background:linear-gradient(180deg,var(--ui-gloss),transparent 52%),var(--ui-surface)!important;box-shadow:inset 0 1px var(--ui-gloss)!important;overflow:hidden!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.back,.section-back,.chat-back,.account-pda-back,.admin-menu-button,a.ui-back-button):first-child,
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > a:first-child:not(.top-new-topic){
  box-sizing:border-box!important;display:grid!important;place-items:center!important;align-self:stretch!important;justify-self:stretch!important;
  width:34px!important;min-width:34px!important;max-width:34px!important;height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;
  border:0!important;border-right:1px solid var(--ui-line-strong)!important;border-radius:0!important;background-color:transparent!important;background-position:center!important;background-size:20px 20px!important;background-repeat:no-repeat!important;box-shadow:none!important;filter:none!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.title,.heading,.section-heading,.page-title,.account-pda-title,.strategic-management-title,.top-title,.topbar-title,h1):nth-child(2){
  box-sizing:border-box!important;display:flex!important;align-items:center!important;align-self:stretch!important;min-width:0!important;width:auto!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0 8px!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;color:var(--ui-strong)!important;
  font:900 var(--ui-font-base)/1 var(--ui-mono)!important;letter-spacing:.035em!important;text-transform:none!important;text-shadow:0 1px 2px rgba(0,0,0,.92)!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions{
  box-sizing:border-box!important;display:flex!important;align-items:stretch!important;justify-content:flex-end!important;align-self:stretch!important;justify-self:end!important;
  width:auto!important;min-width:34px!important;height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;gap:0!important;
  border:0!important;border-left:1px solid var(--ui-line-strong)!important;background:transparent!important;box-shadow:none!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > :is(a,button,.icon-btn,.look-refresh,.look-home,.game-link,.ui-auto-game-link,.account-pda-game,.search-toggle),
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.look-home,a.game):last-child{
  box-sizing:border-box!important;display:grid!important;place-items:center!important;flex:0 0 34px!important;width:34px!important;min-width:34px!important;max-width:34px!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;color:var(--ui-accent)!important;box-shadow:none!important;text-decoration:none!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > * + *{border-left:1px solid var(--ui-line)!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] :is(a,button):is(:hover,:focus-visible){background:var(--ui-surface-active)!important;color:var(--ui-strong)!important;outline:0!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] :is(svg,.ui-back-icon){width:17px!important;height:17px!important;min-width:17px!important;min-height:17px!important;max-width:17px!important;max-height:17px!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] .look-header-weight{box-sizing:border-box!important;display:flex!important;align-items:center!important;height:34px!important;min-height:34px!important;margin:0!important;padding:0 8px!important;border:0!important;background:transparent!important;color:var(--ui-strong)!important;font:800 var(--ui-font-secondary)/1 var(--ui-mono)!important;white-space:nowrap!important;text-shadow:0 1px 2px rgba(0,0,0,.9)!important}
}

/* GAME: footer follows chat immediately; no empty spacer block between them. */
.game ~ .perimeter-global-footer{margin-top:0!important;padding-top:6px!important}

/* V188 marquee exception: item-cell name motion is a requested gameplay UI cue. */
@layer base {
@media(prefers-reduced-motion:reduce){
  body[data-service-page="trade"] .trade-name-track.is-marquee{
    animation-duration:var(--trade-marquee-time,8s)!important;
    animation-iteration-count:infinite!important;
  }
}
body[data-ui-reduce-motion="1"][data-service-page="trade"] .trade-name-track.is-marquee{
  animation-duration:var(--trade-marquee-time,8s)!important;
  animation-iteration-count:infinite!important;
}
}


/* V188 — GAME UI UNIFICATION CONTRACT.
   Older route CSS remains for compatibility, but shared chrome/section dimensions are canonical here. */
@layer chrome {
/* V667: keep the game, legacy and PDA shells on the same edge-aware grid as the shared footer. */
body[data-ui-theme] .project-root{box-sizing:border-box;width:100%;max-width:700px;margin:0 auto}
body[data-ui-theme] .project-root :is(.section-head,.service-ui-section-head,.pda-section-title,.faction-section-title,.pda-divider,.base-facilities-head){
  box-sizing:border-box;min-height:30px;margin:0;border-radius:0;border-top:0;border-bottom:1px solid var(--ui-line-strong);
  background:repeating-linear-gradient(135deg,color-mix(in srgb,var(--ui-accent) 4%,transparent) 0 8px,transparent 8px 16px),var(--ui-bg-2);
  color:var(--ui-strong);text-shadow:0 1px 2px rgba(0,0,0,.92)
}
body[data-ui-theme] .project-root :is(button,.runtime-btn,.btn,.action-btn,.faction-button){border-radius:0}
body[data-pda-subpage] .pda-page{width:100%!important;max-width:700px!important;margin:0 auto!important}
body[data-pda-subpage] .head-row.ui-local-header[data-page-local-header="1"]{height:34px!important;min-height:34px!important;max-height:34px!important}
body[data-pda-subpage] :is(.pda-section-title,.faction-section-title,.pda-divider){min-height:30px!important;padding:0 8px!important;display:flex!important;align-items:center!important}
body[data-pda-subpage] :is(.pda-toolbar,.pda-quest-tabs,.pda-user-tabs,.pda-profile-tabs){border-radius:0!important;margin:0!important}
body[data-pda-subpage] :is(.pda-menu-row,.pda-dialog-row,.pda-stalker-row,.pda-person-row,.rating-row,.faction-ledger-row){border-radius:0!important;margin:0!important;min-height:44px}
body.route-pages-game-backpack .backpack-section-tools{margin-right:0!important}
body.route-pages-game-backpack .backpack-section-tools .search-toggle{border-radius:0!important}
}

@layer components {
html.npc-repair-open,html.npc-repair-open body{overflow:hidden}
.npc-repair-modal[hidden]{display:none!important}
.npc-repair-modal{position:fixed;inset:0;z-index:12000;display:grid;place-items:center;padding:12px}
.npc-repair-backdrop{position:absolute;inset:0;width:100%;height:100%;border:0!important;background:rgba(0,0,0,.78)!important;backdrop-filter:blur(2px);cursor:default}
.npc-repair-card{position:relative;z-index:1;box-sizing:border-box;width:min(100%,700px);max-height:min(82dvh,660px);display:grid;grid-template-rows:34px minmax(0,1fr) 38px;overflow:hidden;border:1px solid var(--ui-line-strong);background:var(--ui-bg);box-shadow:0 18px 55px rgba(0,0,0,.88)}
.npc-repair-head{display:grid;grid-template-columns:minmax(0,1fr) 34px;align-items:center;border-bottom:1px solid var(--ui-line-strong);background:repeating-linear-gradient(135deg,color-mix(in srgb,var(--ui-accent) 4%,transparent) 0 8px,transparent 8px 16px),var(--ui-bg-2)}
.npc-repair-head strong{padding:0 9px;color:var(--ui-strong);font:900 var(--ui-font-base)/1 var(--ui-mono);text-shadow:0 1px 2px #000}
.npc-repair-head button{width:34px;height:34px;padding:0;border:0;border-left:1px solid var(--ui-line);border-radius:0;background:transparent;color:var(--ui-muted);font-size:18px}
.npc-repair-list{min-height:0;overflow:auto}
.npc-repair-row{display:grid;grid-template-columns:minmax(0,1fr) 92px;min-height:48px;border-bottom:1px solid var(--ui-line);background:var(--ui-bg-2)}
.npc-repair-row>span{min-width:0;display:flex;flex-direction:column;justify-content:center;padding:6px 9px}
.npc-repair-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ui-strong);font-size:var(--ui-font-base)}
.npc-repair-row small{margin-top:3px;color:var(--ui-muted);font:700 var(--ui-font-micro)/1 var(--ui-mono)}
.npc-repair-row button,.npc-repair-close{border:0;border-left:1px solid var(--ui-line);border-radius:0;background:var(--ui-surface);color:var(--ui-accent);font:900 var(--ui-font-secondary)/1 var(--ui-mono)}
.npc-repair-empty{padding:16px 9px;color:var(--ui-muted);text-align:center}
.npc-repair-close{height:38px;border-left:0;border-top:1px solid var(--ui-line-strong)}
@media(max-width:480px){.npc-repair-modal{padding:6px}.npc-repair-row{grid-template-columns:minmax(0,1fr) 82px}.npc-repair-row button{font-size:var(--ui-font-micro)}}
}


/* V188 phase 2 — hard unification with GAME.
   Empty/right-less legacy headers keep a 34px mirror cell; text/action headers may expand only on the right. */
@layer chrome {
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]{grid-template-columns:34px minmax(0,1fr) 34px!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]:has(>.ui-local-header-actions),
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]:has(>.auth-head-action),
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]:has(>.top-new-topic),
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]:has(>.landing-account){grid-template-columns:34px minmax(0,1fr) auto!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>span:empty:last-child,
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>.character-header-spacer:last-child{box-sizing:border-box!important;display:block!important;width:34px!important;min-width:34px!important;max-width:34px!important;height:34px!important;margin:0!important;padding:0!important;border-left:1px solid var(--ui-line-strong)!important;background:transparent!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>.auth-head-action,
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>.top-new-topic,
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>.landing-account{box-sizing:border-box!important;display:flex!important;align-items:center!important;justify-content:center!important;height:34px!important;min-height:34px!important;margin:0!important;padding:0 9px!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;border-radius:0!important;background:transparent!important;color:var(--ui-accent)!important;font:900 var(--ui-font-secondary)/1 var(--ui-mono)!important;text-decoration:none!important;text-shadow:0 1px 2px #000!important;white-space:nowrap!important}

body[data-pda-subpage] .pda-page :is(.pda-divider,.pda-section-title,.faction-section-title,.pda-toolbar,.pda-profile-split-title,.quest-progress-head),
body.route-pages-game-pda .pda-page :is(.pda-divider,.pda-section-title,.faction-section-title,.pda-toolbar,.pda-profile-split-title,.quest-progress-head){box-sizing:border-box!important;min-height:30px!important;margin:0!important;padding:4px 9px!important;border-radius:0!important}
body[data-pda-subpage] .pda-page :is(.pda-menu-row,.pda-stalker-row,.pda-dialog-row,.pda-person-row,.rating-row,.faction-ledger-row,.pda-combat-stat-row,.pda-quest-summary),
body.route-pages-game-pda .pda-page :is(.pda-menu-row,.pda-stalker-row,.pda-dialog-row,.pda-person-row,.rating-row,.faction-ledger-row,.pda-combat-stat-row,.pda-quest-summary){box-sizing:border-box!important;min-height:46px!important;margin:0!important;padding-top:5px!important;padding-bottom:5px!important;border-radius:0!important}
@media(max-width:560px){
 body[data-pda-subpage] .pda-page :is(.pda-divider,.pda-section-title,.faction-section-title,.pda-toolbar,.pda-profile-split-title,.quest-progress-head),body.route-pages-game-pda .pda-page :is(.pda-divider,.pda-section-title,.faction-section-title,.pda-toolbar,.pda-profile-split-title,.quest-progress-head){min-height:29px!important;padding-top:4px!important;padding-bottom:4px!important}
 body[data-pda-subpage] .pda-page :is(.pda-menu-row,.pda-stalker-row,.pda-dialog-row,.pda-person-row,.rating-row,.faction-ledger-row,.pda-combat-stat-row,.pda-quest-summary),body.route-pages-game-pda .pda-page :is(.pda-menu-row,.pda-stalker-row,.pda-dialog-row,.pda-person-row,.rating-row,.faction-ledger-row,.pda-combat-stat-row,.pda-quest-summary){min-height:44px!important}
}
}

/* V188 phase 3 — catch the remaining legacy header markup variants.
   The markup may call the title .issue-header-title, <strong>, <h1>, etc.;
   visually it is still the same GAME local header. */
@layer chrome {
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :nth-child(2):not(.ui-local-header-actions):not(.chat-head-actions){
  box-sizing:border-box!important;display:flex!important;align-items:center!important;align-self:stretch!important;min-width:0!important;width:auto!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0 8px!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;color:var(--ui-strong)!important;
  font:900 var(--ui-font-base)/1 var(--ui-mono)!important;letter-spacing:.035em!important;text-shadow:0 1px 2px rgba(0,0,0,.92)!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :nth-child(2) > :is(strong,b){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"] > :nth-child(2) > span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]:has(>.chat-head-actions){grid-template-columns:34px minmax(0,1fr) auto!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>.chat-head-actions{
  box-sizing:border-box!important;display:flex!important;align-items:stretch!important;justify-content:flex-end!important;height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;gap:0!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;background:transparent!important;
}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>.chat-head-actions>:is(a,button){box-sizing:border-box!important;display:grid!important;place-items:center!important;height:34px!important;min-height:34px!important;margin:0!important;border:0!important;border-radius:0!important;background:transparent!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>:is(div,span):empty:last-child{box-sizing:border-box!important;display:block!important;width:34px!important;min-width:34px!important;max-width:34px!important;height:34px!important;margin:0!important;padding:0!important;border-left:1px solid var(--ui-line-strong)!important;background:transparent!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>button:first-child,
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>span:first-child.landing-mark{box-sizing:border-box!important;display:grid!important;place-items:center!important;width:34px!important;min-width:34px!important;max-width:34px!important;height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;border:0!important;border-right:1px solid var(--ui-line-strong)!important;border-radius:0!important;background:transparent!important}
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>button:last-child:not(.auth-head-action),
body[data-ui-theme] .ui-local-header[data-page-local-header="1"]>a:last-child:not(.auth-head-action):not(.top-new-topic):not(.landing-account){box-sizing:border-box!important;display:grid!important;place-items:center!important;width:34px!important;min-width:34px!important;max-width:34px!important;height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;padding:0!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;border-radius:0!important;background:transparent!important}
}


/* V238 — global КПК / ПЕРСОНАЖ / РЮКЗАК outside GAME must stay visually identical to GAME. */
@layer chrome {
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav{
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  align-items:stretch!important;
  width:100%!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  gap:0!important;
  border:0!important;
  border-bottom:1px solid var(--ui-line-strong)!important;
  border-radius:0!important;
  background:var(--ui-bg-2)!important;
  box-shadow:none!important;
  overflow:hidden!important;
}
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a{
  box-sizing:border-box!important;
  appearance:none!important;
  -webkit-appearance:none!important;
  position:relative!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:5px!important;
  width:100%!important;
  min-width:0!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0 6px!important;
  border:0!important;
  border-right:1px solid var(--ui-line-strong)!important;
  border-radius:0!important;
  background:linear-gradient(180deg,var(--ui-gloss-strong),transparent 48%),var(--ui-surface)!important;
  color:var(--ui-strong)!important;
  font:800 var(--ui-font-base)/1 var(--ui-mono)!important;
  letter-spacing:.02em!important;
  text-align:center!important;
  text-decoration:none!important;
  box-shadow:inset 0 1px rgba(255,255,255,.025),inset 0 -1px color-mix(in srgb,var(--ui-accent) 8%,transparent)!important;
  overflow:hidden!important;
  white-space:nowrap!important;
  cursor:pointer!important;
  transform:none!important;
  filter:none!important;
}
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a:first-child,
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a:last-child{margin:0!important}
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a:last-child{border-right:0!important}
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a::after{content:none!important;display:none!important}
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a:is(:hover,:focus-visible,.active){
  outline:0!important;
  color:var(--ui-accent)!important;
  border-color:var(--ui-line-strong)!important;
  background:linear-gradient(180deg,var(--ui-gloss-strong),transparent 48%),color-mix(in srgb,var(--ui-accent) 8%,var(--ui-surface-active))!important;
  box-shadow:inset 0 -2px color-mix(in srgb,var(--ui-accent) 58%,transparent)!important;
  transform:none!important;
  filter:none!important;
}
body[data-ui-theme] .perimeter-global-header .perimeter-game-nav > a:active{
  transform:none!important;
  box-shadow:inset 0 -2px color-mix(in srgb,var(--ui-accent) 58%,transparent)!important;
}
body[data-ui-theme] .perimeter-global-header .perimeter-nav-device-state{color:var(--ui-muted)!important}
}

/* V272 stalker guide service */
.npc-dialog-page .npc-guide-offer{display:grid;gap:6px}
.npc-dialog-page .npc-guide-offer>strong{color:var(--ui-accent);font-size:var(--ui-font-section);font-weight:900}
.npc-dialog-page .npc-guide-offer>.row{display:grid;grid-template-columns:minmax(78px,.42fr) minmax(0,1fr);gap:8px;align-items:start;padding:4px 0;border-bottom:1px solid var(--ui-line);font-size:var(--ui-font-secondary)}
.npc-dialog-page .npc-guide-offer>.row:last-of-type{border-bottom:0}
.npc-dialog-page .npc-guide-offer>.row span{color:var(--ui-muted)}
.npc-dialog-page .npc-guide-offer>.row b{min-width:0;color:var(--ui-strong);font-weight:800;overflow-wrap:anywhere;text-align:right}
.npc-dialog-page .npc-guide-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:2px}
.npc-dialog-page .npc-guide-actions .btn{min-width:0;height:34px}
@media(max-width:480px){.npc-dialog-page .npc-guide-offer>.row{grid-template-columns:72px minmax(0,1fr);gap:6px}.npc-dialog-page .npc-guide-actions{gap:5px}}

/* V314 — compact cookie preference bar. */
@layer components {
.perimeter-cookie-banner{
  position:fixed;
  left:50%;
  bottom:max(6px,env(safe-area-inset-bottom));
  z-index:9998;
  width:min(684px,calc(100vw - 12px));
  transform:translateX(-50%);
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  align-items:center;
  padding:8px 9px;
  border:1px solid var(--ui-line-strong,var(--ui-line));
  /* V317: use an always-defined opaque theme surface. The old --ui-panel
     token did not exist, so the whole background declaration became invalid
     and the banner rendered transparent on affected browsers/WebViews. */
  background:var(--ui-bg-2,#070a08);
  background-image:linear-gradient(180deg,var(--ui-gloss-strong,rgba(255,255,255,.04)),transparent 52%);
  opacity:1;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  box-shadow:0 6px 18px rgba(0,0,0,.72);
  overflow:hidden;
}
.perimeter-cookie-banner[hidden]{display:none!important}
.perimeter-cookie-copy{min-width:0;display:grid;grid-template-columns:auto 1fr;column-gap:7px;row-gap:2px;align-items:baseline}
.perimeter-cookie-copy b{color:var(--ui-strong);font-size:13px!important;line-height:1.15;letter-spacing:.02em;white-space:nowrap}
.perimeter-cookie-copy span{min-width:0;color:var(--ui-text);font-size:11px!important;line-height:1.25;overflow-wrap:anywhere}
.perimeter-cookie-copy a{grid-column:1/-1;justify-self:start;color:var(--ui-accent);font-size:10px!important;line-height:1.1;font-weight:800;text-decoration:none}
.perimeter-cookie-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;min-width:300px}
.perimeter-cookie-actions .ui-btn{box-sizing:border-box;min-width:0;min-height:32px;height:32px;padding:4px 7px;font-size:10px!important;line-height:1.1;white-space:normal;overflow-wrap:anywhere}
.cookie-settings-summary h1{margin:0;color:var(--ui-strong);font-size:var(--ui-font-display)}
.cookie-settings-summary .cookie-current-line{margin-top:8px;color:var(--ui-muted)}
.cookie-settings-summary .cookie-current-line b{color:var(--ui-accent)}
.cookie-settings-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px}
.cookie-settings-actions .ui-btn{min-width:0;min-height:40px;white-space:normal;overflow-wrap:anywhere}
.route-cookies .legal-intro,.route-cookies .legal-section,.route-cookies .legal-links,.route-cookies .cookie-page-nav{background:var(--ui-bg-2)}
.route-cookies .legal-section{background:var(--ui-surface)}
.route-cookies .legal-links{border-top:1px solid var(--ui-line)}
.cookie-page-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0;border-top:1px solid var(--ui-line-strong);border-bottom:1px solid var(--ui-line-strong)}
.cookie-page-nav .ui-btn{display:flex;align-items:center;justify-content:center;min-width:0;min-height:42px;height:auto;margin:0;padding:7px 6px;border:0;border-right:1px solid var(--ui-line);border-radius:0;white-space:normal;text-align:center;text-decoration:none}
.cookie-page-nav .ui-btn:last-child{border-right:0}
.route-cookies code{display:none!important}
@media(max-width:560px){
  .perimeter-cookie-banner{
    width:calc(100vw - 10px);
    bottom:max(5px,env(safe-area-inset-bottom));
    grid-template-columns:1fr;
    gap:6px;
    padding:7px;
  }
  .perimeter-cookie-copy{grid-template-columns:auto 1fr;column-gap:6px;row-gap:1px}
  .perimeter-cookie-copy b{font-size:12px!important}
  .perimeter-cookie-copy span{font-size:10.5px!important;line-height:1.18}
  .perimeter-cookie-copy a{font-size:9.5px!important}
  .perimeter-cookie-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;min-width:0}
  .perimeter-cookie-actions .ui-btn{height:30px;min-height:30px;padding:3px 5px;font-size:9.5px!important;line-height:1.05}
  .cookie-settings-actions{grid-template-columns:1fr}
  .cookie-page-nav{grid-template-columns:1fr}
  .cookie-page-nav .ui-btn{border-right:0;border-bottom:1px solid var(--ui-line)}
  .cookie-page-nav .ui-btn:last-child{border-bottom:0}
}

@media(max-width:360px){
  .perimeter-cookie-copy{grid-template-columns:1fr;gap:1px}
  .perimeter-cookie-copy b{white-space:normal}
  .perimeter-cookie-copy a{grid-column:auto}
  .perimeter-cookie-actions .ui-btn{font-size:9px!important}
}
}


/* V462 LOW-LOAD TEST — mobile theme decoration keeps the same look but uses
   slower compositor work. No gameplay element is hidden. */
@media (max-width:700px){
  body[data-ui-theme="new-year-night"] .project-root::before{
    animation-duration:36s,15s;
    will-change:auto;
  }
  body[data-ui-theme="new-year-night"] .project-root::after{
    animation-duration:36s,15s;
    will-change:auto;
  }
  body[data-ui-theme="new-year-night"] .perimeter-status-bar::after{
    animation-duration:7.2s,16s;
  }
}


/* PERIMETER V538 — canonical item-cell icon scale.
   Primary item art in every shared cell/grid is 10% smaller than the previous size. */
@layer chrome{
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-cell-icon>img,
:is(body[data-service-page="trade"],body[data-service-page="stash"],body.route-pages-game-backpack) .service-ui-cell-icon img.item-visual{
  transform:scale(.9)!important;
  transform-origin:50% 50%!important;
}
body[data-service-page="mass-sell"] .item-card .item-icon>img{
  transform:scale(.9)!important;
  transform-origin:50% 50%!important;
}
body[data-service-page="stash"] .stash-transfer-icon-v537>img,
body[data-service-page="stash"] .stash-market-item-icon>img,
body[data-service-page="stash"] .stash-parcel-row-icon>img{
  transform:scale(.9)!important;
  transform-origin:50% 50%!important;
}
}


/* PERIMETER V558 — HARD PROJECT TERMINAL ACTION CONTRACT.
   Text actions "В ИГРУ" and "ЗАКРЫТЬ" use exactly the same visual contract
   as the canonical NPC "ЗАКРЫТЬ ДИАЛОГ" bar. Route CSS must not restyle it. */
:where(.guard-dialogue-close,.ui-project-terminal-action){
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  height:36px!important;
  min-height:36px!important;
  max-height:36px!important;
  margin:0!important;
  padding:0 10px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:0!important;
  border:0!important;
  border-radius:0!important;
  border-bottom:1px solid var(--ui-line)!important;
  background:color-mix(in srgb,var(--ui-warning) 6%,var(--ui-bg))!important;
  color:var(--ui-warning)!important;
  box-shadow:none!important;
  font-family:var(--ui-mono)!important;
  font-size:var(--ui-font-base)!important;
  font-weight:900!important;
  font-style:normal!important;
  line-height:1!important;
  letter-spacing:0!important;
  text-align:center!important;
  text-transform:uppercase!important;
  text-decoration:none!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  cursor:pointer!important;
  appearance:none!important;
  -webkit-appearance:none!important;
}
:where(.guard-dialogue-close,.ui-project-terminal-action):is(:hover,:focus-visible){
  outline:0!important;
  background:color-mix(in srgb,var(--ui-warning) 12%,var(--ui-bg))!important;
  border-bottom-color:var(--ui-line-strong)!important;
  color:var(--ui-strong)!important;
}
:where(.guard-dialogue-close,.ui-project-terminal-action):disabled,
:where(.ui-project-terminal-action)[aria-disabled="true"]{
  opacity:.48!important;
  cursor:not-allowed!important;
}
/* Text-only terminal actions: decorative return marks are removed globally;
   navigation remains the ordinary, labelled link or button. */
html body .ui-project-terminal-action::before,
html body .ui-project-terminal-action::after{
  content:none!important;
  display:none!important;
}

/* V559 — EXACT NPC DIALOG SHELL GEOMETRY CONTRACT
   Every NPC dialogue-derived screen must occupy the exact same outer width and
   margins. This intentionally overrides theme and route-level shell sizing. */
.npc-dialog-page main.npc-dialog-shell.project-root{
  box-sizing:border-box!important;
  width:100%!important;
  max-width:700px!important;
  min-width:0!important;
  margin:0 auto!important;
  padding:0!important;
  overflow-x:hidden!important;
}
@media(max-width:700px){
  .npc-dialog-page main.npc-dialog-shell.project-root{
    width:100%!important;
    max-width:700px!important;
    margin:0 auto!important;
  }
}

/* PERIMETER V567 — CLEAN TERMINAL ACTION / EMPTY STATE SEPARATORS.
   Page-end actions and empty placeholders use spacing/background instead of
   redundant horizontal rules. Real list, table and section dividers remain. */
:where(.guard-dialogue-close,.ui-project-terminal-action){
  border-top:0!important;
  border-bottom:0!important;
  box-shadow:none!important;
}
.perimeter-global-footer{
  border-top:1px solid var(--ui-line)!important;
}
.pda-page :where(.empty,.pda-user-empty,.pda-quest-empty,.faction-empty,.pda-rating-empty,.pda-profile-empty){
  border-top:0!important;
  border-bottom:0!important;
}
.npc-dialog-empty{
  border-bottom:0!important;
}


/* V575 — SYMMETRIC TERMINAL ACTION SEPARATORS.
   Full-width terminal actions use one deliberate line above and below.
   Ordinary buttons/tabs/cards are intentionally not affected. */
:where(.guard-dialogue-close,.ui-project-terminal-action){
  border-top:1px solid var(--ui-line)!important;
  border-bottom:1px solid var(--ui-line)!important;
  border-left:0!important;
  border-right:0!important;
  box-shadow:none!important;
}
:where(.guard-dialogue-close,.ui-project-terminal-action):is(:hover,:focus-visible){
  border-top-color:var(--ui-line-strong)!important;
  border-bottom-color:var(--ui-line-strong)!important;
}


/* V634 — persistent paid-services status notice. */
.perimeter-payment-notice{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 32px;align-items:stretch;width:100%;min-width:0;border-bottom:1px solid var(--ui-line-strong);background:linear-gradient(180deg,color-mix(in srgb,var(--ui-accent) 8%,var(--ui-bg-2)),var(--ui-bg-2));box-shadow:inset 2px 0 var(--ui-accent)}
.perimeter-payment-notice__main{min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"label title action" "label text action";column-gap:8px;row-gap:1px;align-items:center;padding:6px 8px;color:var(--ui-text);text-decoration:none}
.perimeter-payment-notice__label{grid-area:label;color:var(--ui-accent);font:900 var(--ui-font-micro)/1 var(--ui-mono);letter-spacing:.04em;white-space:nowrap}
.perimeter-payment-notice__main strong{grid-area:title;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:900 var(--ui-font-secondary)/1.15 var(--ui-mono);color:var(--ui-strong)}
.perimeter-payment-notice__text{grid-area:text;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ui-muted);font:700 var(--ui-font-micro)/1.2 var(--ui-mono)}
.perimeter-payment-notice__action{grid-area:action;color:var(--ui-accent);font:900 var(--ui-font-micro)/1 var(--ui-mono);white-space:nowrap}
.perimeter-payment-notice__hide{display:grid;margin:0;border-left:1px solid var(--ui-line)}
.perimeter-payment-notice__hide button{width:32px;min-height:100%;padding:0;border:0;background:transparent;color:var(--ui-muted);font:900 20px/1 var(--ui-mono);cursor:pointer}
.perimeter-payment-notice__hide button:is(:hover,:focus-visible){outline:0;background:var(--ui-surface-active);color:var(--ui-strong)}
@media(max-width:480px){.perimeter-payment-notice{grid-template-columns:minmax(0,1fr) 30px}.perimeter-payment-notice__main{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"label action" "title action" "text action";gap:2px 6px;padding:5px 7px}.perimeter-payment-notice__label{white-space:normal}.perimeter-payment-notice__hide button{width:30px}.perimeter-payment-notice__text{font-size:9px}}


/* V679: shared MINI item sort controls on backpack, trader and stash grids.
   Inherit every palette from the active UI theme; no new page shells. */
.item-mini{width:100%;min-width:0;max-width:100%;box-sizing:border-box;background:var(--ui-surface,var(--surface));border-top:1px solid var(--ui-line);border-bottom:1px solid var(--ui-line);color:var(--ui-text);font-family:inherit}
.item-mini *{box-sizing:border-box}
.item-mini__line{display:flex;align-items:center;gap:7px;min-width:0;min-height:36px;padding:3px 7px}
.item-mini__total{flex:0 0 auto;font-size:var(--ui-font-secondary,12px);font-weight:700;white-space:nowrap;color:var(--ui-strong)}
.item-mini__summary{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right;color:var(--ui-muted);font-size:var(--ui-font-micro,11px)}
.item-mini__toggle{flex:0 0 auto;min-height:30px;border:1px solid var(--ui-line-strong);background:var(--ui-surface-2);color:var(--ui-strong);font:inherit;font-size:12px;font-weight:700;letter-spacing:0;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:4px 10px;border-radius:3px;cursor:pointer}
.item-mini__toggle.is-open{border-color:var(--ui-accent);color:var(--ui-accent)}
.item-mini__panel{padding:8px;border-top:1px solid var(--ui-line);background:var(--ui-bg-2);min-width:0}
.item-mini [hidden]{display:none!important}
.item-mini__search-label,.item-mini__fields label{display:block;min-width:0;color:var(--ui-muted);font:inherit;font-size:11px;font-weight:700;letter-spacing:.02em;text-transform:uppercase}
.item-mini__search,.item-mini__fields select{display:block;min-width:0;width:100%;max-width:100%;height:36px;min-height:36px;margin-top:4px;border:1px solid var(--ui-line-strong);border-radius:3px;background:var(--ui-surface);color:var(--ui-strong);padding:5px 9px;font-family:inherit;font-size:13px;line-height:1.2;box-shadow:none;outline-offset:1px}
.item-mini__fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;margin-top:8px}
.item-mini__bottom{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:7px;color:var(--ui-muted);font-size:11px}
.item-mini__bottom button{min-height:29px;padding:4px 11px;border:1px solid var(--ui-line-strong);border-radius:3px;color:var(--ui-text);background:var(--ui-surface-2);font:inherit;font-weight:700;font-size:11px;cursor:pointer}
.item-mini__search:focus-visible,.item-mini__fields select:focus-visible,.item-mini button:focus-visible{outline:2px solid var(--ui-focus,var(--ui-accent));outline-offset:1px}
.stash-v46 .stash-item-mini{margin:3px 0 6px}
@media(max-width:360px){.item-mini__line{padding-inline:4px;gap:4px}.item-mini__total{font-size:11px}.item-mini__summary{font-size:10px}.item-mini__toggle{padding:4px 7px;font-size:11px}.item-mini__fields{gap:5px}.item-mini__panel{padding:6px}.item-mini__fields select{padding:4px 3px;font-size:12px}}
/* PERIMETER V189 — final GAME-style local header contract.
   This file is intentionally loaded AFTER the route stylesheet.
   Route CSS may compose page content but must not redefine shared local chrome. */

.project-root .ui-local-header[data-page-local-header="1"]{
  box-sizing:border-box!important;
  display:grid!important;
  grid-template-columns:34px minmax(0,1fr) 34px!important;
  align-items:stretch!important;
  width:100%!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  gap:0!important;
  overflow:hidden!important;
  border:0!important;
  border-top:0!important;
  border-bottom:1px solid var(--ui-line-strong)!important;
  border-radius:0!important;
  background:linear-gradient(180deg,var(--ui-gloss),transparent 52%),var(--ui-surface)!important;
  box-shadow:inset 0 1px var(--ui-gloss)!important;
}

.project-root .ui-local-header[data-page-local-header="1"]:has(> .ui-local-header-actions),
.project-root .ui-local-header[data-page-local-header="1"]:has(> .chat-head-actions),
.project-root .ui-local-header[data-page-local-header="1"]:has(> .auth-head-action),
.project-root .ui-local-header[data-page-local-header="1"]:has(> .top-new-topic),
.project-root .ui-local-header[data-page-local-header="1"]:has(> .landing-account){
  grid-template-columns:34px minmax(0,1fr) auto!important;
}

/* Left/back control: always one 34px cell. */
.project-root .ui-local-header[data-page-local-header="1"] > :first-child{
  box-sizing:border-box!important;
  align-self:stretch!important;
  justify-self:stretch!important;
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-right:1px solid var(--ui-line-strong)!important;
  border-radius:0!important;
  background:transparent!important;
  color:var(--ui-accent)!important;
  box-shadow:none!important;
  text-decoration:none!important;
  display:grid!important;
  place-items:center!important;
  overflow:hidden!important;
}

/* Legacy text arrow becomes the same vector chevron as modern pages. */
.project-root .ui-local-header[data-page-local-header="1"] > a:first-child:not(:has(svg)):not(:has(img)),
.project-root .ui-local-header[data-page-local-header="1"] > button:first-child:not(:has(svg)):not(:has(img)){
  font-size:0!important;
  line-height:0!important;
}
.project-root .ui-local-header[data-page-local-header="1"] > a:first-child:not(:has(svg)):not(:has(img))::before,
.project-root .ui-local-header[data-page-local-header="1"] > button:first-child:not(:has(svg)):not(:has(img))::before{
  content:"";
  box-sizing:border-box;
  width:10px;
  height:10px;
  border-left:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:translateX(2px) rotate(45deg);
  filter:drop-shadow(0 1px 1px rgba(0,0,0,.9));
}

.project-root .ui-local-header[data-page-local-header="1"] > :first-child svg,
.project-root .ui-local-header[data-page-local-header="1"] .ui-back-icon{
  display:block!important;
  width:17px!important;
  height:17px!important;
  min-width:17px!important;
  min-height:17px!important;
  max-width:17px!important;
  max-height:17px!important;
  fill:none!important;
  stroke:currentColor!important;
  stroke-width:1.8!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
}

/* Center/title cell: one line, same typography and vertical alignment everywhere. */
.project-root .ui-local-header[data-page-local-header="1"] > :nth-child(2):not(.ui-local-header-actions):not(.chat-head-actions){
  box-sizing:border-box!important;
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:flex-start!important;
  align-self:stretch!important;
  min-width:0!important;
  width:auto!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0 8px!important;
  gap:6px!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--ui-strong)!important;
  font:900 var(--ui-font-base)/1 var(--ui-mono)!important;
  letter-spacing:.035em!important;
  text-transform:none!important;
  text-align:left!important;
  text-shadow:0 1px 2px rgba(0,0,0,.92)!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.project-root .ui-local-header[data-page-local-header="1"] > :nth-child(2) > :is(strong,b){
  min-width:0!important;
  margin:0!important;
  padding:0!important;
  color:inherit!important;
  font:inherit!important;
  letter-spacing:inherit!important;
  text-transform:inherit!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
/* Local-header subtitles caused several headers to become visually taller/different. */
.project-root .ui-local-header[data-page-local-header="1"] > :nth-child(2) > span:not(:only-child){
  display:none!important;
}

/* Right cell / action strip. */
.project-root .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions,
.project-root .ui-local-header[data-page-local-header="1"] > .chat-head-actions{
  box-sizing:border-box!important;
  display:flex!important;
  align-items:stretch!important;
  justify-content:flex-end!important;
  align-self:stretch!important;
  justify-self:end!important;
  width:auto!important;
  min-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  gap:0!important;
  border:0!important;
  border-left:1px solid var(--ui-line-strong)!important;
  background:transparent!important;
  box-shadow:none!important;
}
.project-root .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > :is(a,button,.icon-btn,.look-refresh,.look-home,.game-link,.ui-auto-game-link,.account-pda-game,.search-toggle),
.project-root .ui-local-header[data-page-local-header="1"] > .chat-head-actions > :is(a,button),
.project-root .ui-local-header[data-page-local-header="1"] > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.look-home,a.game):last-child{
  box-sizing:border-box!important;
  display:grid!important;
  place-items:center!important;
  flex:0 0 34px!important;
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-left:1px solid var(--ui-line)!important;
  border-radius:0!important;
  background:transparent!important;
  color:var(--ui-accent)!important;
  box-shadow:none!important;
  text-decoration:none!important;
  overflow:hidden!important;
}
.project-root .ui-local-header[data-page-local-header="1"] > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.look-home,a.game):last-child{
  border-left:1px solid var(--ui-line-strong)!important;
}

/* Right text actions that intentionally need more than one icon cell. */
.project-root .ui-local-header[data-page-local-header="1"] > :is(.auth-head-action,.top-new-topic,.landing-account):last-child,
.project-root .ui-local-header[data-page-local-header="1"] .look-header-weight{
  box-sizing:border-box!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:auto!important;
  min-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0 8px!important;
  border:0!important;
  border-left:1px solid var(--ui-line-strong)!important;
  border-radius:0!important;
  background:transparent!important;
  color:var(--ui-strong)!important;
  font:800 var(--ui-font-secondary)/1 var(--ui-mono)!important;
  white-space:nowrap!important;
  text-shadow:0 1px 2px rgba(0,0,0,.92)!important;
  box-shadow:none!important;
}

/* Legacy empty/spacer third cells must still mirror the 34px back cell. */
.project-root .ui-local-header[data-page-local-header="1"] > :is(div,span):empty:last-child,
.project-root .ui-local-header[data-page-local-header="1"] > :is(.character-header-spacer,.bar-private-head__spacer,.durak-game-head__spacer):last-child{
  box-sizing:border-box!important;
  display:block!important;
  width:34px!important;
  min-width:34px!important;
  max-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  max-height:34px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-left:1px solid var(--ui-line-strong)!important;
  background:transparent!important;
}

.project-root .ui-local-header[data-page-local-header="1"] :is(a,button):is(:hover,:focus-visible){
  outline:0!important;
  background:var(--ui-surface-active)!important;
  color:var(--ui-strong)!important;
}

.project-root .ui-local-header[data-page-local-header="1"] :is(.perimeter-gamepad-icon,img.perimeter-gamepad-icon){
  display:block!important;
  width:20px!important;
  height:20px!important;
  min-width:20px!important;
  min-height:20px!important;
  max-width:20px!important;
  max-height:20px!important;
  object-fit:contain!important;
}

/* No double seam immediately below the shared header. */
.project-root .ui-local-header[data-page-local-header="1"] + *{border-top:0!important;}

@media(max-width:560px){
  .project-root .ui-local-header[data-page-local-header="1"]{
    grid-template-columns:34px minmax(0,1fr) 34px!important;
  }
  .project-root .ui-local-header[data-page-local-header="1"]:has(> .ui-local-header-actions),
  .project-root .ui-local-header[data-page-local-header="1"]:has(> .chat-head-actions),
  .project-root .ui-local-header[data-page-local-header="1"]:has(> .auth-head-action),
  .project-root .ui-local-header[data-page-local-header="1"]:has(> .top-new-topic),
  .project-root .ui-local-header[data-page-local-header="1"]:has(> .landing-account){
    grid-template-columns:34px minmax(0,1fr) auto!important;
  }
}

/* V337 — text action in NEWS local header needs a real text cell, not a 34px icon slot. */
.project-root .ui-local-header[data-page-local-header="1"]:has(> .top-new-topic){
  grid-template-columns:34px minmax(0,1fr) minmax(76px,auto)!important;
}
.project-root .ui-local-header[data-page-local-header="1"] > .top-new-topic:last-child{
  box-sizing:border-box!important;display:flex!important;align-items:center!important;justify-content:center!important;
  width:auto!important;min-width:76px!important;max-width:none!important;height:34px!important;min-height:34px!important;max-height:34px!important;
  margin:0!important;padding:0 9px!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;border-radius:0!important;
  background:transparent!important;color:var(--ui-accent)!important;font:900 var(--ui-font-secondary)/1 var(--ui-mono)!important;
  white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important;text-decoration:none!important;
}


/* V779 — common game control skin for legacy player pages.
   Mirrors GAME transition actions; keeps each control's existing dimensions,
   semantics, events, layout and active/disabled states. Colors always come
   from the selected interface theme, never from hardcoded old palettes. */
body[data-ui-theme]:not([data-admin-ui="1"]) .project-root:not(.game) :is(
  .btn,.ui-btn,.runtime-btn,.action-btn,.game-btn,.faction-button,
  .quest-modal-action,.market-board-action,.market-board-mini__submit,
  .issue-button,.forum-primary-action,.dev-button,.trade-save,.open-btn,
  .pda-dialog-action,.faction-create-submit,.pda-user-search-button,
  .bulk-action,.entity-action,.row-action,.pickup-one,.trade-info-button,
  .perks-reset-btn,.dialog-btn,.show-all-button,.profile-v725__button,
  .stash-bulk-btn,.trade-mass-sell-link,.item-title-action,
  .battle-result-loot-btn,.camp-v656-action,.pda-specialist-search-button,
  .repair-sort-submit,.sector-aid-choice,.look-game-return-button
):not(:disabled):not([aria-disabled="true"]){
  box-sizing:border-box;
  max-width:100%;
  min-width:0;
  border-radius:0;
  border-color:var(--ui-line-strong);
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 78%),var(--ui-bg-2);
  color:var(--ui-strong);
  box-shadow:none;
  text-shadow:none;
  font-family:var(--ui-mono);
  font-weight:800;
  text-decoration:none;
  touch-action:manipulation;
}
body[data-ui-theme]:not([data-admin-ui="1"]) .project-root:not(.game) :is(
  .btn,.ui-btn,.runtime-btn,.action-btn,.game-btn,.faction-button,
  .quest-modal-action,.market-board-action,.market-board-mini__submit,
  .issue-button,.forum-primary-action,.dev-button,.trade-save,.open-btn,
  .pda-dialog-action,.faction-create-submit,.pda-user-search-button,
  .bulk-action,.entity-action,.row-action,.pickup-one,.trade-info-button,
  .perks-reset-btn,.dialog-btn,.show-all-button,.profile-v725__button,
  .stash-bulk-btn,.trade-mass-sell-link,.item-title-action,
  .battle-result-loot-btn,.camp-v656-action,.pda-specialist-search-button,
  .repair-sort-submit,.sector-aid-choice,.look-game-return-button
):not(:disabled):not([aria-disabled="true"]):is(:hover,:focus-visible){
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 9%,transparent),transparent 82%),var(--ui-surface-active);
  border-color:color-mix(in srgb,var(--ui-accent) 32%,var(--ui-line-strong));
  color:var(--ui-accent);
}
/* Explicitly synchronize legacy terminal links with GAME's flat
   transition appearance, without touching destructive or modal actions. */
body[data-ui-theme] .project-root:not(.game) a.look-game-return-button[href="game.php"]{
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 78%),var(--ui-bg-2)!important;
  color:var(--ui-strong)!important;
  font-family:var(--ui-mono)!important;
  font-weight:800!important;
}
body[data-ui-theme] .project-root:not(.game) a.look-game-return-button[href="game.php"]:is(:hover,:focus-visible){
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 9%,transparent),transparent 82%),var(--ui-surface-active)!important;
  color:var(--ui-accent)!important;
}

/* V779 — shared bottom GAME action for authenticated routes.
   Rendered by the existing unified footer without duplicating page markup. */
body[data-ui-theme] .perimeter-bottom-game-return.project-root{
  box-sizing:border-box;
  display:block;
  width:min(calc(100% - var(--ui-edge) * 2),var(--ui-page-max));
  max-width:var(--ui-page-max);
  min-width:0;
  margin:0 auto;
  padding:0;
  border-top:1px solid var(--ui-line);
  border-bottom:1px solid var(--ui-line);
  background:var(--ui-bg-2);
}
body[data-ui-theme] .perimeter-bottom-game-return__link{
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  min-width:0;
  min-height:40px;
  margin:0;
  padding:8px 12px;
  border:0;
  border-radius:0;
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 78%),var(--ui-bg-2);
  color:var(--ui-strong);
  font:800 var(--ui-font-base)/1.2 var(--ui-mono);
  text-align:center;
  text-decoration:none;
  touch-action:manipulation;
}
body[data-ui-theme] .perimeter-bottom-game-return__link svg{
  display:block;
  flex:0 0 18px;
  width:18px;
  height:18px;
  fill:none;
  stroke:var(--ui-accent);
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
body[data-ui-theme] .perimeter-bottom-game-return__link:is(:hover,:focus-visible){
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 9%,transparent),transparent 82%),var(--ui-surface-active);
  color:var(--ui-accent);
}
body[data-ui-theme] .perimeter-bottom-game-return__link:focus-visible{
  outline:2px solid var(--ui-focus);
  outline-offset:-2px;
}
body[data-ui-theme] .perimeter-bottom-game-return__link:active{
  background:color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg-2));
}
@media(max-width:560px){
  body[data-ui-theme] .perimeter-bottom-game-return__link{min-height:42px;padding:8px 10px}
  body[data-ui-theme]:not([data-admin-ui="1"]) .project-root:not(.game) :is(
    .btn,.ui-btn,.runtime-btn,.action-btn,.game-btn,.faction-button,
    .entity-action,.row-action,.pickup-one,.dialog-btn,.bulk-action
  ){
    overflow-wrap:anywhere;
  }
}


/* V780 — Secondary pages now have the same compact four-action game menu.
   The saved per-account show/hide preference is honored. No separate theme
   switcher; everything derives from the active shared eight-theme tokens. */
body[data-ui-theme] .perimeter-global-header:has(:is(.perimeter-secondary-menu-bar,.perimeter-secondary-game-location)){position:relative;z-index:100;overflow:visible}
body[data-ui-theme] :is(.perimeter-secondary-menu-bar,.perimeter-secondary-game-location){
  position:relative;display:flex;justify-content:flex-end;align-items:center;
  box-sizing:border-box;width:100%;height:33px;min-height:33px;margin:0;padding:0;
  border:0;border-bottom:1px solid var(--ui-line-strong);
  background:linear-gradient(180deg,var(--ui-gloss),transparent 55%),var(--ui-bg-2);
}
body[data-ui-theme] .perimeter-secondary-menu-toggle{
  box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:7px;
  min-width:90px;max-width:100%;height:32px;min-height:32px;
  padding:0 12px;margin:0;border:0;border-left:1px solid var(--ui-line);
  border-radius:0;background:transparent;color:var(--ui-strong);
  font:800 var(--ui-font-secondary)/1 var(--ui-mono);cursor:pointer;touch-action:manipulation;
}
body[data-ui-theme] .perimeter-secondary-menu-toggle svg{
  width:18px;height:18px;flex:0 0 18px;fill:none;stroke:var(--ui-accent);
  stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;
}
body[data-ui-theme] .perimeter-secondary-menu-toggle:is(:hover,:focus-visible,[aria-expanded="true"]){
  color:var(--ui-accent);background:var(--ui-surface-active);
}
body[data-ui-theme] .perimeter-secondary-game-menu{
  position:absolute;right:0;top:100%;z-index:150;
  box-sizing:border-box;width:min(100%,480px);max-width:100%;
  padding:3px;border:1px solid var(--ui-line-strong);background:var(--ui-bg-2);
  box-shadow:0 8px 18px rgba(0,0,0,.62);
}
body[data-ui-theme] .perimeter-secondary-game-menu[hidden]{display:none!important}
body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup{
  box-sizing:border-box;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  position:static;width:100%;max-width:100%;height:auto;min-height:42px;max-height:none;
  gap:2px;margin:0;padding:0;border:0;overflow:visible;background:transparent;
}
body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{
  box-sizing:border-box;display:flex;flex-direction:row;align-items:center;justify-content:center;
  position:relative;width:100%;min-width:0;height:42px;min-height:42px;max-height:42px;
  gap:4px;margin:0;padding:0 4px;border:1px solid var(--ui-line);border-radius:0;
  background:var(--ui-surface);color:var(--ui-strong);
  font:700 11px/1.15 var(--ui-font);letter-spacing:0;
  white-space:normal;text-align:center;text-decoration:none;overflow:hidden;
}
body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a:is(:hover,:focus-visible){
  background:var(--ui-surface-active);color:var(--ui-accent);outline:2px solid var(--ui-focus);outline-offset:-2px;
}
body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup .game-quick-icon{
  display:block;flex:0 0 16px;width:16px;height:16px;min-width:16px;
  fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;
}
body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup .perimeter-nav-label{
  display:block;min-width:0;overflow-wrap:anywhere;white-space:normal;text-overflow:clip;
}
body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-nav-device-state{display:none}
body[data-ui-theme] .perimeter-secondary-game-menu .game-quick-unread{
  position:absolute;top:1px;right:1px;min-width:13px;height:13px;
  display:grid;place-items:center;padding:0 2px;border-radius:20px;
  background:var(--ui-danger);color:var(--ui-bg);font:700 9px/1 var(--ui-mono);
}
body[data-ui-theme] .perimeter-secondary-game-menu .game-quick-unread[hidden]{display:none}
@media(max-width:390px){
  body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{gap:3px;padding-inline:2px;font-size:10px}
  body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup .game-quick-icon{flex-basis:14px;width:14px;height:14px;min-width:14px}
}
@media(max-width:320px){
  body[data-ui-theme] .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{flex-direction:column;gap:1px;font-size:9px}
}

/* V780 — complete the V779 button skin. Previously V779 applied only to a
   small hand-written class list; many live buttons were still using their old
   route-specific backgrounds/fonts. Change visual skin, not sizes or logic. */
body[data-ui-theme]:not([data-admin-ui="1"]) .project-root:not(.game) :is(
  .pda-row-menu-action,.trade-pager-btn,.pager-btn,.quest-result-v730__btn,
  .issue-primary,.dev-primary,.forum-reply-action,.forum-quote-action,
  .npc-repair-close,.camp-v656-link,.stash-market-list-btn,.stash-parcel-receive,
  .trade-save,.trade-picker__save,.service-ui-submit,.bar-table-room-game-button,
  .repair-all,.repair-toggle,.repair-select-all,.pda-user-search-button,
  .pda-specialist-search-button,.stash-mass-action,.sm-save-assign,
  button[type="submit"]:not(.icon-btn):not(.loot-modal-close):not(.faction-icon-btn),
  input[type="submit"]
):not(:disabled):not([aria-disabled="true"]):not(.danger):not(.decline):not([class*="danger"]){
  box-sizing:border-box;max-width:100%;min-width:0;border-radius:0;
  border-color:var(--ui-line-strong);
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 78%),var(--ui-bg-2);
  color:var(--ui-strong);font-family:var(--ui-mono);font-weight:800;
  box-shadow:none;text-shadow:none;text-decoration:none;touch-action:manipulation;
}
body[data-ui-theme]:not([data-admin-ui="1"]) .project-root:not(.game) :is(
  .pda-row-menu-action,.trade-pager-btn,.pager-btn,.quest-result-v730__btn,
  .issue-primary,.dev-primary,.forum-reply-action,.forum-quote-action,
  .npc-repair-close,.camp-v656-link,.stash-market-list-btn,.stash-parcel-receive,
  .trade-save,.trade-picker__save,.service-ui-submit,.bar-table-room-game-button,
  .repair-all,.repair-toggle,.repair-select-all,.pda-user-search-button,
  .pda-specialist-search-button,.stash-mass-action,.sm-save-assign,
  button[type="submit"]:not(.icon-btn):not(.loot-modal-close):not(.faction-icon-btn),
  input[type="submit"]
):not(:disabled):not([aria-disabled="true"]):not(.danger):not(.decline):not([class*="danger"]):is(:hover,:focus-visible){
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 9%,transparent),transparent 82%),var(--ui-surface-active);
  color:var(--ui-accent);
}
/* Warnings and deletion buttons retain their warning semantics across themes. */
body[data-ui-theme] .project-root:not(.game) :is(button,a):is(.danger,.decline,[class*="danger"]){
  color:var(--ui-danger);border-color:color-mix(in srgb,var(--ui-danger) 50%,var(--ui-line));
}
/* Preserve the main game/terminal row treatment on secondary routes. */
body[data-ui-theme] .project-root:not(.game) :is(
  .ui-project-terminal-action,.look-game-return-button,.perimeter-bottom-game-return__link
){
  box-sizing:border-box;border-radius:0;font-family:var(--ui-mono);
  color:var(--ui-strong);background:var(--ui-bg-2);text-shadow:none;box-shadow:none;
}
body[data-ui-theme] .project-root:not(.game) :is(
  .ui-project-terminal-action,.look-game-return-button,.perimeter-bottom-game-return__link
):is(:hover,:focus-visible){background:var(--ui-surface-active);color:var(--ui-accent)}
/* Secondary content follows GAME's existing narrow, flat row visual rhythm. */
body[data-ui-theme] .project-root:not(.game) :is(
  .plain-observation-title,.section-title,.service-ui-section-head,.pda-section-title,
  .faction-section-title,.npc-section-title
){
  border-radius:0;background:linear-gradient(180deg,var(--ui-gloss),transparent 58%),repeating-linear-gradient(135deg,color-mix(in srgb,var(--ui-accent) 5%,var(--ui-surface)) 0 8px,var(--ui-surface) 8px 16px);
  color:var(--ui-strong);box-shadow:none;
}
body[data-ui-theme] .project-root:not(.game) :is(
  .entity-line,.plain-name-list>li,.pda-list-row,.trade-item-row,.quest-row
){
  border-radius:0;border-color:var(--ui-line);
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 78%),var(--ui-bg-2);
}
@media(max-width:560px){
  body[data-ui-theme] .project-root:not(.game) :is(
    .pda-row-menu-action,.trade-pager-btn,.pager-btn,.quest-result-v730__btn,
    .issue-primary,.dev-primary,.forum-reply-action,.forum-quote-action,
    .npc-repair-close,.camp-v656-link,.stash-market-list-btn,.stash-parcel-receive,
    .trade-save,.trade-picker__save,.service-ui-submit,.bar-table-room-game-button
  ){overflow-wrap:anywhere;min-width:0}
}


@layer chrome {
body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu{
  width:min(100%,480px,calc(100vw - 24px))!important;
}
body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup{
  box-sizing:border-box!important;display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  position:static!important;width:100%!important;
  height:auto!important;min-height:42px!important;max-height:none!important;
  gap:2px!important;padding:0!important;margin:0!important;
  border:0!important;overflow:visible!important;background:transparent!important;
}
body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{
  box-sizing:border-box!important;display:flex!important;position:relative!important;
  flex-direction:row!important;align-items:center!important;justify-content:center!important;
  width:100%!important;min-width:0!important;
  height:42px!important;min-height:42px!important;max-height:42px!important;
  gap:4px!important;padding:0 4px!important;margin:0!important;
  border:1px solid var(--ui-line)!important;border-radius:0!important;
  background:var(--ui-surface)!important;color:var(--ui-strong)!important;
  font:700 11px/1.15 var(--ui-font)!important;letter-spacing:0!important;
  white-space:normal!important;overflow:hidden!important;
  box-shadow:none!important;text-align:center!important;
}

/* V789 — one GAME visual language for every non-map screen.
   Route sheets retain only their page composition; this block owns the shared
   field-terminal chrome: headers, sections, rows, controls and compact panels. */
@layer chrome {
  :root{
    --ui-header-h:36px;
    --ui-terminal-rim:color-mix(in srgb,var(--ui-line-strong) 88%,var(--ui-accent));
    --ui-terminal-glow:color-mix(in srgb,var(--ui-accent) 10%,transparent);
  }

  body[data-ui-theme]{
    background:
      radial-gradient(ellipse 76% 24% at 50% 0,var(--ui-terminal-glow),transparent 68%),
      linear-gradient(180deg,var(--ui-bg-2),var(--ui-bg) 42%);
  }
  .project-root{isolation:isolate}

  /* The GAME shell is the reference: a thin top glint, hard seams, and no
     floating card treatment. Every local header now uses the same three-cell
     command-bar geometry as the in-game navigation. */
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"]{
    height:var(--ui-header-h)!important;min-height:var(--ui-header-h)!important;max-height:var(--ui-header-h)!important;
    border-top:1px solid var(--ui-terminal-rim)!important;
    border-bottom:1px solid var(--ui-line-strong)!important;
    background:
      linear-gradient(180deg,var(--ui-gloss-strong),transparent 45%),
      linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 5%,transparent),transparent 34%),
      var(--ui-surface)!important;
    box-shadow:inset 0 1px var(--ui-gloss),0 1px 0 rgba(0,0,0,.38)!important;
  }
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :first-child,
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :nth-child(2):not(.ui-local-header-actions):not(.chat-head-actions),
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.look-home,a.game):last-child,
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions,
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > .chat-head-actions{height:var(--ui-header-h)!important;min-height:var(--ui-header-h)!important;max-height:var(--ui-header-h)!important}
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :first-child,
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :is(.game-link,.ui-auto-game-link,.account-pda-game,.icon-btn,.look-refresh,.look-home,a.game):last-child,
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > .ui-local-header-actions > :is(a,button,.icon-btn,.look-refresh,.look-home,.game-link,.ui-auto-game-link,.account-pda-game,.search-toggle),
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > .chat-head-actions > :is(a,button){
    width:var(--ui-header-h)!important;min-width:var(--ui-header-h)!important;max-width:var(--ui-header-h)!important;
    height:var(--ui-header-h)!important;min-height:var(--ui-header-h)!important;max-height:var(--ui-header-h)!important;
  }
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :nth-child(2):not(.ui-local-header-actions):not(.chat-head-actions){
    color:var(--ui-strong)!important;font-size:var(--ui-font-secondary)!important;letter-spacing:.075em!important;
  }
  body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] :is(a,button):is(:hover,:focus-visible){
    background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 13%,transparent),transparent 88%)!important;
    color:var(--ui-accent)!important;
  }

  /* Reusable section command bars: same edge treatment as GAME actions. */
  body[data-ui-theme] .project-root:not(.game) :is(
    .section-head,.service-ui-section-head,.pda-section-title,.faction-section-title,
    .pda-divider,.base-facilities-head,.landing-section-head,.auth-section-head,
    .forum-section-head,.news-head,.help-section-head,.quest-section-head,.stash-section-head
  ){
    position:relative;min-height:36px;margin:0;padding:7px 10px;
    border-top:1px solid var(--ui-line)!important;border-bottom:1px solid var(--ui-line-strong)!important;border-left:0!important;border-right:0!important;border-radius:0!important;
    background:linear-gradient(180deg,var(--ui-gloss),transparent 56%),linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 4%,transparent),transparent 46%),var(--ui-surface)!important;
    color:var(--ui-strong);box-shadow:inset 0 1px var(--ui-gloss);
  }
  body[data-ui-theme] .project-root:not(.game) :is(
    .section-head,.service-ui-section-head,.pda-section-title,.faction-section-title,
    .pda-divider,.base-facilities-head,.landing-section-head,.auth-section-head,
    .forum-section-head,.news-head,.help-section-head,.quest-section-head,.stash-section-head
  ) :is(b,strong,h1,h2,h3){color:var(--ui-strong);font-family:var(--ui-mono);font-weight:900;letter-spacing:.045em}

  /* Content is organised as field records instead of disconnected cards. */
  body[data-ui-theme] .project-root:not(.game) :is(
    .landing-section,.auth-section,.pda-page,.service-ui-panel,.forum-panel,
    .news-list,.quest-list,.stash-page,.market-board,.profile-v725
  ){border-color:var(--ui-line)}
  body[data-ui-theme] .project-root:not(.game) :is(
    .landing-news-row,.auth-field,.pda-row,.pda-user-row,.pda-quest-row,
    .forum-row,.news-row,.quest-row,.item-row,.service-ui-row
  ){border-color:var(--ui-line);background:transparent}
  body[data-ui-theme] .project-root:not(.game) :is(
    .landing-news-row,.pda-row,.pda-user-row,.pda-quest-row,.forum-row,.news-row,.quest-row,.item-row,.service-ui-row
  ):is(:hover,:focus-within){background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 6%,transparent),transparent 72%),var(--ui-surface)}

  /* Inputs and actions share the in-game hard-edged terminal control. */
  body[data-ui-theme] .project-root:not(.game) :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
    border-radius:0;border-color:var(--ui-line-strong);background:linear-gradient(180deg,var(--ui-gloss),transparent 55%),var(--ui-bg-2);box-shadow:inset 0 1px rgba(255,255,255,.02);
  }
  body[data-ui-theme] .project-root:not(.game) :where(input,select,textarea):focus{border-color:var(--ui-accent);box-shadow:inset 2px 0 var(--ui-accent),inset 0 1px rgba(255,255,255,.02)}
  body[data-ui-theme] .project-root:not(.game) :where(button,.btn,.ui-btn,input[type="submit"],input[type="button"],a.btn,a.ui-btn){border-radius:0}

  @media(max-width:420px){
    :root{--ui-header-h:34px}
    body[data-ui-theme] .project-root .ui-local-header[data-page-local-header="1"] > :nth-child(2):not(.ui-local-header-actions):not(.chat-head-actions){padding-inline:7px!important;font-size:11px!important;letter-spacing:.045em!important}
    body[data-ui-theme] .project-root:not(.game) :is(.section-head,.service-ui-section-head,.pda-section-title,.faction-section-title,.pda-divider,.base-facilities-head,.landing-section-head,.auth-section-head){padding-inline:8px}
  }
}
body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a:is(:hover,:focus-visible){
  background:var(--ui-surface-active)!important;color:var(--ui-accent)!important;
  outline:2px solid var(--ui-focus)!important;outline-offset:-2px!important;
}
@media(max-width:390px){
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{
    gap:3px!important;padding-inline:2px!important;font-size:10px!important;
  }
}
@media(max-width:320px){
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{
    flex-direction:column!important;gap:1px!important;font-size:9px!important;
  }
}
}


@layer chrome {
@media(max-width:390px){
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{
    flex-direction:row!important;min-height:42px!important;height:42px!important;
    gap:5px!important;font-size:11px!important;
  }
}
}

/* V793 — GAME shell parity for every route.  The quick menu is a vertical
   command stack on the reference GAME screen; secondary pages must not fall
   back to the legacy four-column strip. */
@layer chrome {
  body[data-ui-theme] .project-root:not(.game) .perimeter-wallet-strip{display:none!important}
  body[data-ui-theme] .perimeter-global-header :is(.perimeter-secondary-menu-bar,.perimeter-secondary-game-location){
    justify-content:space-between!important;
    height:34px!important;min-height:34px!important;max-height:34px!important;
    background:linear-gradient(180deg,var(--ui-gloss),transparent 55%),var(--ui-bg-2)!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-page-title{
    display:flex!important;align-items:center!important;min-width:0!important;flex:1 1 auto!important;
    height:34px!important;min-height:34px!important;max-height:34px!important;margin:0!important;
    padding:0 10px!important;overflow:hidden!important;color:var(--ui-strong)!important;
    font:800 var(--ui-font-page)/1 var(--ui-mono)!important;letter-spacing:.035em!important;
    text-overflow:ellipsis!important;white-space:nowrap!important;text-shadow:0 1px 2px rgba(0,0,0,.85)!important;
  }
  /* Secondary routes reuse the GAME location row: the page name occupies the
     same left cell as a location name, and the menu control keeps GAME's right
     edge, height and single separating border. */
  body[data-ui-theme] .perimeter-game-header-location{
    display:flex!important;align-items:center!important;justify-content:space-between!important;
    padding-right:0!important;border-top:1px solid var(--ui-line-strong)!important;
    background:var(--ui-bg)!important;
  }
  body[data-ui-theme] .perimeter-secondary-game-location__main{
    display:flex;align-items:center;gap:5px;flex:1 1 auto;min-width:0;height:100%;
    padding:0 10px;overflow:hidden;
  }
  body[data-ui-theme] .perimeter-secondary-game-location .location-name{
    display:block;min-width:0;margin:0;padding:0;overflow:hidden;color:var(--ui-accent);
    font:700 var(--ui-font-base)/1 var(--ui-font);letter-spacing:0;
    text-overflow:ellipsis!important;white-space:nowrap!important;text-shadow:none!important;
  }
  body[data-ui-theme] .perimeter-secondary-game-location .coords{
    flex:0 0 auto;margin:0;color:var(--ui-muted);font:700 var(--ui-font-micro)/1 var(--ui-mono);
  }
  body[data-ui-theme] .perimeter-secondary-game-location .weather-location-icon{
    flex:0 0 15px;display:grid;place-items:center;width:15px;height:15px;margin:0;color:var(--ui-accent);
  }
  body[data-ui-theme] .perimeter-secondary-game-location .weather-location-icon img{display:block;width:15px;height:15px;object-fit:contain}
  body[data-ui-theme] .perimeter-secondary-game-location .weather-status{
    display:flex;align-items:center;gap:3px;min-width:0;overflow:hidden;color:var(--ui-text);font:700 var(--ui-font-micro)/1 var(--ui-font);white-space:nowrap;
  }
  body[data-ui-theme] .perimeter-secondary-game-location .weather-status b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  body[data-ui-theme] .perimeter-secondary-game-location .weather-context[hidden]{display:none}

  /* This is the GAME location row copied without changes in dimensions,
     colours, borders and control geometry.  It is deliberately a shared
     component selector rather than a route-specific approximation. */
  body[data-ui-theme] .perimeter-secondary-game-location{
    display:flex!important;align-items:center!important;justify-content:space-between!important;
    position:relative!important;z-index:150!important;isolation:isolate!important;
    box-sizing:border-box!important;width:100%!important;height:34px!important;min-height:34px!important;max-height:34px!important;
    margin:0!important;padding:0 0 0 10px!important;gap:0!important;overflow:visible!important;
    border:0!important;border-bottom:1px solid color-mix(in srgb,var(--ui-strong) 45%,var(--ui-bg) 55%)!important;
    background:var(--ui-bg-2)!important;background-image:none!important;box-shadow:none!important;
  }
  body[data-ui-theme] .perimeter-game-header-location::before,
  body[data-ui-theme] .perimeter-game-header-location::after{display:none!important;content:none!important}
  body[data-ui-theme] .perimeter-game-header-location .location-main{
    display:flex!important;align-items:center!important;flex:1 1 auto!important;min-width:0!important;max-width:calc(100% - 39px)!important;
    height:100%!important;gap:5px!important;margin:0!important;padding:0!important;overflow:hidden!important;white-space:nowrap!important;
  }
  body[data-ui-theme] .perimeter-game-header-location .location-name{
    display:inline-block!important;min-width:0!important;max-width:65%!important;
    font:700 var(--ui-font-base)/1 var(--ui-font)!important;color:var(--ui-strong)!important;
    overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
  }
  body[data-ui-theme] .perimeter-game-header-location .coords{
    display:inline-block!important;flex:0 0 auto!important;margin:0!important;
    /* V1038: match the location name typography; emphasize the position via the active theme. */
    font:700 var(--ui-font-base)/1 var(--ui-font)!important;
    color:color-mix(in srgb,var(--ui-accent) 78%,var(--ui-strong) 22%)!important;
    white-space:nowrap!important;
  }
  body[data-ui-theme] .perimeter-game-header-location .weather-location-icon{
    order:3!important;display:inline-grid!important;place-items:center!important;
    flex:0 0 17px!important;width:17px!important;min-width:17px!important;height:18px!important;margin:0!important;
  }
  body[data-ui-theme] .perimeter-game-header-location .weather-location-icon img{display:block!important;width:16px!important;height:16px!important;object-fit:contain!important}
  body[data-ui-theme] .perimeter-game-header-location .game-menu-toggle{
    display:grid!important;place-items:center!important;flex:0 0 39px!important;
    box-sizing:border-box!important;width:39px!important;height:34px!important;min-height:34px!important;max-height:34px!important;
    margin:0!important;padding:0!important;border:0!important;border-left:1px solid var(--ui-line-strong)!important;
    border-radius:0!important;background:var(--ui-bg-2)!important;color:var(--ui-strong)!important;
    box-shadow:inset 1px 0 color-mix(in srgb,var(--ui-strong) 42%,var(--ui-bg))!important;
  }
  body[data-ui-theme] .perimeter-game-header-location .game-menu-toggle svg{
    display:block!important;width:24px!important;height:24px!important;fill:none!important;stroke:currentColor!important;stroke-width:2!important;stroke-linecap:square!important;
  }

  /* GAME is the width reference: every ordinary page uses its exact root
     geometry instead of subtracting the legacy 3–4px side container gap. */
  body[data-ui-theme]:not([data-admin-ui="1"]) > main.project-root{
    box-sizing:border-box!important;width:100%!important;max-width:700px!important;min-width:0!important;
    margin:0 auto!important;padding:0!important;
  }
  body[data-ui-theme]:not([data-admin-ui="1"]) > :is(.perimeter-global-footer,.perimeter-bottom-game-return.project-root){
    box-sizing:border-box!important;width:100%!important;max-width:700px!important;min-width:0!important;
    margin-left:auto!important;margin-right:auto!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-location .perimeter-secondary-menu-toggle{
    flex:0 0 39px!important;width:39px!important;min-width:39px!important;max-width:39px!important;
    height:34px!important;min-height:34px!important;max-height:34px!important;
    border-left:1px solid var(--ui-line-strong)!important;background:var(--ui-bg-2)!important;
    box-shadow:inset 1px 0 color-mix(in srgb,var(--ui-strong) 42%,var(--ui-bg))!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-menu-toggle{
    width:39px!important;min-width:39px!important;max-width:39px!important;
    height:34px!important;min-height:34px!important;max-height:34px!important;
    padding:0!important;font-size:0!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-menu-toggle svg{
    width:24px!important;height:24px!important;fill:none!important;stroke:currentColor!important;
    stroke-width:2!important;stroke-linecap:square!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu{
    width:228px!important;max-width:calc(100vw - 12px)!important;padding:3px!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    grid-auto-rows:40px!important;gap:2px!important;height:auto!important;min-height:0!important;max-height:none!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup>a{
    height:40px!important;min-height:40px!important;max-height:40px!important;
    justify-content:flex-start!important;padding:0 10px!important;gap:9px!important;
    font-size:11px!important;text-align:left!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-menu .perimeter-game-nav--secondary-popup .game-quick-icon{
    width:16px!important;height:16px!important;min-width:16px!important;flex-basis:16px!important;
  }
  /* GAME fixes this line at 24px.  Keep that measured height on every route
     instead of allowing the mobile helper to compress secondary headers. */
  body[data-ui-theme] .perimeter-global-header .perimeter-status-bar{
    height:24px!important;min-height:24px!important;max-height:24px!important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-status-item{
    height:23px!important;min-height:23px!important;
  }
}

/* V821 — secondary navigation is a body-level layer while open.  It therefore
   remains fully visible above every legacy page shell, regardless of that
   page's overflow or stacking context. */
body[data-ui-theme] > .perimeter-secondary-game-menu.perimeter-secondary-game-menu--portal{
  position:fixed!important;z-index:2147483000!important;
  box-sizing:border-box!important;width:228px!important;max-width:calc(100vw - 12px)!important;
  padding:3px!important;border:1px solid var(--ui-line-strong)!important;
  background:var(--ui-bg-2)!important;box-shadow:0 8px 18px rgba(0,0,0,.62)!important;
  overflow:visible!important;
}
body[data-ui-theme] > .perimeter-secondary-game-menu.perimeter-secondary-game-menu--portal .perimeter-game-nav--secondary-popup{
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;
  grid-auto-rows:40px!important;gap:2px!important;width:100%!important;height:auto!important;
  min-height:0!important;max-height:none!important;margin:0!important;padding:0!important;
  border:0!important;overflow:visible!important;background:transparent!important;
}
body[data-ui-theme] > .perimeter-secondary-game-menu.perimeter-secondary-game-menu--portal .perimeter-game-nav--secondary-popup>a{
  display:flex!important;align-items:center!important;justify-content:flex-start!important;
  width:100%!important;height:40px!important;min-height:40px!important;max-height:40px!important;
  padding:0 10px!important;gap:9px!important;font-size:11px!important;text-align:left!important;
}
body[data-ui-theme] > .perimeter-secondary-game-menu.perimeter-secondary-game-menu--portal .perimeter-game-nav--secondary-popup .game-quick-icon{
  width:16px!important;height:16px!important;min-width:16px!important;flex-basis:16px!important;
}

/* V823 — consistent NPC and terminal return controls. */
body[data-ui-theme] .perimeter-bottom-game-return--pda-quests{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
body[data-ui-theme] .perimeter-bottom-game-return--pda-quests .perimeter-bottom-game-return__link{min-width:0!important}
body[data-ui-theme] .perimeter-bottom-game-return--pda-quests .perimeter-bottom-game-return__link + .perimeter-bottom-game-return__link{border-left:1px solid var(--ui-line)!important}
body[data-ui-theme] .perimeter-bottom-game-return--crafting{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
body[data-ui-theme] .perimeter-bottom-game-return--crafting .perimeter-bottom-game-return__link{min-width:0!important}
body[data-ui-theme] .perimeter-bottom-game-return--crafting .perimeter-bottom-game-return__link + .perimeter-bottom-game-return__link{border-left:1px solid var(--ui-line)!important}
/* V827: learned-recipes uses exactly the same flat GAME action treatment. */
body[data-ui-theme] .perimeter-bottom-game-return--crafting .perimeter-bottom-game-return__link{
  min-height:40px!important;border:0!important;border-radius:0!important;
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 3.5%,transparent),transparent 78%),var(--ui-bg-2)!important;
  color:var(--ui-strong)!important;font:800 var(--ui-font-base)/1.2 var(--ui-mono)!important;
}
body[data-ui-theme] .perimeter-bottom-game-return--crafting .perimeter-bottom-game-return__link:is(:hover,:focus-visible){
  background:linear-gradient(90deg,color-mix(in srgb,var(--ui-accent) 9%,transparent),transparent 82%),var(--ui-surface-active)!important;
  color:var(--ui-accent)!important;
}
body[data-ui-theme].npc-dialog-page .perimeter-bottom-game-return{display:none!important}
body[data-ui-theme].npc-dialog-page .guard-identity{grid-template-columns:minmax(0,1fr) 70px!important;min-height:84px!important}
body[data-ui-theme].npc-dialog-page .guard-npc-avatar{width:70px!important;height:70px!important;min-width:70px!important}
body[data-ui-theme].npc-dialog-page .guard-dialogue-topics .guard-topic{grid-template-columns:20px minmax(0,1fr)!important;padding-right:8px!important}
body[data-ui-theme].npc-dialog-page .guard-dialogue-topics .guard-topic>b{display:none!important}
@media(max-width:480px){
  body[data-ui-theme].npc-dialog-page .guard-identity{grid-template-columns:minmax(0,1fr) 70px!important;min-height:84px!important}
  body[data-ui-theme].npc-dialog-page .guard-npc-avatar{width:70px!important;height:70px!important;min-width:70px!important}
  body[data-ui-theme].npc-dialog-page .guard-dialogue-topics .guard-topic{grid-template-columns:18px minmax(0,1fr)!important}
}


/* V849 — externally loaded segmented menu for V848 markup.
   IMPORTANT: includes/runtime/page_bridge.php deliberately strips <style> tags
   from PHP-rendered HTML. These styles must live in the shared CSS asset.
   The reset layer is used only for this new widget because its !important
   geometry must win over the older route/chrome layers' !important rules.
   Original popup navigation, fonts, themes and menu settings are unchanged. */
@layer reset {
  body[data-ui-theme] .perimeter-menu-segments-v847 {
    --v849-cell:46px;
    box-sizing:border-box !important;
    display:grid !important;
    grid-template-columns:repeat(3,var(--v849-cell)) !important;
    align-items:stretch !important;
    justify-items:stretch !important;
    justify-content:start !important;
    flex:0 0 auto !important;
    gap:0 !important;
    width:calc(3 * var(--v849-cell)) !important;
    min-width:calc(3 * var(--v849-cell)) !important;
    max-width:calc(3 * var(--v849-cell)) !important;
    height:34px !important;
    min-height:34px !important;
    max-height:34px !important;
    margin:0 !important;
    padding:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    overflow:visible !important;
    position:relative !important;
  }
  body[data-ui-theme] .perimeter-menu-segments-v847 > a {
    box-sizing:border-box !important;
    display:flex !important;
    position:relative !important;
    align-items:center !important;
    justify-content:center !important;
    flex:0 0 auto !important;
    width:var(--v849-cell) !important;
    min-width:var(--v849-cell) !important;
    max-width:var(--v849-cell) !important;
    height:34px !important;
    min-height:34px !important;
    max-height:34px !important;
    margin:0 !important;
    padding:0 !important;
    gap:0 !important;
    border:0 !important;
    border-left:1px solid color-mix(in srgb,var(--ui-strong,#d0cec0) 44%,var(--ui-bg,#040606)) !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    overflow:hidden !important;
    text-decoration:none !important;
    transform:none !important;
    line-height:1 !important;
  }
  body[data-ui-theme] .perimeter-menu-segments-v847 > a:last-child {
    border-right:1px solid color-mix(in srgb,var(--ui-strong,#d0cec0) 44%,var(--ui-bg,#040606)) !important;
  }
  body[data-ui-theme] .perimeter-menu-segments-v847 > a::before,
  body[data-ui-theme] .perimeter-menu-segments-v847 > a::after {
    content:none !important;
    display:none !important;
  }
  body[data-ui-theme] .perimeter-menu-segments-v847 > a:is(:hover,:focus-visible) {
    background:color-mix(in srgb,var(--ui-accent,#a5aa5d) 9%,transparent) !important;
  }
  body[data-ui-theme] .perimeter-menu-segments-v847 img.perimeter-menu-icon-v847 {
    display:block !important;
    position:static !important;
    box-sizing:border-box !important;
    flex:0 0 auto !important;
    min-width:0 !important;
    min-height:0 !important;
    max-width:none !important;
    max-height:none !important;
    margin:0 !important;
    padding:0 !important;
    border:0 !important;
    object-fit:contain !important;
    opacity:1 !important;
    filter:none !important;
    transform:none !important;
  }
  body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="pda"] img {width:26px !important;height:26px !important;}
  body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="character"] img {width:22px !important;height:22px !important;}
  body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="backpack"] img {width:21px !important;height:21px !important;}
  body[data-ui-theme] .game > .location.location-corner-v847 {
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    box-sizing:border-box !important;
    width:100% !important;
    height:34px !important;
    min-height:34px !important;
    max-height:34px !important;
    padding-right:0 !important;
    overflow:visible !important;
  }
  body[data-ui-theme] .game > .location.location-corner-v847 > .location-main {
    display:flex !important;
    flex:1 1 auto !important;
    min-width:0 !important;
    max-width:none !important;
    overflow:hidden !important;
    white-space:nowrap !important;
  }
  body[data-ui-theme] .game > .location.location-corner-v847 > .game-menu-corner-slot {
    --v849-cell:46px;
    display:flex !important;
    align-items:center !important;
    justify-content:flex-end !important;
    flex:0 0 auto !important;
    width:calc(3 * var(--v849-cell)) !important;
    min-width:calc(3 * var(--v849-cell)) !important;
    max-width:calc(3 * var(--v849-cell)) !important;
    height:34px !important;
    margin:0 !important;
    padding:0 !important;
    overflow:visible !important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-location--corner > .location-main {
    flex:1 1 auto !important;
    min-width:0 !important;
    max-width:none !important;
    overflow:hidden !important;
    white-space:nowrap !important;
  }
  body[data-ui-theme] .perimeter-global-header .perimeter-secondary-game-location--corner > .perimeter-menu-segments-v847 {
    flex:0 0 auto !important;
  }
  @media(max-width:420px){
    body[data-ui-theme] .perimeter-menu-segments-v847,
    body[data-ui-theme] .game > .location.location-corner-v847 > .game-menu-corner-slot{--v849-cell:42px;}
    body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="pda"] img{width:24px !important;height:24px !important;}
    body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="character"] img{width:21px !important;height:21px !important;}
    body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="backpack"] img{width:20px !important;height:20px !important;}
  }
  @media(max-width:340px){
    body[data-ui-theme] .perimeter-menu-segments-v847,
    body[data-ui-theme] .game > .location.location-corner-v847 > .game-menu-corner-slot{--v849-cell:39px;}
    body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="pda"] img{width:23px !important;height:23px !important;}
    body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="character"] img{width:19px !important;height:19px !important;}
    body[data-ui-theme] .perimeter-menu-segments-v847 [data-corner-shortcut="backpack"] img{width:19px !important;height:19px !important;}
  }
}

/* V869: warning/status feedback remains in document flow; no screen overlay. */
@layer components {
 .perimeter-inline-feedback-v869{
  box-sizing:border-box;display:block;position:relative;max-width:700px;width:100%;
  margin:0 auto;padding:7px 10px;border:0;border-bottom:1px solid var(--ui-line-strong);
  background:var(--ui-bg-2);color:var(--ui-strong);
  font:700 var(--ui-font-base)/1.45 var(--ui-mono);overflow-wrap:anywhere;
 }
 .perimeter-inline-feedback-v869[hidden]{display:none!important}
 .perimeter-inline-feedback-v869.is-error{border-bottom-color:var(--ui-danger);color:var(--ui-danger)}
}

/* V897: GAME sector transitions use the established footer "В ИГРУ" control.
   Visual only: do not alter the transition form, its target, hidden state or JS. */
body[data-ui-theme] .game #transitionBlock{
  box-sizing:border-box!important;
  width:100%!important;max-width:100%!important;min-width:0!important;
  margin:0!important;padding:0!important;
  border:0!important;
  border-top:1px solid var(--ui-line)!important;
  border-bottom:1px solid var(--ui-line)!important;
  border-radius:0!important;
  background:var(--ui-bg-2)!important;
  box-shadow:none!important;
}
body[data-ui-theme] .game #transitionBlock #transitionBtn{
  box-sizing:border-box!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
  gap:8px!important;
  width:100%!important;min-width:0!important;
  min-height:40px!important;height:auto!important;max-height:none!important;
  margin:0!important;padding:8px 12px!important;
  border:0!important;border-radius:0!important;
  background:var(--ui-bg-2)!important;
  color:var(--ui-strong)!important;
  font:800 var(--ui-font-base)/1.2 var(--ui-mono)!important;
  letter-spacing:normal!important;
  text-align:center!important;text-decoration:none!important;
  box-shadow:none!important;
  touch-action:manipulation;
}
body[data-ui-theme] .game #transitionBlock #transitionBtn .transition-btn__label{
  flex:0 1 auto!important;
  min-width:0!important;max-width:100%!important;
  margin:0!important;padding:0!important;
  color:inherit!important;font:inherit!important;
  letter-spacing:inherit!important;text-align:center!important;
  white-space:normal!important;overflow-wrap:anywhere!important;
  text-overflow:clip!important;
}
body[data-ui-theme] .game #transitionBlock #transitionBtn .transition-btn__icon{
  display:block!important;flex:0 0 18px!important;
  width:18px!important;height:18px!important;
  fill:none!important;stroke:var(--ui-accent)!important;
  stroke-width:1.8!important;stroke-linecap:round!important;stroke-linejoin:round!important;filter:none!important;
}
body[data-ui-theme] .game #transitionBlock #transitionBtn::after{content:none!important;display:none!important}
body[data-ui-theme] .game #transitionBlock #transitionBtn:is(:hover,:focus-visible){
  background:var(--ui-surface-active)!important;
  color:var(--ui-accent)!important;
}
body[data-ui-theme] .game #transitionBlock #transitionBtn:focus-visible{
  outline:2px solid var(--ui-focus)!important;outline-offset:-2px!important;
}
body[data-ui-theme] .game #transitionBlock #transitionBtn:active{
  background:color-mix(in srgb,var(--ui-accent) 7%,var(--ui-bg-2))!important;
}
@media(max-width:560px){
  body[data-ui-theme] .game #transitionBlock #transitionBtn{
    min-height:42px!important;padding:8px 10px!important;
  }
}


/* V971 — web-optimized ZONE photograph for the existing shared footer.
   No footer links or behavior are changed. Preserve the global theme typography. */
body[data-ui-theme] > footer.perimeter-global-footer[data-unified-footer="1"]{
  background-color:#0a0c0d!important;
  background-image:
    linear-gradient(180deg,rgba(0,0,0,.64) 0%,rgba(0,0,0,.46) 56%,rgba(0,0,0,.66) 100%),
    url('/assets/images/ui/footer-zone-v971.webp')!important;
  background-repeat:no-repeat!important;
  background-position:center center,center 66%!important;
  background-size:cover!important;
  color:#bbb6ac;
  text-shadow:0 1px 3px rgba(0,0,0,.96);
}
body[data-ui-theme] > footer.perimeter-global-footer[data-unified-footer="1"] .perimeter-footer-links a{
  color:#d2c9ba;
}
body[data-ui-theme] > footer.perimeter-global-footer[data-unified-footer="1"] .perimeter-footer-links a:is(:hover,:focus-visible){
  color:#f5e5b9;
}
body[data-ui-theme] > footer.perimeter-global-footer[data-unified-footer="1"] .perimeter-footer-social{
  border-top-color:rgba(200,194,171,.20);
}
@media(max-width:420px){
  body[data-ui-theme] > footer.perimeter-global-footer[data-unified-footer="1"]{
    background-position:center center,68% 68%!important;
  }
}

/* V982: the old footer navigation and on-line list stay on every game page.
   Hide only the browser-generated marker; keep click-to-open player list. */
body[data-ui-theme] .perimeter-footer-runtime{position:relative}
body[data-ui-theme] .perimeter-online-v940{position:relative;display:inline-flex;align-items:center;min-width:0}
body[data-ui-theme] .perimeter-online-v940>summary{
  list-style:none;display:inline-flex;align-items:center;gap:4px;
  padding:0;margin:0;cursor:pointer;color:inherit;font:inherit;
}
body[data-ui-theme] .perimeter-online-v940>summary::-webkit-details-marker{display:none}
body[data-ui-theme] .perimeter-online-v940>summary::marker{content:''}
body[data-ui-theme] .perimeter-online-v940>summary:is(:hover,:focus-visible){color:var(--ui-strong)}
body[data-ui-theme] .perimeter-online-v940>summary:focus-visible{outline:1px solid var(--ui-focus);outline-offset:2px}
/* V994: keep the V940 footer indicator's visual appearance as a link. */
body[data-ui-theme] a.perimeter-online-v940{
  gap:4px;color:inherit;font:inherit;text-decoration:none;cursor:pointer;
}
body[data-ui-theme] a.perimeter-online-v940:is(:hover,:focus-visible){color:var(--ui-strong)}
body[data-ui-theme] a.perimeter-online-v940:focus-visible{outline:1px solid var(--ui-focus);outline-offset:2px}
body[data-ui-theme] .perimeter-online-v940__list{
  position:absolute;z-index:200;top:calc(100% + 5px);left:50%;transform:translateX(-50%);
  box-sizing:border-box;display:grid;grid-template-columns:minmax(0,1fr);gap:0;
  min-width:185px;max-width:min(280px,calc(100vw - 24px));max-height:210px;overflow:auto;
  padding:3px 5px;border:1px solid var(--ui-line-strong);
  background:var(--ui-bg-2);box-shadow:0 7px 15px rgba(0,0,0,.75);text-align:left;
}
body[data-ui-theme] .perimeter-online-v940__list>a{
  display:block;padding:6px 7px;border-bottom:1px solid var(--ui-line);
  color:var(--ui-strong);text-decoration:none;overflow-wrap:anywhere;font:inherit;
}
body[data-ui-theme] .perimeter-online-v940__list>a:is(:hover,:focus-visible){color:var(--ui-accent);background:var(--ui-surface-active)}
