:root {
  --bg: var(--bg-page);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  padding: 1rem 1.25rem;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.participant-badge {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-weight: 600;
}

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.join-heading {
  margin-top: 0;
  font-size: 1.125rem;
}

.intro-question {
  background: var(--surface-muted);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 1rem 1.125rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.intro-question p {
  margin: 0.375rem 0 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-block-end: 1.25rem;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input,
textarea,
button {
  font: inherit;
  font-size: max(1rem, 1em);
}

input[type="text"],
textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  min-height: 48px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 180px;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary {
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.btn-secondary {
  min-height: 40px;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.chat-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  flex: 1;
}

.msg {
  max-width: 85%;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.msg-user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.msg-role {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.composer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding-top: 0.75rem;
}

.composer-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.composer-row textarea {
  flex: 1;
}

.status-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

.status-error {
  color: var(--danger);
  font-weight: 500;
}

[hidden] {
  display: none !important;
}
