/* 九九アプリ — スマホ前提 */
:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --ink: #2b2622;
  --muted: #6b6560;
  --header-border: #ffe0b2;
  --header-util-bg: #fff3e0;
  --accent-dark: #e65100;
  --accent: #ff8a3d;
  --accent-2: #4caf93;
  --danger: #e85a5a;
  --ok: #43a047;
  --shadow: 0 8px 24px rgba(43, 38, 34, 0.12);
  --radius: 16px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    system-ui, sans-serif;
}

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

html {
  height: 100%;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  box-sizing: border-box;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  max-width: 480px;
  margin: 0 auto;
}

/* 上半分：ヘッダー */
.zone-top {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

/* 下半分：問題＋テンキー＋ステータス */
.zone-input {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  overflow: hidden;
  background: var(--bg);
  border-top: 2px solid #ffe0b2;
}

.app-header:not(.app-header--unified) {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 4px;
  padding: 3px 6px;
  background: var(--bg);
}

.app-header--unified {
  flex: 0 0 auto;
  background: var(--bg);
}

.app-header--unified .btn-ghost {
  padding: 4px 8px;
  font-size: 0.72rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid #eceff1;
  color: var(--ink);
  cursor: pointer;
}

.app-header--unified .level-pill {
  font-size: 0.68rem;
}

.app-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  min-width: 0;
}

.app-title-link {
  color: inherit;
  text-decoration: none;
}

.app-title-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-title-link:active {
  opacity: 0.85;
}

.header-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

select,
button {
  font: inherit;
  cursor: pointer;
  border: none;
}

select.mode-select {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: none;
  border: 1px solid #eceff1;
  color: var(--ink);
  min-width: 0;
  max-width: 10rem;
  font-size: 0.75rem;
}

.btn-home {
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: none;
  border: 1px solid #eceff1;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.btn-home:active {
  transform: scale(0.98);
}

.btn-ghost {
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: none;
  border: 1px solid #eceff1;
  color: var(--ink);
}

.btn-quit {
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid #ffcdd2;
  background: #fff8f8;
  color: #c62828;
  cursor: pointer;
}

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

.btn-ghost:active {
  transform: scale(0.98);
}

.level-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe082, #ffcc80);
  color: #5d4037;
  white-space: nowrap;
}

.character-panel {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
  padding: 2px 4px 4px;
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

.speech-bubble {
  flex: 0 0 auto;
  margin: 0 0 2px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
}

.char-stage-block {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.char-stage {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(78vw, 280px);
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.1));
  transition: transform 0.2s ease;
}

.char-name {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1.1;
  color: var(--muted);
  text-align: center;
}

.problem-card {
  margin: 0;
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  padding: 4px 6px;
  text-align: center;
  border-bottom: 1px solid #eceff1;
}

.problem-card.flash-ok {
  animation: flashOk 0.55s ease;
}

.problem-card.flash-ng {
  animation: flashNg 0.55s ease;
}

.problem-text {
  margin: 0;
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.numpad {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 2px 3px;
}

.numpad button {
  min-height: 0;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: none;
  border: 1px solid #eceff1;
  font-size: clamp(0.95rem, 4.5vw, 1.15rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.numpad button.digit:active,
.numpad .btn-wide:active {
  transform: scale(0.97);
}

.numpad .btn-wide {
  grid-column: span 1;
}

.numpad .btn-clear {
  background: #ffebee;
  color: #c62828;
}

.numpad .btn-submit {
  background: linear-gradient(135deg, #81c784, var(--ok));
  color: #fff;
}

.footer-stats {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--muted);
  padding: 2px 6px;
  line-height: 1.1;
  background: var(--surface);
  border-top: 1px solid #eceff1;
}

@media (max-height: 680px) {
  .app-title {
    font-size: 0.85rem;
  }

  .problem-text {
    font-size: 1.2rem;
  }

  .numpad button {
    font-size: 0.88rem;
  }
}

.footer-stats strong {
  color: var(--ink);
  font-weight: 800;
}

/* —— モーダル —— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 34, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(100%, 400px);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.char-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: var(--bg);
  border: 2px solid transparent;
}

.char-pick img {
  display: block;
  width: auto;
  height: auto;
  max-width: 72px;
  max-height: 72px;
  object-fit: contain;
  object-position: center;
}

.char-pick.selected {
  border-color: var(--accent);
  background: #fff3e0;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #ff6b35);
  color: #fff;
  font-weight: 700;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  background: #eceff1;
  color: var(--ink);
  font-weight: 600;
}

.levelup-banner {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -20px) scale(0.9);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd54f, #ffb74d);
  color: #4e342e;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.levelup-banner.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

@keyframes flashOk {
  0% {
    box-shadow: 0 0 0 0 rgba(67, 160, 71, 0.5);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@keyframes flashNg {
  0% {
    box-shadow: 0 0 0 0 rgba(232, 90, 90, 0.45);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@keyframes poyon {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-14px);
  }
  70% {
    transform: translateY(-4px);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-6deg);
  }
  75% {
    transform: rotate(6deg);
  }
}

@keyframes tailWag {
  0%,
  100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(8deg);
  }
}

@keyframes shakeSoft {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px) rotate(-1deg);
  }
  40% {
    transform: translateX(4px) rotate(1deg);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08)) brightness(1);
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(255, 214, 0, 0.85)) brightness(1.08);
  }
}

/* —— 連続正解演出 —— */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.fx-stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.fx-stars span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  font-size: 0;
  background: linear-gradient(135deg, #ffe082, #ffb300);
  clip-path: polygon(
    50% 0%,
    61% 38%,
    100% 50%,
    61% 62%,
    50% 100%,
    39% 62%,
    0% 50%,
    39% 38%
  );
  opacity: 0;
  transform: scale(0.2);
}

.fx-stars span:nth-child(1) {
  --fx-angle: 0deg;
  --fx-dist: 46%;
}
.fx-stars span:nth-child(2) {
  --fx-angle: 45deg;
  --fx-dist: 50%;
}
.fx-stars span:nth-child(3) {
  --fx-angle: 90deg;
  --fx-dist: 46%;
}
.fx-stars span:nth-child(4) {
  --fx-angle: 135deg;
  --fx-dist: 50%;
}
.fx-stars span:nth-child(5) {
  --fx-angle: 180deg;
  --fx-dist: 46%;
}
.fx-stars span:nth-child(6) {
  --fx-angle: 225deg;
  --fx-dist: 50%;
}
.fx-stars span:nth-child(7) {
  --fx-angle: 270deg;
  --fx-dist: 46%;
}
.fx-stars span:nth-child(8) {
  --fx-angle: 315deg;
  --fx-dist: 50%;
}

@keyframes charJump {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-18px) scale(1.03);
  }
  55% {
    transform: translateY(-6px) scale(1.01);
  }
}

@keyframes starBurst {
  0% {
    opacity: 0;
    transform: rotate(var(--fx-angle)) translateY(0) scale(0.2);
  }
  25% {
    opacity: 1;
    transform: rotate(var(--fx-angle)) translateY(calc(-1 * var(--fx-dist)))
      scale(1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--fx-angle))
      translateY(calc(-1.1 * var(--fx-dist))) scale(0.6);
  }
}

@keyframes charGlow {
  0%,
  100% {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1)) brightness(1);
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(255, 193, 7, 0.95))
      drop-shadow(0 0 28px rgba(255, 152, 0, 0.55)) brightness(1.12);
  }
}

@keyframes orbitSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes stampPop {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@keyframes peelHint {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes floatEmoji {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* 3連続：ジャンプ（キャラ別で上書き可） */
.character-panel.fx-tier-3 .char-stage img {
  transform-origin: center bottom;
  animation: charJump 0.52s ease 3;
}

/* 10連続：星 */
.character-panel.fx-tier-10 .fx-stars {
  opacity: 1;
}

.character-panel.fx-tier-10 .fx-stars span {
  animation: starBurst 1.4s ease-out infinite;
}

.character-panel.fx-tier-10 .fx-stars span:nth-child(1) {
  animation-delay: 0s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(2) {
  animation-delay: 0.08s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(3) {
  animation-delay: 0.16s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(4) {
  animation-delay: 0.24s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(5) {
  animation-delay: 0.32s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(6) {
  animation-delay: 0.4s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(7) {
  animation-delay: 0.48s;
}
.character-panel.fx-tier-10 .fx-stars span:nth-child(8) {
  animation-delay: 0.56s;
}

/* 20連続：光る */
.character-panel.fx-tier-20 .char-stage img {
  animation: charGlow 0.85s ease-in-out infinite;
}

.character-panel.fx-tier-20 .fx-stars {
  opacity: 1;
}

.character-panel.fx-tier-20 .fx-stars span {
  background: linear-gradient(135deg, #fff9c4, #ffeb3b);
  animation: starBurst 1.8s ease-in-out infinite;
}

/* —— キャラ別の追加演出 —— */

/* ぱんだるま：ぽよん / 竹 / 竹花火 */
.fx-panda-bamboo.fx-tier-10 .fx-layer::after {
  content: "🎋";
  position: absolute;
  right: 6%;
  bottom: 8%;
  font-size: 1.75rem;
  animation: floatEmoji 0.9s ease-in-out infinite;
}

.fx-panda-firework.fx-tier-20 .fx-layer::before {
  content: "✨🎋✨";
  position: absolute;
  left: 50%;
  top: 6%;
  transform: translateX(-50%);
  font-size: 1.35rem;
  animation: wiggle 0.7s ease-in-out infinite;
}

/* ぽちまる：しっぽ / 骨 / 星走り */
.fx-dog-tail.fx-tier-3 .char-stage img {
  animation: tailWag 0.32s ease 8;
}

.fx-dog-bone.fx-tier-10 .fx-layer::after {
  content: "🦴";
  position: absolute;
  left: 8%;
  bottom: 10%;
  font-size: 1.5rem;
  animation: floatEmoji 0.75s ease-in-out infinite;
}

.fx-dog-stars.fx-tier-20 .fx-layer::before {
  content: "🐾";
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -0.6rem 0 0 -0.6rem;
  font-size: 1.2rem;
  animation: orbitSpin 2.5s linear infinite;
}

/* みけにゃん：ハートしっぽ / 肉球 / 巨大ハート */
.fx-cat-heart-tail.fx-tier-3 .char-stage img {
  animation: wiggle 0.45s ease 5;
}

.fx-cat-heart-tail.fx-tier-3 .fx-layer::after {
  content: "💕";
  position: absolute;
  right: 8%;
  bottom: 12%;
  font-size: 1.25rem;
  animation: floatEmoji 0.8s ease-in-out infinite;
}

.fx-cat-paw.fx-tier-10 .fx-layer::before {
  content: "🐾";
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 2.5rem;
  transform: translate(-50%, -50%) scale(0);
  animation: stampPop 0.65s ease forwards;
}

.fx-cat-mega-heart.fx-tier-20 .fx-layer::before {
  content: "💖";
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  animation: stampPop 0.5s ease forwards, floatEmoji 1s ease-in-out 0.5s infinite;
}

/* とうふさん：ぷるぷる / ネギ / 金豆腐 */
.fx-tofu-shake.fx-tier-3 .char-stage img {
  animation: shakeSoft 0.4s ease 4;
}

.fx-tofu-negi.fx-tier-10 .fx-layer::after {
  content: "🌿✨🌿";
  position: absolute;
  left: 0;
  right: 0;
  top: 4%;
  text-align: center;
  font-size: 1.1rem;
  animation: wiggle 0.65s ease-in-out infinite;
}

.fx-tofu-gold.fx-tier-20 .char-stage img {
  animation: charGlow 0.75s ease-in-out infinite,
    shakeSoft 0.5s ease 2;
  filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.9)) brightness(1.15);
}

/* みかん：皮が開く / 果汁 / 太陽 */
.fx-orange-peel.fx-tier-3 .char-stage img {
  animation: peelHint 0.65s ease 3, charJump 0.52s ease 3;
}

.fx-orange-juice.fx-tier-10 .fx-layer::before {
  content: "✨💧✨";
  position: absolute;
  left: 0;
  right: 0;
  top: 8%;
  text-align: center;
  font-size: 1rem;
  animation: wiggle 0.6s ease-in-out infinite;
}

.fx-orange-sun.fx-tier-20 .fx-layer::after {
  content: "☀️";
  position: absolute;
  right: 6%;
  top: 6%;
  font-size: 1.4rem;
  animation: orbitSpin 3s linear infinite;
}

/* りんご：葉っぱ / 香り / 金りんご */
.fx-apple-leaf.fx-tier-3 .char-stage img {
  animation: wiggle 0.5s ease 6;
}

.fx-apple-scent.fx-tier-10 .fx-layer::before {
  content: "～♪～";
  position: absolute;
  left: 10%;
  top: 10%;
  font-size: 0.95rem;
  color: #8d6e63;
  animation: floatEmoji 1s ease-in-out infinite;
}

.fx-apple-gold.fx-tier-20 .char-stage img {
  filter: drop-shadow(0 0 16px rgba(255, 193, 7, 0.85)) brightness(1.1);
}

/* —— タイムアタック —— */
.timed-bar {
  flex: 0 0 auto;
  padding: 4px 8px 6px;
  background: linear-gradient(180deg, #fff3e0, #ffe0b2);
  border-bottom: 1px solid #ffcc80;
}

.timed-bar-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.timed-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.timed-sec {
  font-size: 1.35rem;
  font-weight: 800;
  color: #e65100;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timed-sec.timed-urgent {
  color: var(--danger);
  animation: timedPulse 0.55s ease-in-out infinite;
}

.timed-unit {
  font-size: 0.75rem;
  color: var(--muted);
}

.timed-best-pill {
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f5e9;
  color: #2e7d32;
}

.timed-progress-track {
  margin-top: 4px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.timed-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #81c784, #43a047);
  transition: width 0.1s linear;
}

.timed-progress-fill.timed-urgent-fill {
  background: linear-gradient(90deg, #ff8a65, #e53935);
}

@keyframes timedPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.timed-modal {
  z-index: 60;
}

.timed-modal-card {
  position: relative;
  width: min(100%, 360px);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, #fffde7, #fff8e1);
  border-radius: 20px;
  padding: 18px 16px 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  text-align: center;
  border: 3px solid #ffd54f;
}

.timed-modal-card.record-burst {
  animation: recordShake 0.45s ease, recordGlow 1.2s ease 2;
}

.timed-modal-card.record-burst::before,
.timed-modal-card.record-burst::after {
  content: "✨";
  position: absolute;
  font-size: 1.4rem;
  animation: confettiFloat 1.4s ease-out infinite;
  pointer-events: none;
}

.timed-modal-card.record-burst::before {
  left: 8%;
  top: 10%;
}

.timed-modal-card.record-burst::after {
  right: 8%;
  top: 14%;
  animation-delay: 0.35s;
}

@keyframes recordShake {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  20% {
    transform: rotate(-2deg) scale(1.02);
  }
  40% {
    transform: rotate(2deg) scale(1.03);
  }
  60% {
    transform: rotate(-1deg) scale(1.02);
  }
}

@keyframes recordGlow {
  0%,
  100% {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(255, 193, 7, 0.5),
      0 20px 50px rgba(255, 152, 0, 0.35);
  }
}

@keyframes confettiFloat {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.6);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(1.1);
  }
}

.timed-modal-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #e65100;
}

.timed-modal-msg {
  margin: 0 0 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-line;
  color: var(--ink);
}

.timed-modal-img {
  display: block;
  width: min(100%, 300px);
  margin: 0 auto 10px;
  border-radius: 12px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.12));
  animation: celebratePop 0.55s ease;
}

@keyframes celebratePop {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.timed-modal-time {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
}

.timed-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .character-panel.fx-playing .char-stage img,
  .character-panel.fx-playing .fx-stars span,
  .character-panel.fx-playing .fx-layer::before,
  .character-panel.fx-playing .fx-layer::after {
    animation: none !important;
  }

  .character-panel.fx-tier-10 .fx-stars,
  .character-panel.fx-tier-20 .fx-stars {
    opacity: 0.6;
  }
}
