:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-canvas: #f2efe9;
  --surface: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #a1a1aa;

  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fff4ed;
  --accent-soft-border: #ffddc2;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-soft-border: #fecaca;

  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-soft-border: #bbf7d0;

  --neutral-soft: #f4f4f5;
  --neutral-soft-border: #e4e4e7;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 2px 8px rgba(24, 24, 27, 0.06), 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.09), 0 2px 6px rgba(24, 24, 27, 0.04);
  --shadow-panel: 0 1px 1px rgba(24, 24, 27, 0.02), 0 20px 48px -20px rgba(24, 24, 27, 0.14);

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Unbounded", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* A gentle overshoot instead of plain ease — motion with a little
     life to it, not a bounce. Used anywhere something settles into
     place: button presses, card hovers, page entrances. */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  font-size: 15px;
  line-height: 1.55;
}

/* A host session (sign-in, dashboard, create fire, QR) sits on a warm,
   textured ember backdrop — a halftone dot field glowing from a soft
   cream at the top into a deep ember glow, the literal visual of
   "around the fire." Content stays in plain white cards on top for
   contrast and legibility. Attendees never see this — FirePage renders
   its bare .app-body full-bleed (see Main.elm), so the conversation
   stays edge-to-edge and instant, not tucked inside a card. */
body:has(.app-header) {
  min-height: 100vh;
  background-color: #1c0a02;
  background-image: radial-gradient(
      circle at 1px 1px,
      rgba(255, 180, 120, 0.5) 1px,
      transparent 0
    ),
    linear-gradient(
      180deg,
      #fdf8f1 0%,
      #fdf1e4 26%,
      #f3b980 52%,
      #c2410c 76%,
      #1c0a02 100%
    );
  background-size: 16px 16px, 100% 100%;
  background-attachment: fixed, fixed;
  background-repeat: repeat, no-repeat;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.15rem;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* --- Shell --- */

.app-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  font-size: 1.05rem;
}

.brand-flame {
  color: var(--accent);
  flex-shrink: 0;
  animation: ember-glow 3s ease-in-out infinite;
}

@keyframes ember-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(194, 65, 12, 0));
  }
  50% {
    filter: drop-shadow(0 0 5px rgba(194, 65, 12, 0.65));
  }
}

.brand:hover {
  color: var(--text);
}

.session-info {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.app-body {
  max-width: 760px;
  margin: 0 auto;
}

/* Short, single-card host forms (sign-in, create fire, join by code) sit
   centered in the viewport instead of pinned to the top with a trailing
   stretch of empty canvas below them. Longer pages (the fire list) are
   left out on purpose — centering a growing list looks wrong. */
.app-body:has(.page-narrow),
.app-body:has(.hero) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 4rem);
}

.hero {
  max-width: 560px;
  text-align: center;
}

.hero-intro {
  margin-bottom: 1.75rem;
}

.hero-intro .eyebrow {
  display: block;
  margin-bottom: 0.75rem;
}

.hero-intro h1 {
  font-size: 2.1rem;
  margin-bottom: 0.85rem;
}

.hero-sub {
  font-size: 1rem;
  max-width: 440px;
  margin: 0 auto;
}

.hero-actions {
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Layout primitives --- */

.page {
  padding: 2.5rem 1.5rem 4rem;
  animation: page-enter 0.4s var(--spring) both;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-narrow {
  max-width: 420px;
  margin: 0 auto;
}

.centered {
  text-align: center;
  padding-top: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.centered .button,
.centered .button-secondary {
  margin-top: 0.75rem;
}

.page-intro {
  margin-bottom: 1.5rem;
}

.page-intro h1 {
  margin-bottom: 0.35rem;
}

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

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

.field-half {
  flex: 1;
  min-width: 0;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

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

.muted {
  color: var(--text-secondary);
}

.eyebrow {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Feedback --- */

.error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft-border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
}

.callout {
  background: var(--success-soft);
  border: 1px solid var(--success-soft-border);
  color: var(--success);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  font-size: 0.92rem;
}

/* --- Cards --- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

/* --- Forms --- */

label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 550;
  margin-bottom: 0.35rem;
}

input,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  /* Forces the browser's native picker chrome (date/time increment
     arrows, calendar icon) to render in light mode regardless of the
     OS theme, so it doesn't clash against this input's light surface. */
  color-scheme: light;
}

input[type="datetime-local"] {
  padding-right: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* The dropdown calendar/time panel itself is OS/browser-rendered and
   can't be restyled from CSS in any browser — this only reaches the
   chrome inside the input (the icon), which is all the platform
   exposes. */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  padding: 0.25rem;
  margin-left: 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.12s ease, background-color 0.12s ease;
}

input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
  background: var(--accent-soft);
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

/* --- Buttons --- */

button,
.button,
.button-secondary,
.button-danger {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.05rem;
  font-size: 0.9rem;
  font-weight: 560;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease,
    transform 0.2s var(--spring), box-shadow 0.2s var(--spring);
  white-space: nowrap;
}

button:hover:not(:disabled),
.button:hover,
.button-secondary:hover,
.button-danger:hover {
  transform: translateY(-1px) scale(1.015);
}

button:active:not(:disabled),
.button:active,
.button-secondary:active,
.button-danger:active {
  transform: translateY(1px) scale(0.98);
}

button[type="submit"],
.button {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

button[type="submit"]:hover,
.button:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.button-secondary:hover {
  background: var(--neutral-soft);
  color: var(--text);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-soft-border);
}

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

/* --- Status badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-scheduled {
  background: var(--neutral-soft);
  color: var(--text-secondary);
  border-color: var(--neutral-soft-border);
}

.badge-burning {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft-border);
}

.badge-ended {
  background: var(--neutral-soft);
  color: var(--text-tertiary);
  border-color: var(--neutral-soft-border);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

/* A fire that's actually burning is live, right now — the one place a
   quiet functional pulse earns its keep (not decoration, a status). */
.badge-burning .badge-dot {
  animation: ember-pulse 2.2s ease-in-out infinite;
}

@keyframes ember-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* --- QR / join screen --- */

.qr-page {
  display: flex;
  justify-content: center;
  padding-top: 3rem;
}

.qr-card {
  text-align: center;
  width: 100%;
  max-width: 360px;
  padding: 2rem 1.75rem 1.75rem;
}

.qr-code {
  margin: 1.5rem auto;
  width: 220px;
  height: 220px;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.qr-code svg {
  width: 100%;
  height: 100%;
}

.qr-join-url {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
}

.qr-join-code {
  margin-bottom: 1.5rem;
}

.join-code {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
}

/* --- Fire list (dashboard) --- */

.fire-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.fire-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: border-color 0.12s ease, box-shadow 0.2s var(--spring), transform 0.2s var(--spring);
}

.fire-list-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.fire-list-name {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.fire-list-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

/* --- Conversation --- */

.fire-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  max-width: 640px;
  margin: 0 auto;
}

.fire-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.fire-header h1 {
  font-size: 1.25rem;
  margin-bottom: 0.3rem;
}

.fire-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.fire-error {
  padding: 0.75rem 1.5rem 0;
}

.join-card {
  width: 100%;
  text-align: left;
  margin-top: 0.5rem;
}

.message-list {
  list-style: none;
  margin: 0;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  overflow-y: auto;
}

.message {
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.message:hover {
  background: var(--bg-subtle);
}

.message-nickname {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.8rem;
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.message-actions {
  margin-top: 0.1rem;
  display: flex;
  gap: 0.9rem;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-actions button {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 0;
  font-size: 0.75rem;
  font-weight: 500;
}

.message-actions button:hover {
  color: var(--danger);
  background: none;
}

.composer {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer input {
  flex: 1;
}
