/*
 * One screen with nothing on it, and one screen with a conversation on it.
 *
 * There is no sidebar, no conversation list and no contact list — not because
 * they were hard, but because the thing this is trying to be does not have
 * them. A link is the room; what you are looking at is whatever link you opened.
 */

:root {
  --paper: #faf9f7;
  --ink: #1e1c1a;
  --ink-soft: #4a4642;
  --grey: #9a948c;
  --line: #e4e0d9;
  --focus: #c7c0b4;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI',
    'Malgun Gothic', 'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input {
  font: inherit;
  color: inherit;
}

/* ─── 빈 화면 ─────────────────────────────────────────────────────────── */

.gate {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
}

.gate-line {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
  letter-spacing: -0.01em;
}

.gate-input {
  width: 100%;
  max-width: 420px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  outline: none;
}

.gate-input:focus { border-color: var(--focus); }

.gate-error {
  margin: 0;
  max-width: 420px;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.gate-mine {
  color: var(--grey);
  font-size: 13px;
  padding: 4px 8px;
}

.gate-mine:hover { color: var(--ink-soft); }

.gate-offline {
  margin: 0;
  max-width: 420px;
  color: #8a6a4a;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.gate-link {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  outline: none;
}

/* ─── 연결된 화면 ─────────────────────────────────────────────────────── */

.room {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.room-head {
  position: relative;
  flex: none;
  padding: 14px 20px 10px;
  text-align: center;
}

.room-state {
  display: inline-block;
  margin: 0;
  padding: 2px 8px;
  color: var(--grey);
  font-size: 12px;
  letter-spacing: -0.01em;
  cursor: default;
}

.room-leave {
  position: absolute;
  top: 12px;
  right: 14px;
  color: var(--grey);
  font-size: 12px;
  padding: 2px 6px;
}

.room-leave:hover { color: var(--ink-soft); }

.stream {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.said {
  /*
   * A bubble, but a quiet one.
   *
   * With no avatar, no name and no timestamp, alignment was the only thing
   * saying who spoke — which is legible in a screenshot of four lines and not
   * on a phone halfway through a real conversation. A shape costs nothing that
   * the austerity was protecting.
   */
  max-width: 78%;
  margin: 0;
  padding: 9px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  opacity: 0.9;
  /* Twelve seconds, so it reads as air moving rather than as a UI animation. */
  transition: opacity 12s linear;
}

.said.mine {
  align-self: flex-end;
  background: #ece7df;
  color: var(--ink);
  border-bottom-right-radius: 6px;
}

.said.theirs {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-bottom-left-radius: 6px;
}

.said.faded { opacity: 0.4; }

/* Not a message — the one line the client says for itself. */
.aside {
  align-self: center;
  margin: 0;
  color: var(--grey);
  font-size: 12px;
  text-align: center;
}

.say {
  flex: none;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
}

.say-input {
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.say-input:focus { border-color: var(--focus); }
.say-input::placeholder { color: var(--grey); }
