/* ロゴの 2 色を面で使う。光沢やグラデーションには頼らない。 */
:root {
  --amber:      #e8b04b;
  --amber-deep: #cf9526;
  --amber-pale: #f6dfae;
  --ink:        #2a2926;
  --ink-soft:   #6b665c;
  --paper:      #fdfbf6;
  --forest:     #1f4a3d;

  --radius: 4px;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--amber);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

/* 画面ごとに地の色を変え、めくる感覚を出す */
body[data-screen="register"] { background: var(--paper); }
body[data-screen="result"]   { background: var(--ink); color: var(--paper); }

body[data-screen="result"] .app {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}

/* 動作確認中であることを、どの画面でも隠れない位置で示す */
.preview-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0;
  padding: .625rem 1rem;
  font-size: .8125rem;
  font-weight: 700;
  text-align: center;
  color: var(--paper);
  background: var(--forest);
}

.app {
  max-width: 32rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.screen { display: none; }
.screen.is-active { display: block; }

/* ---------- 見出し ---------- */

.hero { padding-bottom: 2.5rem; }
.hero--compact { padding-bottom: 1.25rem; }

.hero__logo {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.5rem;
  padding: .4375rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.hero__eyebrow {
  margin: 0 0 1.25rem;
  padding-bottom: .625rem;
  font-size: .9375rem;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--ink);
}

.hero__title { margin: 0; }

.hero__title-line {
  display: block;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.hero__title-line:first-child { margin-bottom: -.25rem; }

.hero__figure {
  display: flex;
  align-items: baseline;
  gap: .1em;
}

.hero__amount {
  font-size: clamp(3.5rem, 18vw, 5.25rem);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}

.hero__yen {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0;
}

.hero__title--sm {
  font-size: clamp(1.375rem, 6vw, 1.875rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.hero__lede {
  margin: 1.5rem 0 0;
  font-size: .9375rem;
  max-width: 24rem;
  /* 設定した改行をそのまま活かす */
  white-space: pre-line;
}

.hero__lede strong {
  font-weight: 800;
  border-bottom: 3px solid var(--ink);
}

/* 金額のラインナップ。2 列に並べて 1 つずつを大きく見せる */
.hero__badges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .4375rem;
  margin-top: 1.75rem;
}

.badge {
  padding: .625rem .75rem;
  font-size: .9375rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
  background: var(--ink);
  border-radius: var(--radius);
}

.badge--muted {
  color: var(--ink-soft);
  background: transparent;
  border: 2px solid var(--ink-soft);
}

/* ---------- ステップ ---------- */

.steps {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
}

.steps__dot,
.steps__bar {
  height: 5px;
  background: rgba(42, 41, 38, .2);
}

.steps__dot { width: 5px; }
.steps__bar { width: 2.25rem; }
.steps__dot.is-done, .steps__bar.is-done { background: var(--ink); }
.steps__dot.is-current { width: 1.25rem; background: var(--ink); }

/* ---------- カード ---------- */

.card {
  padding: 1.5rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--ink);
}

.card + .card { margin-top: 1.5rem; }

body[data-screen="register"] .card { background: #fff; }

body[data-screen="result"] .card {
  background: var(--ink);
  border-color: var(--paper);
  box-shadow: 5px 5px 0 var(--amber);
}

.card__title {
  margin: 0 0 1.375rem;
  padding-bottom: .625rem;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .1em;
  border-bottom: 2px solid var(--ink);
}

body[data-screen="result"] .card__title { border-color: var(--paper); }

/* ---------- フォーム ---------- */

.field + .field { margin-top: 1.375rem; }

.field label {
  display: block;
  margin-bottom: .5rem;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.field__input {
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.field__input:focus-within {
  background: var(--amber-pale);
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.field__prefix {
  padding-left: .8125rem;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  padding: .8125rem;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
}

.field input::placeholder { color: rgba(107, 102, 92, .55); font-weight: 500; }
.field input:read-only { color: var(--ink-soft); }
.field__input:has(input[aria-invalid="true"]) { background: #ffe4de; }

.hint {
  margin: .5rem 0 0;
  font-size: .78125rem;
  color: var(--ink-soft);
}

.hint--center { text-align: center; margin-top: 1rem; }

.check {
  display: flex;
  gap: .6875rem;
  align-items: flex-start;
  margin-top: 1.375rem;
  font-size: .875rem;
  line-height: 1.6;
  cursor: pointer;
}

.check input { position: absolute; opacity: 0; width: 0; height: 0; }

.check__box {
  position: relative;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: .1875rem;
  background: var(--paper);
  border: 2px solid var(--ink);
}

.check__box::after {
  content: "";
  position: absolute;
  top: .125rem;
  left: .3125rem;
  width: .3125rem;
  height: .625rem;
  border: solid var(--paper);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .12s var(--ease);
}

.check input:checked + .check__box { background: var(--ink); }
.check input:checked + .check__box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check__box { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- ボタン ---------- */

.btn {
  display: block;
  width: 100%;
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--amber-deep);
  cursor: pointer;
  transition: transform .1s var(--ease), box-shadow .1s var(--ease);
}

.btn:hover:not(:disabled) { transform: translate(1px, 1px); box-shadow: 3px 3px 0 var(--amber-deep); }
.btn:active:not(:disabled) { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--amber-deep); }

.btn:disabled {
  color: var(--ink-soft);
  background: transparent;
  box-shadow: none;
  cursor: not-allowed;
}

.btn__shine { display: none; }

body[data-screen="register"] .btn { box-shadow: 4px 4px 0 var(--amber); }

.btn--spin {
  margin-top: 2rem;
  padding: 1.25rem;
  font-size: 1.125rem;
  letter-spacing: .1em;
}

/* ---------- 確率表 ---------- */

.odds__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .5rem;
}

/*
 * 行そのものを盤面の色で塗る。数字を並べるより、
 * どの金額がどの面かが一目で結びつく。
 */
.odds__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem .9375rem 1.0625rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  animation: odds-in .34s var(--ease-hard) both;
}

/* 行は左からずれて入る。透過は使わない */
@keyframes odds-in {
  from { transform: translateX(-14px); }
  to   { transform: none; }
}

/* 確率は行の下端で示す。文字の上に重ねると読めなくなる */
.odds__fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 6px;
  background: currentColor;
  opacity: .55;
  animation: odds-fill .7s var(--ease-hard) both;
}

@keyframes odds-fill {
  from { width: 0 !important; }
}

.odds__amount {
  flex: 1;
  font-size: 1.1875rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.odds__yen { font-size: .8125rem; font-weight: 700; margin-left: .125rem; }

.odds__pct {
  font-size: 1.125rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* 最高額の行だけ厚くして、目が最初にそこへ行くようにする */
.odds__row--top {
  padding-top: 1.125rem;
  padding-bottom: 1.3125rem;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}

.odds__row--top .odds__amount { font-size: 1.4375rem; }
.odds__row--top .odds__pct { font-size: 1.25rem; }

.odds__row--soldout { opacity: .4; }
.odds__row--soldout .odds__amount { text-decoration: line-through; }
.odds__row--soldout .odds__pct { font-size: .8125rem; font-weight: 700; }

.odds__loading {
  padding: .8125rem 0;
  color: var(--ink-soft);
  font-size: .875rem;
}

/* ---------- ルーレット ---------- */

.wheel {
  position: relative;
  width: min(22rem, 90vw);
  margin: 0 auto;
  aspect-ratio: 1;
}

.wheel canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.wheel__halo { display: none; }

.wheel__pointer {
  position: absolute;
  top: -3.5%;
  left: 50%;
  z-index: 3;
  width: 1.5rem;
  height: 1.875rem;
  transform: translateX(-50%);
  transform-origin: 50% 10%;
  background: var(--ink);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.wheel__pointer.is-ticking { animation: tick .08s steps(2, end); }

@keyframes tick {
  50% { transform: translateX(-50%) rotate(-13deg); }
}

.wheel__hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 25%;
  height: 25%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.wheel__hub img { width: 58%; height: 58%; }

.wheel__flash {
  position: absolute;
  inset: -6%;
  z-index: 4;
  border: 6px solid var(--ink);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.wheel__flash.is-firing { animation: ring .42s steps(3, end); }

/* にじませず、輪が段階的に開いて消える */
@keyframes ring {
  0%   { opacity: 1; transform: scale(.94); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* ---------- 抽選から結果への間 ---------- */

/*
 * 盤が止まってから結果を出すまでに一拍置く。
 * 画面がそのまま切り替わると、何が起きたのか分からないまま結果だけが現れる。
 */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
}

.curtain.is-closing { animation: curtain-close .55s var(--ease) forwards; }
.curtain.is-opening { animation: curtain-open .5s var(--ease) forwards; }

@keyframes curtain-close {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes curtain-open {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.curtain__word {
  margin: 0;
  font-size: clamp(3rem, 16vw, 4.5rem);
  font-weight: 900;
  letter-spacing: .1em;
  color: var(--amber);
  opacity: 0;
}

.curtain.is-closing .curtain__word { animation: word-in .5s var(--ease) .15s forwards; }

@keyframes word-in {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 結果 ---------- */

/*
 * 結果が出た瞬間に、盤面の色の帯が画面を横切る。
 * 粒を撒く演出は、面と線で作った画面から浮くので採らない。
 */
.burst {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

.burst span {
  position: absolute;
  left: 0;
  width: 100%;
  transform: translateX(-100%);
}

.burst span:nth-child(1) { top: 14%; height: 3.25rem; background: var(--amber); }
.burst span:nth-child(2) { top: 30%; height: 1.75rem; background: var(--paper); }
.burst span:nth-child(3) { top: 46%; height: 3rem;    background: var(--forest); }
.burst span:nth-child(4) { top: 60%; height: 2.25rem; background: var(--amber-deep); }
.burst span:nth-child(5) { top: 73%; height: 1.25rem; background: var(--paper); }
.burst span:nth-child(6) { top: 85%; height: 2.75rem; background: var(--amber); }

/* 奇数は左から、偶数は右から。すれ違わせて一度だけ画面を走らせる */
.burst.is-firing span:nth-child(odd)  { animation: sweep-right .62s var(--ease-hard) both; }
.burst.is-firing span:nth-child(even) { animation: sweep-left .62s var(--ease-hard) both; }

.burst.is-firing span:nth-child(2) { animation-delay: .05s; }
.burst.is-firing span:nth-child(3) { animation-delay: .1s; }
.burst.is-firing span:nth-child(4) { animation-delay: .04s; }
.burst.is-firing span:nth-child(5) { animation-delay: .12s; }
.burst.is-firing span:nth-child(6) { animation-delay: .08s; }

@keyframes sweep-right {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

@keyframes sweep-left {
  from { transform: translateX(100%); }
  to   { transform: translateX(-100%); }
}


.result__logo {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.5rem;
  padding: .4375rem;
  background: var(--paper);
  border: 2px solid var(--amber);
  border-radius: var(--radius);
}

.result__eyebrow {
  margin: 0 0 .75rem;
  padding-bottom: .625rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--amber);
  border-bottom: 2px solid var(--amber);
}

.result__heading { margin: 0; line-height: .95; }

.result__amount {
  display: inline-block;
  font-size: clamp(4rem, 22vw, 6.5rem);
  font-weight: 900;
  letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
}

/* 数え上げの最後で一度だけ、面がずれて戻る */
.result__amount.is-landed { animation: land .28s var(--ease-snap); }

@keyframes land {
  0%   { transform: translate(0, 0); }
  40%  { transform: translate(-5px, 5px); }
  100% { transform: translate(0, 0); }
}

/* 最高額のときだけ、見出しを地の色ごと反転させて点滅させる */
.result--top .result__eyebrow { animation: flip-eyebrow .9s steps(1, end) 4; }

@keyframes flip-eyebrow {
  0%, 49%   { color: var(--amber); background: transparent; }
  50%, 100% { color: var(--ink); background: var(--amber); }
}

.result__yen {
  font-size: .3em;
  font-weight: 800;
  margin-left: .1em;
  color: var(--paper);
}

.result__caption {
  margin: 1.25rem 0 0;
  font-size: 1.0625rem;
  font-weight: 800;
}

.result__meta {
  display: grid;
  gap: .5rem;
  margin: 2.25rem 0 1.5rem;
  padding: 1.125rem 1.25rem;
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius);
}

.result__meta > div { display: flex; justify-content: space-between; gap: 1rem; }
.result__meta dt { margin: 0; font-size: .8125rem; color: var(--amber-pale); }
.result__meta dd { margin: 0; font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.result__next { text-align: left; }

.flow { margin: 0; padding: 0; list-style: none; display: grid; gap: .875rem; }

.flow li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  font-size: .875rem;
  line-height: 1.65;
}

.flow strong { color: var(--amber); font-weight: 700; }

.flow__num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: .75rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--amber);
}

.result__next .hint { margin-top: 1.25rem; }

/* 濃い地では補助テキストも読める明るさにする */
body[data-screen="result"] .hint { color: var(--amber-pale); opacity: .75; }
body[data-screen="result"] .flow li { color: var(--paper); }

/* ---------- エラー ---------- */

.alert {
  margin: 1.375rem 0 0;
  padding: .8125rem .9375rem;
  font-size: .875rem;
  font-weight: 700;
  color: var(--paper);
  background: #8c2f22;
  border-radius: var(--radius);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
