/*
 * くじカス診断。くじ券モチーフの開始画面・選択肢カード・結果カードだけをここに置く。
 * ページの見出しやボタンは他のページと揃えたいので Tailwind で書く。
 *
 * Tailwind の出力はすべてカスケードレイヤーの中にあるため、
 * レイヤーに属さないこのファイルの指定が読み込み順に関わらず優先される。
 * ここで面倒を見る要素には Tailwind のユーティリティを重ねない。
 *
 * 色はサイト共通の値に合わせる。rose-600 #e11d48 / slate-200 #e2e8f0 /
 * slate-50 #f8fafc / slate-900 #0f172a。金だけは他に前例が無いので占いと揃える。
 */

/* ---------- 開始画面 ---------- */

.shindan-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 0.5rem 2rem;
}

.shindan-eyebrow-mark {
  width: 8px;
  height: 8px;
  border: 2px solid currentcolor;
  border-radius: 2px;
  transform: rotate(8deg);
}

/* くじ券。3 枚を少しずらして重ね、いちばん手前だけ中身を持つ */
.shindan-ticket-visual {
  position: relative;
  width: min(88vw, 350px);
  height: 184px;
  margin: 2.4rem auto 2.1rem;
}

.shindan-ticket {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgb(15 23 42 / 7%);
}

.shindan-ticket-back2 {
  transform: translate(15px, 11px) rotate(4deg);
  opacity: .52;
}

.shindan-ticket-back1 {
  transform: translate(-14px, 8px) rotate(-4deg);
  opacity: .72;
}

.shindan-ticket-front {
  display: grid;
  grid-template-columns: 46px 1fr;
}

.shindan-ticket-side {
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  background: #e11d48;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}

.shindan-ticket-main {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.3rem 1.2rem;
  text-align: left;
}

/* 切り取り線。券だと分かるのはここなので、実券と同じ破線を引く */
.shindan-ticket-main::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  border-left: 2px dashed #fecdd3;
}

.shindan-ticket-kicker {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: .08em;
}

/* 券の幅は画面によって変わる。狭い端末で「どこまで染まってる？」が折れないよう、
   文字サイズも一緒に縮める */
.shindan-ticket-title {
  margin: 0;
  color: #0f172a;
  font-size: clamp(17px, 5.2vw, 25px);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -.04em;
}

/* 7 問あることを、開始画面のうちに形でも伝えておく */
.shindan-ticket-dots {
  display: flex;
  gap: 8px;
}

.shindan-ticket-dots span {
  width: 18px;
  height: 7px;
  background: #e2e8f0;
  border-radius: 99px;
}

.shindan-ticket-dots span:nth-child(-n+2) {
  background: #fda4af;
}

/* ---------- 質問画面 ---------- */

/* 追従ヘッダー（境界線込みで 49px）を除いた高さ。設問が短い問でも
   「次へ」が画面の下端に来て、探さずに押せる */
.shindan-quiz {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 49px);
}

/* 7 分割のバー。今どこにいるかを、数字と形の両方で出す */
.shindan-seg {
  height: 5px;
  background: #cbd5e1;
  border-radius: 99px;
  transition: background-color .2s ease;
}

.shindan-seg.is-done,
.shindan-seg.is-current {
  background: #e11d48;
}

/* 回答済みと今の問を同じ赤で塗ると、どこまで進んだかが読めない */
.shindan-seg.is-current {
  opacity: .55;
}

/* 選択肢。指で押す的が小さいと発売日の店頭では選びにくいので、高さを確保する */
.shindan-option {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 66px;
  padding: 13px 15px;
  text-align: left;
  color: #0f172a;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 0 rgb(15 23 42 / 2%);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.shindan-option:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.shindan-option.is-selected {
  background: #fff1f2;
  border-color: #e11d48;
  box-shadow: 0 0 0 1px rgb(225 29 72 / 8%);
}

.shindan-option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
}

.shindan-option.is-selected .shindan-option-letter {
  color: #fff;
  background: #e11d48;
  border-color: #e11d48;
}

.shindan-option-text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
}

/* 日本語は文字と文字の間ならどこでも折れるので、放っておくと「発売前」が
   「発 / 売前」、「下位賞」が「下 / 位賞」のように語の途中で切れる。
   読点・句点・閉じ括弧の後に置いた <wbr> の位置だけで折らせる。
   ただし 1 文節が 1 行に収まらないときは、はみ出すより切れたほうがましなので、
   そのときだけ従来どおりどこでも折る */
.shindan-question-text,
.shindan-option-text {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ---------- 結果画面 ---------- */

.shindan-result-card {
  position: relative;
  overflow: hidden;
  padding: 30px 22px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgb(15 23 42 / 6%);
}

/* スクリーンショットで X に貼られる前提なので、レベルだけは離れても読める大きさにする */
.shindan-score {
  color: #e11d48;
  font-size: 68px;
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.06em;
}

.shindan-rank-badge {
  display: inline-block;
  margin-top: 18px;
  padding: 6px 10px;
  color: #fff;
  background: #0f172a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: .04em;
}

/* 満点だけの特別扱い。点滅もフラッシュもさせず、金に寄せて粒を 4 つ置くだけにする */
.shindan-result-card.is-legend {
  background: linear-gradient(180deg, #fffdf6 0%, #fff 60%);
  border-color: #ead9a4;
}

.shindan-result-card.is-legend .shindan-score {
  color: #b7791f;
}

.shindan-result-card.is-legend .shindan-rank-badge {
  background: #b7791f;
}

.shindan-sparkles {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.shindan-result-card.is-legend .shindan-sparkles {
  display: block;
}

.shindan-sparkles i {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #d6a23d;
  border-radius: 50%;
  opacity: .5;
  animation: shindan-twinkle 1.9s ease-in-out infinite;
}

.shindan-sparkles i:nth-child(1) { top: 15px; left: 12%; animation-delay: .2s; }
.shindan-sparkles i:nth-child(2) { top: 42px; right: 10%; animation-delay: .7s; }
.shindan-sparkles i:nth-child(3) { top: 96px; left: 7%; animation-delay: 1.1s; }
.shindan-sparkles i:nth-child(4) { top: 118px; right: 7%; animation-delay: .4s; }

@keyframes shindan-twinkle {
  0%, 100% { transform: scale(.5); opacity: .18; }
  50% { transform: scale(1.5); opacity: .75; }
}

/* ---------- 広い画面 ----------
   スマートフォンでは画面いっぱいの 1 枚、PC では中央に置いたカードにする */
@media (width >= 768px) {
  .shindan-intro {
    justify-content: center;
    min-height: 640px;
    padding: 3.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgb(15 23 42 / 6%);
  }

  .shindan-quiz {
    min-height: 640px;
    margin: 2.25rem 0 3rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgb(15 23 42 / 6%);
  }

  /* カードの角から中身がはみ出さないようにする。
     .shindan-quiz を overflow: hidden にすると「次へ」の追従が効かなくなる */
  .shindan-quiz-actions {
    border-radius: 0 0 24px 24px;
  }

  .shindan-result-card {
    padding: 38px 34px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shindan-sparkles i {
    animation: none;
    opacity: .45;
  }

  .shindan-option,
  .shindan-seg {
    transition: none;
  }

  .shindan-option:hover {
    transform: none;
  }
}
