/* Sluse: a trailhead sign-in board, not a chat app skin.
   Palette (neutrals lean warm: R > G > B on every step, campfire-at-night,
   not the swampy green you get if those channels drift out of order):
     --bg        #12100d  near-black, warm undertone (night at camp)
     --panel     #1d1a16  card/panel surface
     --line      #36302a  hairline borders
     --ink       #e0dcd8  primary text
     --ink-dim   #96908a  secondary text
     --amber     #ffb454  human / social layer: presence, chat, capture
     --cyan      #5ee6e6  cryptographic layer: encryption, verification
     --danger    #ff6b6b  errors
   Type: JetBrains Mono for everything, this is signage, not prose.
*/

@font-face {
  font-family: 'JetBrains Mono Fallback';
  src: local('JetBrains Mono'), local('Menlo'), local('Consolas');
}

:root {
  --bg: #12100d;
  --panel: #1d1a16;
  --panel-raised: #252119;
  --line: #36302a;
  --ink: #e0dcd8;
  --ink-dim: #96908a;
  --amber: #ffb454;
  --cyan: #5ee6e6;
  --danger: #ff6b6b;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

button, input {
  font-family: inherit;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen { flex: 1; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* ---------------- join screen ---------------- */

#screen-join {
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 28px;
  position: relative;
  overflow: hidden;
}
/* campfire glow: the one warm, atmospheric touch on an otherwise quiet screen */
#screen-join::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 640px;
  height: 640px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 180, 84, 0.10) 0%, rgba(255, 180, 84, 0) 62%);
  pointer-events: none;
}
#screen-join > * { position: relative; }

.wordmark { text-align: center; }
.wordmark-main {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--amber);
}
.wordmark-sub {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.lede {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-dim);
}

.field { display: block; margin-bottom: 16px; }
.field span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.field input, .verify-body input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 12px;
  border-radius: var(--radius);
  font-size: 15px;
  letter-spacing: 0.06em;
  transition: border-color 0.15s ease;
}
.field input:hover, .verify-body input:hover {
  border-color: var(--ink-dim);
}
.field input:focus, .verify-body input:focus, button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

.btn-row { display: flex; gap: 10px; }
.btn {
  flex: 1;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--amber); color: #1a1200; border-color: var(--amber); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn:hover { border-color: var(--amber); }
.btn-primary:hover { background: #ffc270; border-color: #ffc270; }
.btn-ghost:hover { background: var(--panel-raised); }
.btn:active { transform: translateY(1px); }

.error { color: var(--danger); font-size: 12px; margin-top: 12px; }

/* ---------------- camp screen ---------------- */

#screen-camp { height: 100dvh; }

.camp-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.room-chip { display: flex; align-items: center; gap: 8px; }
.room-chip-label { font-size: 10px; color: var(--ink-dim); letter-spacing: 0.1em; }
.room-chip-code { font-size: 14px; color: var(--amber); letter-spacing: 0.12em; font-weight: 700; }
.icon-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: var(--radius);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--amber); border-color: var(--amber); }

/* waypoint ladder: the signature element. Each stage is a real, ordered
   connection state, not decoration. Amber = social/session, cyan = crypto. */
.waypoints {
  display: flex;
  list-style: none;
  margin: 0; padding: 0;
  gap: 4px;
}
.waypoint {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-top: 2px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  transition: color 0.3s ease, border-color 0.3s ease;
}
.wp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}
.waypoint.reached { color: var(--ink); border-top-color: var(--amber); }
.waypoint.reached .wp-dot { background: var(--amber); }
.waypoint[data-stage="encrypted"].reached,
.waypoint[data-stage="verified"].reached {
  color: var(--cyan);
  border-top-color: var(--cyan);
}
.waypoint[data-stage="encrypted"].reached .wp-dot,
.waypoint[data-stage="verified"].reached .wp-dot {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

/* ---------------- chat ---------------- */

.camp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 16px;
  gap: 10px;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.msg {
  max-width: 78%;
  padding: 8px 11px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.45;
  position: relative;
  border: 1px solid var(--line);
}
.msg.mine { align-self: flex-end; background: var(--panel-raised); }
.msg.theirs { align-self: flex-start; background: var(--panel); }
.msg.system {
  align-self: center;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.msg.system.verified { color: var(--cyan); }
.msg-ttl {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-dim);
}
.msg.expiring { opacity: 0.35; }

.snap-bubble {
  cursor: pointer;
  color: var(--amber);
  font-size: 13px;
}
.snap-media {
  max-width: 220px;
  max-height: 220px;
  border-radius: var(--radius);
  display: block;
}

/* ---------------- snap capture tray ---------------- */

.snap-tray {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.snap-tray[hidden] { display: none; }
#camera-preview { width: 100%; max-height: 320px; object-fit: cover; display: block; }
.snap-tray-controls {
  position: absolute;
  bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 10px;
}

/* ---------------- composer ---------------- */

.composer {
  display: flex;
  gap: 8px;
  align-items: center;
}
.composer input[type="text"] {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
}
.composer .icon-btn { margin-left: 0; font-size: 18px; padding: 6px 9px; }
.icon-btn.recording { color: var(--danger); border-color: var(--danger); }

/* ---------------- verify panel ---------------- */

.verify-panel {
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.verify-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--cyan);
  padding: 14px 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.verify-toggle:hover { background: var(--panel-raised); }
.verify-body { padding: 4px 16px 18px; }
.verify-body[hidden] { display: none; }
.verify-step { font-size: 12px; color: var(--ink-dim); margin: 10px 0 6px; }
.challenge-code {
  font-size: 24px;
  letter-spacing: 0.3em;
  color: var(--cyan);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  margin-bottom: 4px;
  user-select: all;
}
.verify-body input { margin: 6px 0 10px; }
.verify-result { font-size: 12px; margin-top: 10px; }
.verify-result.ok { color: var(--cyan); }
.verify-result.fail { color: var(--danger); }
.verify-note { font-size: 11px; color: var(--ink-dim); margin-top: 12px; line-height: 1.5; }

/* ---------------- misc ---------------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (min-width: 720px) {
  .card { max-width: 440px; }
  .msg { max-width: 60%; }
}
