:root {
  color-scheme: light;

  /* Bridge aliases — map old variable names to new tokens so existing
     component styles keep working during the screen-by-screen migration.
     Remove each alias once its component is rebuilt with new tokens. */
  --bg:           var(--color-bg);
  --bg-soft:      var(--color-accent-bg);
  --bg-dark:      var(--700-yellow);
  --bg-deep:      var(--100-yellow);
  --bg-form:      var(--color-bg);
  --surface:      var(--200-gray);
  --line:         var(--color-ink);
  --line-muted:   var(--color-border);
  --text:         var(--color-ink);
  --text-muted:   var(--color-ink-muted);
  --brand:        var(--color-accent);
  --danger:       var(--color-danger);
  --danger-action: var(--color-danger);
  --success:      var(--color-success);
  --toast-bg:     var(--color-accent-bg);
  --toast-border: var(--color-accent);
  --toast-text:   var(--800-yellow);
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

/* Nav stays fixed and unanimated during all page transitions */
::view-transition-old(bottom-nav),
::view-transition-new(bottom-nav) {
  animation: none;
}


::view-transition-old(app-main),
::view-transition-new(app-main) {
  animation-duration: 180ms;
  animation-timing-function: ease;
}

::view-transition-old(app-main) {
  animation-name: fade-out-main;
}

::view-transition-new(app-main) {
  animation-name: fade-in-main;
}

@keyframes fade-out-main {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes fade-in-main {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--color-bg);
}

body {
  margin: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  line-height: 1.5;
  background: var(--color-bg);
  color: var(--color-ink);
}

/* Tree art — fixed behind all content, anchored top-right */
.tree-art {
  position: fixed;
  top: 0;
  right: 0;
  height: 90dvh;
  width: auto;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

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

a:hover {
  text-decoration: underline;
}

.top-bar {
  position: relative;
  z-index: 3;
  min-height: var(--top-bar-h);
  padding: calc(env(safe-area-inset-top) + var(--space-3)) var(--space-4)
    var(--space-3) var(--space-4);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.top-bar__rule {
  flex: 1;
  border: none;
  border-top: 1px solid var(--color-ink);
  margin: 0;
}

.top-bar__back {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-ink-muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.top-bar__wordmark {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  line-height: normal;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) calc(var(--bottom-nav-h) + max(var(--space-2), env(safe-area-inset-bottom)) + var(--space-4));
  view-transition-name: app-main;
}

section {
  margin-bottom: var(--space-5);
}

h1 {
  margin: 0 0 var(--space-3);
  font-size: 1.25rem;
}

h2 {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  view-transition-name: bottom-nav;

  /* Heights and safe-area padding unchanged — debugged across all devices */
  padding: var(--space-2) var(--space-3) max(var(--space-2), env(safe-area-inset-bottom));
  min-height: var(--bottom-nav-h);

  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: var(--space-2);
}

.bottom-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  text-decoration: none;
}

.bottom-nav a[aria-current="page"] {
  font-weight: 700;
  color: var(--color-ink);
}

.btn,
button,
input,
textarea {
  font: inherit;
}

button {
  border: none;
}

.btn,
button {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 var(--space-3);
  color: var(--text);
  background: var(--line-muted);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.btn:hover,
button:hover {
  background: color-mix(in srgb, var(--bg-soft), black 10%);
}

.btn:active,
button:active {
  background: color-mix(in srgb, var(--bg-soft), black 16%);
  border-color: var(--brand);
  transform: translateY(1px);
}

a.btn {
  text-decoration: none;
  text-align: center;
  padding-top: var(--space-3);
}

.btn-primary {
  background: var(--brand);
  color: #000;
  font-weight: 600;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--brand), white 15%);
  border-color: color-mix(in srgb, var(--brand), white 15%);
}

.btn-primary:active {
  background: color-mix(in srgb, var(--brand), black 10%);
  border-color: color-mix(in srgb, var(--brand), black 10%);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.btn-popdown.is-selected button {
  border-radius: 10px 10px 0px 0px;
}
.btn-popdown .popdown {
  border-radius: 0px 0px 10px 10px;
}

input,
textarea {
  background: var(--bg-form);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: var(--space-3);
}

input.is-invalid {
  border-color: var(--danger-action);
}

input[type="checkbox"],
input[type="radio"] {
  padding: 0;
  border: none;
  background: none;
  accent-color: var(--brand);
}

label {
  font-size: 0.95rem;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

small {
  color: var(--text-muted);
}

pre {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  padding: var(--space-3);
  border-radius: 10px;
  overflow-x: auto;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--avatar-color, var(--brand));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: default;
}

.badge--joined {
  background: color-mix(in srgb, var(--success), transparent 80%);
  color: var(--success);
}

.badge--pending {
  background: color-mix(in srgb, var(--text-muted), transparent 80%);
  color: var(--text-muted);
  cursor: pointer;
}

.badge--pending:hover {
  background: color-mix(in srgb, var(--text-muted), transparent 65%);
}

#friends-list li,
#pending-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line-muted);
  border-radius: var(--radius);
}

.list-empty {
  background: none;
  border: none;
  color: var(--text-muted);
  font-style: italic;
  padding: 0;
}

.friends-list__phone {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.register-greeting {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
}

.register-greeting strong {
  color: var(--text);
}

.page-notice {
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.page-notice--error {
  background: color-mix(in srgb, var(--danger), transparent 85%);
  border: 1px solid color-mix(in srgb, var(--danger), transparent 55%);
  color: var(--danger);
}

#note-form-message {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(app-main),
  ::view-transition-new(app-main) {
    animation-duration: 0ms;
  }
}

/* ── You page ────────────────────────────────────────────── */

.you-page {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xl);
  padding-top: var(--spacing-xl);
}

.you-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin: 0;
}

.you-section-label {
  margin-bottom: var(--spacing-xs);
}

.you-place {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.you-save-place {
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  color: var(--color-ink);
  text-align: left;
}

.you-see-all {
  text-decoration: none;
  margin-top: var(--spacing-xs);
}

.you-logout {
  color: var(--color-ink);
  cursor: pointer;
}

/* ── Relationship timeline ────────────────────────────────── */

.relationship-line {
  flex: 1 1 auto;
  margin: 0;
  border: none;
  border-top: 1px solid var(--color-ink);
}

.relationship-line--virtual {
  border-top-style: dashed;
}

.relationship-line--first {
  border-top-color: var(--color-accent);
}

.relationship-avatar--overlap {
  margin-left: -8px;
}

.user-texture {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.you-save-done {
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ── Scene (illustration + content layout used on multiple pages) ────────── */

.page-scene {
  position: relative;
  overflow: hidden;
}

.scene-illus {
  position: fixed;
  bottom: env(safe-area-inset-bottom, 0px);
  right: 5%;
  width: 110vw;
  height: auto;
  display: block;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

/* Authenticated pages have a fixed bottom nav painting over the screen bottom.
   Lift the illustration so it rests at the bottom of the content area — matching
   how it sits at the screen bottom on login, where there is no nav. */
.scene-illus--inset {
  bottom: calc(
    var(--bottom-nav-h) + max(var(--space-2), env(safe-area-inset-bottom, 0px))
  );
}

.page-highlight {
  background: var(--color-accent-bg);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ── Login ───────────────────────────────────────────────── */

.login-section {
  padding-top: clamp(60px, 15dvh, 100px);
  padding-bottom: clamp(240px, 28vw, 280px);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  position: relative;
  z-index: 1;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.login-label {
  color: var(--color-ink-muted);
}

.login-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border-mid);
  border-radius: 0;
  padding: var(--space-2) 0;
  outline: none;
  width: 100%;
}

.login-input:focus {
  border-bottom-color: var(--color-ink);
}

.login-input::placeholder {
  color: var(--color-ink-muted);
}

.login-action {
  align-self: flex-start;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--700-yellow);
  cursor: pointer;
}

.register-action {
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--color-accent);
  cursor: pointer;
}

.register-body {
  color: var(--color-ink-muted);
  line-height: 1.6;
}

.login-status {
  color: var(--color-ink-muted);
}

.login-error {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  color: var(--color-danger);
}

.login-resend {
  color: var(--color-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.login-footer {
  color: var(--color-ink-muted);
}

/* ── Create Wizard ─────────────────────────────────────── */

.wizard-progress {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.wizard-progress__bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line-muted);
  transition: background 250ms ease;
}

.wizard-progress__bar.is-active {
  background: var(--brand);
}

.wizard-progress__bar.is-done {
  background: color-mix(in srgb, var(--brand), transparent 50%);
}

.wizard-headline {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-5);
}

.wizard-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.wizard-nav {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.wizard-nav .btn {
  flex: 1;
}

/* Previous locations */

.previous-locations__heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.previous-locations__pills {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Suggestion pills */

.suggestion-pill {
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  font-size: 0.9rem;
  background: var(--surface);
  border-radius: 12px;
}

.suggestion-pill:hover {
  background: var(--bg-soft);
}

.suggestion-pill.is-selected {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
}

/* Day list */

.day-item {
  background: var(--surface);
}

.day-item__btn {
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  font-size: 1rem;
}

.day-item__btn:hover {
  background: var(--bg-soft);
}

.day-item.is-selected .day-item__btn {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
  border-bottom: none;
}

.day-item__time {
  padding: var(--space-2) var(--space-4) var(--space-3);
}

.day-item.is-selected .day-item__time {
  border: 1px solid var(--brand);
  border-top: none;
  background: var(--bg-soft);
}

.day-item__time input[type="time"] {
  font-size: 1.25rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  color: var(--text-muted);
}

/* Friend select */
.friend-select-item {
  background: var(--surface);
}

.friend-select-item:hover {
  background: var(--bg-soft);
}

.friend-select-item.is-selected {
  background-color: var(--brand);
  border-color: var(--line);
}

.friend-select-item__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  transition:
    background 120ms,
    border-color 120ms;
}

.friend-select-item.is-selected .friend-select-item__check {
  background: var(--bg-dark);
  border-color: var(--bg-dark);
}

/* ── Bid summary (step 4 review) ────────────────────────── */

.bid-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.bid-summary__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.bid-summary__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  min-width: 56px;
  flex-shrink: 0;
}

.bid-summary__value {
  font-size: 0.95rem;
  color: var(--text);
}

/* ── Location autocomplete dropdown ─────────────────────── */

.location-dropdown {
  position: absolute;
  top: calc(100% - var(--space-3));
  left: 0;
  right: 0;
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: var(--space-1) 0;
  background: var(--bg-form);
  border: 1px solid var(--line-muted);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-height: 260px;
  overflow-y: auto;
}

.location-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
}

.location-option__name {
  font-size: 0.95rem;
  color: var(--text);
}

.location-option__address {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 55%;
}

/* ── Activity detail page ────────────────────────────────── */

.activity-page {
  display: flex;
  flex-direction: column;
}
.activity-section {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: clamp(240px, 28vw, 280px);
}

.activity-loading {
  color: var(--text-muted);
  font-style: italic;
}

.activity-title { margin: 0 0 var(--space-1); }

/* Icon-only button — must not look like .btn */
.activity-share-btn {
  cursor: pointer;
  margin-top: var(--space-1);
}

/* Notes line — circle icon + italic text */
.activity-notes { display: flex; align-items: baseline; gap: var(--space-2); }
.activity-notes-btn { text-align: left; }

/* Underlined text action (join in person, edit, etc.) */
.activity-action-link {
  display: block;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  color: var(--color-ink);
  min-height: 0;
  text-align: left;
}

/* Soft dismiss action (cancel activity, next time) */
.activity-action-dismiss {
  display: block;
  cursor: pointer;
  min-height: 0;
  text-align: left;
}

/* "see more times" inline link */
.activity-see-more {
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  color: var(--text-muted);
}

/* "create another" link below illustration */
.activity-create-another {
  display: block;
  text-decoration: none;
}
.activity-create-another:hover { text-decoration: underline; }

/* People section */
.activity-people { display: flex; flex-direction: column; gap: var(--space-3); }

.activity-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0;
}

.activity-joiner__name { font-size: 0.95rem; font-weight: 500; }

.activity-joiner__phone {
  font-size: 0.8rem;
  color: var(--brand);
  text-decoration: underline;
  font-variant-numeric: tabular-nums;
}

/* Series times sheet */
.series-times-sheet { padding: var(--space-2) 0; }
.series-times-row { border: none; background: none; text-align: left; cursor: pointer; }
.series-times-range--current {
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--brand);
}

.avatar--pending {
  background: transparent;
  border: 2px dashed var(--text-muted);
  color: var(--text-muted);
}

.friend-select-item--pending {
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
}

.friend-select-item--pending .friend-select-item__name-info {
  grid-column: 2;
  grid-row: 1;
  gap: 1px;
}

.friend-select-item--pending .friend-select-item__check {
  grid-column: 3;
  grid-row: 1;
}

.friend-select-item__pending-label {
  font-size: 0.8rem;
}

.friend-select-item__resend {
  grid-column: 2 / 4;
  grid-row: 2;
  font-size: 0.8rem;
}

.activity-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  width: fit-content;
}

.activity-status-badge--on-my-way {
  background: color-mix(in srgb, var(--brand), transparent 80%);
  color: var(--brand);
}

.activity-status-badge--arrived {
  background: color-mix(in srgb, var(--success), transparent 80%);
  color: var(--success);
}

.btn-danger {
  background: color-mix(in srgb, var(--danger-action), transparent 85%);
  border-color: var(--danger-action);
  color: var(--danger-action);
  font-weight: 600;
}

.btn-danger:active {
  background: color-mix(in srgb, var(--danger-action), transparent 70%);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger-action), transparent 75%);
}

/* ── Confirm dialog ───────────────────────────────────── */

.confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
}

.confirm-dialog {
  background: var(--color-surface);
  border: 1px solid var(--900-gray);
  padding: var(--spacing-xl) var(--spacing-xl);
  width: 100%;
  max-width: 320px;
}

.confirm-dialog__message {
  line-height: 1.4;
}

.confirm-dialog__actions {
  display: flex;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
  min-height: 0;
}

.confirm-dialog .confirm-dialog__confirm {
  color: var(--600-red);
  text-decoration: underline;
  min-height: 0;
}

.confirm-dialog .confirm-dialog__cancel {
  min-height: 0;
}

/* ── Toast notifications ──────────────────────────────── */

.toast {
  position: fixed;
  top: calc(var(--top-bar-h) + var(--space-3));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  color: var(--toast-text);
  border-radius: 20px;
  padding: var(--space-3) var(--space-5);
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
  pointer-events: none;
  z-index: 100;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Sheets (bottom sheet + side sheet) ──────────────────── */

/*
 * Easing: approximation of iOS spring (matches native sheet feel).
 * Duration vars can be overridden on a per-sheet basis if needed.
 */
:root {
  --sheet-easing:         cubic-bezier(0.32, 0.72, 0, 1);
  --sheet-open-duration:  380ms;
  --sheet-close-duration: 260ms;
  --sheet-width:          min(340px, 92vw);
  --sheet-max-height:     92svh;
  --sheet-radius-bottom:  20px;
  --sheet-radius-side:    16px;
}

/* Backdrop */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}

.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel base */
.sheet {
  position: fixed;
  z-index: 201;
  background: var(--bg);
  outline: none;
  will-change: transform;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Bottom sheet */
.sheet--bottom {
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--sheet-radius-bottom) var(--sheet-radius-bottom) 0 0;
  max-height: var(--sheet-max-height);
  transform: translateY(105%);
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.14);
  transition:
    transform var(--sheet-open-duration) var(--sheet-easing);
}

.sheet--bottom.is-open {
  transform: translateY(0);
}

.sheet--bottom.is-closing {
  transform: translateY(105%);
  transition-duration: var(--sheet-close-duration);
  transition-timing-function: ease-in;
}

/* Side sheet */
.sheet--side {
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sheet-width);
  border-radius: var(--sheet-radius-side) 0 0 var(--sheet-radius-side);
  transform: translateX(110%);
  box-shadow: -6px 0 40px rgba(0, 0, 0, 0.14);
  transition:
    transform var(--sheet-open-duration) var(--sheet-easing);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

.sheet--side.is-open {
  transform: translateX(0);
}

.sheet--side.is-closing {
  transform: translateX(110%);
  transition-duration: var(--sheet-close-duration);
  transition-timing-function: ease-in;
}

/* Drag handle indicator (bottom sheet only) */
.sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-muted);
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* Content area */
.sheet__content {
  padding: var(--spacing-2xl);
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
}

.sheet--side .sheet__content {
  padding: var(--space-4);
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .sheet--bottom,
  .sheet--side {
    transition-duration: 0ms !important;
  }
  .sheet-backdrop {
    transition-duration: 0ms !important;
  }
}

/* ── Drum picker (bottom sheet content) ──────────────────── */

.sheet--drum-picker {
  background: var(--10-yellow);
  border-radius: 0;
}

.sheet--drum-picker .sheet__handle {
  display: none;
}

/* Notes sheet */
.location-search-sheet__input-row {
  border-bottom: 1px solid var(--line);
}

.location-search-sheet__input-row input {
  min-width: 0;
}

.location-search-sheet__clear {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.location-search-list {
  list-style: none;
}

.location-search-list__address {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.location-upsell {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) 0 var(--space-4);
}

.location-upsell__list {
  list-style: disc;
  list-style-position: inside;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  line-height: 1.5;
}

.location-snapshot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6) 0 var(--space-4);
}

/* Leaflet requires an explicit pixel height on its container. */
.location-snapshot__map {
  height: 260px;
  margin-top: var(--space-2);
}

.notes-sheet {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.notes-textarea {
  width: 100%;
  min-height: 120px;
  line-height: 1.6;
}

.notes-textarea::placeholder {
  color: var(--color-ink-faint);
  font-style: italic;
}

.drum-picker {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Day drum */
.drum-picker__days {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drum-col--days {
  width: 100%;
}

.drum-item--day {
  gap: 20px;
  justify-content: flex-start;
  width: 100%;
  min-width: unset;
}

.drum-day__name {
  flex: 1;
}

.drum-day__date {
  flex: 1;
  text-align: right;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--900-gray);
  white-space: nowrap;
}

/* Count drum (single column) */
.drum-col--count {
  width: 100%;
}

.drum-col--count .drum-item {
  justify-content: flex-start;
  width: 100%;
  min-width: unset;
}

/* Drums row — two groups side by side */
.drum-picker__drums {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.drum-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.drum-picker__cols {
  display: flex;
  align-items: center;
}

[data-group="end"] {
  flex: 0 0 auto;
  margin-left: auto;
}

.drum-col[data-role="hour"] .drum-item {
  justify-content: flex-start;
}

.drum-col[data-role="min"] .drum-item {
  justify-content: flex-end;
}

.drum-colon {
  font-family: var(--font-serif);
  font-size: 20px;
  padding: 0 2px;
  color: var(--color-ink);
}

.drum-col {
  height: 132px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent, black 33%, black 67%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 33%, black 67%, transparent);
}

.drum-col::-webkit-scrollbar { display: none; }

.drum-col__list {
  padding: 44px 0;
}

.drum-item {
  height: 44px;
  min-width: 40px;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 20px;
}

/* Footer — Done button right-aligned */
.drum-picker__footer {
  display: flex;
  justify-content: flex-end;
}

/* ── Push prompt (bottom sheet content) ──────────────────── */

/* Layout/typography handled by utility classes in push-prompt.js */

.push-prompt__message {
  max-width: 26ch; /* no utility equivalent */
}

.push-prompt__dismiss {
  min-height: 36px; /* overrides global 44px button minimum */
}

.push-prompt__dismiss:hover {
  background: none;
  color: var(--text);
}

/* ── Settings side sheet content ────────────────────────── */

/* Layout handled by utility classes in side-sheet.js */

.sheet-settings__close:hover {
  background: var(--surface);
  color: var(--text);
}

.sheet-settings__divider {
  border: none;
  border-top: 1px solid var(--line-muted);
  margin: 0;
}

.sheet-settings__notif-on {
  color: var(--success);
  font-weight: 600;
}

.sheet-settings__notif-hint {
  line-height: 1.5; /* no utility equivalent */
}

.sheet-settings__logout-btn {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), transparent 92%);
}

.sheet-settings__logout-btn:hover {
  background: color-mix(in srgb, var(--danger), transparent 85%);
}

/* ── Gear icon (top bar) ──────────────────────────────────── */

.top-bar__gear {
  width: 36px;
  height: 36px;
  min-height: unset; /* overrides global 44px button minimum */
}

.top-bar__gear:hover  { background: var(--surface); }
.top-bar__gear:active { background: var(--line-muted); transform: none; }

/* ── Create & confirm shared ─────────────────────────────────────────────── */

/* Hairline rules — used wherever a section divider is needed */
.rule     { border: none; border-top: 1px solid var(--color-border); margin: 0; }
.rule-mid { border: none; border-top: 1px solid var(--color-border-mid); margin: 0; }

/* Bare input/textarea — no chrome, transparent; layout via utilities */
.bare-input {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  resize: none;
  min-height: 24px;
}

/* Radio button — visually hidden input + adjacent span shows ○/◉ */
.radio-cb { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.radio-dot { font-size: 10px; flex-shrink: 0; }
.radio-dot::before { content: '○'; }
.radio-cb:checked + .radio-dot::before { content: '◉'; }

/* Diamond checkbox — visually hidden input + adjacent span shows ◇/◈ */
.diamond-cb { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.diamond-dot { font-size: 10px; flex-shrink: 0; }
.diamond-dot::before { content: '◇'; }
.diamond-cb:checked + .diamond-dot::before { content: '◈'; }

/* ── Create landing ──────────────────────────────────────────────────────── */

/* Viewport-relative push positions the card below the tree canopy */
.create-landing { padding-top: clamp(80px, 28dvh, 240px); }

/* The actual card — compact, translucent, auto-sized to content */
.create-card {
  background: var(--color-surface);
  padding: var(--spacing-xl);
}

/* Absolute overlay for rotating placeholder text */
.create-placeholder { position: absolute; top: 0; left: 0; right: 0; transition: opacity 0.5s; }

/* Textarea reset — layout handled by utility classes on the element */
.create-nlp-input { border: none; outline: none; resize: none; padding: 0; min-height: 3.5em; }

.create-submit { min-height: 44px; }
.create-submit:hover, .create-submit:active { background: none; transform: none; }

/* ── Confirm form ────────────────────────────────────────────────────────── */

/* Underlined text-button for Confirm action */
.confirm-btn {
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-ink);
  border-radius: 0;
  min-height: unset;
  padding: 0 0 2px;
  color: var(--color-ink);
  cursor: pointer;
}
.confirm-btn:hover, .confirm-btn:active { background: none; transform: none; }

/* Slot swipe-to-delete */
.slot-row { position: relative; overflow: hidden; background: var(--danger); }
.slot-delete-hint {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding-right: 16px;
}
.slot-item { background: var(--bg); position: relative; z-index: 1; }

/* Shake a section to signal a validation error */
@keyframes invalid-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-7px); }
  80%       { transform: translateX(5px); }
}
.invalid-shake { animation: invalid-shake 0.45s ease; }

/* Join page carousel */
/* Fill the content area so the per-card illustration anchors to the bottom
   (above the nav), matching login — rather than floating mid-screen. */
.join-page {
  min-height: 100%;
}
.join-carousel {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.join-carousel::-webkit-scrollbar { display: none; }

.join-card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  min-height: 60dvh;
  position: relative;
  overflow: hidden;
}
.join-card__body {
  flex: 1;
  position: relative;
  z-index: 1;
  padding-bottom: clamp(240px, 28vw, 280px);
}
.card-scene-illus {
  position: absolute;
  bottom: 0;
  right: 5%;
  width: 110%;
  height: auto;
  display: block;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.join-dots {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  align-items: center;
  padding: var(--spacing-md) 0;
}
.join-dot {
  width: 24px;
  height: 2px;
  background: var(--color-ink);
  opacity: 0.25;
  transition: opacity 0.2s;
}
.join-dot.is-active { opacity: 1; }

.join-card__notes { font-style: italic; }
.join-card__notes-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid currentColor;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Legal pages (privacy, terms) ────────────────────────── */

.legal-page {
  max-width: clamp(320px, 90vw, 640px);
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-2xl);
}

/* Reveal page once this stylesheet (the last one) has been parsed — prevents FOUC. */
html { visibility: visible; }
