/* CAMP FLOW (cf-): join or create a camp, full screen, one question at a
 * time. The content sits at the TOP of the screen and the Next button sits
 * right under the field, so the phone keyboard (which covers the lower half)
 * never hides what is being typed. Black like the rest of the app. */
.cf {
  position: fixed; inset: 0; z-index: 70;
  background: var(--night); color: var(--bone);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  animation: cf-up .28s cubic-bezier(.2,.75,.25,1) both;
}
@keyframes cf-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.cf-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px 4px; min-height: 56px; flex: none; }
.cf-icon { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--smoke); color: var(--bone);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.cf-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cf-icon:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.cf-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--smoke-2); overflow: hidden; }
.cf-progress i { display: block; height: 100%; width: 0; background: var(--ember); border-radius: 2px; transition: width .35s ease; }
.cf-count { color: var(--ash); font-size: .82rem; min-width: 3.2em; text-align: right; margin-left: auto; }
.cf-progress:not([hidden]) + .cf-count { margin-left: 0; }

.cf-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 20px 40px; }
.cf-step { display: flex; flex-direction: column; gap: 14px; max-width: 460px; margin: 0 auto; }
.cf-step.cf-in { animation: cf-rise .32s cubic-bezier(.2,.75,.25,1) both; }
.cf-step.cf-in.cf-back { animation-name: cf-rise-back; }
@keyframes cf-rise { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes cf-rise-back { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

.cf-q { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 1.6rem; line-height: 1.2; margin: 0 0 4px; }
.cf-lead { color: var(--ash); font-size: 1rem; line-height: 1.5; margin: 0; }
.cf-hint { color: var(--ash); font-size: .9rem; line-height: 1.45; margin: 0; }
.cf-hint:empty { display: none; }
.cf-step .error { margin: 0; min-height: 0; }
.cf-step .error:empty { display: none; }

.cf-input {
  width: 100%; background: transparent; color: var(--bone); border: 0; border-bottom: 2px solid var(--smoke-2);
  border-radius: 0; padding: 10px 2px; font-size: 1.45rem; font-family: inherit; outline: none;
}
.cf-input:focus { border-bottom-color: var(--ember); }
.cf-input::placeholder { color: #4A504D; }
.cf-area { font-size: 1.1rem; line-height: 1.45; resize: none; border: 1px solid var(--smoke-2); border-radius: var(--radius); padding: 14px; background: var(--smoke); }
.cf-area:focus { border-color: var(--ember); }
.cf-suffix { display: flex; align-items: baseline; gap: 12px; }
.cf-suffix .cf-input { max-width: 160px; }
.cf-suffix span { font-size: 1.25rem; color: var(--ash); }
.cf-next { width: 100%; min-height: 54px; font-size: 1.05rem; margin-top: 4px; }
#cf .cf-next:disabled, #cf .btn.primary.cf-next:disabled { background: var(--smoke); border-color: var(--smoke-2); color: var(--ash); cursor: default; }

.cf-chips, .cf-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.cf-chips button, .cf-choice {
  border: 1px solid var(--smoke-2); background: var(--smoke); color: var(--bone); border-radius: 999px;
  padding: 10px 16px; font: inherit; font-size: .95rem; cursor: pointer;
}
.cf-choice { flex: 1; border-radius: var(--radius); padding: 14px 12px; }
.cf-choice.on, .cf-chips button.on { border-color: var(--ember); background: rgba(255,122,61,.12); color: var(--ember); font-weight: 600; }
.cf-row { display: flex; gap: 10px; }
.cf-row .field { flex: 1; min-width: 0; margin: 0; }
.cf-row select { width: 100%; }
.cf-days { display: flex; gap: 6px; margin-top: 10px; }
.cf-days button { flex: 1; min-width: 0; padding: 10px 0; border-radius: 10px; border: 1px solid var(--smoke-2); background: var(--smoke);
  color: var(--ash); font: inherit; font-size: .82rem; cursor: pointer; }
.cf-days button.on { border-color: var(--ember); color: var(--ember); background: rgba(255,122,61,.12); font-weight: 600; }

/* ---- people and goal ---- */
.cf-stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.cf-stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--smoke-2); background: var(--smoke);
  color: var(--bone); font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0; }
.cf-stepper button:disabled { color: #4A504D; cursor: default; }
.cf-stepper b { min-width: 2.2em; text-align: center; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.cf-stepper-big { justify-content: center; gap: 18px; padding: 10px 0; }
.cf-stepper-big button { width: 56px; height: 56px; font-size: 1.7rem; }
.cf-stepper-big b { font-size: 3rem; min-width: 1.6em; font-family: "Bricolage Grotesque", sans-serif; }
.cf-avail { margin: 0; background: var(--smoke); border-radius: var(--radius); overflow: hidden; }
.cf-avail > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--smoke-2); }
.cf-avail > div:first-child, .cf-avail > div[hidden] + div { border-top: 0; }
.cf-avail > div[hidden] { display: none; }
.cf-avail dt { color: var(--ash); font-size: .95rem; }
.cf-avail dd { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cf-pace { margin: -4px 0 0; color: var(--bone); font-size: 1rem; line-height: 1.45; min-height: 1.45em; }
.cf-pace.cf-pace-over { color: var(--ember); }

/* ---- step 1: Join grows into the code field, Create folds away ---- */
.cf-join { background: var(--night); border: 1px solid var(--smoke-2); border-radius: 16px; overflow: hidden;
  transition: border-color .3s; }
.cf-join > .ob-choice { border: 0; border-radius: 0; }
.cf-join-form { display: grid; grid-template-rows: 0fr; opacity: 0; padding: 0 16px; transition: grid-template-rows .32s ease, opacity .25s ease, padding .32s ease; }
.cf-join-form > * { min-height: 0; }
.cf-join-form { gap: 0; }
.cf-join-inner { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.cf-code { width: 100%; background: var(--smoke); color: var(--bone); border: 1px solid var(--smoke-2); border-radius: var(--radius);
  padding: 14px 16px; font-size: 1.6rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; text-align: center;
  font-variant-numeric: tabular-nums; outline: none; font-family: inherit; }
.cf-code:focus { border-color: var(--ember); }
.cf-code::placeholder { color: #3A3F3C; letter-spacing: .3em; }
.cf-preview { margin: 0; color: var(--ash); font-size: .95rem; text-align: center; min-height: 1.4em; }
.cf-preview b { color: var(--bone); }
.cf-join .error { margin: 0; text-align: center; }
.cf-join .error:empty { display: none; }
.cf-create-open, #cf-start-lead { transition: opacity .25s ease, transform .3s ease, max-height .32s ease, margin .32s ease, padding .32s ease; max-height: 140px; }

.cf-joining .cf-join { border-color: var(--ember-deep); }
.cf-joining .cf-join-form { grid-template-rows: 1fr; opacity: 1; padding: 0 16px 16px; }
.cf-joining .cf-create-open, .cf-joining #cf-start-lead { opacity: 0; max-height: 0; margin: -14px 0 0; padding-top: 0; padding-bottom: 0; transform: translateY(-8px);
  pointer-events: none; overflow: hidden; border-width: 0; }
.cf-joining #cf-join-open { pointer-events: none; }

/* ---- step 2: the three kinds ---- */
.cf-type { display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--bone);
  background: var(--smoke); border: 1px solid var(--smoke-2); border-radius: 18px; padding: 18px; }
.cf-type:active { transform: scale(.99); }
.cf-type:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.cf-type-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cf-type b { font-size: 1.12rem; }
.cf-type em { font-style: normal; font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--ember);
  border: 1px solid var(--ember-deep); border-radius: 999px; padding: 3px 9px; }
.cf-type small { color: var(--ash); font-size: .92rem; line-height: 1.45; }
.cf-type.cf-off { opacity: .55; cursor: default; }
.cf-type .cf-type-busy { color: var(--bone); }

/* ---- check and done ---- */
.cf-review { margin: 0; display: flex; flex-direction: column; gap: 0; border-radius: var(--radius); background: var(--smoke); overflow: hidden; }
.cf-review > div { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--smoke-2); }
.cf-review > div:first-child { border-top: 0; }
.cf-review dt { color: var(--ash); font-size: .85rem; width: 5.6em; flex: none; }
.cf-review dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cf-review button { border: 0; background: none; color: var(--ember); font: inherit; font-size: .88rem; cursor: pointer; padding: 4px; }
.cf-done { align-items: center; text-align: center; padding-top: 6vh; }
.cf-done-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--ember); display: flex; align-items: center; justify-content: center;
  animation: cf-pop .45s cubic-bezier(.2,1.4,.4,1) both; }
.cf-done-ic svg { width: 32px; height: 32px; fill: none; stroke: #1A0E06; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cf-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.cf-code-big { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--smoke); border-radius: 18px; padding: 14px 28px; }
.cf-code-big span { color: var(--ash); font-size: .82rem; }
.cf-code-big b { color: var(--ember); font-size: 2rem; letter-spacing: .25em; font-variant-numeric: tabular-nums; padding-left: .25em; }

@media (prefers-reduced-motion: reduce) {
  .cf, .cf-step.cf-in, .cf-done-ic { animation: none; }
  .cf-join-form, .cf-create-open, #cf-start-lead, .cf-progress i { transition: none; }
}
