/* ==========================================================================
   LANDFORGE — interface
   Dark industrial. Amber = your holdings, cyan = systems, red = rivals.
   ========================================================================== */

:root {
  --bg:        #0a0d12;
  --bg-2:      #0f141b;
  --panel:     #131a23;
  --panel-2:   #18212c;
  --line:      #232f3d;
  --line-2:    #2f3f52;
  --ink:       #dfe7f0;
  --ink-dim:   #8b9bad;
  --ink-faint: #5d6b7c;

  --amber:     #f5a623;
  --amber-dim: #8a5f14;
  --cyan:      #35d0d8;
  --cyan-dim:  #1c6e73;
  --red:       #ef5a5a;
  --green:     #4fd67e;
  --violet:    #9b7bef;

  --r: 3px;
  --shadow: 0 18px 44px rgba(0, 0, 0, .55);
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --display: 'Chakra Petch', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; margin: 0; }

/* ---- shared controls --------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--display); font-weight: 600; font-size: .875rem;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .7rem 1.35rem; border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer; transition: .16s ease; background: none; color: inherit;
}
.btn-primary {
  background: linear-gradient(180deg, var(--amber), #d88f14);
  color: #14100a; border-color: #ffc65e;
  box-shadow: 0 0 0 1px rgba(245,166,35,.18), 0 8px 22px rgba(245,166,35,.16);
}
.btn-primary:hover { filter: brightness(1.09); transform: translateY(-1px); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; filter: none; }
.btn-sm { padding: .45rem .8rem; font-size: .74rem; }
.btn-danger { border-color: #5a2a2a; color: #e88; }
.btn-danger:hover { border-color: var(--red); color: var(--red); }

/* ==========================================================================
   LANDING
   ========================================================================== */
.landing { position: relative; overflow-x: hidden; }
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(53,208,216,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,208,216,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
}
.bg-glow {
  position: fixed; top: -30vh; left: 50%; transform: translateX(-50%);
  width: 120vw; height: 80vh; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(245,166,35,.10), transparent 62%);
}
.landing main, .nav, .foot { position: relative; z-index: 1; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem clamp(1rem, 5vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: rgba(10,13,18,.72); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark { color: var(--amber); font-size: 1.3rem; line-height: 1; }
.brand-name {
  font-family: var(--display); font-weight: 700; font-size: 1.12rem;
  letter-spacing: .14em;
}
.brand-name em { font-style: normal; color: var(--amber); }
.nav-links { display: flex; align-items: center; gap: 1.6rem; font-size: .9rem; color: var(--ink-dim); }
.nav-links a:hover { color: var(--ink); }

.hero { max-width: 980px; margin: 0 auto; padding: clamp(3.5rem, 9vw, 7rem) 1.5rem 4rem; text-align: center; }
.kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--cyan); margin: 0 0 1.5rem;
}
.hero h1 { font-size: clamp(2.1rem, 5.6vw, 3.9rem); line-height: 1.08; }
.hero h1 .accent { color: var(--amber); }
.lede { color: var(--ink-dim); font-size: clamp(1rem, 1.6vw, 1.12rem); max-width: 66ch; margin: 1.6rem auto 0; }
.lede strong { color: var(--ink); font-weight: 600; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 2.2rem; }
.notice { margin-top: 1.4rem; color: var(--amber); font-family: var(--mono); font-size: .8rem; }

.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px; margin: 3.5rem 0 0; padding: 0;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.stat-strip > div { background: var(--bg-2); padding: 1.05rem .5rem; }
.stat-strip dt { font-family: var(--mono); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }
.stat-strip dd { margin: .35rem 0 0; font-family: var(--display); font-size: 1.45rem; font-weight: 700; color: var(--amber); }

.section { max-width: 1120px; margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) 1.5rem; }
.section.alt { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(15,20,27,.55); max-width: none; }
.section.alt > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.section-title { font-size: clamp(1.5rem, 3vw, 2.05rem); margin-bottom: 1.1rem; }
.section-title span { font-family: var(--mono); font-size: .78rem; color: var(--cyan); margin-right: .8rem; vertical-align: middle; }
.section-lede { color: var(--ink-dim); max-width: 72ch; margin: 0 0 2.4rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 1rem; margin-top: 2rem; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.4rem 1.3rem; transition: .18s ease;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card-ico { color: var(--amber); font-size: 1.4rem; margin-bottom: .6rem; }
.card h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.card p { color: var(--ink-dim); font-size: .9rem; margin: 0; }

.chain { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin: 0 0 3rem; }
.chain-tier { width: 100%; max-width: 780px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.2rem; text-align: center; }
.tier-label { font-family: var(--mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .7rem; }
.chips i {
  font-style: normal; font-family: var(--display); font-weight: 600; font-size: .82rem;
  padding: .3rem .75rem; border: 1px solid var(--line-2); border-radius: 100px; color: var(--ink);
}
.chain-arrow { color: var(--cyan); font-size: 1.1rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.8rem; }
.split h4 { color: var(--amber); font-size: .95rem; margin-bottom: .4rem; }
.split p { color: var(--ink-dim); font-size: .9rem; margin: 0; }

.join { padding-bottom: 5rem; }
.auth-wrap { display: grid; grid-template-columns: 1fr 400px; gap: 3rem; align-items: start; }
.auth-copy h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .9rem; }
.auth-copy p { color: var(--ink-dim); }
.ticks { list-style: none; padding: 0; margin: 1.4rem 0 0; }
.ticks li { position: relative; padding-left: 1.5rem; color: var(--ink-dim); font-size: .9rem; margin-bottom: .5rem; }
.ticks li::before { content: '▸'; position: absolute; left: 0; color: var(--amber); }

.auth-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; box-shadow: var(--shadow); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 1.3rem; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tab { padding: .6rem; background: transparent; border: 0; color: var(--ink-dim); font-family: var(--display); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.tab.active { background: var(--panel-2); color: var(--amber); }
.auth-form { display: none; flex-direction: column; gap: .9rem; }
.auth-form.active { display: flex; }
.auth-form label, .field { display: flex; flex-direction: column; gap: .35rem; font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); }
input, select {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: .65rem .75rem; color: var(--ink); font-family: var(--body); font-size: .95rem;
  letter-spacing: normal; text-transform: none;
}
input:focus, select:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245,166,35,.12); }
.alert { background: rgba(239,90,90,.1); border: 1px solid rgba(239,90,90,.4); color: #ffb3b3; padding: .7rem .85rem; border-radius: var(--r); font-size: .86rem; margin-bottom: 1rem; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1.6rem clamp(1rem, 5vw, 4rem); border-top: 1px solid var(--line); color: var(--ink-faint); font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .nav-links a:not(.btn) { display: none; }
}

/* ==========================================================================
   GAME CLIENT
   ========================================================================== */
body.game { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.hud {
  display: flex; align-items: center; gap: 1rem; flex-wrap: nowrap;
  padding: .5rem .9rem; background: var(--bg-2); border-bottom: 1px solid var(--line);
  z-index: 1000; overflow-x: auto; scrollbar-width: thin;
}
.hud .brand { flex: 0 0 auto; margin-right: .4rem; }
.hud-sep { width: 1px; height: 26px; background: var(--line); flex: 0 0 auto; }

.meter { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.meter-ico { width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--r); background: var(--panel-2); color: var(--amber); font-size: .8rem; }
.meter-body { display: flex; flex-direction: column; line-height: 1.15; }
.meter-label { font-family: var(--mono); font-size: .58rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); }
.meter-value { font-family: var(--display); font-weight: 700; font-size: .95rem; }
.meter-rate { font-family: var(--mono); font-size: .62rem; }
.up { color: var(--green); } .down { color: var(--red); } .flat { color: var(--ink-faint); }

.hud-spacer { flex: 1 1 auto; }
.hud-actions { display: flex; gap: .4rem; flex: 0 0 auto; }

.stage { flex: 1 1 auto; position: relative; display: flex; min-height: 0; }
#map { flex: 1 1 auto; background: #0b0f14; }
.leaflet-container { background: #0b0f14; font-family: var(--body); }
.leaflet-control-attribution { background: rgba(10,13,18,.8) !important; color: var(--ink-faint) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--ink-dim) !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--panel-2) !important; }

/* --- side panel --- */
.panel {
  width: 372px; flex: 0 0 372px; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; z-index: 900;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: .75rem .95rem; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.panel-head h2 { font-size: .95rem; letter-spacing: .04em; }
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.panel-tabs button {
  flex: 1; padding: .6rem .3rem; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-faint); font-family: var(--display); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .07em; cursor: pointer;
}
.panel-tabs button.active { color: var(--amber); border-bottom-color: var(--amber); background: var(--panel); }
.panel-body { flex: 1 1 auto; overflow-y: auto; padding: .95rem; }
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.pane { display: none; } .pane.active { display: block; }

.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .38rem 0; border-bottom: 1px dashed var(--line); font-size: .85rem; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--ink-faint); }
.kv span:last-child { font-family: var(--mono); font-size: .82rem; }

.block { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem; margin-bottom: .8rem; }
.block h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); margin-bottom: .55rem; }
.muted { color: var(--ink-faint); font-size: .82rem; }
.tag { display: inline-block; font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; padding: .16rem .45rem; border-radius: 2px; border: 1px solid var(--line-2); color: var(--ink-dim); }
.tag.mine { border-color: var(--amber-dim); color: var(--amber); }
.tag.rival { border-color: #5a2a2a; color: var(--red); }
.tag.free { border-color: var(--cyan-dim); color: var(--cyan); }
.tag.warn { border-color: #6b5a1e; color: #e0c46a; }

.bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: .3rem; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-dim), var(--amber)); }
.bar.cyan > i { background: linear-gradient(90deg, var(--cyan-dim), var(--cyan)); }

.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.res {
  display: flex; flex-direction: column; gap: .1rem; padding: .45rem .55rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
}
.res b { font-family: var(--display); font-size: .9rem; font-weight: 700; }
.res small { font-family: var(--mono); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.res em { font-style: normal; font-family: var(--mono); font-size: .66rem; }

.build-list { display: flex; flex-direction: column; gap: .45rem; }
.build-item {
  display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .7rem;
  cursor: pointer; transition: .14s;
}
.build-item:hover { border-color: var(--line-2); }
.build-item.locked { opacity: .45; cursor: not-allowed; }
.build-item h4 { font-size: .87rem; }
.build-item p { margin: .15rem 0 0; font-size: .74rem; color: var(--ink-faint); line-height: 1.45; }
.cost { font-family: var(--mono); font-size: .68rem; color: var(--ink-dim); margin-top: .35rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.cost s { text-decoration: none; color: var(--red); }

.cat-head { font-family: var(--mono); font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); margin: .95rem 0 .45rem; }
.cat-head:first-child { margin-top: 0; }

.row { display: flex; gap: .4rem; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }

.toast-wrap { position: fixed; bottom: 1.1rem; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--amber);
  border-radius: var(--r); padding: .6rem .95rem; font-size: .85rem; box-shadow: var(--shadow);
  animation: rise .25s ease;
}
.toast.err { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.legend {
  position: absolute; left: .75rem; bottom: 1.6rem; z-index: 800;
  background: rgba(19,26,35,.92); border: 1px solid var(--line); border-radius: var(--r);
  padding: .6rem .75rem; font-size: .72rem; color: var(--ink-dim); backdrop-filter: blur(6px);
}
.legend div { display: flex; align-items: center; gap: .45rem; margin-bottom: .3rem; }
.legend div:last-child { margin-bottom: 0; }
.swatch { width: 11px; height: 11px; border-radius: 2px; border: 1px solid rgba(255,255,255,.25); }

.zoom-hint {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 800; background: rgba(19,26,35,.94); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 1rem 1.4rem; text-align: center; box-shadow: var(--shadow);
}
.zoom-hint strong { display: block; font-family: var(--display); color: var(--amber); margin-bottom: .25rem; }
.zoom-hint span { color: var(--ink-dim); font-size: .85rem; }

.search-box { position: absolute; top: .75rem; left: 50%; transform: translateX(-50%); z-index: 800; width: min(420px, 70vw); }
.search-box input { width: 100%; background: rgba(19,26,35,.95); border-color: var(--line-2); box-shadow: var(--shadow); }

.table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.table th { text-align: left; font-family: var(--mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); padding: .4rem .3rem; border-bottom: 1px solid var(--line); }
.table td { padding: .42rem .3rem; border-bottom: 1px solid var(--line); }
.table tr:hover td { background: var(--panel-2); }
.num { font-family: var(--mono); text-align: right; }

@media (max-width: 900px) {
  .panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(372px, 92vw); flex: none; transform: translateX(100%); transition: .22s ease; box-shadow: var(--shadow); }
  .panel.open { transform: none; }
}

/* ---- position meter state ---------------------------------------------- */
.meter-value.warnc { color: var(--cyan); }

/* ---- travel routes ------------------------------------------------------ */
.block.blue { border-left: 3px solid var(--cyan); }
.block.route { cursor: pointer; transition: border-color .14s; }
.block.route:hover { border-color: var(--line-2); }
.block.route h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .92rem; }
.block.route.blocked { opacity: .5; border-left: 3px solid var(--line-2); }

/* ---- first deployment ---------------------------------------------------
   A side card, not a modal: the player has to be able to pan and click the
   map underneath it while choosing. Only the card itself takes pointer events. */
.settle {
  position: absolute; inset: 0; z-index: 1200; pointer-events: none;
  display: flex; align-items: flex-start; padding: 4.2rem 1rem 1rem 1rem;
}
.settle::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 70% at 22% 40%, rgba(10,13,18,.86), rgba(10,13,18,.30) 70%);
}
.settle-card {
  position: relative; pointer-events: auto;
  width: min(390px, 92vw); background: var(--panel);
  border: 1px solid var(--line-2); border-top: 3px solid var(--amber);
  border-radius: var(--r); padding: 1.3rem 1.35rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .7rem;
}
.settle-kicker {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--amber);
}
.settle-card h2 { font-size: 1.35rem; }
.settle-card p { margin: 0; color: var(--ink-dim); font-size: .89rem; }
.settle-card input { width: 100%; }
.settle-hint {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .05em;
  color: var(--ink-faint); border-top: 1px dashed var(--line); padding-top: .6rem;
}
.settle-hint b { color: var(--cyan); }
.settle-choice {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: .7rem .8rem;
}

@media (max-width: 900px) {
  .settle { padding-top: 3.4rem; }
}
