:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;

  --accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  --accent-contrast: #ffffff;

  --bg: #ffffff;
  --bg-rgb: 255, 255, 255;
  --surface: #f7f8fa;
  --surface-rgb: 247, 248, 250;
  --fg: #14161a;
  --muted: #6b7280;
  --border: #e2e4e9;

  --error: #dc2626;
  --error-rgb: 220, 38, 38;
  --success: #16a34a;
  --success-rgb: 22, 163, 74;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d10;
    --bg-rgb: 12, 13, 16;
    --surface: #17191e;
    --surface-rgb: 23, 25, 30;
    --fg: #f2f3f5;
    --muted: #9aa0aa;
    --border: #2a2d34;

    --error: #f87171;
    --error-rgb: 248, 113, 113;
    --success: #4ade80;
    --success-rgb: 74, 222, 128;
  }
}

* {
  box-sizing: border-box;
}

body {
  max-width: 34rem;
  margin: 3rem auto;
  padding: 0 1.25rem;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
    url('https://images.unsplash.com/photo-1560434019-4558f9a9e2a1?w=1600&q=80&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

@media (prefers-color-scheme: dark) {
  body {
    background-image:
      linear-gradient(rgba(12, 13, 16, 0.88), rgba(12, 13, 16, 0.88)),
      url('https://images.unsplash.com/photo-1560434019-4558f9a9e2a1?w=1600&q=80&auto=format&fit=crop');
  }
}

.photo-credit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.photo-credit a {
  color: inherit;
}

.landing-page h1 {
  text-align: center;
}

.avatar-placeholder {
  width: 6rem;
  height: 6rem;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  overflow: hidden;
}

.avatar-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro {
  text-align: center;
  margin-bottom: 2rem;
}

.ground-rules {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.5rem 1.25rem;
  margin-bottom: 2rem;
}

.ground-rules h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.ground-rules ul {
  margin: 0;
  padding-left: 1.2rem;
}

.ground-rules li {
  margin-bottom: 0.4rem;
}

.ground-rules li:last-child {
  margin-bottom: 0;
}

.button-link {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  margin-bottom: 2rem;
  transition: filter 0.15s ease;
}

.button-link:hover {
  filter: brightness(1.08);
}

.button-link.disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.button-link.disabled:hover {
  filter: none;
}

h1 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin-bottom: 1.75rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem 1.25rem;
  margin: 0 0 1.25rem;
}

legend {
  padding: 0 0.4rem;
  font-weight: 600;
  color: var(--fg);
}

label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--fg);
}

input[type="text"],
input[type="email"],
textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--fg);
  background: rgba(var(--bg-rgb), 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.guest-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.guest-row input {
  flex: 1;
  margin-top: 0;
}

button {
  padding: 0.55rem 1.1rem;
  font: inherit;
  color: var(--fg);
  background: rgba(var(--surface-rgb), 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, filter 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: var(--muted);
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

#next-btn,
#submit-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

#next-btn:hover:not(:disabled),
#submit-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.remove-guest {
  /* Same padding/line-height/font-size as the inputs beside it, so its
     natural height matches exactly rather than relying on flex stretch
     (form controls are notoriously inconsistent about honoring that). */
  flex: none;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
}

.remove-guest[disabled] {
  visibility: hidden;
}

#form-status {
  min-height: 1.2em;
}

#form-status.error,
#form-status.success {
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

#form-status.error {
  color: var(--error);
  background: rgba(var(--error-rgb), 0.12);
  border: 1px solid rgba(var(--error-rgb), 0.3);
}

#form-status.success {
  color: var(--success);
  background: rgba(var(--success-rgb), 0.12);
  border: 1px solid rgba(var(--success-rgb), 0.3);
}

.step-indicator {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.progress-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.75rem;
}

.progress-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background-color 0.2s ease;
}

.progress-segment.filled {
  background: var(--accent);
  transform-origin: left;
  animation: fill-segment 0.4s ease-out;
}

@keyframes fill-segment {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.step-nav {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.step-nav[hidden] {
  display: none;
}

.disclaimer {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
