/* ============================================
   RESPAWN — Mobile App Prototype
   The Unconformity / Moonland Rover Lab
   Queenstown, lutruwita
   ============================================ */

:root {
  /* Raw industrial palette — the actual colours of Queenstown */
  --bg:          #1a1714;
  --bg-surface:  #221f1a;
  --bg-card:     #2a2520;
  --bg-raised:   #33302a;
  --border:      #3d3830;
  --border-hi:   #524a3e;

  /* Text */
  --text:        #d4ccc0;
  --text-dim:    #8a8074;
  --text-faint:  #5c5448;

  /* The landscape's actual colours */
  --oxide:       #c4623a;    /* iron oxide, rust, stripped hills */
  --acid:        #7ab648;    /* acid mine drainage regrowth */
  --ochre:       #c99a2e;    /* ochre soil */
  --copper:      #4a9e8a;    /* oxidised copper, Queen River */
  --slate:       #6a7e8c;    /* metamorphic rock */
  --deep:        #5c4e72;    /* deep time purple */
  --ash:         #9c9488;    /* smelter ash */

  /* Functional */
  --highlight:   var(--oxide);
  --glow:        rgba(196, 98, 58, 0.12);

  --phone-w: 390px;
  --phone-h: 844px;
  --nav-h: 68px;
  --radius: 6px;
}

/* ── Reset ─────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: #0e0c0a;
  color: var(--text);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Phone Frame ───────────────── */
.phone-frame {
  width: var(--phone-w);
  height: var(--phone-h);
  background: var(--bg);
  border-radius: 48px;
  border: 3px solid #3a3530;
  box-shadow:
    0 40px 80px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.02);
  position: relative;
  overflow: hidden;
}
.phone-notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 160px; height: 34px;
  background: #000;
  border-radius: 0 0 20px 20px;
  z-index: 100;
}
.phone-home-indicator {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 140px; height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  z-index: 100;
}

/* Film grain overlay */
.grain-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 90;
  opacity: 0.5;
  mix-blend-mode: overlay;
}

@media (max-width: 430px) {
  body { background: var(--bg); }
  .phone-frame {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .phone-notch, .phone-home-indicator { display: none; }
}

/* ── App ───────────────────────── */
#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none !important;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--nav-h);
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.active { display: flex !important; flex-direction: column; }

/* ═══════════════════════════════════
   ENTRY
   ═══════════════════════════════════ */
#screenEntry {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 32px;
}
.entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.entry-mark {
  width: 200px;
  height: 140px;
  position: relative;
}
#entryCanvas {
  width: 100%;
  height: 100%;
}
.entry-text { display: flex; flex-direction: column; gap: 6px; }
.entry-title {
  font-family: 'Space Mono', monospace;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--oxide);
  position: relative;
}
.glitch-letter {
  display: inline-block;
  animation: glitchLetter 4s ease-in-out infinite;
}
@keyframes glitchLetter {
  0%, 92%, 100% { transform: none; opacity: 1; }
  93% { transform: translateX(-3px) skewX(-8deg); opacity: 0.7; }
  94% { transform: translateX(2px) skewX(5deg); opacity: 0.9; }
  95% { transform: none; opacity: 1; }
}
.entry-sub {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  line-height: 1.6;
  text-transform: uppercase;
}
.entry-notice {
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.entry-notice p {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
}
.notice-small {
  font-size: 14px !important;
  color: var(--text-dim) !important;
  font-style: italic;
}
.entry-btn {
  margin-top: 8px;
  padding: 16px 36px;
  background: var(--oxide);
  border: none;
  color: var(--bg);
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.entry-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 1px solid var(--oxide);
  opacity: 0.3;
}
.entry-btn:active { transform: scale(0.96); }
.entry-warning {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* ═══════════════════════════════════
   FIELD (Home)
   ═══════════════════════════════════ */
#screenField { padding: 0; }
.field-scroll {
  padding: 48px 18px 88px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}
.strip-item {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.strip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.strip-dot.alive {
  background: var(--acid);
  animation: alivePulse 2.5s ease infinite;
}
@keyframes alivePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(122,182,72,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 8px 2px rgba(122,182,72,0.15); }
}

/* Transmission Banner */
.transmission-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--oxide);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.transmission-banner:active { background: var(--bg-raised); }
.transmission-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--oxide);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tx-icon {
  font-size: 8px;
  animation: txBlink 2s step-end infinite;
}
@keyframes txBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.transmission-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  font-style: italic;
}
.transmission-tap {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 1px;
  position: absolute;
  bottom: 8px;
  right: 14px;
}

/* Action Card */
.action-card-wrap {
  position: relative;
}
.action-card-wrap::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: -4px; bottom: -4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  z-index: 0;
}
.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-hi);
  padding: 20px;
  position: relative;
  z-index: 1;
}
.action-number {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--oxide);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.action-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text);
}
.action-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.action-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tag {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 3px 8px;
  text-transform: uppercase;
}
.action-controls {
  display: flex;
  gap: 10px;
}
.action-done-btn {
  flex: 1;
  padding: 14px;
  background: var(--oxide);
  border: none;
  color: var(--bg);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
}
.action-done-btn:active { transform: scale(0.97); }
.action-skip-btn {
  padding: 14px 20px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.action-skip-btn:active { border-color: var(--text-dim); }

/* Vitals */
.vitals-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
}
.vital {
  flex: 1;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
}
.vital:last-child { border-right: none; }
.vital-val {
  font-family: 'Space Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.vital-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* Field Links */
.field-links {
  display: flex;
  gap: 8px;
}
.field-link {
  flex: 1;
  padding: 14px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.field-link:active { background: var(--bg-raised); }
.field-link-num {
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--oxide);
}
.field-link-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* Gap Preview */
.gap-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.gap-preview:active { background: var(--bg-raised); }
.gap-visual {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  width: 40px;
}
.gap-layer {
  height: 4px;
  border-radius: 1px;
  opacity: 0.7;
}
.gap-space {
  height: 10px;
  border-left: 1px dashed var(--text-faint);
  margin-left: 20px;
}
.gap-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.gap-title {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text);
}
.gap-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

/* ═══════════════════════════════════
   SCREEN HEADERS
   ═══════════════════════════════════ */
.screen-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 52px 18px 10px;
  flex-shrink: 0;
}
.screen-top.floating-top {
  position: sticky;
  top: 0; z-index: 20;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
  padding-bottom: 18px;
}
.screen-top h2 {
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  flex: 1;
}
.screen-top-meta {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}
.back-btn {
  background: none;
  border: none;
  color: var(--oxide);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}
.screen-intro {
  padding: 0 18px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* ═══════════════════════════════════
   ACTION DECK
   ═══════════════════════════════════ */
.action-deck {
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deck-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.deck-card:active { background: var(--bg-raised); }
.deck-card.completed {
  opacity: 0.4;
  text-decoration: line-through;
}
.deck-num {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--oxide);
  min-width: 28px;
  flex-shrink: 0;
  padding-top: 2px;
}
.deck-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.deck-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.deck-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.deck-tags .tag { font-size: 8px; padding: 2px 6px; }

/* ═══════════════════════════════════
   TRANSMISSIONS
   ═══════════════════════════════════ */
.tx-feed {
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tx-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tx-item:last-child { border-bottom: none; }
.tx-source {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-transform: uppercase;
}
.tx-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  font-style: italic;
}
.tx-time {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
}

.tx-request-btn {
  margin: 16px 18px;
  padding: 14px;
  background: none;
  border: 1px solid var(--oxide);
  color: var(--oxide);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.tx-request-btn:active { background: var(--glow); }

/* ═══════════════════════════════════
   OFFERINGS
   ═══════════════════════════════════ */
#screenOfferings { padding: 0; display: flex; flex-direction: column; }
.offerings-list {
  flex: 1;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.offerings-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
  gap: 8px;
}
.offerings-empty p { font-size: 15px; color: var(--text-dim); }
.offerings-empty span { font-size: 12px; color: var(--text-faint); }

.offering-item {
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.offering-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.offering-meta {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}

.offering-composer {
  flex-shrink: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.offering-composer textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.offering-composer textarea:focus { border-color: var(--oxide); }
.offering-composer textarea::placeholder { color: var(--text-faint); }
.offering-send {
  padding: 10px 16px;
  background: var(--oxide);
  border: none;
  color: var(--bg);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.offering-send:active { transform: scale(0.95); }

/* ═══════════════════════════════════
   THE GAP
   ═══════════════════════════════════ */
#screenGap { padding: 0; }
.gap-scroll {
  padding: 80px 22px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.gap-intro {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gap-intro p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-dim);
}

.gap-strata {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.stratum {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.stratum-bar {
  width: 4px;
  background: var(--s-color);
  border-radius: 2px;
  flex-shrink: 0;
  min-height: 40px;
}
.stratum-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stratum-age {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--s-color);
  font-weight: 700;
}
.stratum-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* The Gap itself */
.the-gap {
  padding: 24px 0;
  position: relative;
}
.gap-void {
  width: 100%;
  height: 150px;
  position: relative;
  overflow: hidden;
}
#gapCanvas {
  width: 100%;
  height: 100%;
}
.gap-label-wrap {
  text-align: center;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gap-label-text {
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--oxide);
}
.gap-label-sub {
  font-size: 13px;
  color: var(--text-faint);
  font-style: italic;
}

.gap-coda {
  text-align: center;
  padding: 40px 16px;
}
.gap-coda p {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}
.gap-coda-small {
  font-size: 14px !important;
  color: var(--oxide) !important;
  font-weight: 400 !important;
  font-style: italic;
  margin-top: 8px;
}

/* ═══════════════════════════════════
   NAV
   ═══════════════════════════════════ */
.nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 10px;
  z-index: 50;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 4px 14px;
  transition: color 0.2s;
}
.nav-item .nav-icon { font-size: 16px; }
.nav-item.active { color: var(--oxide); }

/* ── Toast ─────────────────────── */
.toast {
  position: absolute;
  top: 56px; left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: var(--bg-raised);
  border: 1px solid var(--oxide);
  padding: 10px 20px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--oxide);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Animations ────────────────── */
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-slide { animation: fadeSlide 0.35s ease forwards; }
