/* Book creator — "Subway Map" brand, light. Phone first: one view at a time with
   an Edit / Preview switch; wide screens show editor + phone preview side by side.
   Days are subway-line bullets; the finale stop is marked in red. */

.maker { padding-bottom: 96px; background: var(--paper-2); }
.maker .top { background: rgba(255,255,255,.96); }
.top__status { font: 600 14px/1 var(--text); color: var(--green-strong); }

.maker__grid { max-width: 1180px; margin: 0 auto; padding: 20px var(--gutter) 40px; }

/* ---------- Editor ------------------------------------------------------------ */

.editor { display: flex; flex-direction: column; gap: 20px; }
.editor__loading { color: var(--muted); }

.panel, .day-card {
  padding: 22px 18px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(20,20,20,.05);
}
.panel .kicker { margin-bottom: 16px; }
.panel p { margin: 0 0 16px; font-size: 16px; }
.panel__title { font-size: 28px; margin: 0 0 10px; }

.label { display: block; margin: 18px 0 8px; font: 700 15px/1.3 var(--text); color: var(--ink); }
.intro .label:first-of-type { margin-top: 0; }

.field {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  font: 17px/1.25 var(--text);           /* 16px+ keeps iPhone Safari from zooming in */
  color: var(--ink);
  background: var(--paper);
  border: 2px solid #cfcfc8;
  border-radius: 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31,111,235,.25); }
.field::placeholder { color: #8e8e88; }
select.field {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field--big { font: 700 21px/1.2 var(--display); }

/* Days + stops */
.day-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.day-card__head h2 { display: flex; align-items: center; gap: 12px; font-size: 26px; margin: 0; }
.day-card__head .bullet { font-size: 18px; }

.scene-pick { display: flex; align-items: center; gap: 10px; margin: -4px 0 14px; font: 600 15px var(--text); color: var(--muted); }
.scene-pick .field { flex: 1; min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 16px; }

.stop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.stop-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--paper-2);
  border-radius: 14px;
}
.stop-card.is-finale { background: #fff4f3; box-shadow: inset 0 0 0 2px var(--red); }
.stop-card__row { display: flex; align-items: center; gap: 8px; }
.stop-card__num {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font: 800 14px/1 var(--display);
  color: #fff;
  background: var(--ink);
}
.stop-card.is-finale .stop-card__num { background: var(--red); }
.field--type { flex: 0 1 160px; min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 16px; }
.field--title { font: 700 19px/1.2 var(--display); }
.stop-card__moves { margin-left: auto; display: flex; gap: 4px; }
.stop-card__more { display: flex; gap: 8px; }
.field--time { flex: 0 0 100px; }
.stop-card__hint { margin: 6px 2px 0 !important; font-size: 14px !important; color: var(--green-strong) !important; font-weight: 600; }

.icon-btn {
  width: 38px;
  height: 38px;
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px #cfcfc8;
  cursor: pointer;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:not(:disabled):active { background: var(--line); }
.icon-btn--del:hover { color: var(--red-strong); box-shadow: inset 0 0 0 1.5px var(--red-strong); }

.add-btn {
  width: 100%;
  margin-top: 14px;
  min-height: 52px;
  padding: 12px;
  font: 700 16px/1 var(--text);
  color: var(--ink);
  background: transparent;
  border: 2px dashed #b9b9b2;
  border-radius: 14px;
  cursor: pointer;
}
.add-btn:hover { border-color: var(--ink); }
.add-btn:active { background: var(--paper-2); }
.add-btn--day { margin-top: 0; min-height: 60px; background: var(--paper); }
.link-btn { font: 600 15px var(--text); color: var(--muted); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 6px; }
.limit { margin: 14px 0 0 !important; font-size: 15px !important; }

/* Extras */
.extra-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.extra { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 12px; background: var(--paper-2); border-radius: 14px; }
.extra__map { grid-column: 1 / 3; }

/* Save */
.save__warn { padding: 10px 12px; background: #fff7e0; border-radius: 10px; font-size: 15px !important; color: var(--ink) !important; }
.save__row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.save__msg { min-height: 1.4em; margin: 12px 0 0 !important; color: var(--red-strong) !important; font-weight: 600; }
.save__msg.is-ok { color: var(--green-strong) !important; }
.save.is-saved { box-shadow: 0 0 0 2px var(--green), 0 6px 18px rgba(20,20,20,.05); }
.save__label { margin: 20px 0 8px !important; font: 700 15px/1.3 var(--text) !important; color: var(--ink) !important; }
.save__tip { font-size: 15px !important; margin: 10px 0 0 !important; }
.save__preview-note { margin: 18px 0 0 !important; font-size: 14px !important; }
.linkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  background: var(--paper-2);
  border-radius: 12px;
}
.linkbox a, .linkbox span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.linkbox span { color: var(--muted); }
.linkbox--secret { box-shadow: inset 0 0 0 2px #e9b0ad; background: #fff7f6; }
.save .btn--wide { margin-top: 22px; }

.import { box-shadow: 0 0 0 2px var(--green), 0 6px 18px rgba(20,20,20,.05); }
.import__text { min-height: 140px; resize: vertical; font-size: 16px; line-height: 1.45; margin-bottom: 12px; }
.import__note { margin: 10px 0 0 !important; font-size: 14px !important; }
.mailbox, .pay { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.mailbox__form { flex-direction: row; margin-bottom: 0; }
.mailbox__form .field { flex: 1; }
.pay p { margin: 0 0 12px; font-size: 15px; }
.pay .pay__terms { margin: 12px 0 0; font-size: 14px; }

/* ---------- Preview ---------------------------------------------------------- */

.preview { display: none; flex-direction: column; align-items: center; gap: 14px; }
.phone {
  width: min(100%, 340px);
  aspect-ratio: 393 / 852;
  padding: 11px;
  background: #1b1d22;
  border-radius: 48px;
  box-shadow: 0 0 0 1px #3a3d44, 0 26px 50px rgba(20,20,20,.25);
  box-sizing: content-box;
}
.phone__screen { display: block; width: 100%; height: 100%; border: 0; border-radius: 37px; background: #071629; }
.preview__hint { margin: 0; font-size: 15px; }

/* Phone: one view at a time */
body[data-view="preview"] .editor { display: none; }
body[data-view="preview"] .preview { display: flex; }
body[data-view="preview"] .phone { width: min(100%, calc((100svh - 240px) * 393 / 852)); }

.switcher {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: var(--paper);
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(20,20,20,.18);
}
.switcher button {
  min-width: 112px;
  min-height: 46px;
  padding: 10px 18px;
  font: 700 16px/1 var(--text);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.switcher button[aria-pressed="true"] { color: #fff; background: var(--ink); }

/* Wide screens: side by side, no switcher */
@media (min-width: 900px) {
  .maker { padding-bottom: 0; }
  .maker__grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
  .preview, body[data-view="preview"] .preview { display: flex; position: sticky; top: 92px; }
  body[data-view] .editor { display: flex; }
  .phone, body[data-view="preview"] .phone { width: min(100%, calc((100vh - 170px) * 393 / 852)); }
  .switcher { display: none; }
  .save__row { flex-direction: row; }
}

/* ---------- Your party: the character creator ---------- */
.party__row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 16px; }
.party__member {
  width: 76px; height: 72px; padding: 4px; cursor: pointer; border-radius: 14px;
  background: var(--paper-2); border: 2px solid transparent;
}
.party__member[aria-pressed="true"] { border-color: var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); }
.party__member canvas { width: 64px; height: 58px; image-rendering: pixelated; display: block; margin: 0 auto; }
.party__add { font: 700 28px/1 var(--text, inherit); color: var(--ink); border: 2px dashed currentColor; background: none; }
.party__editor { border-top: 1px solid rgba(0,0,0,.12); padding-top: 12px; }
.party__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.party__tab {
  font: 600 14px/1 inherit; padding: 9px 12px; border-radius: 999px; cursor: pointer;
  background: var(--paper-2); border: 0; color: var(--ink);
}
.party__tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.party__h { font-size: 15px; margin: 14px 0 8px; }
.party__opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.party__opt {
  aspect-ratio: 1; padding: 3px; cursor: pointer; border-radius: 10px;
  background: var(--paper-2); border: 2px solid transparent; font: 600 12px/1.1 inherit; color: var(--ink);
}
.party__opt[aria-pressed="true"] { border-color: var(--ink); background: #fff; }
.party__thumb { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.party__swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.party__swatch {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; background: var(--c);
  border: 2px solid rgba(0,0,0,.18); box-shadow: inset 0 0 0 2px #fff;
}
.party__swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--ink); }
.party__words { display: flex; flex-wrap: wrap; gap: 6px; }
.party__words .chip {
  font: 600 14px/1 inherit; padding: 10px 14px; border-radius: 999px; cursor: pointer;
  background: var(--paper-2); border: 2px solid transparent; color: var(--ink);
}
.party__words .chip[aria-pressed="true"] { border-color: var(--ink); background: #fff; }
.party__actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.party__loading { color: var(--muted); }

/* Out of the way while scrolling down the form (create.ts); back on scrolling up. */
.switcher { transition: transform .2s ease-out; }
.switcher.is-away { transform: translate(-50%, calc(100% + 24px + env(safe-area-inset-bottom))); }
