/* ── 상단 바: cpbc플러스 로고 고정 + 단계 막대 ─────────────── */
.topbar {
  position: relative;
  z-index: 30;
  flex: none;
  width: 100%;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 6px 0;
  display: grid;
  grid-template-columns: 76px 1fr 76px;
  align-items: center;
  background: #fff;
  box-shadow: 0 1px 0 var(--line);
}
@media (min-width: 520px) {
  .topbar {
    padding-top: 12px;
    height: calc(var(--topbar-h) + 12px);
  }
}
.topbar__logo {
  display: flex;
  justify-content: center;
  align-items: center;
}
.cpbc-logo {
  display: block;
  height: 22px;
  width: auto; /* 원본 비율 유지 */
  max-width: none;
}
.topbar__right {
  grid-column: 3;
  justify-self: end;
}
.topbar__steps {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 3px;
}
.topbar__steps li {
  flex: 1;
  background: var(--line);
  transition: background var(--dur-m);
}
.topbar__steps li.is-done,
.topbar__steps li.is-current {
  background: var(--sky);
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-2);
}
.icon-btn:active {
  background: rgba(29, 75, 143, 0.06);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ── 하단 파란 띠 + 저작권 ─────────────────────────── */
.brand-footer {
  flex: none;
  background: #fff;
}
.brand-banner {
  display: block;
  background: #0b67c2;
}
.brand-banner img {
  display: block;
  width: 100%;
  height: auto; /* 원본 비율 유지 */
}
.copyright {
  padding: 8px 0 calc(8px + var(--safe-b));
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
  background: #fff;
}

/* ── 버튼 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  transition: transform var(--dur-s) var(--ease), background var(--dur-s), box-shadow var(--dur-s), opacity var(--dur-s);
  user-select: none;
  -webkit-user-select: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn--block {
  width: 100%;
}
.btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #2a5da8, var(--burgundy-deep));
  box-shadow: 0 8px 20px rgba(26, 52, 102, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn--gold {
  color: #fff;
  background: linear-gradient(180deg, #7cb8f4, #4f97e6);
  box-shadow: 0 6px 16px rgba(93, 163, 236, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn--sky {
  color: #fff;
  background: linear-gradient(180deg, #74b2f4, var(--sky-deep));
  box-shadow: 0 6px 16px rgba(62, 134, 218, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn--outline {
  color: var(--navy);
  background: #fff;
  border: 1.5px solid var(--navy);
}
.btn--secondary {
  color: var(--burgundy);
  background: var(--cream);
  border: 1px solid var(--line-strong);
}
.btn--ghost {
  color: var(--ink-2);
  min-height: 44px;
  padding: 0 12px;
  font-weight: 600;
}
.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.bottombar {
  position: relative;
  z-index: 25;
  flex: none;
  width: 100%;
  padding: 8px var(--gutter) calc(14px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bottombar__hint {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ── 카드 ─────────────────────────────────────────────── */
.card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 20px;
}
.card--soft {
  background: rgba(255, 255, 255, 0.7);
}
.section-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}
.section-desc {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-text);
  letter-spacing: 0.04em;
}
.eyebrow::before {
  content: '';
  width: 14px;
  height: 1px;
  background: currentColor;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--burgundy);
  white-space: nowrap;
}
.badge--gold {
  color: #1d4b8f;
  background: var(--gold-soft);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--burgundy);
  background: var(--burgundy-soft);
}

/* ── 입력 ─────────────────────────────────────────────── */
.field + .field {
  margin-top: 22px;
}
.field__label {
  display: block;
  font-weight: 700;
  font-size: 15.5px;
}
.field__label small {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}
.field__help {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.input,
.textarea {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px 16px;
  font-size: 16px; /* iOS 확대 방지 */
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  transition: border-color var(--dur-s), box-shadow var(--dur-s);
}
.input::placeholder,
.textarea::placeholder {
  color: #9b8d86;
}
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(93, 163, 236, 0.16);
}
.textarea {
  min-height: 118px;
  resize: none;
  line-height: 1.6;
}
.field__meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.field__meta .count {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.field__meta .count.is-max {
  color: var(--burgundy);
  font-weight: 700;
}
.privacy-note {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.privacy-note svg {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 3px;
}

/* ── 묵주 디자인 선택 (가로 스크롤) ─────────────────────── */
.hscroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 14px var(--gutter) 8px;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hscroll::-webkit-scrollbar {
  display: none;
}
.design-card {
  position: relative;
  flex: 0 0 138px;
  scroll-snap-align: start;
  padding: 14px 12px 12px;
  border-radius: 20px;
  background: var(--cream);
  border: 1.5px solid var(--line);
  text-align: center;
  transition: border-color var(--dur-s), box-shadow var(--dur-s), transform var(--dur-s) var(--ease);
}
.design-card:active {
  transform: scale(0.98);
}
.design-card[aria-checked='true'] {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(29, 75, 143, 0.1), var(--shadow-m);
}
.design-card__no {
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--gold-text);
}
.design-card__preview {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  height: 58px;
  margin: 4px 0 8px;
}
.design-card__name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
}
.design-card__en {
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.check-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--burgundy);
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-s), transform var(--dur-s) var(--ease);
}
.check-mark svg {
  width: 14px;
  height: 14px;
}
[aria-checked='true'] > .check-mark {
  opacity: 1;
  transform: none;
}
.state-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}
.state-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── 신비 선택 ──────────────────────────────────────── */
.today-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(214, 231, 251, 0.45), rgba(234, 242, 252, 0.6));
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
}
.today-note b {
  color: var(--burgundy);
}
.mystery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 560px) {
  .mystery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.mystery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 128px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  text-align: left;
  background: var(--cream);
  border: 1.5px solid var(--line);
  overflow: hidden;
  transition: border-color var(--dur-s), box-shadow var(--dur-s), transform var(--dur-s) var(--ease);
}
.mystery-card::after {
  content: '';
  position: absolute;
  right: -24px;
  top: -24px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tone), transparent 70%);
  opacity: 0.16;
}
.mystery-card:active {
  transform: scale(0.98);
}
.mystery-card[aria-checked='true'] {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(29, 75, 143, 0.1), var(--shadow-m);
}
.mystery-card .badge {
  height: 22px;
  font-size: 11px;
  margin-bottom: 2px;
}
.mystery-card__name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
}
.mystery-card__days {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-text);
}
.mystery-card__desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.mystery-card .check-mark {
  top: 10px;
  right: 10px;
}

/* ── 영상 ─────────────────────────────────────────────── */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: #0f1a2e;
  box-shadow: var(--shadow-m);
}
@supports not (aspect-ratio: 16 / 9) {
  .video {
    height: 0;
    padding-top: 56.25%;
  }
}
.video iframe,
.video__facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video__facade {
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
}
.video__facade::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 24, 48, 0.1), rgba(12, 24, 48, 0.55));
}
.video__play {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: var(--burgundy);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.video__play svg {
  width: 26px;
  height: 26px;
  margin-left: 4px;
}
.video__caption {
  position: absolute;
  left: 14px;
  bottom: 12px;
  right: 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  text-align: left;
}
.video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.video-meta a {
  color: var(--ink-3);
  font-size: 12.5px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── 진행 바 ───────────────────────────────────────── */
.progress {
  height: 8px;
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--burgundy));
  transition: width var(--dur-m) var(--ease);
}

/* ── 세그먼트 컨트롤 ─────────────────────────────── */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  border-radius: 14px;
  background: var(--paper);
}
.segmented button {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.35;
  transition: background var(--dur-s), color var(--dur-s), box-shadow var(--dur-s);
}
.segmented button[aria-checked='true'] {
  background: #fff;
  color: var(--burgundy);
  box-shadow: var(--shadow-s);
}

/* ── 모달 · 시트 ─────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 24, 48, 0.42);
  animation: fade-in var(--dur-s) both;
}
.overlay.is-sheet {
  align-items: flex-end;
  padding: 0;
}
.overlay.is-closing {
  animation: fade-out var(--dur-s) both;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
.dialog {
  width: 100%;
  max-width: 360px;
  padding: 26px 22px 18px;
  border-radius: 24px;
  background: var(--cream);
  box-shadow: var(--shadow-l);
  text-align: center;
  animation: pop-in var(--dur-m) var(--ease) both;
}
.is-sheet .dialog {
  max-width: var(--maxw);
  border-radius: 28px 28px 0 0;
  padding: 12px 22px calc(18px + var(--safe-b));
  animation: sheet-in var(--dur-m) var(--ease) both;
}
.is-sheet .dialog::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 4px;
  background: var(--line-strong);
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}
@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}
.dialog__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--burgundy-soft);
  color: var(--burgundy);
}
.dialog__icon svg {
  width: 26px;
  height: 26px;
}
.dialog__title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
}
.dialog__body {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.65;
}
.dialog__actions {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}
.dialog__actions.is-row {
  grid-template-columns: 1fr 1fr;
}
.dialog__actions .btn {
  min-height: 50px;
  padding: 0 12px;
  font-size: 15px;
}

/* ── 토스트 ─────────────────────────────────────── */
.toast-wrap {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  bottom: calc(132px + var(--safe-b));
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 24px;
}
.toast {
  max-width: 340px;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(22, 32, 52, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-m);
  animation: toast-in var(--dur-m) var(--ease) both;
}
.toast.is-out {
  animation: fade-out var(--dur-s) both;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ── 체크박스 행 ────────────────────────────────── */
.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 44px;
  padding: 10px 0;
  text-align: left;
  font-size: 14.5px;
  line-height: 1.5;
  cursor: pointer;
}
.check-row input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--burgundy);
}
.quote-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.65;
  text-align: left;
  white-space: pre-line;
  color: var(--ink);
}

/* 공통 아이콘 크기 */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.chip .icon {
  width: 16px;
  height: 16px;
}
/* 화면 전환 시 제목에 주는 프로그램 포커스는 표시하지 않음 */
h1[tabindex='-1']:focus {
  outline: none;
}
/* 모달이 열려 있으면 토스트를 위쪽에 표시 (버튼 가림 방지) */
#app:has(.overlay) .toast-wrap {
  bottom: auto;
  top: calc(var(--topbar-h) + var(--safe-t) + 12px);
}
