/*
 * 配色は ios/Tenfall/Theme.swift が正本。値を変えるときは両方を揃える。
 * アプリはカードを画像ではなく図形とテキストで描いているので、
 * ここでも同じ方針を取る（スクリーンショット以外に画像素材を持たない）。
 */
:root {
  --bg: #07090c;
  --panel: #0d1116;
  --panel-raised: #141a21;
  --hairline: #232a34;

  --text: #f2f5f9;
  --text-muted: #8a93a2;
  --text-faint: #4a525f;

  --you: #4a9eff;
  --rival: #e5484d;

  --gold: #f2c94c;
  --gold-dim: #8a6d22;

  --card-one: #a9e34b;
  --card-ten: #ef4444;

  --measure: 62rem;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Noto Sans JP", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 数字が主役のゲームなので、桁が揺れないよう等幅数字を既定にする。 */
.num {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--you);
  text-decoration-color: color-mix(in srgb, var(--you) 40%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--you);
}

.wrap {
  width: min(100% - 2.5rem, var(--measure));
  margin-inline: auto;
}

/* ── ヘッダー ───────────────────────────────────────────── */

.site-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.site-head .mark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}

.site-head .mark img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}

.site-head nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
}

.site-head nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-head nav a:hover {
  color: var(--text);
}

/* 言語の切り替え。自動で飛ばさず、押した人だけが移動する。 */
.site-head nav a.lang {
  padding: 0.1rem 0.65rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.site-head nav a.lang:hover {
  border-color: var(--text-faint);
}

/* ── ヒーロー ───────────────────────────────────────────── */

.hero {
  position: relative;
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(3rem, 8vw, 5rem);
  text-align: center;
}

/* アイコンの金の輪を背景に写したもの。中身ではなく空気を作るだけ。 */
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto;
  height: 46rem;
  background:
    radial-gradient(
      42rem 30rem at 50% 34%,
      rgba(242, 201, 76, 0.09),
      transparent 70%
    ),
    radial-gradient(
      26rem 22rem at 22% 46%,
      rgba(169, 227, 75, 0.06),
      transparent 70%
    ),
    radial-gradient(
      26rem 22rem at 78% 46%,
      rgba(239, 68, 68, 0.07),
      transparent 70%
    );
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.kicker {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 11vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.tagline {
  margin: 1.5rem auto 0;
  max-width: 34rem;
  font-size: clamp(1.35rem, 4.4vw, 1.9rem);
  font-weight: 700;
  line-height: 1.5;
}

.tagline .one {
  color: var(--card-one);
}

.tagline .ten {
  color: var(--card-ten);
}

.hero p.lead {
  margin: 1.25rem auto 0;
  max-width: 36rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

/* ── 対の 2 枚（アイコンの構図をそのまま図形で描く） ───────── */

.duel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 2rem);
  margin-block: clamp(2.5rem, 7vw, 4rem);
}

.card {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(7rem, 24vw, 10.5rem);
  aspect-ratio: 5 / 7;
  border-radius: clamp(0.9rem, 2.5vw, 1.35rem);
  border: 1.5px solid var(--edge);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--edge) 16%, var(--panel)),
    var(--panel) 62%
  );
  box-shadow:
    0 0 2.5rem color-mix(in srgb, var(--edge) 22%, transparent),
    inset 0 0 3rem color-mix(in srgb, var(--edge) 10%, transparent);
  font-size: clamp(3.2rem, 11vw, 5rem);
  font-weight: 800;
  color: var(--edge);
  line-height: 1;
}

.card.one {
  --edge: var(--card-one);
  transform: rotate(-7deg);
}

.card.ten {
  --edge: var(--card-ten);
  transform: rotate(7deg);
}

/* 2 枚が触れるところの金の火花。アイコンの中心にあるもの。 */
.spark {
  width: clamp(1.5rem, 5vw, 2.5rem);
  height: clamp(1.5rem, 5vw, 2.5rem);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--gold),
    rgba(242, 201, 76, 0.35) 42%,
    transparent 70%
  );
  flex: none;
}

/* ── 入手ボタン ─────────────────────────────────────────── */

.cta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--panel-raised);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0.75rem var(--gold);
}

.cta small {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ── 節 ─────────────────────────────────────────────────── */

section {
  padding-block: clamp(3.5rem, 9vw, 6rem);
  border-top: 1px solid var(--hairline);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.section-lead {
  margin: 0 0 2.5rem;
  max-width: 40rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

/* ── 手札の帯（アプリの数字チップの再現） ───────────────── */

.hand {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-block: 2rem;
}

.chip {
  display: grid;
  place-items: center;
  width: clamp(2.4rem, 7vw, 3.25rem);
  aspect-ratio: 1;
  border-radius: 0.6rem;
  border: 1px solid var(--hairline);
  background: var(--panel);
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--text);
}

.chip.one {
  border-color: var(--card-one);
  color: var(--card-one);
}

.chip.ten {
  border-color: var(--card-ten);
  color: var(--card-ten);
}

.chip.point {
  border-color: var(--gold-dim);
  background: color-mix(in srgb, var(--gold) 12%, var(--panel));
  color: var(--gold);
}

/* ── 手順 ───────────────────────────────────────────────── */

.steps {
  display: grid;
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.step {
  background: var(--panel);
  padding: 1.75rem;
}

.step .n {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
}

.step h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── 逆転の説明 ─────────────────────────────────────────── */

.upset {
  margin-top: 2.5rem;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 1px solid var(--gold-dim);
  border-radius: 1rem;
  background:
    radial-gradient(
      30rem 16rem at 50% 0%,
      rgba(242, 201, 76, 0.08),
      transparent 70%
    ),
    var(--panel);
  text-align: center;
}

.upset .formula {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 800;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.upset .formula .one {
  color: var(--card-one);
}

.upset .formula .ten {
  color: var(--card-ten);
}

.upset .formula .op {
  color: var(--text-faint);
  font-size: 0.6em;
  font-weight: 600;
}

.upset .formula .bonus {
  color: var(--gold);
}

.upset p {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--text-muted);
  text-wrap: pretty;
}

/* ── 画面 ───────────────────────────────────────────────── */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: clamp(1rem, 3vw, 1.75rem);
}

.shot figure {
  margin: 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
  border: 1px solid var(--hairline);
  background: var(--panel);
}

.shot figcaption {
  margin-top: 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── 特徴 ───────────────────────────────────────────────── */

/* 4 つあるので 2 列に畳む。3 列だと最後の 1 つが取り残される。 */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  gap: 1.5rem;
}

.fact {
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  background: var(--panel);
}

.fact h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.fact p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── フッター ───────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--hairline);
  padding-block: 3rem 4rem;
  color: var(--text-faint);
  font-size: 0.9rem;
}

footer .rows {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: center;
}

footer nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

footer nav a {
  color: var(--text-muted);
  text-decoration: none;
}

footer nav a:hover {
  color: var(--text);
}

/* ── サポートページ ─────────────────────────────────────── */

/* 読みものなので、LP より行を短くする。 */
.doc {
  max-width: 44rem;
  padding-block: clamp(2.5rem, 7vw, 4rem);
}

.doc h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}

.doc .updated {
  color: var(--text-faint);
  font-size: 0.9rem;
  margin: 0 0 3rem;
}

.doc h2 {
  font-size: 1.35rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.doc h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 2rem 0 0.4rem;
}

.doc p,
.doc li {
  color: var(--text-muted);
  text-wrap: pretty;
}

.doc strong {
  color: var(--text);
  font-weight: 600;
}

.doc ul {
  padding-left: 1.25rem;
}

.doc li {
  margin-bottom: 0.5rem;
}

/* 問い合わせ先のボタン。
 *
 * md 側にクラスを書けないので、mailto: を目印にする。本文は普通の
 * マークダウンのリンクのまま書けて、生の HTML を混ぜずに済む。 */
.doc a[href^="mailto:"] {
  display: block;
  margin-top: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  background: var(--panel);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

/* ── 動き ───────────────────────────────────────────────
 *
 * すべて `prefers-reduced-motion: no-preference` の中にある。動きを切っている
 * 人には何も起きず、レイアウトも変わらない。
 *
 * 滑り込みは scroll-driven animation（`animation-timeline: view()`）で書き、
 * `@supports` で囲っている。**囲いの外に opacity: 0 を置かない**のが要点で、
 * 対応していないブラウザでは要素が最初から見えている状態になる。
 * JavaScript は使わない。読むだけのページに実行コードを積む理由がない。
 */
@media (prefers-reduced-motion: no-preference) {
  a,
  .card {
    transition: color 0.15s ease, transform 0.3s ease;
  }

  .card.one:hover {
    transform: rotate(-9deg) translateY(-4px);
  }

  .card.ten:hover {
    transform: rotate(9deg) translateY(-4px);
  }

  /* 読み込み直後。2 枚が外から寄ってきて、触れた瞬間に火花が灯る。
     アイコンの構図がそのまま組み上がる形にしてある。 */
  @keyframes deal-one {
    from {
      opacity: 0;
      transform: translateX(-2.5rem) rotate(-22deg);
    }
    to {
      opacity: 1;
      transform: rotate(-7deg);
    }
  }

  @keyframes deal-ten {
    from {
      opacity: 0;
      transform: translateX(2.5rem) rotate(22deg);
    }
    to {
      opacity: 1;
      transform: rotate(7deg);
    }
  }

  @keyframes ignite {
    from {
      opacity: 0;
      transform: scale(0.2);
    }
    60% {
      opacity: 1;
      transform: scale(1.35);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(0.75rem);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  .card.one {
    animation: deal-one 0.75s cubic-bezier(0.2, 0.9, 0.25, 1) backwards;
  }

  .card.ten {
    animation: deal-ten 0.75s cubic-bezier(0.2, 0.9, 0.25, 1) backwards;
  }

  .spark {
    animation: ignite 0.5s ease-out 0.6s backwards;
  }

  .kicker,
  .hero h1,
  .tagline,
  .hero p.lead,
  .cta {
    animation: rise 0.6s ease-out backwards;
  }

  .kicker {
    animation-delay: 0.05s;
  }
  .hero h1 {
    animation-delay: 0.12s;
  }
  .tagline {
    animation-delay: 0.85s;
  }
  .hero p.lead {
    animation-delay: 0.95s;
  }
  .cta {
    animation-delay: 1.05s;
  }

  /* 手札は左から順に置かれる。10 枚あることが動きで分かる。 */
  .hand .chip {
    animation: rise 0.4s ease-out backwards;
  }

  .hand .chip:nth-child(1) { animation-delay: 0.02s; }
  .hand .chip:nth-child(2) { animation-delay: 0.06s; }
  .hand .chip:nth-child(3) { animation-delay: 0.1s; }
  .hand .chip:nth-child(4) { animation-delay: 0.14s; }
  .hand .chip:nth-child(5) { animation-delay: 0.18s; }
  .hand .chip:nth-child(6) { animation-delay: 0.22s; }
  .hand .chip:nth-child(7) { animation-delay: 0.26s; }
  .hand .chip:nth-child(8) { animation-delay: 0.3s; }
  .hand .chip:nth-child(9) { animation-delay: 0.34s; }
  .hand .chip:nth-child(10) { animation-delay: 0.38s; }

  /* 画面に入ってきたものを持ち上げる。対応していなければ何もしない。 */
  @supports (animation-timeline: view()) {
    @keyframes enter {
      from {
        opacity: 0;
        transform: translateY(1.5rem);
      }
      to {
        opacity: 1;
        transform: none;
      }
    }

    .steps .step,
    .upset,
    .shot,
    .fact,
    #screens > .wrap > h2,
    #about > .wrap > h2 {
      animation: enter linear both;
      animation-timeline: view();
      animation-range: entry 5% cover 28%;
    }

    /* 手札は読み込み時の演出を持っているので、そちらを上書きしない。 */
    .hand .chip {
      animation-timeline: auto;
    }
  }
}

/* 印刷では動きを全部止める。スクロールが無いので、滑り込みを待つ要素が
   透明なまま焼き付いてしまう。 */
@media print {
  *,
  *::before,
  *::after {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
