/* ==========================================================================
   GRAY DOOM — STUDIO PRODUCTION DIEGETIC TACTICAL UI/UX SYSTEM (v1.0)
   Aesthetic: Brutal Technological Realism (Weathered Gunmetal, Command Brass,
   Radar Cyan, Chamfered Military Bezels, Above-the-Fold Spatial Viewport)
   ========================================================================== */

:root {
  --studio-obsidian: #060a0f;
  --studio-gunmetal: #0c141d;
  --studio-plate: #111c28;
  --studio-plate-hi: #172636;
  --studio-bezel: #2a4156;
  --studio-bezel-hi: #466985;
  --studio-brass: #d89b3c;
  --studio-brass-hi: #f3c26b;
  --studio-brass-dim: rgba(216, 155, 60, 0.18);
  --studio-cyan: #58c7d8;
  --studio-cyan-hi: #8ce5f2;
  --studio-cyan-dim: rgba(88, 199, 216, 0.16);
  --studio-crimson: #dc4c56;
  --studio-emerald: #3ca87d;
  --studio-ink: #eaf1f6;
  --studio-muted: #8ea4b5;
  --studio-chamfer-sm: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  --studio-chamfer-md: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

/* --------------------------------------------------------------------------
   1. GLOBAL SHELL & TYPOGRAPHY CALIBRATION
   -------------------------------------------------------------------------- */
body {
  background:
    radial-gradient(circle at 50% 0%, rgba(26, 54, 74, 0.42) 0%, rgba(9, 15, 22, 0.96) 55%, #05080c 100%),
    #05080c;
  color: var(--studio-ink);
}

/* Remove wasted 8vh top/bottom margin when inside the active game client */
main.shell {
  width: min(1420px, 96vw);
  margin: 0 auto;
  padding: 12px 0 36px;
}

/* Style Login Screen as a Diegetic Tactical Command Terminal */
#login-panel {
  max-width: 580px;
  margin: 5vh auto;
  padding: 36px 40px;
  background:
    linear-gradient(165deg, rgba(18, 31, 45, 0.95) 0%, rgba(9, 16, 24, 0.98) 100%);
  border: 1px solid var(--studio-bezel-hi);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(88, 199, 216, 0.12);
  clip-path: var(--studio-chamfer-md);
  position: relative;
}

#login-panel::before {
  content: "TERMINAL AUTH // SECTOR GZ-17";
  position: absolute;
  top: 12px;
  right: 18px;
  font: 700 0.65rem var(--font-ui);
  letter-spacing: 0.16em;
  color: var(--studio-brass);
  opacity: 0.85;
}

#login-panel h1 {
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.02;
  margin: 6px 0 10px;
  color: var(--studio-ink);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

#login-panel button {
  background: linear-gradient(180deg, #e2a544 0%, #b87b1e 100%);
  border: 1px solid var(--studio-brass-hi);
  color: #080d13;
  font-weight: 800;
  letter-spacing: 0.12em;
  clip-path: var(--studio-chamfer-sm);
  box-shadow: 0 4px 18px rgba(216, 155, 60, 0.28);
}

#login-panel button:hover {
  background: linear-gradient(180deg, #eeb457 0%, #ca8a27 100%);
}

/* --------------------------------------------------------------------------
   2. COMPACT DIEGETIC IN-GAME TOP HUD (.game-hud-sticky)
   Replaces the bloated 540px SaaS header with a sleek 92px 2-tier Command Bar
   so 88% of the 900px screen is dedicated to the playable map/settlement!
   -------------------------------------------------------------------------- */
#game-panel .game-hud-sticky {
  position: sticky;
  top: 0;
  z-index: 120;
  padding: 6px 14px 6px !important;
  margin: 0 calc(-50vw + 50%) 8px !important;
  padding-inline: max(14px, calc(50vw - 710px)) !important;
  background: linear-gradient(180deg, rgba(8, 14, 21, 0.98) 0%, rgba(11, 20, 30, 0.96) 100%) !important;
  border-bottom: 1px solid var(--studio-bezel-hi) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), inset 0 -1px 0 rgba(216, 155, 60, 0.25) !important;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "brand resources actions"
    "nav nav status";
  align-items: center;
  gap: 6px 14px;
}

/* Top-Left: Compact Commander Callsign & Sector Plate */
#game-panel .game-hud-sticky > header {
  display: contents;
}

#game-panel .game-hud-sticky > header > div:first-child {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 10px;
  background: linear-gradient(90deg, rgba(216, 155, 60, 0.16), rgba(16, 28, 40, 0.85));
  border-left: 3px solid var(--studio-brass);
  border-top: 1px solid rgba(216, 155, 60, 0.35);
  border-bottom: 1px solid rgba(42, 65, 86, 0.8);
  border-right: 1px solid rgba(42, 65, 86, 0.8);
}

#game-panel .game-hud-sticky > header > div:first-child .eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--studio-brass);
  display: none;
}

#game-panel #callsign {
  font-size: 1.08rem !important;
  line-height: 1.1 !important;
  margin: 0 !important;
  white-space: nowrap;
  letter-spacing: 0.06em;
  color: var(--studio-ink);
}

/* Top-Center: Compact 4-Resource Live Telemetry Strip */
#game-panel .game-hud-sticky > .resource-bar {
  grid-area: resources;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) !important;
  gap: 6px !important;
  margin: 0 !important;
}

#game-panel .game-hud-sticky > .resource-bar .resource {
  padding: 4px 10px !important;
  background: rgba(9, 17, 26, 0.92) !important;
  border: 1px solid rgba(56, 86, 110, 0.75) !important;
  border-top: 2px solid var(--studio-cyan) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  min-height: 36px !important;
}

#game-panel .game-hud-sticky > .resource-bar .resource:nth-child(1) { border-top-color: #46b886 !important; }
#game-panel .game-hud-sticky > .resource-bar .resource:nth-child(2) { border-top-color: #d98845 !important; }
#game-panel .game-hud-sticky > .resource-bar .resource:nth-child(3) { border-top-color: #58c7d8 !important; }
#game-panel .game-hud-sticky > .resource-bar .resource:nth-child(4) { border-top-color: #e3b34b !important; }

#game-panel .game-hud-sticky > .resource-bar .resource__identity {
  font-size: 0.66rem !important;
  letter-spacing: 0.06em !important;
  gap: 5px !important;
}

#game-panel .game-hud-sticky > .resource-bar .resource__identity img {
  width: 18px !important;
  height: 18px !important;
}

#game-panel .game-hud-sticky > .resource-bar .resource strong {
  font-size: 0.86rem !important;
  line-height: 1 !important;
  color: var(--studio-ink) !important;
  white-space: nowrap !important;
}

#game-panel .game-hud-sticky > .resource-bar .resource > span:last-child {
  font-size: 0.66rem !important;
  color: var(--studio-brass-hi) !important;
  white-space: nowrap;
}

/* Top-Right: Utility Controls (Sitters, Sound, Disconnect) */
#game-panel .game-hud-sticky .header-actions {
  grid-area: actions;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin: 0 !important;
}

#game-panel .game-hud-sticky .header-actions button {
  padding: 5px 9px !important;
  font-size: 0.68rem !important;
  min-height: 30px !important;
  border-color: var(--studio-bezel-hi) !important;
  background: rgba(15, 27, 39, 0.9) !important;
  color: var(--studio-ink) !important;
  white-space: nowrap;
}

#game-panel .game-hud-sticky .header-actions button:hover {
  border-color: var(--studio-cyan) !important;
  color: var(--studio-cyan-hi) !important;
}

/* Row 2 Left: Single-Line Diegetic Tactical Navigation */
#game-panel .game-hud-sticky > nav.game-navigation {
  grid-area: nav;
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 4px !important;
  padding: 2px 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  scrollbar-width: none;
}

#game-panel .game-hud-sticky > nav.game-navigation a {
  padding: 4px 10px !important;
  font-size: 0.71rem !important;
  min-height: 28px !important;
  white-space: nowrap !important;
  border-radius: 2px !important;
  background: rgba(14, 24, 36, 0.92) !important;
  border: 1px solid rgba(45, 71, 94, 0.85) !important;
  gap: 5px !important;
}

#game-panel .game-hud-sticky > nav.game-navigation a img {
  width: 14px !important;
  height: 14px !important;
}

#game-panel .game-hud-sticky > nav.game-navigation a.is-active-tab,
#game-panel .game-hud-sticky > nav.game-navigation a[aria-current="location"] {
  background: linear-gradient(180deg, rgba(216, 155, 60, 0.26), rgba(20, 35, 50, 0.96)) !important;
  border-color: var(--studio-brass-hi) !important;
  color: var(--studio-brass-hi) !important;
  box-shadow: inset 0 0 8px rgba(216, 155, 60, 0.25) !important;
}

/* Row 2 Right: Compact Sector & Influence Status Readout */
#game-panel .game-hud-sticky > .status {
  grid-area: status;
  margin: 0 !important;
  padding: 2px 8px !important;
  border: 1px solid rgba(45, 71, 94, 0.65) !important;
  background: rgba(7, 13, 20, 0.85) !important;
  font-size: 0.66rem !important;
  gap: 10px !important;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   3. STAGE SWITCHER & COMPACT COMMAND HUB RIBBON
   -------------------------------------------------------------------------- */
#game-panel .settlement-stage-switcher {
  margin: 2px 0 4px !important;
  gap: 6px !important;
}

#game-panel .stage-tab {
  padding: 3px 10px !important;
  font-size: 0.72rem !important;
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
}

#game-panel .stage-tab img {
  width: 14px !important;
  height: 14px !important;
}

#game-panel .stage-tab__key {
  width: 16px !important;
  height: 16px !important;
  font-size: 0.64rem !important;
}

/* Compress the 260px .hero.game-stage banner into a 42px Diegetic Command Bar */
#game-panel .hero.game-stage {
  grid-template-columns: 1fr auto !important;
  align-items: center !important;
  min-height: 0 !important;
  gap: 10px !important;
  padding: 4px 12px !important;
  margin: 0 0 6px !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  border-left: 3px solid var(--studio-brass) !important;
  background: linear-gradient(90deg, rgba(13, 24, 36, 0.94) 0%, rgba(10, 19, 29, 0.82) 100%) !important;
}

#game-panel .hero.game-stage > div:nth-of-type(2) {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  min-width: 0 !important;
}

#game-panel .hero.game-stage .faction-heading {
  margin: 0 !important;
  gap: 6px !important;
}

#game-panel .hero.game-stage .faction-emblem {
  width: 22px !important;
  height: 22px !important;
}

#game-panel .hero.game-stage h2 {
  font-size: 0.92rem !important;
  margin: 0 !important;
  letter-spacing: 0.06em !important;
  white-space: nowrap !important;
}

#game-panel .hero.game-stage > div:nth-of-type(2) > p {
  display: none !important;
}

#game-panel .hero.game-stage .hero-actions {
  gap: 5px !important;
  margin: 0 0 0 auto !important;
}

#game-panel .hero.game-stage .hero-actions button {
  padding: 4px 9px !important;
  font-size: 0.68rem !important;
  min-height: 24px !important;
}

#game-panel .hero.game-stage #upgrade {
  background: linear-gradient(180deg, #e2a544 0%, #b87b1e 100%) !important;
  border-color: var(--studio-brass-hi) !important;
  color: #080d13 !important;
  font-weight: 800 !important;
}

#game-panel .hero.game-stage .upgrade {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding-left: 10px !important;
}

#game-panel .hero.game-stage .upgrade strong {
  font-size: 0.98rem !important;
  color: var(--studio-brass-hi) !important;
}

#game-panel .hero.game-stage .upgrade span {
  font-size: 0.68rem !important;
}

/* --------------------------------------------------------------------------
   4. ABOVE-THE-FOLD SPATIAL SETTLEMENT STAGE (DORF1 & DORF2)
   -------------------------------------------------------------------------- */
#game-panel .settlement.functional-landscape {
  padding: 8px 14px 12px !important;
  margin: 0 0 12px !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  background-color: var(--studio-gunmetal) !important;
  background-image: none !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65) !important;
}

/* Eliminate the 320px empty header gap above dorf1/dorf2/forces! */
#game-panel .functional-landscape > .section-heading {
  min-height: 32px !important;
  padding: 4px 12px !important;
  margin: -8px -14px 6px !important;
  align-items: center !important;
  background: linear-gradient(90deg, rgba(12, 22, 33, 0.96), rgba(16, 30, 44, 0.88)) !important;
  border-bottom: 1px solid var(--studio-bezel) !important;
}

#game-panel .functional-landscape > .section-heading h2 {
  font-size: 1.02rem !important;
  margin: 0 !important;
}

#game-panel .functional-landscape > .section-heading .eyebrow {
  font-size: 0.58rem !important;
  margin: 0 !important;
}

#game-panel .functional-landscape > .section-heading > p {
  margin: 0 !important;
  padding: 2px 8px !important;
  font-size: 0.72rem !important;
}

#game-panel .functional-landscape > .workspace-note {
  display: none !important;
}

#game-panel .dorf1-filter-bar {
  margin: 0 0 6px !important;
  gap: 5px !important;
}

#game-panel .dorf1-filter-bar .filter-pill {
  padding: 3px 9px !important;
  font-size: 0.68rem !important;
  border-radius: 2px !important;
}

/* Constrain Stage Height so 100% of the Map fits on a 1440x900 Viewport! */
#game-panel .dorf1-natural-stage,
#game-panel .dorf2-city-stage {
  grid-template-columns: minmax(0, 1fr) 310px !important;
  gap: 12px !important;
  margin: 2px 0 8px !important;
  align-items: start !important;
}

#game-panel .dorf1-canvas,
#game-panel .dorf2-canvas {
  max-height: 600px !important;
  border: 2px solid var(--studio-bezel-hi) !important;
  border-radius: 4px !important;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.78),
    0 10px 30px rgba(0, 0, 0, 0.65) !important;
}

/* Studio Tactical Reticle & Level Medallions on Dorf1/Dorf2 Nodes */
#game-panel .dorf-field-node__badge,
#game-panel .dorf-building-node__badge {
  background: linear-gradient(180deg, #1a2d3e 0%, #0b141e 100%) !important;
  border: 1px solid var(--studio-brass) !important;
  color: var(--studio-brass-hi) !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.85) !important;
}

/* Docked Right-Hand Tactical Inspector Sidebar */
#game-panel .dorf1-sidebar,
#game-panel .dorf2-sidebar {
  max-height: 600px !important;
  overflow-y: auto !important;
  display: grid !important;
  gap: 8px !important;
  padding-right: 2px;
}

#game-panel .dorf-telemetry-card {
  background: linear-gradient(160deg, rgba(16, 28, 41, 0.96), rgba(9, 16, 24, 0.98)) !important;
  border: 1px solid var(--studio-bezel) !important;
  border-left: 3px solid var(--studio-cyan) !important;
  border-radius: 3px !important;
  padding: 10px 12px !important;
}

#game-panel .inspection-telemetry-card {
  border-left-color: var(--studio-brass) !important;
}

#game-panel .inspector-costs {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
  margin: 8px 0 !important;
}

#game-panel .inspector-costs span {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 4px 6px !important;
  background: rgba(7, 13, 20, 0.9) !important;
  border: 1px solid rgba(56, 86, 110, 0.65) !important;
  border-radius: 2px !important;
  font-size: 0.7rem !important;
  font-family: var(--font-mono) !important;
  color: var(--studio-ink) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#game-panel .inspector-costs span img {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0 !important;
  object-fit: contain !important;
}

#game-panel .inspector-btn {
  width: 100% !important;
  padding: 7px 12px !important;
  background: linear-gradient(180deg, #e5a94c 0%, #b87b20 100%) !important;
  border: 1px solid var(--studio-brass-hi) !important;
  color: #080d14 !important;
  font-weight: 800 !important;
  font-size: 0.76rem !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
  cursor: pointer !important;
}

#game-panel .radar-crimson-alert[hidden] {
  display: none !important;
}

/* World Map Stage (#sector-title) Compact Framing */
#game-panel .sector-console {
  padding: 14px 18px !important;
  margin: 4px 0 16px !important;
  border: 1px solid var(--studio-bezel-hi) !important;
}

/* --------------------------------------------------------------------------
   5. PUBLIC SITE, WORLD PORTAL & ONBOARDING (WELCOME, JOIN, WORLD)
   -------------------------------------------------------------------------- */
body.public-site {
  background:
    linear-gradient(180deg, rgba(6, 11, 17, 0.84) 0%, rgba(7, 12, 19, 0.95) 45%, #05080c 100%),
    url('/assets/runtime/landing-world/gray-meridian-overview-v4.png') center top / cover no-repeat fixed !important;
}

.public-header {
  background: rgba(7, 12, 19, 0.92) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--studio-bezel-hi) !important;
  padding: 10px 24px !important;
}

.public-button {
  background: linear-gradient(180deg, #e5a94c 0%, #b87b20 100%) !important;
  border: 1px solid var(--studio-brass-hi) !important;
  color: #080d14 !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  clip-path: var(--studio-chamfer-sm);
  box-shadow: 0 4px 18px rgba(216, 155, 60, 0.25);
}

.public-button--ghost {
  background: rgba(13, 24, 36, 0.88) !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  color: var(--studio-cyan-hi) !important;
  box-shadow: none;
}

.public-button--ghost:hover {
  border-color: var(--studio-brass-hi) !important;
  color: var(--studio-brass-hi) !important;
}

/* World Login Split-Screen Command Terminal (/world.html) */
body.world-page .world-layout {
  width: min(1620px, 96vw);
  padding: 20px 0 48px;
}

.world-command-grid {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 8px;
}

.world-command-grid #world-login {
  max-width: none;
  margin: 0;
  background: linear-gradient(165deg, rgba(16, 29, 42, 0.96), rgba(8, 15, 23, 0.98));
  border: 1px solid var(--studio-bezel-hi);
  border-top: 3px solid var(--studio-brass);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

.world-theater-brief {
  background: linear-gradient(165deg, rgba(13, 24, 36, 0.94), rgba(8, 14, 21, 0.97));
  border: 1px solid var(--studio-bezel-hi);
  padding: 22px;
  display: grid;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

.world-theater-banner {
  position: relative;
  border: 1px solid var(--studio-bezel-hi);
  overflow: hidden;
  aspect-ratio: 16 / 7;
  background: #060b10;
}

.world-theater-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.world-theater-banner__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 12px 16px;
  background: linear-gradient(180deg, transparent, rgba(5, 9, 14, 0.95));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.world-server-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.world-server-card {
  background: rgba(9, 17, 26, 0.92);
  border: 1px solid var(--studio-bezel);
  border-left: 3px solid var(--studio-cyan);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  color: var(--studio-ink);
}

.world-server-card:hover {
  border-color: var(--studio-brass-hi);
  background: rgba(18, 32, 46, 0.96);
}

.world-server-card strong {
  font: 700 0.95rem var(--font-display);
  letter-spacing: 0.05em;
  color: var(--studio-brass-hi);
}

.world-server-card small {
  color: var(--studio-muted);
  font-size: 0.74rem;
}

/* Join Registration Enhancement (/join.html) */
.join-layout {
  width: min(1140px, 94vw) !important;
  margin: 0 auto !important;
  padding: 20px 0 48px !important;
}

.join-intro h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem) !important;
  margin: 4px 0 8px !important;
}

.join-step {
  background: linear-gradient(165deg, rgba(15, 27, 40, 0.95), rgba(8, 15, 22, 0.98)) !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  border-top: 3px solid var(--studio-brass) !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7) !important;
}

/* --------------------------------------------------------------------------
   6. MOBILE 390x844 RESPONSIVE SAFEGUARDS (ZERO HORIZONTAL OVERFLOW)
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  #game-panel .game-hud-sticky {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "resources resources"
      "nav nav";
    position: relative;
  }
  #game-panel .game-hud-sticky > .status {
    display: none !important;
  }
  #game-panel .game-hud-sticky > .resource-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  #game-panel .dorf1-natural-stage,
  #game-panel .dorf2-city-stage,
  .world-command-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  .world-server-cards {
    grid-template-columns: 1fr;
  }
  #game-panel .game-hud-sticky .header-actions button {
    padding: 4px 6px !important;
    font-size: 0.62rem !important;
  }
}

.world-command-grid:has(#world-login[hidden]) {
  display: none !important;
}

/* --------------------------------------------------------------------------
   7. LANDING PORTAL STUDIO OVERHAUL (body.landing-page)
   Purges SaaS/Fintech pills & neon mint; enforces Brutal Technological Realism,
   Tick-Ruler Scrollbar (Gaussian 44-tick wave), and OCD (ADR-015) Telemetry
   -------------------------------------------------------------------------- */
:root,
html,
body.landing-page {
  color-scheme: dark;
}

body.landing-page *,
body.landing-page *::before,
body.landing-page *::after {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

body.landing-page *::-webkit-scrollbar,
body.landing-page *::-webkit-scrollbar-button,
body.landing-page *::-webkit-scrollbar-track,
body.landing-page *::-webkit-scrollbar-thumb,
body.landing-page *::-webkit-scrollbar-corner {
  width: 0px !important;
  height: 0px !important;
  display: none !important;
  background: transparent !important;
}

body.landing-page {
  --gd-cyan: #58c7d8 !important;
  --gd-cyan-dim: rgba(88, 199, 216, 0.16) !important;
  --gd-cyan-glow: 0 0 18px rgba(88, 199, 216, 0.28) !important;
  --gd-accent: #f3c26b !important;
  --gd-accent-dim: rgba(216, 155, 60, 0.18) !important;
  --gd-accent-glow: 0 0 20px rgba(216, 155, 60, 0.32) !important;
  font-family: var(--font-ui) !important;
  background-color: var(--studio-obsidian) !important;
  background-image:
    linear-gradient(rgba(42, 65, 86, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 65, 86, 0.18) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, rgba(88, 199, 216, 0.08) 0%, transparent 70%) !important;
  background-size: 36px 36px, 36px 36px, 100% 100% !important;
  background-attachment: fixed !important;
}

/* Tick-Ruler Scrollbar (44 Gaussian Ticks) */
.studio-tick-scrollbar {
  position: fixed;
  right: 5px;
  top: 64px;
  bottom: 18px;
  width: 22px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 4px 2px;
  user-select: none;
  cursor: ns-resize;
}

.studio-tick-mark {
  width: 4px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.22);
  transition: width 0.12s ease-out, background-color 0.12s ease-out, box-shadow 0.12s ease-out;
  pointer-events: none;
}

.studio-tick-mark.is-major {
  width: 6px;
  background: rgba(216, 155, 60, 0.38);
}

.studio-tick-mark.is-landmark {
  width: 9px;
  background: rgba(88, 199, 216, 0.52);
}

.studio-tick-mark.dist-3 {
  width: 6px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.28);
}

.studio-tick-mark.dist-2 {
  width: 8px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.38);
}

.studio-tick-mark.dist-1 {
  width: 12px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.62);
}

.studio-tick-mark.dist-0 {
  width: 18px;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.38);
}

@media (max-width: 768px) {
  .studio-tick-scrollbar {
    display: none;
  }
}

/* Diegetic Section Framing & Tactical Index Headers */
body.landing-page .section-title {
  text-align: left !important;
  max-width: 1180px;
  margin: 0 auto 2.2rem !important;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(90deg, rgba(17, 28, 40, 0.94) 0%, rgba(10, 17, 25, 0.65) 100%);
  border: 1px solid var(--studio-bezel);
  border-left: 4px solid var(--studio-brass);
  clip-path: var(--studio-chamfer-sm);
  display: grid;
  gap: 0.35rem;
  position: relative;
}

body.landing-page .section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font: 700 0.72rem var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--studio-brass-hi);
}

body.landing-page .section-title h2 {
  font-family: var(--font-display) !important;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem) !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  margin: 0 !important;
  color: var(--studio-ink) !important;
}

body.landing-page .section-title p {
  margin: 0 !important;
  max-width: 860px !important;
  font-size: 0.96rem !important;
  color: #cbd5e1 !important;
}

/* UI Glyph Standard for Curated Game Icons */
body.landing-page .ui-glyph {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: -3px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}

body.landing-page .ui-glyph--lg {
  width: 24px;
  height: 24px;
}

/* Ontology Concept Dialect (ADR-015) Widgets */
.ocd-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0.9rem;
  background: rgba(8, 14, 21, 0.92);
  border: 1px solid var(--studio-bezel);
  border-left: 3px solid var(--studio-cyan);
  margin-bottom: 1.25rem;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.o1-ring-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e2e8f0;
  font-weight: 600;
}

.o1-micro-ring {
  width: 20px;
  height: 20px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.o1-micro-ring circle.ring-base {
  fill: none;
  stroke: rgba(216, 155, 60, 0.25);
  stroke-width: 2.2;
}

.o1-micro-ring circle.ring-fill {
  fill: none;
  stroke: var(--studio-cyan-hi);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.o2-led-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--studio-cyan-hi);
}

.o2-led-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--studio-cyan-hi);
  box-shadow: 0 0 6px var(--studio-cyan);
  display: inline-block;
}

.o2-led-dot--amber {
  background: var(--studio-brass-hi);
  box-shadow: 0 0 6px var(--studio-brass);
}

.o3-sparkline-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
}

.o3-sparkline {
  width: 48px;
  height: 16px;
  background: rgba(6, 10, 15, 0.85);
  border: 1px solid rgba(70, 105, 133, 0.5);
}

.o3-sparkline polyline {
  fill: none;
  stroke: var(--studio-cyan-hi);
  stroke-width: 1.5;
}

.o7-crypto-seal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: rgba(11, 20, 30, 0.95);
  border: 1px solid var(--studio-bezel-hi);
  color: var(--studio-brass-hi);
  font-family: monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.o5-radar-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.9rem;
  background: rgba(8, 14, 21, 0.9);
  border: 1px solid var(--studio-bezel);
  margin-left: auto;
}

.o5-radar-svg {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.o5-radar-svg polygon.radar-grid {
  fill: none;
  stroke: rgba(216, 155, 60, 0.28);
  stroke-width: 0.9;
}

.o5-radar-svg polygon.radar-poly {
  fill: rgba(25, 198, 219, 0.24);
  stroke: var(--studio-cyan-hi);
  stroke-width: 1.4;
}

.o5-radar-meta,
.o5-radar-legend {
  display: grid;
  gap: 3px;
  font-size: 0.74rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.o5-radar-meta strong,
.o5-radar-legend strong {
  color: var(--studio-brass-hi);
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.84rem;
}

body.landing-page .landing-nav {
  padding: 0.55rem 1.75rem !important;
  background: linear-gradient(180deg, rgba(7, 12, 18, 0.98), rgba(10, 18, 27, 0.95)) !important;
  border-bottom: 1px solid var(--studio-bezel-hi) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.78) !important;
}

body.landing-page .landing-nav .nav-links a {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.92rem;
  color: #cbd5e1;
}

body.landing-page .btn-primary,
body.landing-page .btn-play-now,
body.landing-page .btn-hero-primary {
  background: linear-gradient(180deg, #e5a94c 0%, #b87b20 100%) !important;
  border: 1px solid var(--studio-brass-hi) !important;
  color: #080d14 !important;
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
  box-shadow: 0 4px 20px rgba(216, 155, 60, 0.32) !important;
}

body.landing-page .btn-secondary,
body.landing-page .btn-hero-secondary {
  background: rgba(12, 22, 33, 0.92) !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  color: var(--studio-cyan-hi) !important;
  font-family: var(--font-display) !important;
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
  text-transform: uppercase !important;
  letter-spacing: 0.07em !important;
}

body.landing-page .btn-secondary:hover {
  border-color: var(--studio-brass-hi) !important;
  color: var(--studio-brass-hi) !important;
}

body.landing-page .landing-hero {
  min-height: auto !important;
  padding: 1.6rem 1.5rem 2.2rem !important;
}

body.landing-page .hero-bg-layer.active {
  opacity: 0.68 !important;
  filter: contrast(1.08) saturate(1.06) !important;
}

body.landing-page .hero-backdrop-vignette {
  background: radial-gradient(circle at 50% 32%, rgba(6, 10, 16, 0.25) 0%, rgba(6, 10, 16, 0.82) 72%, rgba(6, 8, 12, 0.98) 100%) !important;
}

body.landing-page .hero-badge-wrap {
  border-radius: 2px !important;
  background: rgba(11, 20, 30, 0.92) !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  border-left: 3px solid var(--studio-brass) !important;
  color: var(--studio-brass-hi) !important;
  padding: 0.32rem 0.95rem !important;
  margin-bottom: 0.85rem !important;
  clip-path: var(--studio-chamfer-sm);
}

body.landing-page .radar-pulse-dot {
  background: var(--studio-brass-hi) !important;
  box-shadow: 0 0 8px var(--studio-brass) !important;
}

body.landing-page .landing-hero h1 {
  font-family: var(--font-display) !important;
  font-size: clamp(2.4rem, 4.8vw, 3.9rem) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  margin: 0 0 0.65rem !important;
  color: var(--studio-ink) !important;
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9), 0 0 1px rgba(243, 194, 107, 0.4);
}

body.landing-page .landing-hero p.subtitle {
  font-size: 1.02rem !important;
  max-width: 760px !important;
  margin: 0 auto 1.15rem !important;
  color: #cbd5e1 !important;
}

body.landing-page .hero-realm-selector {
  margin: 0 auto 1.15rem !important;
  gap: 0.6rem !important;
}

body.landing-page .realm-btn {
  background: linear-gradient(165deg, rgba(14, 25, 37, 0.92), rgba(8, 15, 23, 0.96)) !important;
  border: 1px solid var(--studio-bezel) !important;
  border-left: 3px solid var(--studio-cyan) !important;
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
  padding: 0.55rem 0.85rem !important;
  min-height: 54px !important;
}

body.landing-page .realm-btn.active {
  border-color: var(--studio-brass-hi) !important;
  border-left: 3px solid var(--studio-brass-hi) !important;
  background: linear-gradient(165deg, rgba(28, 42, 56, 0.95), rgba(14, 24, 36, 0.98)) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), inset 0 0 12px rgba(216, 155, 60, 0.18) !important;
}

body.landing-page .hero-cta-group {
  margin-bottom: 1rem !important;
  gap: 0.75rem !important;
}

body.landing-page .hero-cta-group .btn-primary,
body.landing-page .hero-cta-group .btn-secondary {
  padding: 0.68rem 1.45rem !important;
  font-size: 0.92rem !important;
}

body.landing-page .hero-quick-badges {
  margin-bottom: 0.85rem !important;
  gap: 0.65rem 1.2rem !important;
  font-size: 0.78rem !important;
}

body.landing-page .server-status-bar {
  margin-bottom: 1.1rem !important;
  gap: 0.5rem !important;
}

body.landing-page .server-status-bar .status-item {
  border-radius: 2px !important;
  background: rgba(9, 16, 24, 0.92) !important;
  border: 1px solid rgba(56, 86, 110, 0.65) !important;
  border-left: 2px solid var(--studio-brass) !important;
  padding: 0.3rem 0.75rem !important;
  font-size: 0.76rem !important;
}

body.landing-page .preview-showcase,
body.landing-page .hierarchy-viewer {
  border-radius: 2px !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  border-top: 2px solid var(--studio-brass) !important;
  clip-path: var(--studio-chamfer-md);
}

body.landing-page .preview-showcase {
  max-height: 280px !important;
  overflow: hidden !important;
}

body.landing-page .preview-showcase img {
  max-height: 280px !important;
  object-fit: cover !important;
}

body.landing-page .h-faction-btn,
body.landing-page .h-tier-btn,
body.landing-page .faction-tab-btn,
body.landing-page .lb-tab-btn {
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
  font-family: var(--font-display) !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  background: rgba(11, 19, 29, 0.92) !important;
  color: #e2e8f0 !important;
}

body.landing-page .h-faction-btn.active,
body.landing-page .h-tier-btn.active,
body.landing-page .faction-tab-btn.active,
body.landing-page .lb-tab-btn.active {
  background: linear-gradient(180deg, rgba(216, 155, 60, 0.25), rgba(16, 28, 42, 0.96)) !important;
  border-color: var(--studio-brass-hi) !important;
  color: var(--studio-brass-hi) !important;
  box-shadow: inset 0 0 10px rgba(216, 155, 60, 0.2) !important;
}

body.landing-page .hook-card,
body.landing-page .h-card,
body.landing-page .world-card,
body.landing-page .faction-pane,
body.landing-page .trait-badge-card,
body.landing-page .unit-portrait-card,
body.landing-page .community-card,
body.landing-page .ticker-bar-wrap,
body.landing-page .matrix-table-wrap {
  border-radius: 2px !important;
  border: 1px solid var(--studio-bezel) !important;
  border-top: 2px solid var(--studio-brass) !important;
  background: linear-gradient(165deg, rgba(14, 24, 36, 0.95), rgba(8, 14, 22, 0.98)) !important;
  clip-path: var(--studio-chamfer-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65) !important;
}

body.landing-page .hook-icon-wrap {
  border-radius: 2px !important;
  clip-path: var(--studio-chamfer-sm);
  background: rgba(11, 20, 30, 0.95) !important;
  border: 1px solid var(--studio-brass) !important;
  color: var(--studio-brass-hi) !important;
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
}

body.landing-page .hierarchy-tactical-pin {
  border-radius: 2px !important;
  border: 1px solid var(--studio-bezel-hi) !important;
  border-left: 3px solid var(--studio-brass-hi) !important;
  background: rgba(8, 14, 21, 0.94) !important;
  animation: none !important;
}



/* =====================================================================
   DORF3 — Endless toroidal world map (public/world-map-endless.js)
   Canvas fills the stage; the legacy 7x7 diorama grid stays in the DOM
   (app.js still renders it) but is no longer the visible surface.
   ===================================================================== */
body .sector-console .toroidal-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 6px 12px; margin: 0 0 10px; min-height: 0; height: auto;
}
body .sector-console .toroidal-toolbar > * { margin-top: 0; margin-bottom: 0; }
body .sector-console .toroidal-nav-pad { display: none; }
body .sector-console .toroidal-focal-badge { flex-direction: row; align-items: baseline; gap: 10px; padding: 0; border: 0; background: none; }
body .sector-console .toroidal-focal-badge .focal-badge__coords { font-size: 1.15rem; }
body .sector-console .toroidal-jump-form { margin-left: auto; }

body .toroidal-map-stage {
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: stretch;
  height: clamp(440px, calc(100vh - 300px), 760px);
}
body .toroidal-grid-wrapper.has-endless-map {
  position: relative; padding: 0; overflow: hidden; border-radius: 2px;
  border: 1px solid rgba(214, 170, 82, 0.35);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), 0 12px 32px rgba(0, 0, 0, 0.45);
  background: #1b2318;
}
body .toroidal-grid-wrapper.has-endless-map .toroidal-grid-7x7 { display: none; }
body .toroidal-map-stage .quick-march-card { align-self: start; max-height: 100%; overflow: auto; }

.endless-map { position: absolute; inset: 0; }
.endless-map__canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; outline: none; }
.endless-map__canvas.is-dragging { cursor: grabbing; }
.endless-map__canvas:focus-visible { box-shadow: inset 0 0 0 2px #e5aa3e; }
.endless-map__hud { position: absolute; inset: 0; pointer-events: none; }
.endless-map__hud > * { pointer-events: auto; }

.endless-map__readout {
  position: absolute; left: 12px; top: 12px; display: flex; gap: 10px; align-items: baseline;
  padding: 6px 12px 6px 10px; background: rgba(8, 12, 16, 0.82); border-left: 3px solid #e5aa3e;
  font: 600 0.82rem/1.1 var(--font-ui, system-ui); color: #f1ead8; letter-spacing: 0.04em; pointer-events: none;
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.endless-map__cursor { font-variant-numeric: tabular-nums; color: #ffd27a; }
.endless-map__name { color: #b9c2c8; font-weight: 500; max-width: 34ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.endless-map__compass { position: absolute; left: 12px; bottom: 12px; width: 58px; height: 58px; pointer-events: none; }
.endless-map__compass circle { fill: rgba(8, 12, 16, 0.72); stroke: rgba(229, 170, 62, 0.5); }
.endless-map__compass line { stroke: #e5aa3e; stroke-width: 1.6; }
.endless-map__compass .axis-e { stroke: rgba(229, 170, 62, 0.6); }
.endless-map__compass text { fill: #e5aa3e; font: 700 9px var(--font-ui, system-ui); }
.endless-map__zoom {
  position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: stretch;
  background: rgba(8, 12, 16, 0.85); border: 1px solid rgba(229, 170, 62, 0.4);
}
.endless-map__zoom button {
  width: 36px; height: 34px; border: 0; border-bottom: 1px solid rgba(229, 170, 62, 0.25); background: transparent;
  color: #f1ead8; font: 700 1.05rem var(--font-ui, system-ui); cursor: pointer; padding: 0;
}
.endless-map__zoom button:hover, .endless-map__zoom button:focus-visible { background: rgba(229, 170, 62, 0.18); color: #ffd27a; outline: none; }
.endless-map__zoom-level { font: 600 0.64rem var(--font-ui, system-ui); color: #9aa6ad; text-align: center; padding: 3px 0; border-bottom: 1px solid rgba(229, 170, 62, 0.25); }

.endless-map__minimap {
  position: absolute; right: 12px; bottom: 12px; width: 168px; height: 168px; cursor: crosshair;
  border: 1px solid rgba(229, 170, 62, 0.5); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); image-rendering: pixelated;
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 960px) {
  body .toroidal-map-stage { grid-template-columns: 1fr; height: auto; }
  body .toroidal-grid-wrapper.has-endless-map { height: 62vh; min-height: 340px; }
  body .sector-console .toroidal-jump-form { margin-left: 0; }
  .endless-map__minimap { width: 112px; height: 112px; }
  .endless-map__zoom button { width: 44px; height: 44px; }
}
body .sector-console .toroidal-jump-form button { min-height: 0; height: 30px; padding: 0 14px; }
body .sector-console .toroidal-jump-form input { height: 30px; }

/* Resource cards: two-line layout so "+165/hour" never clips (desktop) or
   pushes the document wider than the viewport (390px mobile). */
#game-panel .game-hud-sticky > .resource-bar { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
#game-panel .game-hud-sticky > .resource-bar .resource {
  display: grid !important; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
  column-gap: 6px !important; row-gap: 1px !important; min-width: 0; overflow: hidden; padding: 3px 8px !important;
}
#game-panel .game-hud-sticky > .resource-bar .resource__identity { grid-column: 1; grid-row: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
#game-panel .game-hud-sticky > .resource-bar .resource > span:nth-of-type(2) { grid-column: 2; grid-row: 1; justify-self: end; }
#game-panel .game-hud-sticky > .resource-bar .resource strong { grid-column: 1 / -1; grid-row: 2; font-variant-numeric: tabular-nums; }
#game-panel .game-hud-sticky > .resource-bar .resource .resource__capacity-status { grid-column: 1 / -1; }
@media (max-width: 960px) {
  #game-panel .game-hud-sticky > .resource-bar { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
