/* 04_confetti-celebration — 架空の催し「ユメハネ工作まつり」の申込み完了。色画用紙の切り紙 */
:root {
  --paper: #fdf1d6;
  --card: #fffdf6;
  --ink: #241a12;
  --ink-soft: #5d4a3a;
  --red: #c9341f;
  --blue: #1b56ad;
  --yellow: #f4b41c;
  --green: #197a50;
  --line: rgba(36, 26, 18, .2);
  --display: "Dela Gothic One", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --maru: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --pad: clamp(20px, 5vw, 88px);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--maru);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.8;
  letter-spacing: .04em;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  line-break: strict;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}
.ph { display: inline-block; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* 紙吹雪の層 */
.confetti { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.confetti canvas { display: block; width: 100%; height: 100%; }
/* 静止表示のときは、文字の下に敷く。頁といっしょに送られるようにする（top は main.js が、そのときの送り位置にする） */
.confetti.is-still { position: absolute; z-index: 1; top: 0; bottom: auto; height: 100%; }
.is-static .confetti { display: none; }   /* 紙吹雪を描けないとき（PixiJS・WebGL なし） */

/* ---------- 全体の組み ---------- */
.entry {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(28px, 5vw, 96px);
  padding: clamp(28px, 6vh, 72px) var(--pad) clamp(20px, 4vh, 48px);
  overflow: hidden;
  overflow: clip;   /* hidden だと、フォーカスの移動などで中身が送られてしまうことがある */
}
/* 地の切り紙（色画用紙を貼った見立て） */
.entry::before, .entry::after { content: ""; position: absolute; z-index: 0; pointer-events: none; }
.entry::before {
  left: -9vw; bottom: -22vw; width: 46vw; height: 46vw;
  border-radius: 50%;
  background: var(--yellow);
}
.entry::after {
  right: -6vw; top: -10vw; width: 30vw; height: 30vw;
  background: var(--blue);
  transform: rotate(18deg);
}
.entry__head, .entry__body { position: relative; z-index: 2; min-width: 0; }

.entry__no {
  margin: 0 0 clamp(10px, 2vh, 20px);
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 13px; letter-spacing: .18em; line-height: 1.4;
}
.entry__no span { padding: 4px 12px 5px; background: var(--ink); color: var(--paper); border-radius: 3px; letter-spacing: .12em; }
.entry__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, min(6.4vw, 12.5vh), 104px);
  line-height: 1.12;
  letter-spacing: .02em;
  white-space: nowrap;
}
.entry__title small {
  display: block;
  margin-top: clamp(10px, 2vh, 20px);
  font-family: var(--maru); font-weight: 700;
  font-size: clamp(15px, 1.5vw, 22px);
  letter-spacing: .3em; line-height: 1.5;
}
.entry__title small::before { content: ""; display: inline-block; width: 1.6em; height: 3px; margin-right: .7em; vertical-align: .32em; background: var(--red); }
.entry__lead { margin: clamp(12px, 2.4vh, 26px) 0 0; font-size: clamp(14px, 1.15vw, 17px); font-weight: 700; letter-spacing: .1em; }

.steps {
  list-style: none; margin: clamp(16px, 3.4vh, 40px) 0 0; padding: 0;
  display: flex; align-items: center; gap: 0;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; line-height: 1.4;
}
.steps li { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.steps li + li::before { content: ""; width: clamp(18px, 2.4vw, 40px); height: 2px; margin: 0 10px; background: var(--ink); opacity: .35; }
.steps__no {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--ink-soft); background: var(--paper);
  font-size: 12px; letter-spacing: 0; line-height: 1;
}
.steps li[aria-current="step"] { color: var(--ink); }
.steps li[aria-current="step"] .steps__no { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.steps li.is-past .steps__no { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- 札（確認・完了） ---------- */
.entry__body { display: grid; justify-items: center; }
.card {
  position: relative;
  width: min(100%, 560px);
  padding: clamp(20px, 3.6vh, 40px) clamp(20px, 3vw, 44px) clamp(18px, 3vh, 34px);
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 10px 10px 0 var(--ink);
}
.card[hidden] { display: none; }
.card__title {
  margin: 0 0 clamp(10px, 2vh, 22px);
  font-family: var(--maru); font-weight: 700;
  font-size: clamp(18px, 1.6vw, 22px);
  letter-spacing: .1em; line-height: 1.5;
  outline: none;
}
.card__title:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; border-radius: 2px; }

.sheet, .ticket { margin: 0; }
.sheet div {
  display: grid; grid-template-columns: 5.2em minmax(0, 1fr); gap: 0 16px;
  padding: clamp(7px, 1.3vh, 12px) 0;
  border-top: 1px dashed var(--line);
}
.sheet div:last-child { border-bottom: 1px dashed var(--line); }
.sheet dt { color: var(--ink-soft); font-size: 13px; letter-spacing: .1em; padding-top: .15em; }
.sheet dd { margin: 0; font-weight: 700; font-size: 15.5px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.sheet dd small, .ticket dd small { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-soft); letter-spacing: .06em; }

.card__actions { margin: clamp(14px, 2.6vh, 26px) 0 0; display: flex; flex-wrap: wrap; gap: 12px; }
.card__note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-soft); }
.card__note[hidden] { display: none; }

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px;
  padding: 10px 24px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 700 15px/1.4 var(--maru);
  letter-spacing: .1em;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s cubic-bezier(.2, .8, .2, 1), background .2s;
  box-shadow: 0 4px 0 var(--ink);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.btn--main { background: var(--red); color: #fff; flex: 1 1 auto; }
.btn[hidden] { display: none; }

/* 完了 */
.card--done { text-align: center; padding-top: 76px; }   /* 旗かざり（最大 64px）の下から始める */
.garland { position: absolute; left: 0; right: 0; top: -2px; width: 100%; height: auto; max-height: 64px; overflow: visible; }
.garland__string { fill: none; stroke: var(--ink); stroke-width: 2; }
.garland__flags path { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.garland__flags path:nth-child(4n + 1) { fill: var(--red); }
.garland__flags path:nth-child(4n + 2) { fill: var(--yellow); }
.garland__flags path:nth-child(4n + 3) { fill: var(--blue); }
.garland__flags path:nth-child(4n + 4) { fill: var(--green); }
.ticket-wrap { position: relative; margin: clamp(20px, 2.6vh, 26px) 0 0; }
.card__stamp {
  position: absolute; right: -16px; top: -36px;
  margin: 0;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px double var(--red); color: var(--red); background: rgba(255, 253, 246, .9);
  font-weight: 700; font-size: 15px; letter-spacing: .1em; text-indent: .1em; line-height: 1;
  transform: rotate(-12deg);
}
.card__title--done {
  margin-bottom: clamp(6px, 1.2vh, 12px);
  font-family: var(--display); font-weight: 400;
  font-size: clamp(23px, min(2.5vw, 5.6vh), 36px);
  letter-spacing: .04em; line-height: 1.35;
}
.card__text { margin: 0; padding: 0 44px; font-size: 14px; line-height: 1.8; }   /* 右上の印の幅だけ、左右をあける */
.ticket {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 2px solid var(--ink); border-radius: 4px;
  background: var(--paper);
  text-align: left;
}
.ticket div { padding: 9px 12px 10px; min-width: 0; }
.ticket div + div { border-left: 2px dashed var(--line); }
.ticket dt { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .1em; line-height: 1.5; }
.ticket dd { margin: 2px 0 0; font-weight: 700; font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.card__actions--done { justify-content: center; }
.card__actions--done .btn { flex: 1 1 200px; }

/* 切り替えの動き（札が下から出る） */
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) rotate(-1.2deg); }
  to { opacity: 1; transform: none; }
}
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-12deg) scale(1.7); }
  60% { opacity: 1; transform: rotate(-12deg) scale(.94); }
  100% { opacity: 1; transform: rotate(-12deg) scale(1); }
}
.card.is-in { animation: card-in .5s cubic-bezier(.2, .8, .2, 1) both; }
.card.is-in .card__stamp { animation: stamp-in .42s cubic-bezier(.3, 1.3, .5, 1) .28s both; }

/* ---------- フッター ---------- */
.foot {
  position: relative; z-index: 1;
  padding: 14px var(--pad) 76px;   /* 左下の案内バーの分をあける */
  background: var(--ink);
  color: #e9dcc0;
  font-size: 12px; letter-spacing: .06em; line-height: 1.7;
}
.foot p { margin: 0; }

/* ---------- 幅が狭いとき ---------- */
@media (max-width: 860px) {
  .entry { grid-template-columns: 1fr; align-items: start; gap: 26px; padding-top: 28px; }
  .entry::before { left: -30vw; bottom: -40vw; width: 90vw; height: 90vw; }
  .entry::after { right: -16vw; top: auto; bottom: 12%; width: 56vw; height: 56vw; }   /* 題字の下に色面を敷かない */
  .entry__title { font-size: clamp(40px, 14.5vw, 84px); }
  .steps { margin-top: 16px; }
  .card { box-shadow: 7px 7px 0 var(--ink); }
  .ticket { grid-template-columns: 1fr; }
  .ticket div { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); gap: 0 12px; align-items: baseline; padding: 7px 12px 8px; }
  .ticket div + div { border-left: 0; border-top: 2px dashed var(--line); }
  .ticket dd { margin: 0; }
}
@media (min-width: 560px) and (max-width: 860px) {
  .entry { gap: 20px; padding-top: 24px; }
  .entry__title { font-size: min(8.8vw, 66px); }
  .entry__title br { display: none; }
  .entry__title small { margin-top: 8px; }
  .entry__lead { margin-top: 8px; }
  .steps { margin-top: 12px; }
}
/* 幅はあるが高さが足りないとき（横長の小さな画面）: 2列にして、最初の画面にボタンまで収める */
@media (min-width: 640px) and (max-width: 860px) and (min-height: 481px) and (max-height: 760px) {
  .entry { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); align-items: center; gap: 24px; padding: 20px var(--pad) 16px; }
  .entry__title { font-size: min(6vw, 9vh, 52px); white-space: nowrap; }
  .entry__title br { display: inline; }
  .entry__title small { font-size: 14px; letter-spacing: .2em; }
  .entry__lead { display: none; }
  .steps { font-size: 12px; letter-spacing: .06em; }
  .steps li + li::before { width: 12px; margin: 0 6px; }
  .card { padding: 18px 20px 16px; }
  .card--done { padding-top: 76px; }
  .sheet div { padding: 6px 0; }
  .ticket { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ticket div { display: block; padding: 6px 10px 7px; }
  .ticket div + div { border-top: 0; border-left: 2px dashed var(--line); }
}
@media (max-width: 480px) {
  .card__stamp { width: 50px; height: 50px; font-size: 13px; right: -12px; top: -30px; }
  .card--done { padding-top: 64px; }
  /* 確認の札を詰める（390×844 で、送る前から「見本のため…」が案内バーの上に出るように） */
  .card--confirm { padding-top: 22px; }
  .sheet div { padding: 8px 0; }
}

/* ---------- 高さが低いとき（ノートPC・スマホ横） ---------- */
@media (min-width: 861px) and (max-height: 700px) {
  .entry { padding-top: 22px; padding-bottom: 18px; }
  .sheet dd { font-size: 14.5px; }
  .btn { min-height: 44px; padding: 8px 22px 9px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  body { font-size: 13.5px; }
  .entry { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); align-items: center; gap: 24px; padding: 14px var(--pad) 12px; }
  .entry__title { font-size: clamp(30px, 10.5vh, 44px); white-space: nowrap; }
  .entry__title br { display: inline; }
  .entry__title small { font-size: 13px; margin-top: 6px; }
  .entry__no { margin-bottom: 6px; font-size: 11.5px; }
  .entry__lead { display: none; }
  .steps { margin-top: 10px; font-size: 11.5px; }
  .steps__no { width: 22px; height: 22px; font-size: 11px; }
  .card { padding: 12px 20px 12px; box-shadow: 6px 6px 0 var(--ink); }
  .card__title { font-size: 15px; margin-bottom: 4px; }
  .sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .sheet div { padding: 4px 0; grid-template-columns: 4.2em minmax(0, 1fr); gap: 0 8px; }
  .sheet div:last-child { border-bottom: 0; }
  .sheet dt { font-size: 11.5px; }
  .sheet dd { font-size: 13px; line-height: 1.5; }
  .sheet dd small { font-size: 11.5px; }
  .card__actions { margin-top: 8px; }
  .btn { min-height: 40px; padding: 6px 18px 7px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
  .card__note { margin-top: 5px; font-size: 11.5px; }
  .card--done { padding-top: 38px; }
  .garland { max-height: 34px; }
  .card__stamp { width: 44px; height: 44px; font-size: 12px; top: -28px; }
  .card__title--done { font-size: 21px; margin-bottom: 2px; }
  .card__text { font-size: 12.5px; padding: 0 36px; }
  .ticket-wrap { margin-top: 14px; }
  .ticket { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ticket div { display: block; padding: 4px 10px 5px; }
  .ticket div + div { border-top: 0; border-left: 2px dashed var(--line); }
  .ticket dt { font-size: 11px; }
  .ticket dd { font-size: 12.5px; }
  /* 「※架空」を、左下の案内バーの右へ出す（送る前から読めるように） */
  .foot { min-height: 58px; padding: 12px var(--pad) 12px 200px; }
}
@media (max-height: 480px) and (orientation: landscape) and (min-width: 601px) {
  .foot { padding-left: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  .card.is-in, .card.is-in .card__stamp { animation: none; }
  .btn { transition: none; }
  .btn:hover, .btn:active { transform: none; }
}
