* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050304; color: #f3e6da;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; }
#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

#intro { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 16px calc(48px + env(safe-area-inset-bottom)); pointer-events: none; }
.intro-panel { pointer-events: auto; max-width: 520px; width: 100%; text-align: center;
  background: rgba(20, 10, 8, 0.55); backdrop-filter: blur(6px); border: 1px solid rgba(255, 170, 120, 0.25);
  border-radius: 14px; padding: 22px 22px 16px; }
.intro-panel h1 { margin: 0; font-size: 44px; letter-spacing: 0.45em; font-weight: 300; color: #ffb27a; padding-left: 0.45em; }
.intro-panel .sub { margin: 6px 0 16px; opacity: 0.85; }
.intro-panel .hint { margin: 12px 0 0; font-size: 12px; opacity: 0.6; }
#name { width: 100%; padding: 11px 14px; border-radius: 8px; border: 1px solid rgba(255, 180, 130, 0.4);
  background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 16px; text-align: center; margin-bottom: 10px; }
#land { width: 100%; padding: 13px; border: 0; border-radius: 8px; font-size: 17px; font-weight: 600; cursor: pointer;
  color: #1a0b05; background: linear-gradient(180deg, #ffb27a, #e07a3c); }
#land:disabled { opacity: 0.6; cursor: wait; }

#jezero-label { position: fixed; left: 0; top: 0; padding: 3px 8px; border-radius: 6px; font-size: 13px; font-weight: 600;
  background: rgba(10, 40, 50, 0.7); color: #9fefff; border: 1px solid #7fe3ff; transform: translate(-50%, -160%);
  pointer-events: none; display: none; }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.9s; }
#fade.on { opacity: 1; }

.panel { position: fixed; background: rgba(15, 8, 6, 0.5); border: 1px solid rgba(255, 170, 120, 0.18);
  border-radius: 10px; padding: 8px 12px; backdrop-filter: blur(4px); }
#clock { top: 12px; left: 12px; font-size: 15px; }
#clock b { font-size: 20px; color: #ffcc9e; font-weight: 600; }
#vitals { top: 12px; right: 12px; width: 230px; }
.bar { display: grid; grid-template-columns: 74px 1fr 40px; align-items: center; gap: 6px; font-size: 12px; margin: 2px 0; }
.bar i { display: block; height: 7px; background: rgba(255, 255, 255, 0.12); border-radius: 4px; overflow: hidden; }
.bar b { display: block; height: 100%; width: 100%; background: #7fe3ff; transition: width 0.3s; }
.bar b.warn { background: #ffb347; } .bar b.crit { background: #ff5b4a; }
.bar em { font-style: normal; text-align: right; opacity: 0.85; }
#env { margin-top: 6px; font-size: 11px; opacity: 0.8; }
#where { bottom: 12px; left: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
#mapbox { bottom: 12px; right: 12px; padding: 6px; transition: all 0.25s; }
#mapbox canvas { display: block; width: 180px; height: auto; border-radius: 6px; image-rendering: auto; }
#mapbox .maptitle { display: none; font-size: 12px; margin: 0 0 4px 2px; opacity: 0.8; }
#mapbox.big { bottom: 50%; right: 50%; transform: translate(50%, 50%); }
#mapbox.big canvas { width: min(80vmin, 760px); }
#mapbox.big .maptitle { display: block; }
#net { top: 84px; left: 12px; font-size: 12px; }
#toast { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.55); font-size: 15px; opacity: 0; transition: opacity 0.4s; pointer-events: none; text-align: center; max-width: 90vw; }
#toast.on { opacity: 1; }
#toast.warn { color: #ffcf8a; } #toast.crit { color: #ff8a7a; }
#fact { position: fixed; bottom: 56px; left: 50%; transform: translateX(-50%); max-width: min(640px, 90vw); text-align: center;
  font-size: 13px; padding: 8px 14px; border-radius: 8px; background: rgba(0, 0, 0, 0.4); opacity: 0; transition: opacity 0.8s; pointer-events: none; }
#fact.on { opacity: 1; }
#fact b { color: #7fe3ff; letter-spacing: 0.08em; font-size: 11px; margin-right: 6px; }
#help { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 12px; opacity: 0.55; white-space: nowrap; pointer-events: none; }
.smallbtn { position: fixed; top: 140px; right: 12px; padding: 5px 10px; border-radius: 6px; border: 1px solid rgba(255, 170, 120, 0.35);
  background: rgba(15, 8, 6, 0.6); color: #ffcc9e; cursor: pointer; font-weight: 600; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.name-label { position: absolute; left: 0; top: 0; padding: 2px 7px; border-radius: 5px; font-size: 12px; white-space: nowrap;
  background: rgba(0, 0, 0, 0.45); color: #fff; }

#touch #joy { position: fixed; left: 24px; bottom: calc(110px + env(safe-area-inset-bottom)); width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2); }
#knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 190, 140, 0.45); }
#jumpbtn, #runbtn { position: fixed; right: 24px; width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 190, 140, 0.25); color: #fff; font-size: 24px; }
#jumpbtn { bottom: calc(210px + env(safe-area-inset-bottom)); }
#runbtn { bottom: calc(130px + env(safe-area-inset-bottom)); }
#runbtn.on { background: rgba(127, 227, 255, 0.45); }

@media (max-width: 700px) {
  #help { display: none; }
  #vitals { width: 180px; }
  .bar { grid-template-columns: 58px 1fr 34px; }
  #mapbox canvas { width: 120px; }
  #where { bottom: auto; top: 84px; left: auto; right: 12px; }
  #net { top: 64px; }
  .smallbtn { top: auto; bottom: 12px; left: 12px; right: auto; }
}

@media (max-height: 560px) {
  #intro { padding-bottom: 10px; }
  .intro-panel { padding: 10px 14px 10px; max-width: 460px; }
  .intro-panel h1 { font-size: 26px; }
  .intro-panel .sub { margin: 2px 0 8px; font-size: 12px; }
  .intro-panel .hint { display: none; }
  #name { padding: 7px 10px; margin-bottom: 6px; }
  #land { padding: 9px; font-size: 15px; }
}
