:root {
  color-scheme: light;
  --bg: #fff8ec;
  --panel: #fffdf8;
  --panel-warm: #fff2d2;
  --text: #2d1908;
  --muted: #7a5b35;
  --line: #f0d7a6;
  --accent: #f28a00;
  --accent-dark: #c96b00;
  --accent-soft: #ffe0a0;
  --cream: #fff3d8;
  --warn: #c83e20;
  --wait: #ba7415;
  --ok: #21854a;
  --shadow: 0 22px 58px rgba(141, 76, 0, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 213, 128, 0.42), transparent 28%),
    radial-gradient(circle at 84% 84%, rgba(242, 138, 0, 0.16), transparent 32%),
    linear-gradient(180deg, #fffdf7 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: stretch;
}

.app-shell.in-room {
  width: min(1180px, calc(100vw - 32px));
  grid-template-columns: minmax(500px, 0.95fr) minmax(360px, 0.7fr);
  align-items: start;
}

.app-shell.in-room .brand-panel,
[hidden] {
  display: none !important;
}

.app-shell:not(.in-room) .room-chat-panel {
  display: none;
}

.brand-panel,
.control-panel {
  min-width: 0;
  border: 1px solid rgba(240, 190, 91, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.brand-panel {
  min-height: 640px;
  padding: 24px 30px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.brand-panel::before {
  content: "";
  position: absolute;
  inset: auto -80px -130px -80px;
  height: 260px;
  background: linear-gradient(180deg, rgba(255, 219, 144, 0.58), rgba(242, 138, 0, 0.22));
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.brand-art,
.brand-copy {
  position: relative;
  z-index: 1;
}

.brand-art {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 640px;
  margin: 0 auto 28px;
  min-width: 0;
  min-height: 260px;
}

.brand-art img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 18px 24px rgba(144, 78, 0, 0.18));
}

.brand-copy {
  width: 100%;
  max-width: 620px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 13ch;
  font-size: 4.7rem;
  line-height: 0.96;
  overflow-wrap: break-word;
}

.lede {
  max-width: 100%;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 24px 0 0;
  list-style: none;
}

.trust-list li {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(242, 138, 0, 0.35);
  border-radius: 999px;
  background: rgba(255, 243, 216, 0.92);
  color: #4a2b0d;
  padding: 0 14px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(141, 76, 0, 0.08);
}

.control-panel {
  padding: 28px;
  align-self: stretch;
}

.panel-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.room-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  line-height: 1.05;
}

.room-panel {
  min-height: 560px;
}

.room-chat-panel {
  min-height: 560px;
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  position: sticky;
  top: 16px;
}

.room-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.room-header .eyebrow,
.panel-heading .eyebrow {
  margin-bottom: 8px;
}

.room-status {
  margin-top: 20px;
  padding-bottom: 0;
  border-bottom: 0;
}

.call-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 24px 0;
  padding: 18px;
  border: 1px solid rgba(242, 138, 0, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 243, 216, 0.9), rgba(255, 255, 255, 0.76));
}

.call-avatar {
  width: 84px;
  height: 84px;
  overflow: hidden;
  border: 1px solid rgba(242, 138, 0, 0.35);
  border-radius: 8px;
  background: var(--accent);
}

.call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.call-card h3 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.call-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 650;
}

.participants-panel {
  display: grid;
  gap: 12px;
  margin: 0 0 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.participants-panel .section-title-row {
  align-items: baseline;
}

.participants-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.participants-panel .section-title-row span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.participant-list,
.remote-participant-list {
  display: grid;
  gap: 10px;
}

.participant-card {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(140px, 1fr) minmax(150px, 0.9fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(242, 138, 0, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.self-participant {
  grid-template-columns: minmax(130px, 0.8fr) minmax(140px, 1fr);
}

.participant-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.participant-info strong,
.participant-info span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-info strong {
  color: var(--text);
  font-size: 0.98rem;
}

.participant-info span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.participant-meter {
  height: 12px;
}

.participant-volume {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.participant-volume-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.participant-volume-header output {
  color: var(--accent-dark);
  font: inherit;
}

.music-panel {
  display: grid;
  gap: 12px;
  margin: 0 0 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.music-toggle {
  width: 100%;
}

.music-controls {
  display: grid;
  gap: 10px;
}

.music-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.music-action-row button {
  flex: 0 0 auto;
}

.music-action-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.chat-panel .section-title-row span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.chat-messages {
  min-height: 420px;
  max-height: none;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid rgba(242, 138, 0, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.chat-message {
  width: fit-content;
  max-width: min(86%, 420px);
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid rgba(242, 138, 0, 0.24);
  border-radius: 8px;
  background: #fff;
}

.chat-message.own {
  justify-self: end;
  background: var(--accent-soft);
}

.chat-message span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.chat-message p {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.status-row {
  min-height: 52px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.status-row p {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 850;
}

.status-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 6px rgba(122, 91, 53, 0.14);
}

.status-dot.connecting,
.status-dot.waiting {
  background: var(--wait);
  box-shadow: 0 0 0 6px rgba(186, 116, 21, 0.14);
}

.status-dot.connected {
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(33, 133, 74, 0.14);
}

.status-dot.error,
.status-dot.disconnected {
  background: var(--warn);
  box-shadow: 0 0 0 6px rgba(200, 62, 32, 0.14);
}

.join-form {
  display: grid;
  gap: 10px;
  padding-top: 24px;
}

label,
.field-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 850;
}

.field-label {
  margin-bottom: 0;
}

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

.device-row {
  grid-template-columns: minmax(0, 1fr) auto 44px;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: #b48a4e;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
input[type="range"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 138, 0, 0.18);
}

button {
  min-height: 46px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffab22 0%, var(--accent) 100%);
  color: #fffaf0;
  padding: 0 16px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(201, 107, 0, 0.18);
}

button:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: linear-gradient(180deg, #f99a0c 0%, var(--accent-dark) 100%);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover:not(:disabled),
button.icon-button:hover:not(:disabled) {
  background: var(--cream);
}

button.icon-button {
  width: 44px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--accent-dark);
  font-size: 1.2rem;
  box-shadow: none;
}

button.compact-button {
  padding: 0 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.level-meter {
  width: 100%;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
}

.level-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ok), #f6b73c 68%, var(--warn));
  transition: width 70ms linear;
}

.privacy-note {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(242, 138, 0, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 243, 216, 0.9), rgba(255, 255, 255, 0.76));
}

.privacy-note strong {
  color: var(--text);
  font-size: 0.96rem;
}

.privacy-note span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 650;
}

.open-rooms {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h2,
.section-title-row h3 {
  margin: 0;
  font-size: 1rem;
}

.open-rooms-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.room-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.room-button:hover:not(:disabled) {
  background: var(--cream);
}

.room-button strong,
.room-button span {
  min-width: 0;
}

.room-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-button span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.message.error {
  color: var(--warn);
}

@media (max-width: 900px) {
  body {
    place-items: start center;
    padding: 16px 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.in-room {
    grid-template-columns: 1fr;
  }

  .room-chat-panel {
    min-height: 520px;
    max-height: none;
    position: static;
  }

  .brand-panel {
    min-height: auto;
    gap: 18px;
  }

  .brand-art {
    min-height: 180px;
  }

  .brand-art img {
    max-width: 520px;
  }

  h1 {
    max-width: 13ch;
    font-size: 3.5rem;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: calc(100vw - 20px);
    max-width: 100%;
    overflow-x: hidden;
  }

  .brand-panel,
  .control-panel {
    max-width: 100%;
    padding: 20px;
  }

  .room-header {
    align-items: stretch;
    flex-direction: column;
  }

  .room-header button {
    width: 100%;
  }

  .call-card {
    grid-template-columns: 1fr;
  }

  .participant-card,
  .self-participant {
    grid-template-columns: 1fr;
  }

  .music-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .call-avatar {
    width: 72px;
    height: 72px;
  }

  .brand-art {
    min-height: 120px;
    overflow: hidden;
  }

  .brand-art img {
    width: calc(100vw - 60px);
    max-width: 100%;
  }

  .lede {
    max-width: 100%;
    font-size: 1rem;
    overflow-wrap: anywhere;
  }

  h1 {
    font-size: 2.35rem;
    line-height: 0.98;
  }

  .trust-list {
    display: grid;
  }

  .trust-list li {
    width: 100%;
  }

  .inline-row {
    grid-template-columns: 1fr;
  }

  .device-row {
    grid-template-columns: minmax(0, 1fr) auto 44px;
  }
}
