@property --hue { syntax: '<number>'; inherits: true; initial-value: 0; }

:root {
  --ease: cubic-bezier(0.42, 0, 0.58, 1);
  --ease-land: cubic-bezier(0.5, 0, 0.1, 1);
  --bg: #0a0612;
  --ink: #fff;
  --ink-dim: rgba(255, 255, 255, 0.62);
  --pink: #ff2d95;
  --yellow: #ffe14d;
  --cyan: #27e8ff;
  --violet: #8b5cff;
  --gray: #8a8599;
  --card: rgba(255, 255, 255, 0.07);
  --card-line: rgba(255, 255, 255, 0.16);
  /* JS が毎フレーム / 毎ビート書き換える */
  --pulse: 0;
  --heat: 0;
  --broken: 0;
  --hue: 0;
  transition: --hue 0.36s var(--ease);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
}

body {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  font-weight: 800;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
input, textarea { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }

.display { font-family: "Dela Gothic One", "Hiragino Sans", system-ui, sans-serif; font-weight: 400; letter-spacing: 0.01em; }
.c-yellow { color: var(--yellow); }
.c-pink { color: var(--pink); }

/* ---------- 背景 ---------- */
.bg {
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 28% 30%, hsl(calc(322 + var(--hue)) 100% 58% / 0.55), transparent 70%),
    radial-gradient(42% 36% at 72% 68%, hsl(calc(190 + var(--hue)) 100% 52% / 0.42), transparent 70%),
    radial-gradient(30% 28% at 70% 22%, hsl(calc(52 + var(--hue)) 100% 60% / calc(0.1 + var(--heat) * 0.3)), transparent 70%);
  opacity: calc(0.55 + var(--heat) * 0.45);
  transform: scale(calc(1 + var(--pulse) * 0.05));
  will-change: transform;
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: #fff;
  opacity: calc(var(--pulse) * (0.015 + var(--heat) * 0.06));
}

.is-fever .flash { background: var(--yellow); opacity: calc(var(--pulse) * 0.12); }

/* リズム崩壊中は色が抜ける */
.is-broken #app, .is-broken .bg {
  filter: grayscale(calc(var(--broken) * 0.9)) contrast(calc(1 - var(--broken) * 0.15));
}

/* ---------- 画面 ---------- */
#app {
  position: fixed;
  inset: 0;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease), visibility 0s linear 0.45s;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s var(--ease), visibility 0s;
}

/* ---------- タイトル ---------- */
.title-wrap {
  margin: auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.title-kicker, .result-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--ink-dim);
}

.logo {
  margin: 0;
  font-size: clamp(56px, 19vw, 104px);
  line-height: 0.92;
  display: flex;
  flex-direction: column;
  background: linear-gradient(100deg, var(--pink), var(--yellow) 55%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-beat 0.968s var(--ease) infinite;
}

.logo-line { white-space: nowrap; }
.logo-line:nth-child(2) { padding-left: 0.5em; }
.logo-star { display: inline-block; font-size: 0.6em; vertical-align: 0.35em; }

@keyframes logo-beat {
  0% { transform: scale(1.04); }
  20% { transform: scale(1); }
  50% { transform: scale(1.025); }
  70%, 100% { transform: scale(1); }
}

.title-lead { margin: 4px 0 0; font-size: 17px; }

.title-rules {
  list-style: none;
  margin: 6px 0 10px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.9;
  color: var(--ink-dim);
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 18px;
}

.title-rules b { color: var(--ink); font-weight: 800; }

.start-btn {
  min-width: 240px;
  min-height: 68px;
  padding: 0 32px;
  font-size: 24px;
  border: 0;
  border-radius: 999px;
  color: #1a0010;
  background: linear-gradient(100deg, var(--pink), var(--yellow));
  box-shadow: 0 10px 40px rgba(255, 45, 149, 0.45);
  transition: transform 0.18s var(--ease);
}

.start-btn:active { transform: scale(0.96); }
.start-btn--small { min-height: 60px; font-size: 20px; }
.title-note { margin: 0; font-size: 12px; font-weight: 500; color: var(--ink-dim); }

/* ---------- HUD ---------- */
.hud { display: flex; flex-direction: column; gap: 10px; }

.hud-row { display: flex; justify-content: space-between; align-items: flex-end; padding-right: 48px; }

.hud-label { display: block; font-size: 10px; letter-spacing: 0.3em; color: var(--ink-dim); }
.hud-score .display { font-size: 22px; font-variant-numeric: tabular-nums; }

.hud-combo { text-align: right; }
.hud-combo .display {
  display: block;
  font-size: 34px;
  line-height: 1;
  color: var(--yellow);
  transform: scale(calc(1 + var(--pulse) * 0.08));
  transform-origin: right bottom;
}
.hud-combo.is-zero .display { color: var(--gray); }

.progress { display: flex; gap: 4px; }
.progress i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.3s var(--ease);
}
.progress i.done { background: var(--cyan); }
.progress i.skipped { background: var(--gray); }
.progress i.now { background: var(--ink); }

.gauge {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.gauge-fill {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--violet), var(--pink), var(--yellow));
  transition: transform 0.3s var(--ease);
}

.is-fever .gauge-fill { background: linear-gradient(90deg, var(--yellow), #fff, var(--yellow)); }

.gauge-label {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(0, 0, 0, 0.55);
  mix-blend-mode: normal;
}

/* ---------- 設問カード ---------- */
.stage { position: relative; flex: 1; min-height: 0; }

.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 8px 0 16px;
  animation: card-in 0.32s var(--ease) both;
}

.card.is-leaving {
  animation: card-out 0.26s var(--ease) both;
  pointer-events: none;
}

@keyframes card-in {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes card-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

.q-meta { margin: 0; font-size: 13px; letter-spacing: 0.25em; color: var(--pink); }

.q-text {
  margin: 0;
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1.3;
  text-shadow: 0 2px 18px rgba(10, 6, 18, 0.7);
  perspective: 600px;
  transform: scale(calc(1 + var(--pulse) * 0.015));
  transform-origin: left center;
}

.is-broken .q-text {
  text-shadow:
    calc(var(--broken) * 3px) 0 rgba(255, 45, 149, 0.8),
    calc(var(--broken) * -3px) 0 rgba(39, 232, 255, 0.8);
}

.opts { display: grid; gap: 10px; }
.opts--choice { grid-template-columns: 1fr; }
.opts--yesno { grid-template-columns: 1fr 1fr; }
.opts--scale { grid-template-columns: repeat(5, 1fr); gap: 6px; }

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 18px;
  border: 1.5px solid var(--card-line);
  border-radius: 18px;
  background: rgba(16, 10, 30, 0.62);
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  animation: opt-in 0.28s var(--ease) both;
  animation-delay: calc(var(--i) * var(--half-beat, 0.24s));
  transition: transform 0.14s var(--ease), opacity 0.4s var(--ease), border-color 0.3s var(--ease);
}

@keyframes opt-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ビートで縁が光る（sharp attack はリズムのため） */
.opt::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  border: 2px solid var(--cyan);
  opacity: calc(var(--pulse) * 0.9);
  pointer-events: none;
  will-change: opacity;
}

.is-broken .opt::after { border-color: var(--gray); }
.is-fever .opt::after { border-color: var(--yellow); }

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

.opt-key {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

.opt-emoji { font-size: 28px; line-height: 1; }
.opt-label { font-size: 18px; z-index: 1; }

.opt-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  transform-origin: left;
  transform: scaleX(0);
  background: rgba(255, 255, 255, 0.12);
  transition: transform 0.5s var(--ease-land);
}

.opt-pct {
  margin-left: auto;
  font-family: "Dela Gothic One", system-ui, sans-serif;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  font-variant-numeric: tabular-nums;
}

.opts--yesno .opt { flex-direction: column; justify-content: center; min-height: 132px; gap: 8px; text-align: center; }
.opts--yesno .opt-emoji { font-size: 40px; }
.opts--yesno .opt-label { font-family: "Dela Gothic One", system-ui, sans-serif; font-weight: 400; font-size: 22px; }
.opts--yesno .opt-pct { margin: 0; }
.opts--yesno .opt-fill { transform-origin: bottom; transform: scaleY(0); }

.opts--scale .opt { flex-direction: column; justify-content: center; min-height: 104px; padding: 0 2px; gap: 6px; text-align: center; border-radius: 16px; }
.opts--scale .opt-emoji { font-size: 32px; }
.opts--scale .opt-label { font-size: 11px; }
.opts--scale .opt-pct { margin: 0; font-size: 14px; }
.opts--scale .opt-key { right: 6px; top: 4px; }
.opts--scale .opt-fill { transform-origin: bottom; transform: scaleY(0); }

/* 回答後：みんなの回答 */
.card.is-revealed .opt { pointer-events: none; animation: none; }
.card.is-revealed .opt::after { opacity: 0; }
.card.is-revealed .opt-pct { opacity: 1; }
.card.is-revealed .opt-fill { transform: scaleX(var(--pct, 0)); }
.card.is-revealed .opts--yesno .opt-fill,
.card.is-revealed .opts--scale .opt-fill { transform: scaleY(var(--pct, 0)); }
.card.is-revealed .opt:not(.is-chosen) { opacity: 0.45; }
.opt.is-chosen { border-color: var(--pink); }
.opt.is-chosen .opt-fill { background: linear-gradient(90deg, rgba(255, 45, 149, 0.55), rgba(255, 225, 77, 0.45)); }
.card.is-skipped .opt { opacity: 0.25; }

.verdict {
  margin: 0;
  min-height: 1.4em;
  font-size: 17px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.card.is-revealed .verdict, .card.is-skipped .verdict { opacity: 1; transform: none; }
.verdict b { color: var(--yellow); font-family: "Dela Gothic One", system-ui, sans-serif; font-weight: 400; font-size: 1.3em; }

/* ---------- 判定・カウント ---------- */
.judge, .count {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 10;
  text-align: center;
  pointer-events: none;
}

.judge { opacity: 0; }
.judge.is-show { animation: judge-pop 0.62s var(--ease) both; }

.judge b {
  display: block;
  font-family: "Dela Gothic One", system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(44px, 14vw, 72px);
  line-height: 1;
  -webkit-text-stroke: 2px rgba(0, 0, 0, 0.35);
}

.judge span { display: block; margin-top: 6px; font-size: 16px; letter-spacing: 0.15em; }
.judge small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-dim); letter-spacing: 0.2em; }

.judge--perfect b { background: linear-gradient(100deg, var(--yellow), #fff, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 0; filter: drop-shadow(0 4px 18px rgba(255, 225, 77, 0.55)); }
.judge--great b { color: var(--cyan); }
.judge--good b { color: #b9f; }
.judge--off b { color: var(--gray); }
.judge--fever b { color: var(--yellow); }
.judge--broken b {
  color: #ddd;
  text-shadow: 4px 0 var(--pink), -4px 0 var(--cyan);
  font-size: clamp(36px, 11vw, 56px);
}

@keyframes judge-pop {
  0% { opacity: 0; transform: scale(1.35); }
  18% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.96) translateY(-10px); }
}

.count { top: 26%; font-size: clamp(88px, 30vw, 160px); line-height: 1; opacity: 0; }
.count.is-show { animation: count-pop 0.46s var(--ease) both; }
.count.is-go { background: linear-gradient(100deg, var(--pink), var(--yellow)); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: clamp(64px, 22vw, 120px); }

@keyframes count-pop {
  0% { opacity: 0; transform: scale(1.5); }
  25% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.92); }
}

/* skip の衝撃 */
.is-shaking .stage, .is-shaking .hud { animation: shake 0.42s linear both; }
@keyframes shake {
  0% { transform: translate(0, 0); }
  12% { transform: translate(-9px, 3px); }
  24% { transform: translate(8px, -4px); }
  36% { transform: translate(-6px, -2px); }
  48% { transform: translate(5px, 3px); }
  60% { transform: translate(-3px, 1px); }
  72% { transform: translate(2px, -1px); }
  100% { transform: translate(0, 0); }
}

/* ---------- レーン ---------- */
.lane-wrap { padding: 4px 0 30px; }
.lane { display: block; width: 100%; height: 56px; }

.skip {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
  padding: 8px 6px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
}
.skip:focus { outline: none; }
.skip:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.4); }
.skip:hover { color: rgba(255, 255, 255, 0.7); }
.screen--play:not(.is-active) .skip { display: none; }

.mute {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 30;
  width: 40px;
  height: 40px;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  font-size: 16px;
}

/* ---------- 結果 ---------- */
.screen--result { overflow-y: auto; }
.result-wrap { margin: auto 0; padding: 24px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }

.rank {
  font-size: clamp(120px, 42vw, 200px);
  line-height: 1;
  background: linear-gradient(160deg, var(--yellow), var(--pink) 60%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rank-in 0.9s var(--ease-land) both;
}

@keyframes rank-in {
  from { opacity: 0; transform: scale(2.2); }
  to { opacity: 1; transform: scale(1); }
}

.rank-title { margin: 0; font-size: 26px; }
.result-meter .display { font-size: 44px; color: var(--yellow); }
.result-meter small { margin-left: 4px; font-size: 14px; color: var(--ink-dim); }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin: 6px 0 0;
}

.result-stats div { padding: 10px 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--card-line); }
.result-stats dt { font-size: 10px; letter-spacing: 0.15em; color: var(--ink-dim); }
.result-stats dd { margin: 4px 0 0; font-family: "Dela Gothic One", system-ui, sans-serif; font-size: 20px; }

.result-broken { margin: 4px 0 0; min-height: 1em; font-size: 14px; color: var(--gray); }
.result-broken:empty { display: none; }

.result-answers {
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
}

.result-answers li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.result-answers .ra-q { color: var(--ink-dim); }
.result-answers .ra-a { grid-column: 1; font-weight: 800; }
.result-answers .ra-j { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 11px; letter-spacing: 0.1em; }
.result-answers li { animation: opt-in 0.36s var(--ease) both; animation-delay: calc(0.5s + var(--i, 0) * 0.07s); }
.ra-crowd { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; margin-top: 4px; }
.ra-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ra-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
  transform-origin: left; transform: scaleX(var(--p, 0));
  animation: bar-in 0.6s var(--ease-land) both;
  animation-delay: calc(0.7s + var(--i, 0) * 0.07s);
}
.ra-crowd b { font-weight: 400; font-size: 14px; min-width: 3em; text-align: right; }
.ra-crowd em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--ink-dim); }
.ra-tag { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.ra-tag--major { color: var(--cyan); }
.ra-tag--mid { color: var(--ink); }
.ra-tag--minor { color: #c3a8ff; }
.ra-tag--rare { color: #1a0010; background: linear-gradient(100deg, var(--yellow), var(--pink)); }
.result-answers li.is-skip .ra-bar i { background: rgba(255, 255, 255, 0.25); }
.result-answers li.is-skip .ra-crowd { grid-template-columns: 1fr auto; }
.result-answers li.is-skip .ra-crowd em { grid-column: 1 / -1; }
.result-crowd { margin: 14px 0 0; font-size: 13px; line-height: 1.7; color: var(--ink-dim); }
.result-crowd b { font-weight: 400; font-size: 1.25em; color: var(--yellow); }
.ra-j--perfect { color: var(--yellow); }
.ra-j--great { color: var(--cyan); }
.ra-j--good { color: #b9f; }
.ra-j--off, .ra-j--skip { color: var(--gray); }

.submit-status { margin: 8px 0 4px; font-size: 12px; font-weight: 500; color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  .logo, .rank, .card, .opt { animation: none !important; }
  .is-shaking .stage, .is-shaking .hud { animation: none; }
}

@media (max-height: 640px) {
  .opt { min-height: 54px; }
  .opts--yesno .opt { min-height: 104px; }
  .opts--scale .opt { min-height: 88px; }
  .card { gap: 14px; }
}

/* ---------- 演出レイヤー ---------- */
.fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fx--bg { z-index: 1; }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(60% 45% at 50% 52%, rgba(10, 6, 18, 0.42), rgba(10, 6, 18, 0) 100%);
}
.fx--fg { z-index: 25; }

/* ---------- 問題文の登場（1文字ずつ・32分刻み・型はランダム） ---------- */
.q-text .ch {
  display: inline-block;
  white-space: pre;
  animation-duration: 0.34s;
  animation-timing-function: var(--ease);
  animation-fill-mode: both;
  animation-delay: calc(var(--ci) * var(--q-step, 0.06s));
}
.q-text[data-anim="drop"] .ch { animation-name: ch-drop; }
.q-text[data-anim="rise"] .ch { animation-name: ch-rise; }
.q-text[data-anim="zoom"] .ch { animation-name: ch-zoom; }
.q-text[data-anim="spin"] .ch { animation-name: ch-spin; }
.q-text[data-anim="flip"] .ch { animation-name: ch-flip; }
.q-text[data-anim="side"] .ch { animation-name: ch-side; }

@keyframes ch-drop { from { opacity: 0; transform: translateY(-0.7em); } to { opacity: 1; transform: none; } }
@keyframes ch-rise { from { opacity: 0; transform: translateY(0.6em) scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes ch-zoom { from { opacity: 0; transform: scale(2.2); } to { opacity: 1; transform: none; } }
@keyframes ch-spin { from { opacity: 0; transform: rotate(-120deg) scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes ch-flip { from { opacity: 0; transform: rotateX(90deg); } to { opacity: 1; transform: none; } }
@keyframes ch-side { from { opacity: 0; transform: translateX(calc(var(--dir) * 0.9em)); } to { opacity: 1; transform: none; } }

/* 選択肢の登場（半拍ずつ・型はランダム） */
.card[data-opt-anim="side"] .opt { animation-name: opt-side-l; }
.card[data-opt-anim="side"] .opt:nth-child(even) { animation-name: opt-side-r; }
.card[data-opt-anim="zoom"] .opt { animation-name: opt-zoom; }
.card[data-opt-anim="flip"] .opt { animation-name: opt-flip; }
.card[data-opt-anim="drop"] .opt { animation-name: opt-drop; }
.card[data-opt-anim="flip"] .opts { perspective: 700px; }

@keyframes opt-side-l { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes opt-side-r { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes opt-zoom { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes opt-flip { from { opacity: 0; transform: rotateX(-80deg); } to { opacity: 1; transform: none; } }
@keyframes opt-drop { from { opacity: 0; transform: translateY(-22px) scale(1.04); } to { opacity: 1; transform: none; } }

/* ---------- サブボタン ---------- */
.sub-btn {
  margin-top: 6px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: rgba(10, 6, 18, 0.45);
  font-size: 14px;
  transition: background 0.2s var(--ease), transform 0.18s var(--ease);
}
.sub-btn:hover { background: rgba(255, 255, 255, 0.1); }
.sub-btn:active { transform: scale(0.97); }

/* ---------- ヒアリング項目エディタ ---------- */
.screen--editor {
  overflow-y: auto;
  gap: 14px;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
  font-weight: 500;
}

.ed-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding-right: 48px; }
.ed-back {
  width: 40px; height: 40px;
  border: 1px solid var(--card-line); border-radius: 50%;
  background: rgba(0, 0, 0, 0.25); font-size: 18px;
}
.ed-kicker { margin: 0; font-size: 10px; letter-spacing: 0.3em; color: var(--pink); font-weight: 800; }
.ed-h1 { margin: 2px 0 0; font-size: 24px; }
.ed-count { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }

.ed-idea {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 0; border-radius: 18px;
  text-align: left;
  color: #1a0010;
  background: linear-gradient(100deg, var(--yellow), var(--pink));
  box-shadow: 0 8px 30px rgba(255, 45, 149, 0.3);
  transition: transform 0.18s var(--ease);
}
.ed-idea:active { transform: scale(0.98); }
.ed-idea-dice { font-size: 30px; transition: transform 0.4s var(--ease); }
.ed-idea:hover .ed-idea-dice { transform: rotate(180deg); }
.ed-idea b { display: block; font-size: 18px; font-weight: 400; }
.ed-idea small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; opacity: 0.75; }

.ed-list { display: flex; flex-direction: column; gap: 8px; }

.ed-item {
  border: 1px solid var(--card-line);
  border-radius: 16px;
  background: rgba(16, 10, 30, 0.78);
  overflow: hidden;
  transition: border-color 0.3s var(--ease);
}
.ed-item.is-open { border-color: rgba(255, 45, 149, 0.6); }
.ed-item.is-flash { animation: ed-flash 0.9s var(--ease); }
@keyframes ed-flash {
  0% { box-shadow: 0 0 0 0 rgba(255, 225, 77, 0.0); background: rgba(255, 225, 77, 0.22); }
  100% { box-shadow: 0 0 0 0 rgba(255, 225, 77, 0); background: rgba(16, 10, 30, 0.78); }
}

.ed-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 10px 14px;
  border: 0; background: none; text-align: left;
}
.ed-no { font-size: 14px; color: var(--pink); min-width: 2.2em; }
.ed-badge {
  flex: none;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em;
  background: rgba(39, 232, 255, 0.16); color: var(--cyan);
}
.ed-badge--yesno { background: rgba(255, 225, 77, 0.16); color: var(--yellow); }
.ed-badge--scale { background: rgba(139, 92, 255, 0.2); color: #c3a8ff; }
.ed-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-warn {
  display: none; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pink); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
}
.ed-item.is-invalid .ed-warn { display: block; }
.ed-chev {
  flex: none; width: 10px; height: 10px;
  border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.3s var(--ease);
}
.ed-item.is-open .ed-chev { transform: rotate(225deg) translate(-2px, -2px); }

.ed-body { display: grid; grid-template-rows: 0fr; }
.ed-item.is-open .ed-body { grid-template-rows: 1fr; animation: ed-open 0.34s var(--ease); }
@keyframes ed-open { from { grid-template-rows: 0fr; opacity: 0; } to { grid-template-rows: 1fr; opacity: 1; } }
.ed-body-inner { min-height: 0; overflow: hidden; }
.ed-item.is-open .ed-body-inner { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 16px; }

.ed-field { display: flex; flex-direction: column; gap: 8px; }
.ed-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--ink-dim); letter-spacing: 0.05em; }
.ed-label small { font-weight: 500; font-size: 11px; opacity: 0.8; }
.ed-counter { margin-left: auto; font-variant-numeric: tabular-nums; }

.ed-text, .ed-opt input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 16px;
  font-weight: 800;
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.ed-text { resize: none; line-height: 1.45; }
.ed-text:focus, .ed-opt input:focus { border-color: var(--cyan); background: rgba(0, 0, 0, 0.5); }
.ed-text::placeholder, .ed-opt input::placeholder { color: rgba(255, 255, 255, 0.3); font-weight: 500; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; gap: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); }
.seg-btn {
  min-height: 40px; border: 0; border-radius: 9px; background: none;
  font-size: 13px; font-weight: 800; color: var(--ink-dim);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.seg-btn.is-on { background: linear-gradient(100deg, var(--pink), var(--violet)); color: #fff; }

.ed-opts { display: flex; flex-direction: column; gap: 6px; }
.ed-opt { display: grid; grid-template-columns: 56px 1fr 36px; gap: 6px; align-items: center; animation: opt-in 0.26s var(--ease) both; }
.ed-opt .ed-emoji { padding: 10px 0; text-align: center; font-size: 22px; }
.ed-del-opt {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); color: var(--ink-dim); font-size: 16px;
}
.ed-del-opt.is-ghost { visibility: hidden; }
.ed-add-opt, .ed-reroll {
  align-self: flex-start;
  min-height: 36px; padding: 0 14px;
  border: 1px dashed rgba(255, 255, 255, 0.3); border-radius: 999px;
  background: none; font-size: 13px; font-weight: 800; color: var(--cyan);
}
.ed-reroll { min-height: 28px; margin-left: auto; padding: 0 10px; font-size: 11px; border-style: solid; }

.ed-stats { display: flex; flex-direction: column; gap: 5px; }
.ed-stat { display: grid; grid-template-columns: 28px 1fr 44px; gap: 8px; align-items: center; }
.ed-stat-emoji { text-align: center; font-size: 16px; }
.ed-stat-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ed-stat-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
  transform-origin: left; transform: scaleX(var(--p));
  animation: bar-in 0.5s var(--ease-land) both;
}
@keyframes bar-in { from { transform: scaleX(0); } }
.ed-stat-num { text-align: right; font-size: 13px; }

.ed-errors { margin: 0; font-size: 12px; color: var(--pink); min-height: 0; }
.ed-errors:empty { display: none; }

.ed-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-actions button {
  min-height: 40px; border: 1px solid var(--card-line); border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); font-size: 12px; font-weight: 800;
}
.ed-actions button:disabled { opacity: 0.3; cursor: default; }
.ed-actions .is-danger { color: var(--pink); border-color: rgba(255, 45, 149, 0.4); }

.ed-adders { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.ed-adders-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ed-adders-row button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; border: 1.5px dashed rgba(255, 255, 255, 0.28); border-radius: 14px;
  background: rgba(16, 10, 30, 0.5); font-size: 15px; font-weight: 800;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.ed-adders-row button:hover { border-color: var(--cyan); background: rgba(39, 232, 255, 0.08); }
.ed-adders-row small { font-size: 10px; font-weight: 500; color: var(--ink-dim); }

.ed-tools { display: flex; gap: 8px; justify-content: center; }
.ed-tools button {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: none; font-size: 12px; color: var(--ink-dim); text-decoration: underline; text-underline-offset: 3px;
}

.ed-footer {
  position: fixed;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(10, 6, 18, 0.96) 60%, rgba(10, 6, 18, 0));
  z-index: 5;
}
.ed-footer .start-btn { width: 100%; }
.ed-footer .start-btn:disabled { opacity: 0.4; }
.ed-status { margin: 0; min-height: 1.2em; font-size: 11px; color: var(--ink-dim); }
.ed-status.is-flash { animation: status-in 0.4s var(--ease); }
@keyframes status-in { from { opacity: 0; transform: translateY(4px); } }

.ed-toast {
  position: fixed;
  left: 50%; bottom: calc(118px + env(safe-area-inset-bottom));
  z-index: 6;
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95); color: #1a0010;
  font-size: 13px; font-weight: 800;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.ed-toast.is-show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.ed-toast button { border: 0; background: none; color: var(--pink); font-weight: 800; font-size: 13px; padding: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  .q-text .ch, .ed-opt, .ed-stat-bar i, .ed-item.is-open .ed-body { animation: none !important; }
}

.screen--editor > * { flex-shrink: 0; }

/* ---------- 公開フォーム（/f/:id） ---------- */
.remote-only { display: none; }
.is-remote .remote-only { display: block; }
.is-remote a.remote-only, .is-remote .sub-btn.remote-only { display: inline-flex; }
.is-remote .home-only { display: none; }

a.start-btn, a.sub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
}
a.start-btn { color: #1a0010; }

.form-head { text-align: center; }
.form-title { margin: 6px 0 0; font-size: clamp(20px, 6vw, 28px); line-height: 1.35; }
.form-countdown {
  margin: 6px 0 0;
  font-size: 18px;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.form-countdown.is-hurry { color: var(--pink); animation: hurry 0.968s var(--ease) infinite; }
@keyframes hurry { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.screen--ended { justify-content: center; }
.ended-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.ended-title { margin: 0; font-size: 15px; color: var(--ink-dim); }
.ended-lead {
  margin: 0;
  font-size: clamp(34px, 11vw, 56px);
  line-height: 1.15;
  background: linear-gradient(100deg, var(--pink), var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ended-text { margin: 0 0 12px; font-size: 14px; font-weight: 500; line-height: 1.7; color: var(--ink-dim); }

/* 結果：集計中 */
.result-answers.no-anim li, .result-answers.no-anim .ra-bar i { animation: none; }
.result-answers li.is-pending .ra-crowd em { color: var(--ink-dim); }
.submit-status .sub-btn { margin-top: 8px; }

/* ---------- エディタ：タイトル・8 問・公開 ---------- */
.ed-title-field { display: flex; flex-direction: column; gap: 8px; }
.ed-title-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--card-line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  font-family: "Dela Gothic One", system-ui, sans-serif;
  font-size: 18px;
  outline: none;
  transition: border-color 0.2s var(--ease);
}
.ed-title-input:focus { border-color: var(--pink); }
.ed-title-input::placeholder { color: rgba(255, 255, 255, 0.3); font-family: "M PLUS Rounded 1c", system-ui, sans-serif; font-size: 15px; }

.ed-count { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-weight: 800; }
.ed-count.is-ready { background: linear-gradient(100deg, var(--cyan), var(--violet)); color: #fff; }

.ed-full { margin: 0; font-size: 12px; color: var(--yellow); min-height: 0; }
.ed-full:empty { display: none; }
.ed-idea:disabled, .ed-adders-row button:disabled { opacity: 0.35; cursor: default; }
.ed-idea:disabled .ed-idea-dice { transform: none; }

.ed-footer-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; width: 100%; }
.ed-footer .ed-preview { margin: 0; min-height: 60px; padding: 0 16px; white-space: nowrap; }
.ed-publish-hint { margin: 0; font-size: 11px; color: var(--ink-dim); text-align: center; }
.screen--editor { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.ed-toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

.ed-published { display: flex; flex-direction: column; gap: 8px; }
.pub-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pub-list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.pub-main {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 10px 14px; border-radius: 12px;
  background: rgba(16, 10, 30, 0.7); border: 1px solid var(--card-line);
  color: inherit; text-decoration: none;
}
.pub-title { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-title:empty::before { content: "（タイトル未取得）"; color: var(--ink-dim); }
.pub-state { font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.pub-state.is-open { color: var(--cyan); }
.pub-copy {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--card-line); border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); font-size: 12px; font-weight: 800;
}

/* ---------- モーダル ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 3, 10, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}
.modal.is-show { opacity: 1; visibility: visible; transition: opacity 0.3s var(--ease), visibility 0s; }
.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--card-line);
  border-radius: 24px;
  background: #140c24;
  transform: translateY(24px);
  transition: transform 0.36s var(--ease-land);
}
.modal.is-show .modal-card { transform: none; }
@media (min-width: 600px) { .modal { align-items: center; } }
.modal-kicker { margin: 0; font-size: 10px; letter-spacing: 0.3em; color: var(--pink); font-weight: 800; }
.modal-title { margin: 4px 0 10px; font-size: 26px; }
.modal-text { margin: 0 0 12px; font-size: 14px; font-weight: 500; line-height: 1.7; color: var(--ink-dim); }
.modal-text b { color: var(--yellow); font-weight: 400; }
.modal-list { margin: 0 0 16px; padding-left: 1.2em; font-size: 14px; font-weight: 500; line-height: 1.9; color: var(--ink-dim); }
.modal-list b { color: var(--ink); }
.modal-actions { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 16px; }
.modal-actions .sub-btn { margin: 0; min-height: 60px; }
.modal-actions .start-btn { min-width: 0; }

/* 共有ブロック */
.share { display: flex; flex-direction: column; gap: 10px; }
.share-url { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.share-url input {
  min-width: 0; padding: 12px; border: 1px solid var(--card-line); border-radius: 12px;
  background: rgba(0, 0, 0, 0.4); font-size: 14px; font-weight: 500; outline: none;
}
.share-url button, .share-actions button, .share-actions a {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--card-line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); font-size: 13px; font-weight: 800; color: inherit; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.share-qr { display: flex; justify-content: center; }
.share-qr canvas { width: 200px; height: 200px; border-radius: 16px; image-rendering: pixelated; }
.share-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.admin-url { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--card-line); }
.admin-url-label { margin: 0 0 8px; font-size: 12px; font-weight: 500; line-height: 1.6; color: var(--ink-dim); }
.admin-url-label b { color: var(--yellow); }

/* Turnstile：人の操作が必要なときだけ画面下に出る */
.turnstile {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translateX(-50%);
  display: none;
}
.turnstile.is-show { display: block; }

/* ---------- 管理画面 ---------- */
.screen--admin { overflow-y: auto; gap: 16px; font-weight: 500; }
.screen--admin > * { flex-shrink: 0; }
.adm-header { padding-right: 48px; }
.adm-title { margin: 4px 0 0; font-size: 24px; line-height: 1.35; }
.adm-error { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.adm-error-text { margin: 0; font-size: 14px; line-height: 1.7; color: var(--pink); }
.adm-body { display: flex; flex-direction: column; gap: 18px; padding-bottom: 32px; }
.adm-summary { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 10px; }
.adm-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; border-radius: 18px; border: 1px solid var(--card-line); background: rgba(16, 10, 30, 0.8);
}
.adm-card--total { align-items: center; justify-content: center; text-align: center; padding: 16px 8px; }
.adm-status { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; background: rgba(255, 255, 255, 0.1); color: var(--ink-dim); }
.adm-status.is-open { background: rgba(39, 232, 255, 0.16); color: var(--cyan); }
.adm-countdown { margin: 0; font-size: 24px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-countdown:empty { display: none; }
.adm-countdown.is-hurry { color: var(--pink); }
.adm-expires { margin: 0; font-size: 11px; line-height: 1.6; color: var(--ink-dim); }
.adm-card .start-btn { min-width: 0; width: 100%; margin-top: 6px; padding: 0 12px; font-size: 18px; white-space: nowrap; }
.adm-card .start-btn:disabled { opacity: 0.35; }
.adm-extend-note { margin: 0; font-size: 11px; color: var(--ink-dim); }
.adm-total { margin: 0; font-size: 40px; color: var(--yellow); line-height: 1.1; }
.adm-card .sub-btn { margin: 0; min-height: 36px; font-size: 12px; }
.adm-results { display: flex; flex-direction: column; gap: 10px; }
.adm-q { padding: 14px; border-radius: 16px; border: 1px solid var(--card-line); background: rgba(16, 10, 30, 0.8); }
.adm-q header { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.adm-q-no { color: var(--pink); font-size: 14px; }
.adm-q-text { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.5; }
.adm-opts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.adm-opts li { display: grid; grid-template-columns: minmax(0, 7em) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.adm-opt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.adm-bar { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.adm-bar i { display: block; height: 100%; background: rgba(255, 255, 255, 0.35); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 0.5s var(--ease-land); }
.adm-opts li.is-top .adm-bar i { background: linear-gradient(90deg, var(--pink), var(--yellow)); }
.adm-num { display: flex; flex-direction: column; align-items: flex-end; min-width: 3.4em; }
.adm-num b { font-weight: 400; font-size: 15px; }
.adm-num small { font-size: 10px; color: var(--ink-dim); }
.adm-q-foot { margin: 10px 0 0; font-size: 11px; color: var(--ink-dim); }
