/* ==========================================================================
   SHINOBU — PAPER OPERATIONS
   Warm paper, black ink, one red. Archivo Black / Space Grotesk / JetBrains Mono.
   Presentation layer only. No crypto, room, mailbox, or Firebase logic.
   ========================================================================== */

/* ---------- SELF-HOSTED FONTS ---------- */

@font-face {
  font-family: 'Archivo Black';
  src: url('assets/fonts/ArchivoBlack-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/fonts/SpaceGrotesk-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono-Variable.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Shippori Mincho';
  src: url('assets/fonts/ShipporiMincho-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Shippori Mincho';
  src: url('assets/fonts/ShipporiMincho-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- TOKENS ---------- */

:root {
  --paper: #EBE3D3;
  --paper-lift: #F3ECDC;
  --paper-deep: #DED2BC;
  --ink: #0A0A0A;
  --ink-soft: #1A1A18;

  --red: #C1121F;
  --red-bright: #E5232F;
  --red-deep: #8E0C16;

  --muted: rgba(10, 10, 10, 0.62);
  --muted-soft: rgba(10, 10, 10, 0.45);
  --line: rgba(10, 10, 10, 0.16);
  --line-strong: rgba(10, 10, 10, 0.32);

  --paper-muted: rgba(235, 227, 211, 0.66);
  --paper-soft: rgba(235, 227, 211, 0.4);
  --line-paper: rgba(235, 227, 211, 0.18);

  --font-display: 'Archivo Black', 'Arial Black', sans-serif;
  --font-body: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --font-serif: 'Shippori Mincho', 'Times New Roman', serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Legacy variable bridge: style.css keeps working underneath. */
  --bg: var(--paper);
  --surface: var(--ink);
  --pink: var(--red);
  --pink-dark: var(--red-deep);
  --gray: var(--muted);
  --border: 1px solid var(--line-strong);
  --shadow: none;
  --shadow-sm: none;
  --shadow-dark: none;
}

/* ---------- BASE ---------- */

html {
  height: 100%;
  background: var(--paper);
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 8% -10%, #F6F0E2 0%, rgba(246, 240, 226, 0) 52%),
    radial-gradient(ellipse at 104% 110%, #D9CCB4 0%, rgba(217, 204, 180, 0) 58%),
    var(--paper) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(90deg, rgba(10, 10, 10, 0.018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 9px);
  opacity: 0.55;
}

::selection {
  background: var(--red);
  color: var(--paper);
}

a {
  color: var(--red);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border-radius: 0;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* Paper grain: the only texture layer that sits above the UI. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.14;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

#bg-container,
.moon-glow,
#particles-canvas,
#particles-js {
  display: none !important;
}

/* ---------- TYPE ---------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 0.94;
}

h1 {
  font-size: clamp(3.4rem, 10vw, 7rem);
}

h2 {
  width: 100%;
  font-size: clamp(2.35rem, 5.4vw, 4.5rem);
  color: var(--ink);
  margin: 0 0 1.1rem;
  text-wrap: pretty;
}

h2::before {
  content: 'SHINOBU / PRIVATE MESSAGING';
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.22em;
  color: var(--red);
  text-transform: uppercase;
}

h3 {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--red);
}

.h2-tail {
  white-space: nowrap;
}

@media (min-width: 761px) {
  h2 .h2-tail {
    display: block;
    padding-left: 1.8em;
  }
}

.tag-live,
.tag-async {
  display: inline-block;
  margin-left: 0;
  margin-right: 0.28em;
  padding: 0.3em 0.45em 0.22em;
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 1vw, 0.72rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  vertical-align: 0.28em;
  border: 1px solid currentColor;
}

.tag-live {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.tag-async {
  background: transparent;
  color: var(--ink);
}

/* ---------- SCREEN SHELL ---------- */

.screen {
  display: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: transparent;
}

.screen.active {
  display: flex;
}

.screen::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: 4px;
  background: var(--red);
  pointer-events: none;
}

#screen-home,
#screen-about,
#screen-dossier,
#screen-origin,
#screen-left-menu,
#screen-room-type,
#screen-join-type,
#screen-create-live,
#screen-create-group,
#screen-join-live,
#screen-join-group,
#screen-create-mailbox,
#screen-join-mailbox,
#screen-invite {
  padding: clamp(22px, 4vw, 52px);
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#screen-about .container,
#screen-dossier .container,
#screen-origin .container,
#screen-left-menu .container {
  max-width: 760px;
}

#screen-room-type .container,
#screen-join-type .container,
#screen-create-live .container,
#screen-create-group .container,
#screen-join-live .container,
#screen-join-group .container,
#screen-create-mailbox .container,
#screen-join-mailbox .container {
  max-width: 620px;
}

#screen-dossier .container,
#screen-origin .container {
  max-width: 820px;
}

/* ---------- BACK / KICKERS ---------- */

.btn-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
  padding: 0.3rem 0;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

.btn-back:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

.instruction {
  width: 100%;
  margin: 0 0 clamp(1.75rem, 4vw, 2.5rem);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

/* ---------- BUTTONS ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 52px;
  padding: 1rem 1.4rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 220ms var(--ease),
    border-color 220ms var(--ease),
    color 220ms var(--ease),
    transform 220ms var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
  filter: none;
  transform: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:disabled {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted-soft);
  opacity: 1;
  cursor: not-allowed;
}

.btn-quickstart:disabled {
  background: transparent;
  border-color: rgba(193, 18, 31, 0.35);
  color: var(--red);
  opacity: 0.55;
}

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn-secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.btn-quickstart {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.btn-quickstart:hover:not(:disabled) {
  background: var(--red-deep);
  border-color: var(--red-deep);
}

.mode-tag {
  display: inline-block;
  flex-shrink: 0;
  margin-left: 0.7rem;
  padding: 0.2rem 0.4rem;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.2;
  vertical-align: middle;
}

.btn-quickstart .mode-tag {
  background: transparent;
  color: var(--paper);
}

/* Editorial option rows: home, room type, mailbox menu. */
.button-group {
  counter-reset: option;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--line-strong);
}

.button-group .btn {
  counter-increment: option;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 68px;
  padding: 1.15rem 7.5rem 1.15rem 3.5rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: left;
}

.button-group .btn::before {
  content: counter(option, decimal-leading-zero);
  position: absolute;
  left: 0.12rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.button-group .btn .mode-tag {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  color: var(--red);
  border-color: rgba(193, 18, 31, 0.5);
}

.button-group .btn-quickstart {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.button-group .btn-quickstart::before,
.button-group .btn-quickstart .mode-tag {
  color: var(--paper);
}

.button-group .btn-quickstart .mode-tag {
  border-color: var(--paper-soft);
}

.button-group .btn-primary {
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--line-strong);
  color: var(--ink);
}

.button-group .btn-secondary {
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--line-strong);
  color: var(--ink);
}

.button-group .btn:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.button-group .btn:hover:not(:disabled)::before,
.button-group .btn:hover:not(:disabled) .mode-tag {
  color: var(--paper);
}

.button-group .btn:hover:not(:disabled) .mode-tag {
  border-color: var(--line-paper);
}

.button-group .btn-quickstart:hover:not(:disabled) {
  background: var(--red-deep);
  border-color: var(--red-deep);
}

/* ---------- HOME ---------- */

#screen-home {
  padding: 0;
  justify-content: flex-start;
}

#screen-home .container {
  width: 100%;
  max-width: 1180px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(28px, 4.5vw, 64px) clamp(22px, 5vw, 64px) clamp(72px, 9vw, 120px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(290px, 0.75fr);
  column-gap: clamp(36px, 7vw, 104px);
  align-content: center;
  align-items: start;
}

#screen-home .container::before {
  content: 'SHINOBU / NO-TRACE MESSAGING — EST. 2024';
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: clamp(2rem, 5vw, 3.75rem);
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-align: left;
  text-transform: uppercase;
}

.wordmark {
  position: relative;
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  margin: 0 0 0.32em;
  color: var(--ink);
  font-size: clamp(4.6rem, 15.2vw, 12.5rem);
  line-height: 0.8;
  letter-spacing: -0.055em;
  text-align: left;
  white-space: nowrap;
}

.wordmark::after {
  content: '';
  position: static;
  display: inline-block;
  width: 0.13em;
  height: 0.13em;
  margin-left: 0.07em;
  background: var(--red);
  color: transparent;
  vertical-align: 0.08em;
  z-index: auto;
}

.tagline {
  grid-column: 1 / -1;
  width: fit-content;
  margin: 0 0 clamp(2rem, 5vw, 3.75rem);
  padding: 0 0 0 0.9rem;
  border-left: 3px solid var(--red);
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: clamp(0.78rem, 1.3vw, 1rem);
  line-height: 1.4;
  letter-spacing: 0.38em;
  text-align: left;
  text-transform: none;
  text-shadow: none;
}

.home-deck {
  grid-column: 1;
  max-width: 48ch;
  margin: 0 0 2.5rem;
  color: var(--ink);
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  line-height: 1.6;
  text-wrap: pretty;
}

.home-deck::first-letter {
  float: left;
  margin: 0.04em 0.12em 0 0;
  color: var(--red);
  font-family: var(--font-display);
  font-size: 3.35em;
  line-height: 0.76;
}

#screen-home .button-group {
  grid-column: 2;
  align-self: start;
  margin-top: 0.15rem;
}

#screen-home .mailbox-secondary {
  grid-column: 1;
  align-self: start;
  width: fit-content;
  margin: 0;
  padding: 0 0 0.25rem;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--red);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms var(--ease);
}

#screen-home .mailbox-secondary:hover {
  color: var(--red);
}

.home-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  width: 100%;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-meta span {
  flex: 1 1 0;
  padding: 0.75rem 0.9rem;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.home-meta span:first-child {
  padding-left: 0;
}

.home-meta span:last-child {
  border-right: 0;
  text-align: right;
  padding-right: 0;
}

.btn-help {
  position: fixed;
  right: clamp(18px, 3vw, 40px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 120;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}

.btn-help:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.btn-help:active {
  transform: none;
  box-shadow: none;
}

/* ---------- FORM FIELDS ---------- */

.input-group {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 0 1.1rem;
}

.code-input {
  width: 100%;
  padding: 1.15rem 0.1rem 1rem;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  caret-color: var(--red);
  outline: none;
  font-family: var(--font-mono);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-align: left;
  text-transform: uppercase;
  transition: border-color 180ms var(--ease);
}

.code-input::placeholder {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.code-input:focus {
  border-bottom-color: var(--red);
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-7deg) scale(0);
  padding: 0.25rem 0.85rem;
  background: var(--paper);
  border: 2px solid var(--red);
  color: var(--red);
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
  transition: transform 160ms var(--ease), opacity 120ms var(--ease);
}

.stamp.visible {
  transform: translate(-50%, -50%) rotate(-7deg) scale(1);
  opacity: 1;
}

.btn-generate {
  align-self: flex-start;
  width: auto;
  margin: -0.2rem 0 1.9rem;
  padding: 0.35rem 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

.btn-generate:hover {
  color: var(--red-deep);
  border-bottom-color: var(--red-deep);
  filter: none;
}

.btn-generate:active {
  transform: none;
}

.expiry-group {
  width: 100%;
  max-width: none;
  margin: 1.4rem 0 2.2rem;
}

.expiry-label {
  display: block;
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.expiry-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  border: 1px solid var(--line-strong);
}

.expiry-option {
  min-width: 0;
  flex: none;
  cursor: pointer;
}

.expiry-option span {
  display: block;
  padding: 0.8rem 0.2rem;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.expiry-option:last-child span {
  border-right: 0;
}

.expiry-option:hover span {
  background: var(--paper-deep);
  border-color: var(--line);
}

.expiry-option input:checked + span {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ---------- INVITE LANDING ---------- */

#screen-invite {
  justify-content: center;
}

#screen-invite .container {
  max-width: 560px;
}

.invite-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: clamp(1.9rem, 5vw, 3.2rem);
  background: var(--paper-lift);
  border: 1px solid var(--ink);
  border-top: 4px solid var(--red);
  outline: 0;
  box-shadow: none;
  text-align: left;
  overflow: hidden;
  animation: invite-in 320ms var(--ease) both;
}

.invite-card::before {
  content: '影';
  position: absolute;
  right: -1.5rem;
  bottom: -6.5rem;
  top: auto;
  left: auto;
  transform: none;
  color: var(--red);
  font-family: var(--font-serif);
  font-size: clamp(12rem, 30vw, 18rem);
  line-height: 1;
  opacity: 0.045;
  pointer-events: none;
  user-select: none;
}

.invite-card::after {
  content: 'SEALED DISPATCH';
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
  transform: none;
  padding: 0.38rem 0.8rem;
  background: var(--red);
  box-shadow: none;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.2;
  text-align: center;
}

.invite-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 clamp(1.5rem, 4vw, 2.2rem);
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.invite-eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--red);
}

.invite-title {
  max-width: 11ch;
  margin: 0 0 1.15rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 7vw, 4.2rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-shadow: none;
}

.invite-title::before {
  content: none;
}

.invite-desc {
  max-width: 42ch;
  margin: 0 0 clamp(1.7rem, 4vw, 2.3rem);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.96rem;
  line-height: 1.65;
  opacity: 1;
}

.invite-code-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.2rem 1.2rem;
  background: var(--paper-deep);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.invite-code-block::before,
.invite-code-block::after {
  content: none;
}

.invite-code-block .code-label {
  width: auto;
  padding: 0;
  background: none;
  border: 0;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-align: left;
}

.invite-code {
  margin-top: 0.35rem;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-shadow: none;
  word-break: break-all;
}

.invite-code-block .encryption-badge {
  align-self: flex-start;
  margin-top: 0.9rem;
  padding: 0.2rem 0.45rem;
  background: transparent;
  border: 1px solid rgba(193, 18, 31, 0.55);
  box-shadow: none;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.invite-status {
  min-height: 1rem;
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 1;
}

.invite-status[data-state="checking"] {
  animation: status-blink 1.1s steps(2) infinite;
}

.invite-status[data-state="ready"] {
  color: var(--ink);
  opacity: 1;
}

.invite-status[data-state="ready"]::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.5rem;
  background: var(--red);
  vertical-align: 0.08em;
}

.invite-status[data-state="expired"] {
  color: var(--red);
  opacity: 1;
}

.invite-status[data-state="expired"]::before {
  content: '✕ ';
}

.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.invite-actions .btn {
  font-size: 0.82rem;
  padding: 1rem 1.2rem;
  box-shadow: none;
}

.invite-actions .btn-secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

/* ---------- DOSSIER ---------- */

.dossier-title {
  margin-bottom: 0.55rem;
  font-size: clamp(2.8rem, 7vw, 5rem);
}

.dossier-title::before {
  content: 'SHINOBU / DOSSIER — INDEX OF RECORDS';
}

.dossier-subtitle {
  margin: 0 0 clamp(1.75rem, 4vw, 2.5rem);
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.82rem;
  letter-spacing: 0.3em;
  text-align: left;
}

.dossier-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1.8rem 0 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-strong);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.dossier-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--red);
}

.dossier-eyebrow::after {
  content: none;
}

.dossier-card {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin: 0;
  padding: 1.15rem 0.25rem;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-body);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms var(--ease), color 200ms var(--ease), padding 200ms var(--ease);
}

.dossier-card::before {
  content: none;
}

.dossier-card:hover {
  padding-right: 1rem;
  padding-left: 1rem;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.dossier-card:active {
  transform: none;
  box-shadow: none;
}

.dossier-num {
  min-width: 0;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.dossier-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.dossier-name {
  color: inherit;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.28rem);
  letter-spacing: -0.015em;
  line-height: 1.1;
  text-transform: uppercase;
}

.dossier-desc {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 200ms var(--ease);
}

.dossier-card:hover .dossier-desc {
  color: var(--paper-muted);
}

.dossier-arrow {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform 200ms var(--ease), color 200ms var(--ease);
}

.dossier-card:hover .dossier-arrow {
  color: var(--paper);
  transform: translateX(4px);
}

/* ---------- ABOUT ---------- */

#screen-about h2::before {
  content: 'SHINOBU / THE PROTOCOL — ABOUT';
}

#screen-about .container {
  counter-reset: section;
}

.about-text {
  max-width: 30ch;
  margin: 0 0 clamp(2.2rem, 5vw, 3.2rem);
  padding: 0 0 1.6rem;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  text-align: left;
  text-wrap: pretty;
}

.about-section {
  position: relative;
  width: 100%;
  max-width: none;
  counter-increment: section;
  margin: 0;
  padding: 1.55rem 0 1.55rem 3.4rem;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
}

.about-section:first-of-type {
  border-top: 0;
}

.about-section::before {
  content: counter(section, decimal-leading-zero);
  position: absolute;
  top: 1.85rem;
  left: 0;
  z-index: 1;
  display: block;
  width: auto;
  height: auto;
  background: none;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 1;
}

.about-section h3 {
  margin: 0 0 0.75rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.about-section p {
  max-width: 66ch;
  margin: 0;
  color: rgba(10, 10, 10, 0.82);
  font-size: 0.96rem;
  line-height: 1.7;
}

.landing-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 1.35rem;
  margin-bottom: 0;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.landing-point {
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  grid-template-areas:
    'mark label'
    'mark desc';
  align-items: start;
  column-gap: 0.5rem;
  padding: 0.9rem 1rem;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.landing-point-mark {
  grid-area: mark;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.landing-point-label {
  grid-area: label;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.landing-point-desc {
  grid-area: desc;
  margin-top: 0.25rem;
  margin-left: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-align: left;
}

/* ---------- ORIGIN ---------- */

#screen-origin h2::before {
  content: 'SHINOBU / ORIGIN ARC — THE CODE THAT VANISHES';
}

#screen-origin .container {
  max-width: 760px;
}

.origin-story {
  width: 100%;
  max-width: 68ch;
  margin: 0;
  padding: clamp(1.8rem, 4vw, 2.6rem) 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.origin-story::before {
  content: none;
}

.origin-story h3 {
  margin: 0 0 1.5rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.origin-story p {
  margin: 0 0 1.35rem;
  color: rgba(10, 10, 10, 0.84);
  font-family: var(--font-body);
  font-size: 1.01rem;
  line-height: 1.78;
  text-wrap: pretty;
}

.origin-story p:first-of-type {
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 1.18rem;
  letter-spacing: 0.04em;
}

.origin-story p:last-child {
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 500;
}

.origin-story .story-divider {
  width: 44px;
  height: 2px;
  margin: 2.3rem 0;
  background: var(--red);
  border: 0;
  opacity: 1;
}

/* ---------- ROOM / MAILBOX ENTRY SCREENS ---------- */

#screen-room-type h2::before,
#screen-join-type h2::before {
  content: 'SHINOBU / LIVE ROOMS — SELECT TYPE';
}

#screen-create-live h2::before {
  content: 'SHINOBU / LIVE ROOM — CREATE';
}

#screen-create-group h2::before {
  content: 'SHINOBU / GROUP ROOM — CREATE';
}

#screen-join-live h2::before {
  content: 'SHINOBU / LIVE ROOM — JOIN';
}

#screen-join-group h2::before {
  content: 'SHINOBU / GROUP ROOM — JOIN';
}

#screen-left-menu h2::before {
  content: 'SHINOBU / ASYNC MAILBOX — SELECT MODE';
}

#screen-create-mailbox h2::before {
  content: 'SHINOBU / ASYNC MAILBOX — CREATE';
}

#screen-join-mailbox h2::before {
  content: 'SHINOBU / ASYNC MAILBOX — JOIN';
}

#screen-room-type .button-group,
#screen-join-type .button-group {
  margin-top: 0.5rem;
}

#screen-left-menu .button-group {
  margin-top: 1.5rem;
}

#screen-left-menu .container {
  max-width: 620px;
}

#screen-create-live .btn-primary,
#screen-create-group .btn-primary,
#screen-join-live .btn-primary,
#screen-join-group .btn-primary,
#screen-create-mailbox .btn-primary,
#screen-join-mailbox .btn-primary {
  margin-top: 0.2rem;
  min-height: 58px;
}

#screen-create-group .input-group[style],
#screen-join-group .input-group[style] {
  margin-top: 1.1rem !important;
}

/* ---------- LIVE ROOM SHELL ---------- */

#screen-live-room {
  background: transparent;
}

#screen-live-room[data-theme] {
  background: transparent;
}

#screen-live-room .room-container,
#screen-mailbox .room-container {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
}

#screen-live-room .room-header {
  position: relative;
  z-index: 40;
  width: 100%;
  max-width: none;
  min-height: 64px;
  padding: 0.8rem clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  background: var(--ink);
  border-bottom: 1px solid var(--red);
  color: var(--paper);
}

#screen-live-room .presence-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

#screen-live-room .presence-dot {
  width: 8px;
  height: 8px;
  background: var(--paper-soft);
  border: 1px solid var(--line-paper);
  border-radius: 0;
  box-shadow: none;
}

#screen-live-room .presence-dot.active {
  background: var(--red-bright);
  border-color: var(--red-bright);
  box-shadow: none;
}

#screen-live-room .presence-dot.away {
  background: var(--paper-soft);
}

#screen-live-room .presence-dot.disconnected {
  background: transparent;
  border-color: var(--paper-soft);
}

#screen-live-room .presence-text {
  color: var(--paper-muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
}

#screen-live-room .expiry-timer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--paper-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

#screen-live-room .room-header .expiry-label {
  display: inline;
  margin: 0;
  color: var(--paper-soft);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.1em;
}

#screen-live-room .expiry-time {
  color: var(--paper);
  font-size: 0.6rem;
  font-weight: 600;
}

#screen-live-room .expiry-time.expiring {
  color: var(--red-bright);
}

#screen-live-room[data-fg] .room-menu-btn {
  border-color: var(--line-paper);
  color: var(--paper);
}

#screen-live-room[data-fg] .room-menu-btn:hover,
#screen-live-room[data-fg] .room-menu-btn[aria-expanded="true"] {
  border-color: var(--red-bright);
  color: var(--paper);
}

#screen-live-room[data-fg] .presence-text,
#screen-live-room[data-fg] .expiry-timer {
  color: var(--paper-muted);
}

#screen-live-room[data-fg] .presence-dot {
  border-color: var(--paper-soft);
}

#screen-live-room[data-fg="dark"] .room-menu-btn {
  border-color: var(--line-paper);
  color: var(--paper);
}

#screen-live-room[data-fg="dark"] .room-menu-btn:hover,
#screen-live-room[data-fg="dark"] .room-menu-btn[aria-expanded="true"] {
  border-color: var(--red-bright);
  color: var(--paper);
}

#screen-live-room[data-fg="dark"] .presence-text,
#screen-live-room[data-fg="dark"] .expiry-timer {
  color: var(--paper-muted);
}

#screen-live-room[data-fg="dark"] .presence-dot {
  border-color: var(--paper-soft);
}

/* ---------- ROOM MENU ---------- */

.room-menu {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.room-menu-btn {
  padding: 0.4rem 0.65rem;
  background: transparent;
  border: 1px solid var(--paper-soft);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}

.room-menu-btn:hover,
.room-menu-btn[aria-expanded="true"] {
  border-color: var(--red-bright);
  color: var(--paper);
}

.room-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 500;
  width: min(330px, calc(100vw - 32px));
  min-width: 0;
  max-height: min(70vh, 620px);
  overflow-y: auto;
  padding: 0.4rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--paper-lift);
  border: 1px solid var(--ink);
  border-top: 3px solid var(--red);
  box-shadow: 12px 12px 0 rgba(10, 10, 10, 0.1);
  color: var(--ink);
}

.room-menu-dropdown.hidden {
  display: none;
}

.room-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.58rem 0.15rem;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms var(--ease), background 160ms var(--ease), padding 160ms var(--ease);
}

.room-menu-item:hover {
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  background: var(--paper-deep);
  border-color: var(--line);
}

.room-menu-item.hidden {
  display: none;
}

.room-menu-item-label {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-menu-theme {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  padding-bottom: 0.35rem;
}

.room-menu-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.15rem;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.room-menu-theme-toggle:hover,
.room-menu-theme-toggle:hover .theme-caret {
  color: var(--red);
}

.theme-caret {
  color: var(--red);
  font-size: 0.8rem;
  transition: transform 180ms var(--ease);
}

.room-menu-theme-toggle[aria-expanded="true"] .theme-caret {
  transform: rotate(90deg);
}

.room-menu-swatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 0.35rem 0 0;
  border-top: 1px solid var(--line);
}

.room-menu-swatches.hidden {
  display: none;
}

.bg-swatch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.38rem 0.35rem;
  overflow: hidden;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.bg-swatch:hover {
  background: var(--paper-deep);
  border-color: var(--line);
}

.bg-swatch[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.swatch-dot {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  background: var(--swatch, var(--ink));
  border: 1px solid var(--line-strong);
  border-radius: 0;
}

.bg-swatch[aria-checked="true"] .swatch-dot {
  border-color: var(--paper-soft);
}

.bg-swatch[data-theme="default"] .swatch-dot {
  background: var(--paper-deep);
}

.room-menu-code {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line-strong);
}

.room-menu-code .code-label {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
}

.room-menu-code .code-value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  word-break: break-all;
}

.room-menu-safety {
  border-bottom: 1px solid var(--line);
}

.room-menu-safety .safety-number {
  margin-left: 0;
}

#member-count-badge {
  color: var(--red);
  font-weight: 600;
}

.verified-badge {
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.46rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.verified-badge.hidden {
  display: none;
}

/* ---------- SAFETY BANNER ---------- */

.safety-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.9rem;
  width: 100%;
  max-width: none;
  padding: 0.65rem clamp(16px, 3vw, 40px);
  flex-shrink: 0;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--red);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.safety-banner.hidden {
  display: none;
}

.safety-banner-label {
  color: var(--red);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.safety-banner-text {
  flex: 1;
  min-width: 180px;
  color: var(--muted);
}

.safety-banner-verify,
.safety-banner-later {
  padding: 0.32rem 0.7rem;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}

.safety-banner-verify:hover {
  background: var(--red);
  color: var(--paper);
}

.safety-banner-later {
  border-color: var(--line-strong);
  color: var(--muted);
}

.safety-banner-later:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.capture-warning {
  top: 76px;
  right: clamp(16px, 3vw, 40px);
  padding: 0.25rem 0.5rem;
  background: var(--paper);
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.capture-warning.detected {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

/* ---------- CHAT STAGE + THEMES ---------- */

#screen-live-room .messages-container {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(20px, 3.2vw, 38px) clamp(18px, 3vw, 40px);
  gap: 18px;
  background-color: var(--paper);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--ink);
}

#screen-live-room[data-theme="grey"] .messages-container { background-color: #26262A; }
#screen-live-room[data-theme="black"] .messages-container { background-color: #0A0A0A; }
#screen-live-room[data-theme="white"] .messages-container { background-color: #E8E4DA; }
#screen-live-room[data-theme="red"] .messages-container { background-color: #3A1018; }
#screen-live-room[data-theme="pink"] .messages-container { background-color: #8B0000; }
#screen-live-room[data-theme="maroon"] .messages-container { background-color: #5C0000; }
#screen-live-room[data-theme="steel"] .messages-container { background-color: #8A8A85; }
#screen-live-room[data-theme="bone"] .messages-container { background-color: #F2F0EC; }
#screen-live-room[data-theme="coral"] .messages-container { background-color: #FF6B6B; }
#screen-live-room[data-theme="teal"] .messages-container { background-color: #4ECDC4; }
#screen-live-room[data-theme="butter"] .messages-container { background-color: #FFE66D; }
#screen-live-room[data-theme="mint"] .messages-container { background-color: #A8E6CF; }
#screen-live-room[data-theme="rose"] .messages-container { background-color: #FF8B94; }
#screen-live-room[data-theme="violet"] .messages-container { background-color: #6C5CE7; }
#screen-live-room[data-theme="cyan"] .messages-container { background-color: #00CEC9; }
#screen-live-room[data-theme="magenta"] .messages-container { background-color: #FD79A8; }
#screen-live-room[data-theme="amber"] .messages-container { background-color: #FDCB6E; }
#screen-live-room[data-theme="orange"] .messages-container { background-color: #E17055; }
#screen-live-room[data-theme="emerald"] .messages-container { background-color: #00B894; }
#screen-live-room[data-theme="sky"] .messages-container { background-color: #74B9FF; }

#screen-live-room .messages-container::-webkit-scrollbar {
  width: 5px;
}

#screen-live-room .messages-container::-webkit-scrollbar-thumb {
  background: var(--line-strong);
}

#screen-live-room[data-fg="light"] .messages-container {
  color: var(--paper);
}

#screen-live-room[data-fg="light"] .messages-container::-webkit-scrollbar-thumb {
  background: var(--paper-soft);
}

#screen-live-room[data-fg="light"] .message.sent {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

#screen-live-room[data-fg="light"] .message.sent .message-meta {
  color: var(--paper-muted);
}

#screen-live-room[data-fg="light"] .message.sent .msg-reply-preview {
  background: rgba(235, 227, 211, 0.12);
  border-color: var(--line-paper);
}

#screen-live-room[data-fg="light"] .message-system {
  color: var(--paper-muted);
  border-color: var(--line-paper);
}

#screen-live-room[data-fg="light"] .empty-state {
  color: var(--paper-muted);
}

#screen-live-room[data-fg="dark"] .message.sent {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

#screen-live-room[data-fg="dark"] .message.sent .message-meta {
  color: var(--paper-muted);
}

#screen-live-room[data-fg="dark"] .message.received {
  background: var(--paper-lift);
  border-color: var(--line);
  border-left-color: var(--red);
  color: var(--ink);
}

#screen-live-room[data-fg="dark"] .message.received .message-meta,
#screen-live-room[data-fg="dark"] .message-meta {
  color: var(--muted);
}

#screen-live-room[data-fg="dark"] .message-system {
  color: var(--muted);
  border-color: var(--line);
}

#screen-live-room[data-fg="dark"] .input-row {
  border-color: var(--line-strong);
}

/* ---------- MESSAGES ---------- */

.message {
  width: auto;
  max-width: min(560px, 86%);
  min-width: 0;
  padding: 14px 16px 12px;
  background: var(--paper-lift);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  box-shadow: none;
  word-wrap: break-word;
  animation: msgIn 250ms var(--ease);
  transition: transform 180ms var(--ease), border-color 180ms var(--ease);
}

.message:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line-strong);
}

.message.sent {
  align-self: flex-end;
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--paper);
  box-shadow: none;
}

.message.sent:hover {
  box-shadow: none;
  border-color: var(--ink);
}

.message.received {
  align-self: flex-start;
  background: var(--paper-lift);
  border: 1px solid var(--line);
  border-left: 2px solid var(--red);
  color: var(--ink);
  box-shadow: none;
}

.message.received:hover {
  box-shadow: none;
  border-color: var(--line-strong);
  border-left-color: var(--red);
}

.message-name {
  margin-bottom: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-text {
  font-family: var(--font-body);
  font-size: 0.93rem;
  line-height: 1.55;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.message.sent .message-meta {
  color: var(--paper-muted);
}

.message.received .message-meta {
  color: var(--muted);
}

.message-fading {
  transition: opacity 400ms ease, transform 400ms ease;
  opacity: 0;
  transform: translateY(-8px);
}

.msg-delete-btn {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.46rem;
  letter-spacing: 0.06em;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 160ms var(--ease), border-color 160ms var(--ease);
}

.msg-delete-btn:hover {
  border-color: var(--red);
  color: var(--red);
  opacity: 1;
}

.message.sent .msg-delete-btn:hover {
  border-color: var(--paper);
  color: var(--paper);
}

.read-indicator {
  color: inherit;
  opacity: 0.65;
}

.message-system {
  width: 100%;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.13em;
  text-align: center;
  text-transform: uppercase;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  line-height: 1.8;
  text-align: center;
  text-transform: uppercase;
}

.msg-reply-preview {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.55rem;
  background: rgba(10, 10, 10, 0.05);
  border-left: 2px solid var(--red);
  color: inherit;
  font-size: 0.72rem;
  opacity: 0.85;
}

.message.sent .msg-reply-preview {
  background: rgba(235, 227, 211, 0.1);
}

.msg-reply-preview-name {
  margin-bottom: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message.reply-armed {
  border-color: var(--red);
  box-shadow: none;
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.message.reply-armed::after {
  content: 'REPLY';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  padding: 0.25rem 0.55rem;
  background: var(--red);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- COMPOSER ---------- */

#screen-live-room .input-area,
#screen-mailbox .input-area {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.85rem clamp(16px, 3vw, 40px) 1rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.1rem;
  padding: 0.55rem 0.7rem;
  background: var(--paper-deep);
  border-left: 2px solid var(--red);
  animation: replyBarIn 180ms var(--ease);
}

.reply-bar.hidden {
  display: none;
}

.reply-bar-content {
  flex: 1;
  min-width: 0;
}

.reply-bar-label {
  margin-bottom: 0.1rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.reply-bar-text {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar-cancel {
  padding: 0.2rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.reply-bar-cancel:hover {
  color: var(--red);
}

.voice-rec-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.1rem;
  background: rgba(193, 18, 31, 0.05);
  border: 1px solid rgba(193, 18, 31, 0.45);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.voice-rec-status.hidden {
  display: none;
}

.voice-rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 0;
  background: var(--red);
  animation: rec-blink 1s steps(2) infinite;
  flex-shrink: 0;
}

.voice-rec-timer {
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.voice-rec-hint {
  margin-left: auto;
  opacity: 0.65;
}

.input-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 56px;
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  box-shadow: none;
  transition: border-color 180ms var(--ease);
}

.input-row:focus-within {
  border-color: var(--ink);
  box-shadow: none;
}

.message-input,
.input-row .message-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 0.9rem 1rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  caret-color: var(--red);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  outline: none;
  resize: none;
}

.message-input:focus {
  border-color: transparent;
}

.message-input::placeholder {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

.actions {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
}

.actions .btn-attach,
.actions .btn-record {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  padding: 0;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.actions .btn-attach:hover,
.actions .btn-record:hover {
  background: var(--paper-deep);
  color: var(--red);
}

.actions .btn-record.recording {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.actions .btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: auto;
  min-height: 54px;
  padding: 0;
  background: var(--red);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms var(--ease);
}

.actions .btn-send:hover {
  background: var(--red-deep);
}

.actions .btn-send:active {
  transform: none;
  box-shadow: none;
}

.input-row.typing .actions .btn-attach,
.input-row.typing .actions .btn-record {
  display: none;
}

.input-row.typing .actions .btn-send,
.input-row.recording .actions .btn-record {
  display: flex;
}

.file-input-hidden {
  display: none;
}

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.35rem;
}

.upload-preview:empty {
  display: none;
}

.upload-preview-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 280px;
  padding: 0.4rem 0.6rem;
  background: var(--paper-lift);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
}

.upload-preview-item img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.upload-preview-icon {
  width: 34px;
  flex-shrink: 0;
  font-size: 1.1rem;
  text-align: center;
}

.upload-preview-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.upload-preview-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-preview-size {
  color: var(--muted);
  font-size: 0.5rem;
}

.upload-preview-remove {
  flex-shrink: 0;
  padding: 0 2px;
  background: none;
  border: 0;
  color: var(--red);
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.75;
  cursor: pointer;
}

.upload-preview-remove:hover {
  opacity: 1;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.upload-progress.hidden {
  display: none;
}

.upload-progress-bar {
  flex: 1;
  height: 3px;
  overflow: hidden;
  background: var(--line);
}

.upload-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--red);
  transition: width 200ms ease;
}

.upload-progress-text {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--red);
}

/* ---------- ROOM ACTIONS ---------- */

#screen-live-room .room-actions,
#screen-mailbox .room-actions {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.55rem clamp(16px, 3vw, 40px) 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.btn-leave {
  width: auto;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(193, 18, 31, 0.45);
  border-radius: 0;
  box-shadow: none;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}

.btn-leave:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.btn-leave:active {
  transform: none;
  box-shadow: none;
}

.btn-report {
  width: auto;
  padding: 0.25rem 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

.btn-report:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

/* ---------- MEMBER PANEL ---------- */

.member-panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 60;
  width: 300px;
  max-width: 86vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--paper-lift);
  border-left: 1px solid var(--ink);
  box-shadow: -16px 0 40px rgba(10, 10, 10, 0.08);
}

.member-panel.hidden {
  display: none;
}

.member-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line-strong);
  flex-shrink: 0;
}

.member-panel-title {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.member-panel-close {
  padding: 0.2rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
}

.member-panel-close:hover {
  color: var(--red);
}

.member-panel-list {
  flex: 1;
  overflow-y: auto;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.member-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 0;
}

.member-name {
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-you {
  padding: 0.08em 0.35em;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.46rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.member-status {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 0;
}

.member-status.active {
  background: var(--red);
}

.member-status.away {
  background: var(--muted-soft);
}

/* ---------- MAILBOX ---------- */

#screen-mailbox .room-header {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  background: transparent;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
}

#screen-mailbox .room-code-display {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

#screen-mailbox .code-label {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

#screen-mailbox .code-value {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-mailbox .expiry-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  max-width: none;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

#screen-mailbox .expiry-info .expiry-label {
  display: inline;
  margin: 0;
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 500;
}

#screen-mailbox .expiry-time {
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 600;
}

#screen-mailbox .messages-container {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(20px, 3.2vw, 38px) clamp(18px, 3vw, 40px);
  gap: 18px;
  background-color: transparent;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

#screen-mailbox .messages-container::-webkit-scrollbar {
  width: 5px;
}

#screen-mailbox .messages-container::-webkit-scrollbar-thumb {
  background: var(--line-strong);
}

/* ---------- FILE MESSAGES ---------- */

.message-file {
  margin-top: 0.35rem;
}

.file-loading {
  padding: 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-align: center;
}

.file-error {
  padding: 0.8rem;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.file-image-wrapper,
.file-video-wrapper {
  max-width: 320px;
}

.file-image,
.file-video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-strong);
  background: var(--ink);
}

.message.sent .file-image,
.message.sent .file-video {
  border-color: var(--paper-soft);
}

.file-image:hover {
  opacity: 0.9;
}

.file-download-btn {
  display: block;
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--red);
  border: 1px solid var(--red);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms var(--ease);
}

.file-download-btn:hover {
  background: var(--red-deep);
}

.file-audio-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 200px;
}

.file-audio-icon {
  font-size: 1.25rem;
}

.file-audio {
  width: 100%;
  height: 34px;
}

.file-doc-wrapper {
  max-width: 300px;
}

.file-doc-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line-strong);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms var(--ease);
}

.file-doc-link:hover {
  background: var(--paper-deep);
}

.message.sent .file-doc-link {
  border-color: var(--paper-soft);
}

.message.sent .file-doc-link:hover {
  background: rgba(235, 227, 211, 0.08);
}

.file-doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.message.sent .file-doc-icon {
  border-color: var(--paper-soft);
  color: var(--paper);
}

.file-doc-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.file-doc-name {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-doc-size {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.5rem;
}

.message.sent .file-doc-size {
  color: var(--paper-muted);
}

.file-doc-download {
  flex-shrink: 0;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.message.sent .file-doc-download {
  color: var(--paper);
}

.file-name {
  margin-top: 0.25rem;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.sent .file-name {
  color: var(--paper-muted);
}

/* ---------- SHARE / SAFETY OVERLAY ---------- */

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  padding: clamp(18px, 4vw, 40px);
  overflow-y: auto;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.share-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  background: var(--paper-lift);
  border: 1px solid var(--ink);
  border-top: 4px solid var(--red);
  box-shadow: none;
  text-align: left;
}

.share-content::before {
  content: none;
}

.share-content h3 {
  margin: 0 0 1.6rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-align: left;
  text-transform: uppercase;
}

.share-content h3::before {
  content: 'SHINOBU / SECURE TRANSFER';
  display: block;
  margin-bottom: 0.85rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  line-height: 1.2;
}

.share-section {
  margin-bottom: 1.15rem;
  text-align: left;
}

.share-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.share-value {
  padding: 0.7rem 0.8rem;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.5;
  word-break: break-all;
}

.share-value.share-key {
  background: rgba(193, 18, 31, 0.055);
  border-color: rgba(193, 18, 31, 0.4);
  color: var(--red-deep);
}

.share-copy-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.share-copy-row .share-value {
  flex: 1;
  min-width: 0;
}

.share-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease);
}

.share-copy-btn:hover {
  background: var(--red);
  border-color: var(--red);
  filter: none;
}

.share-copy-btn .ico-copy,
.share-copy-btn .ico-ok {
  width: 16px;
  height: 16px;
}

.share-copy-btn .ico-ok {
  display: none;
}

.share-copy-btn.copied .ico-copy {
  display: none;
}

.share-copy-btn.copied .ico-ok {
  display: block;
}

.share-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  margin-top: 1.2rem;
  padding: 0.7rem 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.share-toggle:hover {
  color: var(--red);
}

.share-toggle .share-caret {
  display: inline-block;
  color: var(--red);
  font-size: 0.8rem;
  transition: transform 200ms var(--ease);
}

.share-toggle.open .share-caret {
  transform: rotate(180deg);
}

.share-panel {
  display: none;
  margin-top: 0;
  padding: 1rem 0 0;
  background: transparent;
  border: 0;
}

.share-panel.open {
  display: block;
}

.share-panel .share-qr {
  margin-top: 0;
}

.share-panel .share-warning {
  margin: 0.9rem 0;
}

.share-panel .share-actions {
  margin-top: 0;
}

.share-actions .btn[hidden] {
  display: none;
}

.share-qr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.9rem 0 0;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.share-qr svg {
  display: block;
  width: 156px;
  height: 156px;
}

.share-qr-label {
  margin-top: 0.4rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.share-warning {
  padding: 0.7rem 0.8rem;
  background: rgba(193, 18, 31, 0.055);
  border: 0;
  border-left: 3px solid var(--red);
  color: var(--red-deep);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  line-height: 1.65;
  letter-spacing: 0.02em;
  text-align: left;
}

.share-tip {
  margin-top: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  line-height: 1.6;
  letter-spacing: 0.03em;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1.4rem;
}

.share-actions .btn {
  padding: 0.85rem 1.1rem;
  font-size: 0.72rem;
}

/* Only the final enter/close action is the red primary. */
.share-panel .share-actions .btn-primary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.share-panel .share-actions .btn-primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.safety-big {
  max-width: none;
  margin: 0 0 1.3rem;
  padding: 1.1rem 0.8rem;
  background: var(--paper-deep);
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 3.5vw, 1.65rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-align: center;
  word-spacing: 0.4em;
  word-break: break-word;
}

.safety-desc {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.86rem;
  line-height: 1.7;
  text-align: left;
}

.safety-overlay .share-content h3::before {
  content: 'SHINOBU / SAFETY CEREMONY';
}

/* ---------- KEY PROMPT ---------- */

.key-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.key-prompt-content {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  background: var(--paper-lift);
  border: 1px solid var(--ink);
  border-top: 4px solid var(--red);
  box-shadow: none;
  text-align: left;
}

.key-prompt-content::before {
  content: none;
}

.key-prompt-content h3 {
  margin: 0 0 0.8rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-align: left;
  text-transform: uppercase;
}

.key-prompt-content h3::before {
  content: 'SHINOBU / DISPLAY NAME';
  display: block;
  margin-bottom: 0.8rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  line-height: 1.2;
}

.key-prompt-desc {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.key-prompt-input {
  width: 100%;
  margin: 0 0 1.2rem;
  padding: 0.9rem 0;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  caret-color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  outline: none;
  text-align: left;
  text-transform: uppercase;
}

.key-prompt-input::placeholder {
  color: var(--muted-soft);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.key-prompt-input:focus {
  border-bottom-color: var(--red);
}

.key-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.key-prompt-actions .btn {
  padding: 0.85rem 1.1rem;
  font-size: 0.72rem;
}

.key-prompt-warning {
  margin-top: 0.9rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  line-height: 1.6;
  letter-spacing: 0.03em;
}

/* ---------- PANIC OVERLAY ---------- */

.panic-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.panic-overlay.hidden {
  display: none;
}

.panic-content {
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: clamp(1.75rem, 5vw, 3rem);
  background: var(--paper-lift);
  border: 1px solid var(--ink);
  border-top: 4px solid var(--red);
  box-shadow: none;
  text-align: left;
}

.panic-content::before {
  content: none;
}

.panic-content h2 {
  margin: 0 0 1rem;
  color: var(--red);
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 7vw, 3.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.panic-content h2::before {
  content: 'EMERGENCY PROTOCOL / IRREVERSIBLE';
  display: block;
  margin-bottom: 0.8rem;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.panic-content p {
  max-width: 44ch;
  margin: 0 0 1.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.panic-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.panic-actions .btn {
  padding: 0.9rem 1rem;
  font-size: 0.74rem;
}

.panic-actions .btn-leave {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.panic-actions .btn-leave:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
}

/* Cancel must never read as another destructive action. */
.panic-actions .btn-primary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.panic-actions .btn-primary:hover:not(:disabled) {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

/* ---------- TOAST ---------- */

.toast {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  z-index: 2000;
  max-width: calc(100vw - 32px);
  padding: 0.65rem 1rem;
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--paper);
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-error,
.toast-warning {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.toast-info {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- SMALL SHARED PIECES ---------- */

.safety-number {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.safety-number:hover {
  color: var(--red-deep);
}

.safety-number.verified {
  color: var(--ink);
}

.safety-number:empty {
  display: none;
}

.room-menu-code:hover,
.room-menu-safety:hover,
.room-menu-theme:hover {
  padding-left: 0.15rem;
  padding-right: 0.15rem;
  background: none;
  border-color: currentColor;
}

.room-menu-theme:hover {
  border-color: transparent;
}

.room-menu-code:hover {
  border-bottom-color: var(--line-strong);
}

.encryption-badge {
  padding: 0.2rem 0.45rem;
  background: transparent;
  border: 1px solid rgba(193, 18, 31, 0.55);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.security-link,
.insta-link {
  color: var(--muted);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 980px) {
  #screen-home .container {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .wordmark,
  .tagline,
  .home-deck,
  #screen-home .button-group,
  #screen-home .mailbox-secondary,
  .home-meta {
    grid-column: 1;
  }

  .home-deck {
    max-width: 56ch;
    margin-bottom: 2rem;
  }

  #screen-home .button-group {
    margin-top: 0;
  }

  .home-meta {
    margin-top: 2.6rem;
  }
}

@media (max-width: 760px) {
  #screen-home,
  #screen-about,
  #screen-dossier,
  #screen-origin,
  #screen-left-menu,
  #screen-room-type,
  #screen-join-type,
  #screen-create-live,
  #screen-create-group,
  #screen-join-live,
  #screen-join-group,
  #screen-create-mailbox,
  #screen-join-mailbox,
  #screen-invite {
    padding: 22px 18px 36px;
  }

  h2 {
    font-size: clamp(2.2rem, 9vw, 3.4rem);
  }

  h2::before {
    margin-bottom: 0.8rem;
    font-size: 0.52rem;
    letter-spacing: 0.17em;
  }

  #screen-home {
    padding: 0;
  }

  #screen-home .container {
    padding: 30px 20px 88px;
  }

  #screen-home .container::before {
    margin-bottom: 2.4rem;
    font-size: 0.5rem;
    letter-spacing: 0.15em;
  }

  .wordmark {
    font-size: clamp(3.4rem, 16.3vw, 6.4rem);
  }

  .tagline {
    margin-bottom: 2.1rem;
    font-size: 0.72rem;
    letter-spacing: 0.25em;
  }

  .home-deck {
    font-size: 0.98rem;
    line-height: 1.6;
  }

  .home-deck::first-letter {
    font-size: 3em;
  }

  .button-group .btn {
    min-height: 62px;
    padding: 1rem 5.7rem 1rem 3rem;
    font-size: 0.76rem;
    letter-spacing: 0.1em;
  }

  .button-group .btn .mode-tag {
    font-size: 0.48rem;
  }

  .mailbox-secondary {
    font-size: 0.55rem;
    letter-spacing: 0.1em;
  }

  .home-meta {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 2.2rem;
  }

  .home-meta span,
  .home-meta span:first-child,
  .home-meta span:last-child {
    padding: 0.55rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .home-meta span:last-child {
    border-bottom: 0;
  }

  .btn-help {
    width: 40px;
    height: 40px;
    right: 16px;
    bottom: 16px;
  }

  .btn-back {
    margin-bottom: 1.6rem;
    font-size: 0.58rem;
  }

  .instruction {
    margin-bottom: 1.7rem;
    font-size: 0.6rem;
  }

  .btn {
    min-height: 50px;
    padding: 0.9rem 1rem;
    font-size: 0.78rem;
  }

  .about-text {
    max-width: none;
    font-size: 1.15rem;
  }

  .about-section {
    padding: 1.3rem 0 1.3rem 2.3rem;
  }

  .about-section::before {
    top: 1.58rem;
  }

  .about-section p {
    font-size: 0.91rem;
    line-height: 1.65;
  }

  .landing-points {
    grid-template-columns: 1fr;
  }

  .landing-point {
    padding: 0.8rem 0.85rem;
  }

  .origin-story p {
    font-size: 0.96rem;
    line-height: 1.72;
  }

  .origin-story p:first-of-type {
    font-size: 1.08rem;
  }

  .dossier-card {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 0.7rem;
    padding: 1rem 0.1rem;
  }

  .dossier-card:hover {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .dossier-name {
    font-size: 1rem;
  }

  .dossier-desc {
    font-size: 0.52rem;
  }

  .expiry-option span {
    padding: 0.75rem 0.15rem;
    font-size: 0.53rem;
  }

  .invite-card {
    padding: 1.7rem 1.25rem;
  }

  .invite-title {
    font-size: clamp(2.3rem, 11vw, 3.2rem);
  }

  .invite-code-block {
    padding: 1rem;
  }

  .invite-code {
    font-size: clamp(1.2rem, 5.5vw, 1.6rem);
  }

  #screen-live-room .room-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 58px;
    padding: 0.62rem 14px;
    gap: 0.3rem 0.55rem;
  }

  #screen-live-room .room-menu-btn {
    padding: 0.38rem 0.5rem;
    font-size: 0.52rem;
  }

  #screen-live-room .presence-indicator {
    justify-self: center;
    min-width: 0;
  }

  #screen-live-room .presence-text {
    max-width: 86px;
    overflow: hidden;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    text-overflow: ellipsis;
  }

  #screen-live-room .expiry-timer {
    justify-self: end;
    font-size: 0.5rem;
  }

  #screen-live-room .room-header .expiry-label {
    display: none;
  }

  #screen-live-room .expiry-time {
    font-size: 0.54rem;
  }

  .room-menu-dropdown {
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - 82px);
  }

  .room-menu-swatches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .capture-warning {
    top: 64px;
    right: 14px;
  }

  .safety-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 0.65rem 14px;
    gap: 0.4rem 0.5rem;
    font-size: 0.52rem;
  }

  .safety-banner-text {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    font-size: 0.5rem;
    line-height: 1.5;
  }

  #screen-live-room .messages-container,
  #screen-mailbox .messages-container {
    padding: 16px 14px;
    gap: 14px;
    border-left: 0;
    border-right: 0;
  }

  .message {
    max-width: 92%;
    padding: 12px 13px 10px;
  }

  .message-text {
    font-size: 0.9rem;
  }

  #screen-live-room .input-area,
  #screen-mailbox .input-area {
    padding: 0.7rem 14px 0.8rem;
  }

  .input-row {
    min-height: 52px;
  }

  .actions .btn-attach,
  .actions .btn-record {
    width: 42px;
  }

  .actions .btn-send {
    width: 48px;
    min-height: 50px;
  }

  #screen-live-room .room-actions,
  #screen-mailbox .room-actions {
    padding: 0.45rem 14px 0.8rem;
    gap: 0.6rem;
  }

  .btn-leave {
    padding: 0.5rem 0.6rem;
    font-size: 0.5rem;
  }

  .btn-report {
    font-size: 0.48rem;
  }

  #screen-mailbox .room-header {
    padding: 0.85rem 14px;
    gap: 0.5rem;
  }

  #screen-mailbox .expiry-info {
    font-size: 0.5rem;
  }

  #screen-mailbox .expiry-info .expiry-label {
    display: none;
  }

  .member-panel {
    width: 300px;
    max-width: 86vw;
  }

  .share-overlay,
  .key-prompt-overlay,
  .panic-overlay {
    padding: 16px;
  }

  .share-content,
  .key-prompt-content,
  .panic-content {
    padding: 1.4rem;
  }

  .share-content h3 {
    font-size: 1.75rem;
  }

  .share-value {
    padding: 0.6rem 0.7rem;
    font-size: 0.7rem;
  }

  .share-copy-btn {
    width: 40px;
  }

  .share-qr svg {
    width: 140px;
    height: 140px;
  }

  .safety-big {
    font-size: clamp(1rem, 4.5vw, 1.4rem);
    letter-spacing: 0.1em;
  }

  .safety-desc {
    font-size: 0.8rem;
  }

  .panic-content h2 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .toast {
    bottom: 1rem;
    font-size: 0.52rem;
  }
}

@media (max-width: 420px) {
  h2 {
    font-size: clamp(2rem, 9.5vw, 2.7rem);
  }

  .tag-live,
  .tag-async {
    margin-left: 0.25rem;
    font-size: 0.5rem;
    vertical-align: 0.2em;
  }

  .wordmark {
    font-size: clamp(3.1rem, 16.3vw, 5.2rem);
  }

  .tagline {
    letter-spacing: 0.18em;
  }

  .button-group .btn {
    padding-right: 4.8rem;
    font-size: 0.72rem;
  }

  .button-group .btn .mode-tag {
    font-size: 0.43rem;
    padding: 0.16rem 0.3rem;
  }

  .expiry-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .expiry-option:nth-child(2n) span {
    border-right: 0;
  }

  .expiry-option:nth-child(-n + 2) span {
    border-bottom: 1px solid var(--line);
  }

  .invite-card::after {
    padding: 0.32rem 0.55rem;
    font-size: 0.42rem;
    letter-spacing: 0.12em;
  }

  .invite-eyebrow {
    font-size: 0.52rem;
  }

  .invite-code {
    letter-spacing: 0.05em;
  }

  .room-menu-dropdown {
    left: 8px;
    right: 8px;
  }

  #screen-live-room .presence-text {
    max-width: 66px;
  }

  #screen-live-room .room-menu-btn {
    padding: 0.34rem 0.4rem;
    font-size: 0.48rem;
  }

  #screen-live-room .expiry-timer {
    font-size: 0.46rem;
  }

  .safety-banner-verify,
  .safety-banner-later {
    padding: 0.28rem 0.5rem;
    font-size: 0.46rem;
  }

  .share-actions .btn,
  .key-prompt-actions .btn {
    font-size: 0.66rem;
  }

  .share-content h3 {
    font-size: 1.55rem;
  }

  .safety-big {
    font-size: 0.95rem;
    word-spacing: 0.2em;
  }

  .dossier-card {
    grid-template-columns: 1.8rem minmax(0, 1fr) auto;
    gap: 0.55rem;
  }

  .dossier-desc {
    display: none;
  }

  #screen-live-room .room-actions,
  #screen-mailbox .room-actions {
    gap: 0.4rem;
  }

  .btn-leave {
    letter-spacing: 0.06em;
  }
}

/* Rooms need the full viewport even when browser chrome resizes. */
@supports (height: 100dvh) {
  #screen-live-room,
  #screen-mailbox {
    height: 100dvh;
  }
}

/* Final cascade guards for high-specificity legacy state rules. */
#screen-live-room[data-fg] .message.sent {
  color: var(--paper);
}

#screen-live-room[data-fg="light"] .message.sent {
  background: var(--red);
  border-color: var(--red);
}

#screen-live-room[data-fg="dark"] .message.sent {
  background: var(--ink);
  border-color: var(--ink);
}

#screen-live-room[data-fg] .message.received {
  color: var(--ink);
}

#screen-live-room[data-fg] .message.sent .message-meta {
  color: var(--paper-muted);
}

#screen-live-room[data-fg] .message.received .message-meta {
  color: var(--muted);
}

#screen-live-room[data-fg] .message-system {
  color: var(--muted);
}

#screen-live-room[data-fg="light"] .message-system {
  color: var(--paper-muted);
}

/* Keep the room menu swatch labels legible if a theme rule leaks in. */
.room-menu-dropdown .bg-swatch {
  color: var(--ink);
}

.room-menu-dropdown .bg-swatch[aria-checked="true"] {
  color: var(--paper);
}

