:root {
  --bg: #f4f1ec;
  --ink: #1f1f1f;
  --accent: #2f6f5e;
  --accent-dark: #245648;
  --card: #ffffff;
  --muted: #6b6b6b;
  --line: #d9d2c9;
  --alex: #2868c7;
  --sam: #a65b2e;
  --you: #2f6f5e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top, #fffaf2 0%, #f4f1ec 45%, #e9e2d9 100%);
  color: var(--ink);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
}

.brand {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.shell {
  flex: 1;
  padding: 32px;
  display: flex;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  max-width: 620px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(25, 20, 15, 0.08);
}

.card h1 {
  margin-top: 0;
  margin-bottom: 12px;
}

.card h2 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 16px;
}

.guidance-panel {
  max-height: 420px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfbf7;
}

.start-form {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.start-form input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.entry-error {
  margin-top: 10px;
  color: #9b2c2c;
  font-size: 14px;
}

.primary {
  display: inline-block;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

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

.chat {
  width: 100%;
  display: grid;
  gap: 20px;
  grid-template-columns: 220px 1fr;
}

.participants {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  height: fit-content;
  box-shadow: 0 15px 30px rgba(25, 20, 15, 0.08);
}

.participants h2 {
  margin-top: 0;
  font-size: 18px;
}

.participants ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.dot.alex {
  background: var(--alex);
}

.dot.sam {
  background: var(--sam);
}

.dot.you {
  background: var(--you);
}

.conversation {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  box-shadow: 0 20px 45px rgba(25, 20, 15, 0.08);
  position: relative;
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

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

.message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  box-shadow: 0 8px 16px rgba(25, 20, 15, 0.08);
}

.message.alex {
  align-self: flex-start;
  background: rgba(40, 104, 199, 0.12);
}

.message.sam {
  align-self: flex-start;
  background: rgba(166, 91, 46, 0.12);
}

.message.you {
  align-self: flex-end;
  background: rgba(47, 111, 94, 0.12);
}

.message .name {
  font-weight: 600;
  margin-bottom: 4px;
}

.input-area {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.4;
  animation: typingPulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

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

.input-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
}

.turn-indicator {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--accent-dark);
}

.paste-warning {
  margin-top: 8px;
  color: #9b2c2c;
  font-size: 13px;
}

.end-panel {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  gap: 10px;
}

.hidden {
  display: none;
}

@keyframes typingPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-2px);
    opacity: 0.9;
  }
}

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

  .participants {
    order: 2;
  }

  .conversation {
    order: 1;
  }
}

@media (max-width: 600px) {
  .shell {
    padding: 20px;
  }

  .conversation {
    min-height: 480px;
  }

  .message {
    max-width: 90%;
  }
}
