/* ==========================================================================
   MeetUp design system — synced from Figma "MeetUp" file, "1. Screens" page
   (Entry / Create 1-8). Tokens follow the sds-* variables used in Figma:
   Inter font, pill-shaped inputs/buttons (radius 100px), #4f90f6 accent.
   ========================================================================== */

:root {
  --color-bg: #ffffff;
  --color-bg-secondary: #f5f5f5;
  --color-ink: #1e1e1e;
  --color-ink-secondary: #757575;
  --color-ink-tertiary: #b3b3b3;
  --color-border: #d9d9d9;
  --color-brand: #4f90f6;
  --color-brand-ink: #ffffff;
  --color-danger: #ee1d36;

  /* Theme accent — overridden per-theme via applyThemeColor() */
  --theme-color: #4f90f6;
  --theme-color-text: #ffffff;
  --theme-color-tint: rgba(79, 144, 246, 0.12);
  --theme-color-text-mute: rgba(255, 255, 255, 0.65);
  --theme-bg-light: #eaf1fe;
  --theme-bg-light-transparent: rgba(234, 241, 254, 0);
  --theme-oncard: #4f90f6;
  --theme-oncard-mute: rgba(79, 144, 246, 0.55);

  /* Preset theme palette — exactly 3 presets per Figma Create-2. Each theme
     pairs an accent color (calendar highlight) with its own preview-card
     background, which is NOT a tint of the accent — the two are picked
     independently in the source design. */
  --theme-1-bg: #4f90f6;
  --theme-1-text: #ffffff;
  --theme-1-bg-light: #eaf1fe;

  --theme-2-bg: #57c031;
  --theme-2-text: #ffffff;
  --theme-2-bg-light: #fec0ca;

  --theme-3-bg: #c936ae;
  --theme-3-text: #ffffff;
  --theme-3-bg-light: #fac75a;

  /* Per-component corner radii, verified against Figma Join/Monitor:
     inputs/pills stay 100px, CTA & buttons 12px, cards/containers 10px,
     grid & calendar cells 4px, stepper 1px. (Circles use 50%, not these.) */
  --radius-pill: 100px;   /* text inputs, invite display, station rows, chips */
  --radius-btn: 12px;     /* CTA / primary / secondary buttons */
  --radius-card: 10px;    /* cards & scroll containers */
  --radius-cell: 4px;     /* calendar day + availability grid cells */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #eef0f3;
  color: var(--color-ink);
  font-family: 'Inter', 'Asta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input {
  font-family: inherit;
}

#app {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--color-bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

/* ---------- screens ---------- */

.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
  background: var(--color-bg);
}

.screen.active {
  display: flex;
}

/* Figma's frames include the iOS status bar (44px) and home indicator
   (34px) as real space-occupying layers ("iPhone with Notch" / "Home
   Indicator"). Our HTML doesn't render device chrome, but must still
   reserve the same space so header/content/CTA land at the same
   positions Figma shows — otherwise everything sits ~44px too high and
   flex:1-centered screens (Entry, Share) center on the wrong midpoint. */
.screen::before {
  content: '';
  display: block;
  flex-shrink: 0;
  height: 44px;
}

.screen::after {
  content: '';
  display: block;
  flex-shrink: 0;
  height: 34px;
}

.step-screen {
  padding-bottom: 96px;
}

.container {
  padding: 24px 20px 20px;
  flex: 1;
}

/* Modifier for screens whose body needs its own vertical flex layout
   (e.g. centering a section under the heading). See stepTheme. */
.container--flex {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* The 7-step creation flow (Create-1..7) uses a 40px top gap under the
   stepper header, not the 24px default — confirmed against Figma
   (Content: pt-[40px]) on every one of those screens. */
.container--step {
  padding-top: 40px;
}

/* Vertically-centered content area — used by screens that have no fixed
   bottom CTA (Entry, Share). Figma centers these with `justify-center` on
   the Content frame rather than fixed top padding, so this must stay a flex
   child of a full-height `.screen` to center correctly at any viewport size. */
.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 0 20px 76px;
}

/* ---------- header: logo split by 7-segment stepper ---------- */

.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
}

/* Header variant for screens with no stepper (e.g. Share) — logo only. */
.simple-header {
  display: flex;
  align-items: center;
  padding: 20px 20px 16px;
}

.step-header-logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
}

.progress-segments {
  display: flex;
  flex: 1;
  gap: 4px;
  align-items: center;
}

.progress-segment {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 1px; /* Figma stepper: near-square bars */
  background: var(--color-border);
  overflow: hidden;
}

/* Participant stepper (rendered without --anim): fills via a solid background. */
.progress-segment.filled:not(.progress-segment--anim) {
  background: var(--theme-color);
}

/* Create-flow stepper (--anim): the brand colour is a scaleX(left) overlay so it
   can wipe left→right on step entry. The track itself stays grey; the overlay
   carries the (theme) colour. */
.progress-segment-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--theme-color);
  transform: scaleX(0);
  transform-origin: left center;
}

.progress-segment--anim.filled .progress-segment-fill {
  transform: scaleX(1);
}

/* New create-flow stepper (Figma "1. Screens"): the active step-pair shows as
   full-width bars while every other step collapses to a 6px dot. renderStepHeader
   tags each segment --bar/--dot. Participant screens keep the base flex:1 bars. */
.progress-segment--bar {
  flex: 1 1 0;
  min-width: 0;
}

.progress-segment--dot {
  flex: 0 0 6px;
  width: 6px;
}

/* Join flow: the meeting title shown under the stepper (Figma [2] Join). */
.join-eventname {
  margin: 0;
  padding: 40px 20px 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--theme-color);
}

/* Join-2..5 reuse the Create step screens; the meeting name is injected as the
   first line of the heading block (participant flow only, via setJoinEventName). */
.join-eventname-inline {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--theme-color);
}

/* ---------- typography ---------- */

.step-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-ink);
  margin: 0;
}

.step-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-required {
  font-size: 14px;
  font-weight: 600;
  color: var(--theme-color);
  white-space: nowrap;
}

.step-subtitle {
  font-size: 14px;
  color: var(--color-ink-secondary);
  margin: 4px 0 0;
}

.step-header-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

/* Use inside `.center-content` (Entry, Share) where the parent's own gap
   already provides spacing to the next element. */
.step-header-block--tight {
  margin-bottom: 0;
}

/* ---------- inputs ---------- */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
}

.pill-input {
  width: 100%;
  height: 48px;
  padding: 0 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 16px;
  color: var(--color-ink);
  background: var(--color-bg);
  outline: none;
}

.pill-input::placeholder {
  color: var(--color-ink-tertiary);
}

.pill-input:focus {
  border-color: var(--theme-color);
}

.input-counter-row {
  position: relative;
}

.input-counter-row .pill-input {
  padding-right: 56px;
}

.input-counter {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--color-ink-tertiary);
  pointer-events: none;
}

.input-with-hint {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.input-hint {
  font-size: 14px;
  text-align: left;
  padding: 0 24px;
  margin: 0;
  display: none;
}

/* Shown only once the field actually hits its character limit. */
.input-hint.visible {
  display: block;
}

.input-hint--danger {
  color: var(--color-danger-tertiary, #ec221f);
}

.entry-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.entry-input-row .pill-input {
  flex: 1;
  min-width: 0;
}

.invite-code-input {
  text-transform: uppercase;
}

/* Invalid invite code (Entry-1.3): red outline + red helper text. */
.pill-input.invalid {
  border-color: var(--color-danger-tertiary, #ec221f);
}

/* Figma reserves the error row's height even when hidden (Input Field is a fixed
   149px block), so the divider/button never shift when the error appears. Use
   visibility, not display, to keep that space. */
.entry-error {
  margin: 8px 0 0;
  padding-left: 8px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--color-danger-tertiary, #ec221f);
}

.entry-error[hidden] {
  display: block;
  visibility: hidden;
}

/* Entry (Figma "[0] Entry - 1.x") exact vertical rhythm. Scoped to #entryScreen
   so the shared .center-content (also the share screen) keeps its centering.
   Content sits 162px below the header, then: title →(8)→ subtitle →(24)→ input
   →(8+reserve)→ [divider] →(24)→ [divider→button 24+24=48]. */
#entryScreen .center-content {
  justify-content: flex-start;
  gap: 24px;
  padding: 162px 20px 0;
}

.entry-field {
  display: flex;
  flex-direction: column;
}

/* Figma title → subtitle gap is 8px (the .step-header-block gap); drop the
   extra 4px the shared .step-subtitle adds elsewhere. */
.entry-field .step-subtitle {
  margin-top: 0;
}

.entry-field .entry-input-row {
  margin-top: 24px;
}

#entryScreen #startPlanBtn {
  margin-top: 24px;
}

/* The button stays neutral gray (#f5f5f5) in BOTH states — only the arrow
   icon recolors: #d9d9d9 when empty (Entry-1.1) → brand #4f90f6 once a code
   is typed (Entry-1.2). JS toggles `.ready` on input. The arrow is the exact
   SVG extracted from Figma, driven via CSS mask so a single file recolors. */
/* Square icon buttons are background-less — icon only. */
.entry-arrow-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Inline SVG (path fill="currentColor") — recolors reliably via `color`,
   with no external-resource loading that file:// would block. */
.entry-arrow-icon {
  display: block;
  width: 18px;
  height: 14.73px;
  color: var(--color-border); /* #d9d9d9 — inactive */
  transition: color 0.15s ease;
}

.entry-arrow-btn.ready .entry-arrow-icon {
  color: var(--color-brand); /* #4f90f6 — active */
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 6px;
}

.or-divider-line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.or-divider-text {
  font-size: 14px;
  color: var(--color-ink-secondary);
  white-space: nowrap;
}

/* ---------- buttons ---------- */

.btn-primary,
.btn-secondary,
.step-cta {
  width: 100%;
  height: 56px;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary,
.step-cta {
  background: var(--theme-color, var(--color-brand));
  color: var(--theme-color-text, #fff);
}

/* "건너뛰기" (skip) state — muted grey fill with themed text, per Figma 3.1. */
.step-cta.step-cta--skip {
  background: var(--color-bg-secondary);
  color: var(--theme-color, var(--color-brand));
}

.btn-primary:disabled,
.step-cta:disabled {
  background: var(--color-border);
  color: var(--color-ink-tertiary);
  cursor: not-allowed;
}

.step-cta--secondary {
  background: var(--color-bg-secondary);
  color: var(--color-ink);
}

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-ink);
}

/* Figma Join: back button is an icon only — no background, themed arrow. */
.btn-back {
  width: 56px;
  height: 56px;
  border: none;
  background: none;
  color: var(--theme-color);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

/* Outline variant keeps its border/fill (an intentional bordered icon button). */
.icon-btn--outline {
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

/* ---------- fixed bottom CTA ---------- */

.cta-fixed {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: linear-gradient(to top, var(--color-bg) 70%, rgba(255, 255, 255, 0));
  /* position:fixed sits outside the .screen flex flow, so it doesn't pick
     up the ::after home-indicator spacer — reserve the same 34px here,
     falling back to the real device safe area when that's larger. */
  padding: 20px 20px max(34px, calc(20px + env(safe-area-inset-bottom)));
}

.cta-row {
  display: flex;
  gap: 12px;
}

/* ---------- theme selector (step 2) ---------- */

/* Figma "[1] Create - 2.x": a single theme-previewing calendar stacked above a
   row of theme swatches. The chosen theme re-skins the preview, the swatches,
   and (scoped to this step) the CTA / back button. */
.theme-picker {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 16px;
}

/* Outer "mat": for decorated themes (e.g. pink) it shows a striped, bordered
   frame around the inner calendar card; plain themes collapse to a single card.
   The green outline is a hand-drawn/rough brush stroke in Figma — we render it
   as a displaced border on a ::before overlay (see .rough-edge rules below) so
   the fill and calendar text stay crisp and the box geometry never changes
   between themes (which is what made the preview jitter on theme switch). */
.theme-preview {
  position: relative;
  background-color: var(--tp-mat-bg, var(--color-bg-secondary));
  background-image: var(--tp-stripe, none);
  border-radius: 10px;
  padding: 10px;
}

.theme-preview-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--tp-card-bg, var(--color-bg-secondary));
  border-radius: 10px;
  padding: 12px 10px;
}

/* Rough hand-drawn green edge, driven by --tp-edge (color) + --tp-edge-filter.
   Plain themes leave --tp-edge transparent, so the overlay is invisible. */
.theme-preview::before,
.theme-preview-card::before,
#stepTheme .step-cta::before,
#stepTheme .btn-back::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--tp-edge, transparent);
  filter: var(--tp-edge-filter, none);
  pointer-events: none;
}

.theme-preview-month {
  padding-left: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tp-head, var(--color-brand));
}

.theme-preview-dow {
  display: flex;
  font-size: 14px;
  color: var(--tp-head, var(--color-brand));
}

.theme-preview-dow span {
  flex: 1;
  text-align: center;
}

.theme-preview-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.theme-preview-grid span {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--tp-date, var(--color-ink));
}

.theme-swatches {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  /* Reserve the tallest swatch height so enlarging the selected one never
     changes the row height (another source of preview jitter). */
  min-height: 84px;
}

/* Selected swatch grows from 56px to 84px, matching Figma. */
.theme-swatch {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  background: var(--sw-bg, var(--color-bg-secondary));
  color: var(--sw-fg, var(--color-brand));
}

.theme-swatch.active {
  width: 84px;
  height: 84px;
}

.theme-swatch--stripe {
  background-color: var(--sw-bg, #fffbea);
  background-image: repeating-linear-gradient(90deg, var(--sw-stripe, #fec0ca) 0 4.5px, transparent 4.5px 9px);
  border: 1.5px solid var(--sw-border, #57c031);
}

/* Theme-scoped CTA / back-button skinning (variables set on #stepTheme in JS).
   position:relative anchors the rough-edge ::before overlay defined above. */
#stepTheme .step-cta {
  position: relative;
}

#stepTheme .btn-back {
  position: relative;
  background: var(--tp-back-bg, var(--color-bg-secondary));
  color: var(--tp-back-fg, var(--color-ink));
}

/* ---------- date range calendar (step 3) ---------- */

.range-calendar {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  overflow: hidden;
}

/* Figma insets only the month label (16px); the weekday row and the date
   grid below it are flush with the calendar's own edges. Both the header
   and the grid share that flush width so 7 columns divide evenly into
   square cells (see .cal-day). */
.cal-sticky-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cal-month-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--theme-color);
  padding: 0 16px;
}

.cal-month-num-wrap {
  display: inline-block;
}

.cal-label-animate {
  display: inline-block;
  animation: cal-label-pop 0.25s ease;
}

@keyframes cal-label-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cal-dow-row {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--theme-color);
  text-align: center;
  padding-bottom: 8px;
}

.cal-dow-row > div {
  flex: 1;
}

.cal-scroll {
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}

.cal-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari/new Edge */
}

.cal-month-block + .cal-month-block {
  margin-top: 8px;
}

.cal-day-grid {
  display: flex;
  flex-wrap: wrap;
}

/* Equal 1/7-width columns with a fixed 50px height and zero gap between
   cells — this is what makes each cell ~1:1 (square) and lets adjacent
   selected days visually merge into one continuous pill. */
.cal-day {
  flex: 0 0 calc(100% / 7);
  height: 50px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--color-ink);
  touch-action: none;
}

.cal-day.empty {
  visibility: hidden;
}

.cal-day.selected {
  background: var(--theme-color);
  color: #fff;
}

.cal-day.selected.run-start {
  border-top-left-radius: var(--radius-cell);
  border-bottom-left-radius: var(--radius-cell);
}

.cal-day.selected.run-end {
  border-top-right-radius: var(--radius-cell);
  border-bottom-right-radius: var(--radius-cell);
}

.cal-day.selected.run-start.run-end {
  border-radius: var(--radius-cell);
}

/* ---------- availability grid (step 4): dates × hours ----------
   Figma "[1] Create - 4.1/4.2". A fixed left hour-axis (10–24h); the dates
   picked in step 3 become columns (grouped by month) that scroll horizontally;
   tap/drag paints a cell = available. Selected cells + labels use --theme-color
   so the grid re-tints with the chosen theme (Figma mock shows the blue default).
   Row pitch: cell 24px + 2px gap = 26px; the axis spacer (94px) matches the
   month-label block (20+10) + column header (64) so labels line up with cells. */

.avail-grid {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 4px;
  position: relative;
}

/* Edge fades over the horizontally-scrolling columns — they signal "more
   content this way", so each only appears when there's actually hidden content
   on that side: the left fade after you scroll right, the right fade whenever
   more columns overflow past the edge (JS toggles .fade-left / .fade-right on
   scroll). Left fade starts after the fixed time axis. */
.avail-grid::before,
.avail-grid::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.avail-grid::before {
  left: 30px; /* time axis (26px) + grid gap (4px) */
  background: linear-gradient(to right, var(--color-bg), transparent);
}

.avail-grid::after {
  right: 0;
  background: linear-gradient(to left, var(--color-bg), transparent);
}

.avail-grid.fade-left::before {
  opacity: 1;
}

.avail-grid.fade-right::after {
  opacity: 1;
}

/* Keep the month label crisp above the left fade — only the cells should
   dissolve at the edge, not the group heading. */
.avail-month-label {
  position: relative;
  z-index: 3;
}

.avail-timeaxis {
  flex-shrink: 0;
  width: 26px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Spacer above the hour labels = month-label block (20+10) + column header
   (dow 20 + gap 10 + date 50) + gap 10 before cells = 120px, so labels line
   up with the first cell. */
.avail-axis-head {
  height: 120px;
  flex-shrink: 0;
}

/* Labels share the same flex region as the cells (both fill grid height minus
   the 120px header, 15 items + 2px gaps) so rows line up and nothing scrolls. */
.avail-axis-labels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.avail-time-label {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: var(--theme-color);
}

.avail-cols {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.avail-cols::-webkit-scrollbar {
  display: none;
}

/* Columns keep a fixed 50px pitch regardless of how many dates are chosen, so
   spacing stays consistent (few dates don't spread apart); overflow scrolls. */
.avail-monthgroup {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.avail-month-label {
  height: 20px;
  margin-bottom: 10px;
  padding-left: 12px; /* sit above the first 50px column, matching Figma */
  font-size: 14px;
  font-weight: 600;
  color: var(--theme-color);
}

.avail-monthcols {
  display: flex;
}

.avail-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 50px;
  flex-shrink: 0;
}

.avail-col-head {
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.avail-col-dow {
  font-size: 14px;
  line-height: 1;
  color: var(--theme-color);
}

.avail-col-date {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-ink);
}

.avail-cells {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.avail-cell {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-cell);
  background: var(--color-bg-secondary);
  touch-action: none;
  cursor: pointer;
}

.avail-cell.on {
  background: var(--theme-color);
}

.avail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-ink-secondary);
  text-align: center;
}

/* ---------- station search (steps 5 & 6) ---------- */

.station-search-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  position: relative;
}

/* Figma nests the input + its live results in their own sub-group with a
   tighter 12px gap once a search query narrows the list (Create-5/2) —
   confirmed against 342:5785 in Figma, gap-[12px] vs. the 24px default
   used for the input/locate-button pairing (Create-5/1). */
.station-search-wrap--tight {
  gap: 12px;
}

.station-search-wrap > .pill-input {
  width: 100%;
}

.station-input-row {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  display: flex;
  align-items: center;
}

.station-input-row:focus-within {
  border-color: var(--theme-color);
}

.station-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  padding: 0;
  font-size: 16px;
  color: var(--color-ink);
}

.station-input::placeholder {
  color: var(--color-ink-tertiary);
}

.station-input-clear {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  font-size: 16px;
  line-height: 1;
}

.station-input-clear[hidden] {
  display: none;
}

/* Auto-width, centered pill — Figma hugs content here rather than
   stretching full-width like the text input above it. */
.station-locate-btn {
  width: auto;
  align-self: center;
  height: 48px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-bg-secondary);
  color: var(--color-ink);
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px 0 16px;
  white-space: nowrap;
}

.station-locate-btn[hidden] {
  display: none;
}

.station-suggest-box {
  width: 100%;
}

.station-suggestions {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.station-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 16px 8px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.station-suggestion + .station-suggestion {
  border-top: 1px solid var(--color-border);
}

.station-line-badge-col {
  width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.station-line-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.station-name {
  flex: 1;
  font-size: 16px;
  color: var(--color-ink);
}

.station-selected-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 24px;
  padding: 16px 16px 16px 24px;
  width: 100%;
}

.station-selected-label {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
}

.station-selected-row .station-name {
  color: var(--color-ink);
}

.station-clear-btn {
  border: none;
  background: none;
  color: var(--color-ink-tertiary);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

/* ---------- place candidate list (step 6) ---------- */

.place-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.place-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.place-item-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.place-item-marker.selected {
  background: var(--theme-color);
  border-color: var(--theme-color);
}

.place-item-name {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 16px;
  color: var(--color-ink);
}

.place-remove-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  color: var(--color-ink-tertiary);
  font-size: 18px;
  flex-shrink: 0;
}

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

.place-add-btn {
  height: 48px;
  padding: 0 20px;
  flex-shrink: 0;
}

/* ---------- share / invite code screen ---------- */

.invite-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.invite-code-display {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--color-ink);
}

.highlight {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: center;
  word-break: break-all;
}

/* ---------- participant / info / results (existing screens, kept) ---------- */

.info-box {
  background: var(--theme-bg-light, #f5f5f5);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}

.option-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.option-desc {
  font-size: 14px;
  color: var(--color-ink-secondary);
}

.note {
  font-size: 13px;
  color: var(--color-ink-secondary);
  text-align: center;
  margin-top: 16px;
}

.place-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 48px;
  padding: 0 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #fff;
  margin-bottom: 8px;
  font-size: 16px;
  color: var(--color-ink);
}

.place-select-item.selected {
  border-color: var(--theme-color);
  background: var(--theme-color-tint);
}

.place-select-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.place-select-name {
  flex: 1;
  text-align: left;
}

.place-select-item.selected .place-select-radio {
  border-color: var(--theme-color);
  background: var(--theme-color);
  box-shadow: inset 0 0 0 3px #fff;
}

.place-select-add-btn {
  width: 100%;
  height: 40px;
  border: none;
  background: none;
  color: var(--theme-color);
  font-size: 14px;
  font-weight: 600;
}

.date-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.date-btn {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 12px 8px;
  background: #fff;
  text-align: center;
}

.date-day {
  font-size: 18px;
  font-weight: 600;
}

.date-dow {
  font-size: 12px;
  color: var(--color-ink-secondary);
}

.progress {
  text-align: center;
  font-size: 13px;
  color: var(--color-ink-secondary);
  margin: 12px 0;
}

.time-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-slot {
  width: 60px;
  font-size: 13px;
  color: var(--color-ink-secondary);
  flex-shrink: 0;
}

.time-btns {
  display: flex;
  gap: 4px;
  flex: 1;
}

.time-btn {
  flex: 1;
  height: 32px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
}

.date-nav {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.date-nav .btn-secondary {
  flex: 1;
}

.results-summary-card {
  background: var(--theme-color, var(--color-brand));
  color: #fff;
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 20px;
}

.results-summary-title {
  font-size: 18px;
  font-weight: 600;
}

.results-summary-dates {
  font-size: 13px;
  opacity: 0.85;
  margin: 4px 0 12px;
}

.results-summary-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 13px;
}

.results-section {
  margin-bottom: 20px;
}

.results-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.results-rank-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.results-rank-card.top {
  border-color: var(--theme-color);
  background: var(--theme-color-tint);
}

.results-rank-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.results-rank-card.top .results-rank-badge {
  background: var(--theme-color);
  color: #fff;
}

.results-rank-info {
  flex: 1;
}

.results-rank-time {
  font-size: 14px;
  font-weight: 600;
}

.results-rank-meta {
  font-size: 12px;
  color: var(--color-ink-secondary);
}

.place-result-row {
  margin-bottom: 12px;
}

.place-result-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 4px;
}

.place-result-row.winner .place-result-head {
  font-weight: 600;
  color: var(--theme-color);
}

.place-result-bar-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-secondary);
  overflow: hidden;
}

.place-result-bar-fill {
  height: 100%;
  background: var(--theme-color);
  border-radius: var(--radius-pill);
}

.participant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.participant-chip {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
}

/* 카카오 역 검색: 검색 결과 주소 보조 텍스트 */
.station-suggestion .station-address {
  display: block;
  font-size: 12px;
  color: var(--color-ink-subtle, #9aa0a6);
  margin-top: 2px;
}
/* 중간지점 추천: 길찾기 링크 */
.midpoint-route {
  margin-top: 6px;
}
.midpoint-route a {
  font-size: 13px;
  color: var(--color-brand, #3b82f6);
  text-decoration: none;
}
.midpoint-route a:hover { text-decoration: underline; }
