/* 족자 포스터(먹·한지·낙관)가 주인공이고, 판정 순간과 PD 말만 예능 자막(노랑 + 검은 테)으로 튄다. */
:root {
  color-scheme: dark;
  --ink: #17120e;
  --ink-raised: #261e17;
  --line: #4a3d31;
  --paper: #f4e9d4;
  --paper-dim: #c9bba3;
  --caption: #ffd400;
  --seal: #ff6a55;
  --on-caption: #17120e;
  --display: 'Black Han Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --gutter: 16px;
  --radius: 12px;
  --ticker: 44px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--paper);
  font: 400 17px/1.6 var(--body);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3, p, figure, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--caption); outline-offset: 2px; }
[data-focus]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.view {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px var(--gutter);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero, .title, .caption-big { font-family: var(--display); font-weight: 400; line-height: 1.25; text-wrap: balance; }
.hero { font-size: clamp(30px, 9vw, 40px); }
.hero em { font-style: normal; color: var(--caption); }
.title { font-size: 26px; }
.caption-big {
  font-size: clamp(26px, 7.5vw, 34px);
  line-height: 1.35;
  color: var(--caption);
  -webkit-text-stroke: 5px #000;
  paint-order: stroke fill;
}
.step { color: var(--paper-dim); font-size: 15px; font-variant-numeric: tabular-nums; }
.fine { color: var(--paper-dim); font-size: 13px; line-height: 1.5; text-align: center; }

/* 첫 화면: 노란 판 위에 큰 제목. 방송 자막의 노랑·검은 테를 판 전체로 키운 것 */
.view-home { padding-top: 0; padding-bottom: 0; }
.back { align-self: flex-start; margin-left: -12px; }
.show {
  position: relative;
  flex: none;
  min-height: 100dvh; /* 첫 화면은 그대로 두고, 배너는 그 아래로 스크롤해서 본다 */
  display: flex;
  flex-direction: column;
  margin: 0 calc(var(--gutter) * -1);
  padding: 24px var(--gutter) calc(var(--ticker) + env(safe-area-inset-bottom) + 8px);
  background: var(--caption);
  color: var(--on-caption);
  overflow: hidden;
}
.show-tag { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; }
.show-tag.is-dark { color: var(--caption); font-size: 14px; }
.show-head { margin-top: 6px; }
.show-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(68px, 24vw, 116px);
  line-height: 1.05;
  white-space: nowrap;
  color: #fff;
  -webkit-text-stroke: 8px #000;
  paint-order: stroke fill;
}
.show-stamp {
  width: fit-content;
  margin-top: 8px;
  padding: 6px 12px;
  background: #e8321e;
  color: #fff;
  font-family: var(--display);
  font-size: clamp(18px, 5.6vw, 26px);
  line-height: 1.25;
  white-space: nowrap;
  transform: rotate(-1.5deg);
  box-shadow: 3px 3px 0 #000;
}
.show-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.show-q { font-family: var(--display); font-size: clamp(16px, 4.8vw, 20px); line-height: 1.3; }
.show-cta {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #000;
  color: var(--caption);
  font-family: var(--display);
  font-size: 16px;
  box-shadow: 2px 2px 0 #e8321e;
}
.show-cta:active { box-shadow: 0 0 0 #e8321e; transform: translate(2px, 2px); }
.show-cta:focus-visible { outline-color: #000; }

/* 결과 예시: 세로로 남은 높이를 모두 쓴다. 다음 장이 살짝 보여 넘길 수 있음을 알리고, 높이가 모자라면 페이지가 스크롤된다 */
.show-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 300px;
  margin: 16px calc(var(--gutter) * -1) 0;
  container-type: size;
}
.show-art {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  height: 100%;
  padding: 2px var(--gutter) 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  cursor: grab;
}
.show-art::-webkit-scrollbar { display: none; }
.show-art.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.show-art:focus-visible { outline-offset: -3px; }
.show-art figure {
  position: relative;
  flex: none;
  /* 높이 기준 2:3. 폭이 좁은 화면에서는 옆 장이 보이도록 폭이 먼저 멈춘다 */
  width: min(calc((100cqh - 14px) * 2 / 3), 86cqw);
  scroll-snap-align: start;
}
.show-art img { width: 100%; height: auto; aspect-ratio: 2 / 3; border: 3px solid #000; box-shadow: 4px 4px 0 #000; }
.show-art figcaption {
  position: absolute;
  inset: auto 0 7%;
  padding: 0 8px;
  text-align: center;
  font-family: var(--display);
  font-size: clamp(22px, 6.5cqh, 38px);
  line-height: 1.2;
  color: var(--caption);
  -webkit-text-stroke: 6px #000;
  paint-order: stroke fill;
}
/* 넘김 단추는 마우스 화면에만. 터치는 스와이프가 있다 */
.show-nav {
  display: none;
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0;
  border: 2px solid var(--caption);
  border-radius: 50%;
  background: #000;
  color: var(--caption);
  font-size: 30px;
  line-height: 1;
}
.show-nav.is-prev { left: 8px; }
.show-nav.is-next { right: 8px; }
.show-nav:disabled { display: none; }
@media (hover: hover) and (pointer: fine) {
  .show-nav:not(:disabled) { display: grid; place-items: center; }
}
.show-dots { display: flex; justify-content: center; margin-top: 2px; }
.show-dots button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; }
.show-dots i { width: 8px; height: 8px; border-radius: 50%; border: 2px solid #000; }
.show-dots i.is-on { background: #000; }

/* 흐르는 대사 띠: 홈과 대기 화면의 아래에 고정. 누르면 멈춘다 */
.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(var(--ticker) + env(safe-area-inset-bottom));
  padding: 0 0 env(safe-area-inset-bottom);
  overflow: hidden;
  border: 0;
  background: #000;
  color: var(--caption);
  font-family: var(--display);
  font-size: 18px;
  white-space: nowrap;
  text-align: left;
}
.view-wait { padding-bottom: calc(var(--ticker) + env(safe-area-inset-bottom) + 16px); }
.ticker-track { display: inline-flex; gap: 28px; animation: ticker 60s linear infinite; }
.ticker.is-paused .ticker-track, .ticker:hover .ticker-track, .ticker:focus-visible .ticker-track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* 방송 대사 인용 */
.quote { margin: 0; padding: 12px 14px; border-left: 6px solid var(--caption); background: #000; }
.quote p { font-family: var(--display); font-size: 21px; line-height: 1.35; color: var(--caption); }
.quote cite { display: block; margin-top: 2px; font-size: 13px; font-style: normal; color: var(--paper-dim); }

/* 입력 */
form { display: flex; flex-direction: column; gap: 12px; }
.row {
  margin: 0;
  padding: 12px;
  border: 2px solid var(--paper);
  border-radius: 4px;
  background: var(--ink-raised);
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  min-width: 0;
}
.photo-pick {
  width: 96px;
  height: 128px;
  border: 1px dashed var(--paper-dim);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 14px;
  color: var(--paper-dim);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.photo-pick.has-photo { border-style: solid; border-color: var(--caption); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick:focus-within { outline: 3px solid var(--caption); outline-offset: 2px; }
.row-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.field label { font-size: 14px; color: var(--paper-dim); }
.field input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  font-size: 17px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field input::placeholder { color: #8f826f; }
.row .error { grid-column: 1 / -1; }
.row-foot { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding-right: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--caption); margin: 0; }
.error { color: var(--seal); font-size: 15px; }

/* 단추 */
.btn {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform 120ms ease-out, opacity 120ms;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.btn-main { background: var(--caption); color: var(--on-caption); font-family: var(--display); font-size: 21px; border: 2px solid #000; box-shadow: 4px 4px 0 #e8321e; }
.btn-main:active { box-shadow: 1px 1px 0 #e8321e; transform: translate(3px, 3px); }
.btn-main[disabled] { box-shadow: none; }
.btn-ghost { background: none; border-color: var(--line); min-height: 48px; }
.btn-sub { background: var(--ink-raised); border-color: var(--paper-dim); min-height: 48px; font-size: 15px; font-weight: 600; }
.phone-field { margin-top: 4px; }
.btn-text { background: none; border: 0; min-height: 44px; padding: 0 12px; color: var(--paper-dim); text-decoration: underline; text-underline-offset: 3px; }
.bar {
  position: sticky;
  bottom: 0;
  margin: auto calc(var(--gutter) * -1) 0;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--ink) 24%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

/* 기다리기·예고 */
.view-wait { justify-content: center; text-align: center; gap: 24px; }
.faces { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.faces img { width: 88px; height: 116px; object-fit: cover; border-radius: 6px; border: 2px solid var(--paper-dim); }
.wait-line {
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.35;
  min-height: 2.7em;
  color: var(--caption);
  -webkit-text-stroke: 4px #000;
  paint-order: stroke fill;
}
.view-opening { justify-content: center; text-align: center; gap: 24px; }

/* 부위 하나씩 */
.face { width: 100%; max-height: 42dvh; object-fit: cover; object-position: center 25%; border-radius: 6px; }
.beats { display: flex; flex-direction: column; gap: 12px; }
.beats li { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 3px solid var(--line); }
.beats li.is-new { border-left-color: var(--caption); animation: rise 240ms ease-out both; }
.beat-part { color: var(--paper-dim); font-size: 14px; }
.beat-see { font-size: 15px; color: var(--paper-dim); }
.beats strong { font-size: 19px; line-height: 1.45; }

/* 판정 카드 */
.card { display: flex; flex-direction: column; gap: 16px; }
.poster { position: relative; }
.poster img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; background: var(--ink-raised); }
.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  padding: 0 12px;
  text-align: center;
  font-family: var(--display);
  font-size: clamp(26px, 8vw, 36px);
  line-height: 1.2;
  color: var(--caption);
  -webkit-text-stroke: 6px #000;
  paint-order: stroke fill;
}
.drawing {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgb(23 18 14 / 0.85);
  font-size: 14px;
  color: var(--paper);
}
.is-stamped .caption { animation: stamp 320ms cubic-bezier(0.2, 1.4, 0.4, 1) both 120ms; }
.is-stamped img { animation: rise 280ms ease-out both; }
@keyframes stamp { from { opacity: 0; transform: scale(1.7); } to { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .is-stamped .caption, .is-stamped img, .beats li.is-new, .ticker-track { animation: none; }
  .btn, .rank { transition: none; }
}

.sticker {
  align-self: center;
  padding: 2px 12px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--caption);
  -webkit-text-stroke: 4px #000;
  paint-order: stroke fill;
  text-align: center;
}
.sticker:empty { display: none; }
.meta { color: var(--paper-dim); font-size: 15px; }
.verdict { font-family: var(--display); font-size: 23px; line-height: 1.4; }
.twist { font-size: 18px; font-weight: 600; }
.about { padding: 12px; border-radius: 8px; background: var(--ink-raised); font-size: 16px; }

.block { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.block h2 { font-family: var(--display); font-weight: 400; font-size: 22px; }
.kicker { color: var(--caption); font-size: 15px; font-weight: 700; }
.parts { display: flex; flex-direction: column; gap: 12px; }
.parts span { color: var(--paper-dim); font-size: 14px; }
.parts p { font-size: 15px; color: var(--paper-dim); }
.parts strong { font-weight: 600; }
.pillars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.pillars div { padding: 8px; border: 1px solid var(--line); border-radius: 8px; text-align: center; font-size: 14px; }
.pillars dt { color: var(--paper-dim); }
.pillars dd strong { display: block; font-size: 26px; line-height: 1.3; font-weight: 500; }
.ohaeng { display: flex; flex-direction: column; gap: 4px; }
.ohaeng li { display: grid; grid-template-columns: 20px 1fr 16px; align-items: center; gap: 8px; font-size: 14px; font-variant-numeric: tabular-nums; }
.ohaeng b { font-weight: 500; text-align: right; }
.engine { font-size: 15px; color: var(--paper-dim); }
.engine strong { display: block; font-size: 14px; font-weight: 600; }
.treason h2 b { color: var(--seal); font-weight: 400; font-variant-numeric: tabular-nums; }
.advice { font-size: 18px; font-weight: 600; }
progress { appearance: none; width: 100%; height: 10px; border: 0; border-radius: 5px; overflow: hidden; background: var(--ink-raised); }
progress::-webkit-progress-bar { background: var(--ink-raised); }
progress::-webkit-progress-value { background: var(--seal); }
progress::-moz-progress-bar { background: var(--seal); }

/* 서열표 */
.group-poster { padding: 16px; text-align: center; border-radius: 4px; background: var(--ink-raised); border: 1px dashed var(--line); color: var(--paper-dim); }
.group-poster.is-ready { padding: 0; border: 0; background: none; }
.group-poster img { width: 100%; border-radius: 4px; }
.decree { padding: 16px; border-radius: var(--radius); background: var(--paper); color: var(--ink); font-size: 18px; font-weight: 700; }
.decree span { display: block; font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.2; color: #a8281a; }
.board { display: flex; flex-direction: column; gap: 8px; }
.rank {
  width: 100%;
  min-height: 112px;
  padding: 8px 12px 8px 8px;
  display: grid;
  grid-template-columns: 28px 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 120ms ease-out;
}
.rank:active { transform: scale(0.99); }
.rank-no { font-family: var(--display); font-weight: 400; font-size: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.rank img { border-radius: 2px; width: 64px; height: 96px; object-fit: cover; }
.rank-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rank-body strong { font-size: 18px; }
.rank-body > span:not(.badges) { font-size: 15px; color: var(--paper-dim); line-height: 1.4; }
.rank-tier { font-size: 14px; color: var(--paper-dim); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badge { padding: 1px 8px; border-radius: 4px; background: var(--caption); color: var(--on-caption); font-size: 13px; font-weight: 700; }
.reveal { font-size: 18px; font-weight: 600; color: var(--seal); }
.closing { font-family: var(--display); font-size: 24px; line-height: 1.35; text-align: center; color: var(--caption); -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
.notice:empty { display: none; }
.bar + .fine { margin-top: -8px; }
.notice { color: var(--caption); font-size: 15px; text-align: center; }

/* 사주냥이 주요 기능 배너 */
.promo { padding-bottom: 24px; }
.promo h2 { font-family: var(--display); font-weight: 400; font-size: 22px; margin-bottom: 12px; }
.promo ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.promo a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 8px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink-raised);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: transform 120ms ease-out, border-color 120ms;
}
.promo a:hover { border-color: var(--caption); }
.promo a:active { transform: scale(0.98); }
.promo img { width: 100%; aspect-ratio: 480 / 382; object-fit: contain; filter: brightness(0) invert(1) drop-shadow(0 0 0.5px #fff); }

/* 맨 아래 법적 고지. 대사 띠가 가리지 않게 아래를 비운다 */
.legal {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px var(--gutter) calc(var(--ticker) + env(safe-area-inset-bottom) + 8px);
  border-top: 1px solid var(--line);
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.6;
}
.legal a { color: inherit; }
.legal-links { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 4px; }
.legal details[open] { flex-basis: 100%; order: 1; }
.legal summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; text-decoration: underline; text-underline-offset: 3px; }
.legal summary::-webkit-details-marker { display: none; }
.legal details p { margin-bottom: 8px; }
