:root {
  --accent: #f0594c;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #2b2b2e;
  --muted: #8a8a90;
  --line: #ececef;
  --hole: #f1f1f3;
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.06), 0 2px 6px rgba(20, 20, 30, 0.06);
  --shadow-md: 0 2px 4px rgba(20, 20, 30, 0.05), 0 10px 28px rgba(20, 20, 30, 0.08);
  --radius: 18px;
  --cell: 64px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
}

/* プレイ中は画面を固定し、スクロールやバウンドを起こさない */
body.playing {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
}

body.playing main {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

#play {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 22px; /* 下に重ねて出す一言のぶん */
  touch-action: none; /* 盤の上や下からの横スワイプを、ブラウザに取られないように */
}

/* ダブルタップでの拡大をしない（盤の上は touch-action: none で、スワイプと両立させている） */
html,
body,
a,
button {
  touch-action: manipulation;
}

html {
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- ヘッダー ---------- */

.topbar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px 16px 6px;
}

.topbar-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  margin-top: 6px;
  translate: 0 -50%;
  width: 36px;
  height: 36px;
}

.topbar-btn svg {
  width: 20px;
  height: 20px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 15px;
}

.logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 40%, transparent);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* ---------- ステージ一覧 ---------- */

.rules {
  padding: 20px 22px;
  margin-bottom: 24px;
}

.rules h1 {
  margin: 0 0 10px;
  font-size: 15px;
  letter-spacing: 0.08em;
}

.rules ol {
  margin: 0;
  padding-left: 1.3em;
  line-height: 1.85;
  font-size: 14px;
  color: #55555b;
}

.rules strong {
  color: var(--accent);
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--hole);
  box-shadow: inset 0 1px 3px rgba(20, 20, 30, 0.08);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.tab[aria-selected="true"] .tab-count {
  color: var(--accent);
}

.set-desc {
  margin: 12px 4px 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.level-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.level-card:active {
  transform: translateY(0);
}

.level-card .meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.level-card .no {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.level-card .name {
  font-size: 14px;
  font-weight: 600;
}

.level-card .done {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
}

.level-card .done svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.mini {
  display: grid;
  gap: 3px;
  height: 84px;
  align-content: center;
  justify-content: center;
}

.mini i {
  width: var(--mini);
  height: var(--mini);
  border-radius: 50%;
}

.mini i.h {
  background: var(--hole);
}

.mini i.b {
  background: var(--ball);
  box-shadow: inset 0 0 0 1px rgba(20, 20, 30, 0.07); /* 白に近い色（2）が、白いカードに溶けないように */
}

/* ---------- プレイ画面 ---------- */

.play-head {
  display: grid;
  grid-template-columns: 44px 1fr auto 44px 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

button.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

button.icon-btn {
  border: 0;
  padding: 0;
  color: var(--text);
  cursor: pointer;
}

.icon-btn .mute,
.icon-btn.off .wave {
  display: none;
}

.icon-btn.off .mute {
  display: inline;
}

.icon-btn.off {
  color: var(--muted);
}

.play-title {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.level-no {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.level-name {
  font-weight: 700;
  font-size: 17px;
}

.remaining {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.remaining b {
  color: var(--text);
  font-size: 18px;
}

.board-row {
  flex: 1;
  min-height: 0;
  display: flex;
}

.board-wrap {
  position: relative;
  touch-action: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 3D の描画領域は枠の外へはみ出して、影の上に、ヘッダー・メッセージが乗る */
.play-head,
.message {
  position: relative;
  z-index: 2;
}

.board {
  position: relative;
  padding: calc(var(--cell) * 0.22);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  box-sizing: content-box;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* 3D の盤（WebGL）は、盤を置く領域いっぱいに描く */
.board3d {
  position: absolute; /* 位置と大きさは、board-3d.js が決める（枠より画面の端のほうへ大きくはみ出させる） */
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

.hole,
.ball {
  position: absolute;
  top: calc(var(--cell) * 0.22);
  left: calc(var(--cell) * 0.22);
  width: var(--cell);
  height: var(--cell);
}

.hole {
  display: grid;
  place-items: center;
  cursor: default;
}

.hole::before {
  content: "";
  width: 62%;
  height: 62%;
  border-radius: 50%;
  /* 穴：影はつけず、ほんの少し色を落とした平らな丸と、細い縁だけ */
  background: #ececf1;
  box-shadow: 0 0 0 1.5px rgba(20, 20, 30, 0.05);
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.hole.target {
  cursor: pointer;
}

.hole.target::before {
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  animation: breathe 1.2s ease-in-out infinite;
}

.hole.hint::before {
  background: color-mix(in srgb, var(--accent) 30%, #fff);
}

@keyframes breathe {
  50% {
    transform: scale(0.9);
  }
}

.ball {
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.17s cubic-bezier(0.3, 0.7, 0.3, 1.05), opacity 0.14s ease;
  z-index: 1;
}

.ball.moving {
  z-index: 3;
}

.ball span {
  display: grid;
  place-items: center;
  width: var(--ball-size, 86.4%);
  height: var(--ball-size, 86.4%);
  border-radius: 50%;
  font-weight: 700;
  font-size: calc(var(--cell) * 0.24); /* 数字の大きさは、3 桁（128）に合わせて、どの数字でも同じ */
  font-variant-numeric: tabular-nums;
  color: #1f1f23; /* 数字は黒（look.js の INK） */
  /* 色は look.js の数字ごとの色（--ball） */
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%),
    var(--ball, #ffffff);
  box-shadow: 0 1px 1px rgba(20, 20, 30, 0.08), 0 4px 10px rgba(20, 20, 30, 0.14), inset 0 -3px 6px rgba(20, 20, 30, 0.06);
  transition: box-shadow 0.15s ease, transform 0.15s ease, translate 0.15s ease;
}

.ball.selected span {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 18px rgba(20, 20, 30, 0.18);
}

.ball.hint span {
  box-shadow: 0 4px 10px rgba(20, 20, 30, 0.14);
}

.ball.shake span {
  animation: shake 0.3s ease;
}

@keyframes shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

/* ヒントや行き詰まりのときだけ出る一言。場所を取らないよう、画面の下に重ねて出す（盤の大きさは変わらない） */
.message {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  pointer-events: none;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

/* 盤の上の小さな案内：盤の上か下を左へスワイプで 1 手戻す、右へで最初から */
.gestures {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 auto 4px;
  width: min(100%, 420px);
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  transition: opacity 0.2s;
}

.gestures.off {
  opacity: 0.4;
}

.gesture {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s;
}

.gesture svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gesture-how {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gesture.armed {
  color: var(--accent);
}

.gesture.fired {
  animation: fired 0.5s ease-out;
}

@keyframes fired {
  from {
    color: var(--accent);
  }
}

.message.alert {
  color: var(--accent);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.level-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: var(--shadow-sm);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---------- クリア表示 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
  animation: fade 0.25s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.clear-card {
  width: min(340px, 100%);
  padding: 28px 24px 22px;
  text-align: center;
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
}

.clear-ball {
  position: static;
  --cell: 88px;
  --ball-size: 80%;
  margin: 0 auto 8px;
  cursor: default;
}

/* 3D の盤のときは、盤のボールと同じ 3D のボールの絵（丸く切り抜いて、足もとに薄い影） */
.clear-ball.solid canvas {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  box-shadow: 0 2px 3px rgba(20, 20, 30, 0.1), 0 8px 16px rgba(20, 20, 30, 0.14);
}

.clear-card h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: 0.1em;
}

.clear-card p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
}

.clear-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- 設定 ---------- */

/* 設定は、スワイプでスクロールしたり、後ろの画面が動いたりしない。色の組み合わせは、画面の高さに合わせて縮めて、全部を一度に見せる */
#settings {
  touch-action: none;
  overscroll-behavior: none;
}

.settings-card {
  display: flex;
  flex-direction: column;
  width: min(380px, 100%);
  max-height: 100%;
  overflow: hidden;
  padding: 24px 20px 20px;
}

.settings-card h2 {
  margin: 0 0 14px;
  text-align: center;
  font-size: 20px;
  letter-spacing: 0.1em;
}

.settings-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.palette-list {
  display: grid;
  /* 1 行の高さは、画面の高さから、見出しとボタンのぶんを引いて、14 行で分ける（18〜38px） */
  --row: clamp(18px, calc((100dvh - 210px) / 14 - 6px), 38px);
  grid-auto-rows: var(--row);
  gap: 6px;
  margin-bottom: 18px;
}

.palette-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 12px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.palette-opt b {
  flex: none;
  width: 5.5em;
  font-weight: 600;
}

.palette-opt[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--surface);
}

.palette-dots {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.palette-dots i {
  width: min(18px, calc(var(--row) - 8px));
  height: min(18px, calc(var(--row) - 8px));
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%),
    var(--ball);
  box-shadow: 0 1px 1px rgba(20, 20, 30, 0.1), 0 1px 3px rgba(20, 20, 30, 0.16);
}

/* 横向きのスマホなど、14 行が入らないほど背が低いときだけ、設定の中をスクロールできる */
@media (max-height: 520px) {
  .settings-card {
    overflow-y: auto;
  }
}

.palette-opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 横向きのスマホなど背の低い画面では、見出しを省いて盤を大きく取る */
@media (max-height: 520px) {
  body.playing .topbar {
    display: none;
  }

  body.playing main {
    padding-top: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .gesture-how {
    display: none;
  }
}

/* ---------- 動き（画面・ボタン・クリア） ---------- */

/* 画面が切り替わるとき：一覧は下からふわっと、遊ぶ画面は見出しが上から降りてくる */
#home.enter > * {
  animation: rise-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#home.enter > :nth-child(2) {
  animation-delay: 0.05s;
}

#home.enter > :nth-child(3) {
  animation-delay: 0.08s;
}

#play.enter .play-head {
  animation: drop-down 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#play.enter .gestures {
  animation: drop-down 0.4s 0.08s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#play.enter .play-title {
  animation: slide-in 0.45s 0.05s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes drop-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
}

/* ステージ一覧のカードは、1 枚ずつ順に出てくる */
.level-list li {
  animation: card-in 0.46s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(min(var(--i, 0), 16) * 26ms + 0.08s);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

/* 押したときに、ぐっと縮んで、離すとぽんと戻る */
.icon-btn,
.tab,
.palette-opt,
.level-card {
  transition:
    transform 0.18s cubic-bezier(0.3, 0.7, 0.4, 1.5),
    box-shadow 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.icon-btn:active,
.tab:active,
.btn:active {
  transform: scale(0.9);
}

.palette-opt:active,
.level-card:active {
  transform: scale(0.97);
}

.btn {
  transition:
    transform 0.18s cubic-bezier(0.3, 0.7, 0.4, 1.5),
    box-shadow 0.12s ease;
}

/* 残りの数が減ると、数字がぽんと弾む */
.remaining b {
  display: inline-block;
}

.remaining b.bump {
  animation: bump 0.42s cubic-bezier(0.3, 0.7, 0.4, 1.4);
}

@keyframes bump {
  35% {
    transform: scale(1.4);
    color: var(--accent);
  }
}

/* ヒント：電球が光の輪を出す */
#hint.glow {
  animation: glow 0.9s ease-out 2;
}

@keyframes glow {
  from {
    box-shadow: var(--shadow-sm), 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  }
  to {
    box-shadow: var(--shadow-sm), 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

/* 音の切り替え：アイコンが小さく揺れる */
#sound.wiggle svg {
  animation: wiggle 0.42s ease;
}

@keyframes wiggle {
  25% {
    transform: rotate(-14deg) scale(1.1);
  }
  60% {
    transform: rotate(9deg);
  }
}

/* 下に重ねて出す一言は、下からすっと出る */
.message.show {
  animation: toast-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ロゴの赤い丸：最初に一度、ぽんと弾む */
.logo-dot {
  animation: dot-bounce 0.9s 0.2s cubic-bezier(0.3, 0.7, 0.4, 1.4) both;
}

@keyframes dot-bounce {
  0% {
    transform: translateY(-14px) scale(0.6);
    opacity: 0;
  }
  45% {
    transform: translateY(0) scale(1.15, 0.85);
    opacity: 1;
  }
  70% {
    transform: translateY(-4px) scale(0.95, 1.05);
  }
}

/* クリア：カードが弾んで出て、ボールが落ちてきて、紙吹雪が舞う */
.clear-card {
  animation: card-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

@keyframes card-pop {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.86);
  }
}

#clear:not([hidden]) .clear-ball {
  animation: ball-drop 0.8s 0.12s cubic-bezier(0.3, 0.7, 0.3, 1) both;
}

@keyframes ball-drop {
  0% {
    transform: translateY(-60px) scale(0.5);
    opacity: 0;
  }
  45% {
    transform: translateY(0) scale(1.12, 0.88);
    opacity: 1;
  }
  65% {
    transform: translateY(-10px) scale(0.96, 1.04);
  }
  82% {
    transform: translateY(0) scale(1.03, 0.97);
  }
}

#clear:not([hidden]) .clear-card h2 {
  animation: rise-in 0.45s 0.3s cubic-bezier(0.2, 0.8, 0.2, 1.3) both;
}

#clear:not([hidden]) .clear-card p,
#clear:not([hidden]) .clear-actions {
  animation: rise-in 0.45s 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

#clear:not([hidden]) #next {
  animation: next-pulse 1.8s 1.1s ease-in-out infinite;
}

@keyframes next-pulse {
  0%,
  100% {
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  }
  50% {
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 0 10px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  top: -16px;
  left: var(--x);
  width: var(--w);
  height: calc(var(--w) * 1.6);
  border-radius: 2px;
  background: var(--c);
  opacity: 0.95;
  animation: confetti-fall var(--t) var(--delay) cubic-bezier(0.25, 0.4, 0.45, 1) both;
}

.confetti i.round {
  height: var(--w);
  border-radius: 50%;
}

@keyframes confetti-fall {
  from {
    transform: translate(0, 0) rotate(0);
  }
  to {
    transform: translate(var(--dx), 105vh) rotate(var(--r));
  }
}

/* 設定：カードが下から上がり、色の組み合わせが順に並ぶ */
.settings-card {
  animation: card-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.palette-opt {
  animation: rise-in 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 22ms + 0.06s);
}

.palette-opt[aria-checked="true"] .palette-dots i {
  animation: dot-hop 0.5s cubic-bezier(0.3, 0.7, 0.4, 1.5) both;
  animation-delay: calc(var(--j, 0) * 30ms);
}

@keyframes dot-hop {
  40% {
    transform: translateY(-5px) scale(1.15);
  }
}

/* クリア済みの印は、ぽんと出る */
.level-card .done {
  animation: pop 0.4s calc(min(var(--i, 0), 16) * 26ms + 0.3s) cubic-bezier(0.3, 0.7, 0.4, 1.6) both;
}

@keyframes pop {
  from {
    transform: scale(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
}
