/* sumwon — know thyself. matches the pitch deck: near-black, white, one red. */

:root {
  --ink:        #0d0d0d;   /* page */
  --ink-2:      #161616;   /* raised panels */
  --ink-3:      #1e1e1e;   /* inputs */
  --edge:       #2a2a2a;   /* hairlines */
  --paper:      #ffffff;   /* primary text / headlines */
  --paper-dim:  #a2a2a2;   /* secondary text */
  --muted:      #5a5a5a;   /* tertiary */
  --red:        #e11d2a;   /* the single accent */
  --red-deep:   #b3141f;
  --red-soft:   rgba(225, 29, 42, 0.12);
  --you:        #c7c7c7;   /* the person's own lines */
  --sans: "Archivo", "Arial", "Helvetica Neue", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --maxw: 46rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* faint grain so pure black doesn't band; deck is otherwise flat */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.025; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- splash -- */
.login {
  position: relative; z-index: 2; min-height: 100dvh; display: flex;
  padding: 2.6rem 2rem calc(2.6rem + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.login-inner { width: min(35rem, 100%); margin: auto; }
.login-inner > * { animation: rise 0.8s cubic-bezier(.2,.7,.2,1) both; }
.login-inner > .mark { animation-delay: 0.08s; }
.login-inner > .lede { animation-delay: 0.20s; }
.login-inner > .how { animation-delay: 0.30s; }
.login-inner > .passcode { animation-delay: 0.40s; }
.login-inner > .foot { animation-delay: 0.48s; }

.kicker {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--red);
  margin: 0 0 1.4rem;
}
.mark {
  display: flex; flex-direction: column; margin: 0;
  font-weight: 900; font-size: clamp(3.4rem, 15vw, 7rem);
  line-height: 0.84; letter-spacing: -0.035em; text-transform: uppercase;
  color: var(--paper);
}
.mark span { display: block; }
/* the wordmark reflects into red, echoing the icon: know thyself, seen in the water */
.mark .reflect {
  color: var(--red); transform: scaleY(-1); transform-origin: top;
  opacity: 0.4; margin-top: 0.16em; pointer-events: none; user-select: none;
  /* dropped below the word with a gap (the water surface) and fading down, so it reads
     as a reflection sitting on water — not the word flipped inside its own box. */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 68%);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 68%);
}
.lede {
  margin: 1.7rem 0 0; max-width: 32rem;
  font-size: 1.06rem; line-height: 1.55; color: var(--paper-dim);
}
/* the invite page's small lines (prompt above the email field, and the status line) */
.prompt {
  margin: 1.5rem 0 0.9rem; max-width: 32rem;
  font-size: 0.92rem; line-height: 1.5; color: var(--paper-dim);
}
#wl-msg:empty { display: none; }
.how { list-style: none; margin: 2rem 0 2.3rem; padding: 0; max-width: 31rem; }
.how li {
  display: flex; align-items: baseline; gap: 0.85rem;
  font-size: 0.98rem; line-height: 1.5; color: var(--paper-dim);
  padding: 0.62rem 0; border-top: 1px solid var(--edge);
}
.how li:last-child { border-bottom: 1px solid var(--edge); }
.how .n {
  font-family: var(--mono); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.08em; color: var(--red); flex: none; transform: translateY(-1px);
}
.foot {
  margin: 1.6rem 0 0; max-width: 30rem;
  font-size: 0.78rem; line-height: 1.55; color: var(--muted);
}
.passcode {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--edge); border-radius: 4px; overflow: hidden;
  max-width: 26rem; transition: border-color .25s ease;
}
.passcode:focus-within { border-color: var(--red); }
.passcode input {
  flex: 1; background: var(--ink-2); border: none; color: var(--paper);
  font-family: var(--mono); font-size: 0.95rem; letter-spacing: 0.06em;
  padding: 0.95rem 1rem; outline: none; caret-color: var(--red);
}
.passcode input::placeholder { color: var(--muted); letter-spacing: 0.02em; }
.passcode button {
  background: var(--red); border: none; color: #fff; font-size: 1.2rem;
  line-height: 1; padding: 0 1.3rem; transition: background .2s ease;
}
.passcode button:hover { background: var(--red-deep); }
.error {
  color: var(--red); font-family: var(--mono); font-size: 0.78rem;
  letter-spacing: 0.04em; margin: 1rem 0 0;
}

/* ----------------------------------------------------------------- chat -- */
.chat {
  position: relative; z-index: 2; height: 100dvh;
  display: flex; flex-direction: column; max-width: var(--maxw); margin: 0 auto;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.4rem; border-bottom: 1px solid var(--edge);
  background: rgba(13,13,13,0.85); backdrop-filter: blur(8px);
}
.who { display: flex; align-items: center; gap: 0.6rem; }
.who .name { font-weight: 700; font-size: 1rem; letter-spacing: 0.01em; }
.avatar {
  width: 40px; height: 40px; border-radius: 11px; display: block; flex: none;
  border: 1px solid var(--edge); background: var(--ink);
}
.mode {
  font-family: var(--mono); font-size: 0.58rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.actions { display: flex; gap: 0.4rem; }
.ghost {
  background: none; border: 1px solid transparent; color: var(--paper-dim);
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.4rem 0.7rem; border-radius: 3px; transition: color .2s, border-color .2s;
}
.ghost:hover { color: var(--paper); border-color: var(--edge); }

.thread {
  flex: 1; overflow-y: auto; padding: 1.8rem 1.4rem 0.6rem;
  display: flex; flex-direction: column; gap: 1.4rem;
  scrollbar-width: thin; scrollbar-color: var(--edge) transparent;
}
.thread::-webkit-scrollbar { width: 7px; }
.thread::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 4px; }

.message { max-width: 82%; animation: rise 0.55s cubic-bezier(.2,.7,.2,1) both; }
.message.someone {
  align-self: flex-start; font-size: 1.08rem; line-height: 1.55;
  color: var(--paper); font-weight: 400; letter-spacing: 0.002em;
}
.message.you {
  align-self: flex-end; text-align: right;
  font-family: var(--mono); font-size: 0.9rem; line-height: 1.5;
  color: var(--you); letter-spacing: -0.01em;
}

/* the recognition beat and the ask: the high-note, red-accented card */
.recognition {
  align-self: flex-start; max-width: 90%;
  border: 1px solid var(--red); border-left-width: 3px; border-radius: 4px;
  background: var(--red-soft); padding: 1rem 1.1rem 0.9rem;
}
.recognition p { margin: 0 0 0.9rem; font-size: 1.06rem; line-height: 1.5; color: var(--paper); }
.recognition .choices { display: flex; gap: 0.6rem; }
.recognition button {
  background: none; border: 1px solid var(--red); color: var(--red);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.45rem 0.9rem; border-radius: 3px; transition: background .2s, color .2s;
}
.recognition button:hover { background: var(--red); color: #fff; }
.recognition.expired { opacity: 0.4; }

.thinking { align-self: flex-start; display: flex; gap: 5px; padding: 0.4rem 0; }
.thinking span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: blink 1.3s ease-in-out infinite;
}
.thinking span:nth-child(2) { animation-delay: 0.18s; }
.thinking span:nth-child(3) { animation-delay: 0.36s; }

.composer {
  display: flex; align-items: flex-end; gap: 0.6rem;
  padding: 0.9rem 1.4rem calc(1.1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge);
}
.composer textarea {
  flex: 1; resize: none; background: var(--ink-3); color: var(--paper);
  border: 1px solid var(--edge); border-radius: 4px;
  font-family: var(--mono); font-size: 0.92rem; line-height: 1.5;
  padding: 0.7rem 0.9rem; max-height: 9rem; outline: none; transition: border-color .25s;
}
.composer textarea:focus { border-color: var(--red); }
.composer textarea::placeholder { color: var(--muted); }
.composer button {
  background: var(--red); border: none; color: #fff; flex: none;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.75rem 1.1rem; border-radius: 4px; transition: background .2s, opacity .2s;
}
.composer button:hover { background: var(--red-deep); }
.composer button:disabled { opacity: 0.4; cursor: default; }

/* voice notes */
.composer .mic {
  background: none; border: 1px solid var(--edge); color: var(--paper-dim); flex: none;
  font-size: 1.05rem; line-height: 1; padding: 0.6rem 0.7rem; border-radius: 4px;
  transition: border-color .2s, color .2s;
}
.composer .mic:hover { color: var(--red); border-color: var(--red); }

.recbar {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.9rem 1.4rem calc(1.1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge);
}
.recbar .rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none;
  box-shadow: 0 0 10px var(--red); animation: breathe 1.4s ease-in-out infinite;
}
.recbar .rec-time {
  flex: 1; font-family: var(--mono); font-size: 0.9rem; letter-spacing: 0.06em; color: var(--paper);
}
.recbar .rec-cancel {
  background: none; border: 1px solid var(--edge); color: var(--paper-dim); flex: none;
  font-size: 0.85rem; line-height: 1; padding: 0.55rem 0.7rem; border-radius: 4px;
  transition: color .2s, border-color .2s;
}
.recbar .rec-cancel:hover { color: var(--paper); }
.recbar .rec-stop {
  background: var(--red); border: none; color: #fff; flex: none;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.75rem 1.2rem; border-radius: 4px; transition: background .2s;
}
.recbar .rec-stop:hover { background: var(--red-deep); }

.message.image { max-width: 62%; }
.message.image img {
  display: block; width: 100%; height: auto; border-radius: 14px;
  border: 1px solid var(--edge); background: var(--ink-2);
}
.message.voice { font-style: italic; opacity: 0.92; }
.message .play {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 0.5rem; vertical-align: middle; width: 1.7rem; height: 1.7rem;
  border-radius: 50%; background: none; border: 1px solid var(--red); color: var(--red);
  font-size: 0.62rem; line-height: 1; transition: background .2s, color .2s;
}
.message .play:hover { background: var(--red); color: #fff; }

/* call voice picker (reuses the .notice overlay) */
.voice-hint { font-size: 0.82rem; line-height: 1.5; color: var(--muted); margin: 0 0 0.9rem; }
.voice-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.voice-list li {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--edge); cursor: pointer; border-radius: 6px;
}
.voice-list li:last-child { border-bottom: 1px solid var(--edge); }
.voice-list li:hover { background: var(--ink-2); }
.voice-list li.chosen { background: var(--red-soft); }
.vplay {
  flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: none; border: 1px solid var(--red); color: var(--red);
  font-size: 0.6rem; line-height: 1; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: background .2s, color .2s;
}
.vplay:hover, .vplay.playing { background: var(--red); color: #fff; }
.vname { flex: 1; font-size: 0.98rem; color: var(--paper); letter-spacing: 0.01em; }
.vpick { flex: none; color: var(--red); opacity: 0; font-size: 0.9rem; }
.voice-list li.chosen .vpick { opacity: 1; }
.voice-style { display: block; margin: 0.4rem 0 0.6rem; }
.voice-style span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; }
.voice-style input {
  width: 100%; background: var(--ink-2); border: 1px solid var(--edge); border-radius: 6px;
  color: var(--paper); padding: 0.7rem 0.8rem; outline: none; caret-color: var(--red);
  font-family: inherit; font-size: 0.95rem;
}
.voice-style input:focus { border-color: var(--red); }
.voice-msg { font-size: 0.8rem; color: var(--red); min-height: 1em; margin: 0.5rem 0 0; }
.call-start { color: var(--red); border-color: var(--red); }

/* in-call screen */
.callui {
  position: fixed; inset: 0; z-index: 20; display: flex;
  align-items: center; justify-content: center;
  background: rgba(10, 10, 10, 0.97); backdrop-filter: blur(6px);
}
.call-inner { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; padding: 2rem; }
.call-orb {
  width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--red), var(--red-deep));
  animation: callpulse 1.8s ease-out infinite;
}
@keyframes callpulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 42, 0.5); }
  70% { box-shadow: 0 0 0 34px rgba(225, 29, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 42, 0); }
}
.call-status {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--paper-dim); margin: 0;
}
.call-caption {
  max-width: 30rem; text-align: center; color: var(--paper);
  font-size: 1rem; line-height: 1.5; min-height: 1.5em; margin: 0;
}
.call-end {
  background: var(--red); border: none; color: #fff; border-radius: 999px;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 0.8rem 1.8rem; cursor: pointer;
}
.call-end:hover { background: var(--red-deep); }

/* noticing panel */
.notice {
  position: fixed; top: 0; right: 0; z-index: 5;
  width: min(25rem, 90vw); height: 100dvh; overflow-y: auto;
  background: var(--ink-2); border-left: 1px solid var(--edge);
  padding: 1.3rem 1.4rem calc(2rem + env(safe-area-inset-bottom));
  box-shadow: -30px 0 60px rgba(0,0,0,0.6);
  animation: slide-in 0.4s cubic-bezier(.2,.7,.2,1) both;
}
.notice-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-dim);
  margin-bottom: 1.6rem;
}
.notice-head button { background: none; border: none; color: var(--paper-dim); font-size: 1.4rem; line-height: 1; }
.notice-group { margin-bottom: 1.8rem; }
.notice-group h3 {
  font-family: var(--mono); font-weight: 600; font-size: 0.62rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--red);
  margin: 0 0 0.7rem;
}
.notice-group ul { list-style: none; margin: 0; padding: 0; }
.notice-group li {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.98rem; line-height: 1.45; padding: 0.5rem 0;
  border-bottom: 1px solid var(--edge); color: var(--paper);
}
.notice-group li .note-text { flex: 1; }
.notice-group li.empty { display: block; }

/* the small × that removes a thing someone noticed (panel + per-turn chips) */
.forget {
  flex: none; background: none; border: none; color: var(--muted);
  font-size: 1.05rem; line-height: 1; padding: 0 0.15rem; border-radius: 3px;
  transition: color .2s;
}
.forget:hover { color: var(--red); }

/* per-turn 'noted' transparency line, under a reply */
.noticed {
  align-self: flex-start; max-width: 90%;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem;
  margin-top: -0.6rem;
}
.noticed-label {
  font-family: var(--mono); font-size: 0.56rem; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.noted-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.82rem; color: var(--paper-dim);
  border: 1px solid var(--edge); border-radius: 999px;
  padding: 0.18rem 0.45rem 0.18rem 0.7rem;
}
.notice-group[data-group="wondering"] li { color: var(--paper-dim); }
.notice-group[data-group="alive"] li { color: var(--red); }
.notice-group li.empty { color: var(--muted); border: none; }
.notice-foot { font-size: 0.8rem; color: var(--muted); margin-top: 1rem; }

/* ----------------------------------------------------------- animations -- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes breathe { 0%,100% { opacity: 1; box-shadow: 0 0 10px var(--red); }
  50% { opacity: 0.45; box-shadow: 0 0 3px var(--red); } }
@keyframes blink { 0%,100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 0.9; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
