:root {
  --bg-1: #f6efe5;
  --bg-2: #d8f0e7;
  --ink: #1b1b1b;
  --ink-soft: #3f3f3f;
  --panel: #ffffff;
  --panel-ghost: rgba(255, 255, 255, 0.78);
  --accent: #ff7a3d;
  --accent-dark: #e45a1a;
  --teal: #0d6b6b;
  --danger: #d64545;
  --shadow: 0 18px 40px rgba(19, 28, 25, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 20% -10%, #ffe7d6 0%, transparent 60%),
    radial-gradient(800px 500px at 90% 0%, #bde8df 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 24px;
  animation: fadeIn 0.6s ease-out;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

.brand {
  display: grid;
  gap: 6px;
}

.logo {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 6px;
  color: var(--teal);
}

.tagline {
  color: var(--ink-soft);
}

.status {
  background: var(--panel-ghost);
  padding: 12px 18px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 240px;
}

.status-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink-soft);
}

.status-text {
  margin-top: 6px;
  font-weight: 600;
}

.content {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

.video-panel,
.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-stage {
  position: relative;
  min-height: 380px;
  border-radius: 22px;
  overflow: hidden;
  background: #0d1117;
  box-shadow: var(--shadow);
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0d1117;
}

#localVideo {
  position: absolute;
  width: 190px;
  height: 130px;
  bottom: 18px;
  right: 18px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  background: #151b22;
}

.local-badge {
  position: absolute;
  right: 32px;
  bottom: 156px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 107, 107, 0.9);
  color: #fff;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(12, 16, 20, 0.9), rgba(7, 10, 13, 0.97));
  transition: opacity 0.3s ease;
}

.video-stage.has-remote .placeholder {
  opacity: 0;
  pointer-events: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  border: 1px solid rgba(27, 27, 27, 0.15);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-weight: 600;
}

.btn:hover:enabled {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(19, 28, 25, 0.18);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover:enabled {
  background: var(--accent-dark);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.chat-panel {
  background: var(--panel-ghost);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 520px;
}

.chat-header {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 8px;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 4px;
  overflow-y: auto;
}

.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.message.me {
  align-self: flex-end;
  background: rgba(255, 122, 61, 0.2);
  border: 1px solid rgba(255, 122, 61, 0.35);
}

.message.stranger {
  align-self: flex-start;
  background: rgba(13, 107, 107, 0.12);
  border: 1px solid rgba(13, 107, 107, 0.25);
}

.message.system {
  align-self: center;
  background: rgba(27, 27, 27, 0.08);
  border: 1px dashed rgba(27, 27, 27, 0.25);
  color: var(--ink-soft);
  font-size: 12px;
}

.chat-input {
  display: flex;
  gap: 10px;
}

.chat-input input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(27, 27, 27, 0.2);
  font-family: inherit;
}

.chat-input input:disabled {
  background: rgba(255, 255, 255, 0.5);
}

.foot {
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .content {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 360px;
  }

  #localVideo {
    width: 160px;
    height: 110px;
  }

  .local-badge {
    bottom: 136px;
  }
}

@media (max-width: 640px) {
  .top {
    flex-direction: column;
    align-items: flex-start;
  }

  .video-stage {
    min-height: 300px;
  }

  #localVideo {
    width: 130px;
    height: 90px;
    bottom: 12px;
    right: 12px;
  }

  .local-badge {
    right: 18px;
    bottom: 110px;
  }
}
