:root {
  --bg: #07090a;
  --ink: #b8c6c6;
  --dim: #5d6b6b;
  --accent: #32c5c1;
  --line: rgba(50, 197, 193, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ---------- hud ---------- */

#hud {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  pointer-events: none;
}

#hud-left { color: #86c9c6; opacity: 0.9; }
#hud-right { color: #7f8f8f; }

/* ---------- whisper (last thought) ---------- */

#whisper {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  padding: 14px 15px;
  border-left: 1px solid var(--accent);
  background: linear-gradient(90deg, rgba(50, 197, 193, 0.07), rgba(7, 9, 10, 0.6) 70%);
  backdrop-filter: blur(6px);
  animation: rise 0.35s ease-out;
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  z-index: 3;
}

#whisper .whisper-name {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

#whisper .whisper-text {
  font-size: 12.5px;
  color: #cfdede;
  line-height: 1.6;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- feed: what the world just did ---------- */

#feed {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.65;
  color: #7d8c8c;
  text-align: left;
  z-index: 2;
}

#feed .line {
  opacity: 0;
  transition: opacity 0.8s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

#feed .line.on { opacity: 1; }
#feed .line:nth-child(2) { opacity: 0.6; }
#feed .line:nth-child(3) { opacity: 0.34; }
#feed .who { color: #6fd6d1; }

/* ---------- controls ---------- */

#controls {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ctl {
  appearance: none;
  background: rgba(10, 14, 15, 0.72);
  border: 1px solid var(--line);
  color: var(--dim);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 9px 13px;
  border-radius: 2px;
  min-width: 44px;
  min-height: 40px;
}

#btn-haptic { color: var(--accent); border-color: rgba(50, 197, 193, 0.42); }
#btn-haptic[aria-pressed="false"] { color: var(--dim); border-color: var(--line); }
#btn-help { font-size: 13px; letter-spacing: 0; padding: 9px 14px; }

/* ---------- help ---------- */

#help {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 7, 0.93);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  padding: 18px;
}

#help .sheet {
  width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  padding: 20px 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
  border: 1px solid var(--line);
  background: #090c0d;
}

#help h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

#help p { margin: 0 0 12px; font-size: 12px; color: #a9b8b8; }
#help ul { margin: 0 0 12px; padding-left: 16px; }
#help li { margin-bottom: 8px; font-size: 12px; color: #a9b8b8; }
#help b { color: #dbe6e6; font-weight: 500; }
#help em { color: var(--accent); font-style: normal; }
#help .dim { color: var(--dim); font-size: 11px; }

#btn-close {
  appearance: none;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-radius: 2px;
}

/* ---------- gate ---------- */

#gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: radial-gradient(120% 90% at 50% 40%, #0b1011 0%, #07090a 62%);
  z-index: 10;
}

#gate.gone { opacity: 0; pointer-events: none; transition: opacity 0.9s ease; }

.gate-inner { width: 100%; max-width: 420px; }

#gate h1 {
  margin: 0 0 10px;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: 0.34em;
  text-transform: lowercase;
  color: #e2eeee;
}

#gate .sub {
  margin: 0 0 26px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

#gate .desc {
  margin: 0 0 30px;
  font-size: 13px;
  color: #a3b3b3;
  line-height: 1.7;
}

#enter {
  appearance: none;
  width: 100%;
  padding: 16px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  border-radius: 2px;
}

#enter:active { background: rgba(50, 197, 193, 0.1); }

#gate .hint {
  margin: 14px 0 0;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
}

@media (max-height: 620px) {
  #gate h1 { font-size: 34px; }
  #gate .desc { font-size: 11.5px; margin-bottom: 22px; }
}
