:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --bg: #07100e;
  --panel: rgba(14, 28, 24, 0.84);
  --panel-strong: rgba(10, 22, 20, 0.94);
  --line: rgba(210, 226, 200, 0.16);
  --text: #f4f1df;
  --muted: rgba(244, 241, 223, 0.66);
  --soft: rgba(244, 241, 223, 0.11);
  --gold: #d7cf87;
  --blue: #8ecae6;
  --danger: #ff9a8e;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(140deg, rgba(215, 207, 135, 0.14), transparent 34%),
    linear-gradient(45deg, rgba(142, 202, 230, 0.1), transparent 36%),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
  padding: 28px;
}

.login-view {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 20, 18, 0.88);
  box-shadow: var(--shadow);
}

.eyebrow,
.host-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.login-panel h1 {
  margin-bottom: 28px;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: 0.95;
}

.login-form label,
.input-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 116px;
  resize: vertical;
  padding: 14px;
}

input:focus,
textarea:focus {
  border-color: rgba(215, 207, 135, 0.72);
  box-shadow: 0 0 0 3px rgba(215, 207, 135, 0.12);
}

.password-row button,
.send-button,
.voice-button,
.ghost-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 20px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.password-row button,
.send-button {
  background: var(--gold);
  color: #10130d;
  border-color: transparent;
  font-weight: 800;
}

.voice-button {
  min-width: 156px;
  border-color: rgba(215, 207, 135, 0.38);
}

.voice-button.active {
  background: rgba(142, 202, 230, 0.2);
  border-color: rgba(142, 202, 230, 0.68);
}

.form-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
}

.room-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(520px, 1.28fr);
  gap: 28px;
  max-width: 1540px;
  margin: 0 auto;
}

.portrait-panel,
.conversation-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.portrait-panel {
  min-height: 720px;
}

.portrait-image {
  width: 100%;
  height: 100%;
  min-height: 720px;
  display: block;
  object-fit: cover;
}

.portrait-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 40%, rgba(5, 8, 7, 0.82) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 38%);
  pointer-events: none;
}

.portrait-panel.speaking .portrait-image {
  filter: saturate(1.06) brightness(1.04);
  transform: scale(1.01);
}

.host-card {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 14, 0.74);
  backdrop-filter: blur(16px);
}

.host-card h2 {
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
}

.host-card p {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row span {
  border-radius: 999px;
  padding: 6px 10px;
  color: #11160f;
  background: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
}

.conversation-panel {
  min-height: 720px;
  padding: 34px;
  display: grid;
  grid-template-rows: auto auto auto minmax(220px, 1fr) auto;
  gap: 22px;
}

.room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.room-header h1 {
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.95;
}

.room-summary {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(215, 207, 135, 0.28);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.status-pill span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(215, 207, 135, 0.76);
}

.status-pill.busy span {
  background: var(--blue);
  box-shadow: 0 0 18px rgba(142, 202, 230, 0.8);
}

.status-pill.error span {
  background: var(--danger);
  box-shadow: 0 0 18px rgba(255, 154, 142, 0.7);
}

.room-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.room-option {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.room-option.active {
  border-color: var(--room-accent, var(--gold));
  background: rgba(255, 255, 255, 0.09);
}

.room-option strong {
  display: block;
  margin-bottom: 8px;
}

.room-option span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.signal-strip {
  height: 22px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  opacity: 0.45;
}

.signal-strip span {
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), rgba(142, 202, 230, 0.9));
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 6px;
}

.message-card {
  width: min(760px, 94%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.message-card.bot {
  background: rgba(215, 207, 135, 0.14);
}

.message-card.user {
  align-self: flex-end;
  background: rgba(142, 202, 230, 0.1);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.replay-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.message-wave {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 0 0 12px;
}

.message-wave span {
  height: 4px;
  border-radius: 99px;
  background: rgba(244, 241, 223, 0.24);
}

.message-text {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.input-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(5, 10, 9, 0.72);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.composer-footer span {
  margin-right: auto;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app {
    padding: 14px;
  }

  .room-shell {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .portrait-panel,
  .portrait-image,
  .conversation-panel {
    min-height: auto;
  }

  .portrait-panel {
    aspect-ratio: 4 / 5;
  }

  .conversation-panel {
    padding: 22px;
  }

  .room-header {
    display: block;
  }

  .header-actions {
    justify-content: flex-start;
    margin-top: 18px;
  }
}

@media (max-width: 640px) {
  .password-row,
  .room-selector {
    grid-template-columns: 1fr;
  }

  .composer-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .composer-footer span {
    margin-right: 0;
  }

  .voice-button,
  .send-button {
    width: 100%;
  }
}
