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

:root {
  --primary: #F06449;
  --primary-light: #F4845F;
  --primary-dark: #D94A33;
  --secondary: #4EBFCF;
  --secondary-light: #6BC9DE;
  --secondary-dark: #2A8FA5;
  --accent: #D4A843;
  --accent-dark: #B8912E;
  --navy: #2C3E50;
  --bg-game: #F5F0E8;
  --bg-card: #FFFFFF;
  --text: #2C3E50;
  --text-light: #6B7B8D;
  --success: #2ECC71;
  --danger: #E74C3C;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 3px 12px rgba(44,62,80,0.1);
  --shadow-lg: 0 6px 24px rgba(44,62,80,0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic Pro", "BIZ UDPGothic", "Yu Gothic", sans-serif;
  font-size: 20px;
  background:
    linear-gradient(rgba(78,191,207,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78,191,207,0.07) 1px, transparent 1px),
    radial-gradient(ellipse at 20% 30%, rgba(78,191,207,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(78,191,207,0.06) 0%, transparent 50%),
    linear-gradient(145deg, #2D4A56 0%, #3B5C6B 40%, #334F5C 100%);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

img { max-width: 100%; height: auto; }
button, input { font: inherit; }

.screen {
  display: none;
  flex-direction: column;
  margin: 0 auto;
  width: 100%;
  max-width: 1100px;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 280px 180px at 2% -4%, rgba(78,191,207,0.22) 58%, transparent 59%),
    radial-gradient(ellipse 200px 150px at 22% -6%, rgba(150,210,170,0.2) 52%, transparent 53%),
    radial-gradient(ellipse 240px 160px at 80% -5%, rgba(78,191,207,0.24) 55%, transparent 56%),
    radial-gradient(ellipse 320px 180px at 50% 106%, rgba(78,191,207,0.26) 55%, transparent 56%),
    radial-gradient(ellipse 180px 130px at 92% 103%, rgba(150,210,170,0.2) 50%, transparent 51%),
    var(--bg-game);
  border-radius: 0;
  border: none;
  /* 3カラム視覚化のため左右にソフトな影 */
  box-shadow: -8px 0 24px -4px rgba(0,0,0,0.4), 8px 0 24px -4px rgba(0,0,0,0.4);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.screen.active { display: flex; }

.screen::before,
.screen::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(255,255,255,0.32) 5px, rgba(255,255,255,0.32) 7px);
}

.screen::before {
  top: -20px;
  left: -10px;
  width: 260px;
  height: 170px;
  border-radius: 30% 70% 60% 40% / 50% 40% 60% 50%;
}

.screen::after {
  bottom: -20px;
  right: 15%;
  width: 280px;
  height: 160px;
  border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%;
}

.screen > * { position: relative; z-index: 1; }

.bg-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.deco-star {
  position: absolute;
  opacity: 0.7;
  animation: twinkle 3s ease-in-out infinite;
}

.ds1 { top: 4%; left: 4%; font-size: 28px; color: var(--accent); }
.ds2 { top: 7%; left: 18%; font-size: 14px; color: var(--secondary); animation-delay: 1.5s; }
.ds3 { top: 5%; right: 18%; font-size: 22px; color: var(--secondary); animation-delay: 0.7s; }
.ds4 { top: 12%; right: 5%; font-size: 18px; color: var(--primary); animation-delay: 2.1s; }
.ds5 { top: 29%; left: 6%; font-size: 24px; color: var(--accent); animation-delay: 1.8s; }
.ds6 { top: 34%; right: 8%; font-size: 16px; color: var(--secondary); animation-delay: 2.5s; }
.ds7 { top: 50%; left: 4%; font-size: 18px; color: var(--secondary); animation-delay: 2.8s; }
.ds8 { top: 60%; right: 4%; font-size: 26px; color: var(--accent); animation-delay: 0.5s; }
.ds9 { top: 76%; left: 5%; font-size: 30px; color: var(--secondary); animation-delay: 1.4s; }
.ds10 { top: 82%; right: 10%; font-size: 18px; color: var(--primary); animation-delay: 1.7s; }
.ds11 { top: 90%; left: 18%; font-size: 12px; color: #C0C8D0; animation-delay: 0.9s; }
.ds12 { top: 92%; right: 20%; font-size: 22px; color: var(--accent); animation-delay: 2.2s; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-large { padding: 20px 40px; font-size: 28px; }
.btn-full { width: 100%; }
.btn:disabled { background: #D1D5DB; color: #8A94A3; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); box-shadow: 0 4px 0 var(--primary-dark), 0 6px 16px rgba(240,100,73,0.25); }
.btn-secondary { background: var(--secondary); box-shadow: 0 4px 0 var(--secondary-dark), 0 6px 16px rgba(58,186,213,0.25); }
.btn-primary:hover:not(:disabled), .btn-secondary:hover:not(:disabled) { transform: translateY(-2px); }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-light); }
.btn:active:not(:disabled) { transform: translateY(2px); }

.top-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.top-header { text-align: center; }

.top-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.top-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 440px;
}

.top-right {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.top-title {
  font-size: 60px;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 0 rgba(58,186,213,0.2);
}

.top-subtitle {
  font-size: 18px;
  color: var(--text-light);
  text-align: center;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.level-selector {
  width: 100%;
  text-align: center;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  box-shadow: var(--shadow);
  border: 2px solid #E0E4E8;
}

.level-label { font-size: 22px; font-weight: 700; color: var(--text); }

#level-display {
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
}

.level-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, #10B981, #FFD700, #FF6B35, #EF4444);
  outline: none;
  margin-top: 10px;
}
.level-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff;
  border: 4px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.level-slider::-moz-range-thumb {
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff;
  border: 4px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.level-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
  position: relative;
}
.level-range-labels span:nth-child(2) {
  position: absolute;
  left: 44.4%;
  transform: translateX(-50%);
}

.top-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.top-buttons-row {
  display: flex;
  gap: 14px;
  width: 100%;
}
.top-buttons-row .btn {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

.brand-link {
  font-size: 17px;
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  margin-top: 4px;
  transition: color 0.2s;
}
.brand-link:hover { color: var(--primary); }

/* プライバシーポリシーへの控えめな誘導リンク */
.policy-link {
  display: inline-block;
  font-size: 13px;
  color: var(--text-light);
  text-decoration: underline;
  text-decoration-color: rgba(107, 123, 141, 0.4);
  text-underline-offset: 3px;
  margin-top: 2px;
  transition: color 0.2s;
}
.policy-link:hover { color: var(--primary); text-decoration-color: var(--primary); }

.anzu-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.anzu-area::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 220px;
  height: 28px;
  background: rgba(44,62,80,0.14);
  border-radius: 50%;
  filter: blur(2px);
}

.anzu { position: relative; z-index: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12)); }

.speech-bubble {
  position: relative;
  z-index: 2;
  max-width: 400px;
  padding: 14px 24px;
  border: 3px solid var(--navy);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--navy);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 3px 0 rgba(44,62,107,0.1);
  margin-bottom: -8px;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid var(--navy);
}

.speech-bubble.sm { max-width: 200px; padding: 10px 18px; font-size: 18px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal[hidden] { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-content {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 34px;
  background: var(--bg-game);
  border: 4px solid #fff;
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.32);
}
.modal-title { color: var(--primary); font-size: 40px; font-weight: 800; text-align: center; margin-bottom: 20px; }
.rule-steps { display: grid; gap: 14px; margin-bottom: 24px; }
.rule-step { display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: start; }
.step-number {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--secondary-dark);
}
.step-title { color: var(--navy); font-size: 22px; font-weight: 800; }
.step-desc { color: var(--text-light); font-size: 17px; line-height: 1.6; }

.game-content, .quiz-content, .result-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  padding: 26px;
}

.game-topbar, .quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.phase-badge, .level-chip, .score-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
}
.phase-badge { background: var(--primary); box-shadow: 0 3px 0 var(--primary-dark); }
.level-chip { background: var(--secondary); box-shadow: 0 3px 0 var(--secondary-dark); }
.score-mini { background: var(--accent); box-shadow: 0 3px 0 var(--accent-dark); }

/* カウントダウン（円形プログレスリング＋中央数字） */
.countdown-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.countdown-ring-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 12px rgba(0,0,0,0.1));
}

.countdown-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* 12時位置からスタート */
}

.countdown-ring-bg {
  fill: #fff;
  stroke: none;
}

.countdown-ring-track {
  fill: none;
  stroke: #E5E7EB;
  stroke-width: 8;
}

.countdown-ring-progress {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 8;
  stroke-linecap: round;
  /* 円周 = 2π × r(58) ≈ 364.42 */
  stroke-dasharray: 364.42;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.countdown-ring-progress.urgent {
  stroke: var(--danger);
}

.countdown-number {
  position: relative;
  z-index: 1;
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.countdown-number.urgent {
  color: var(--danger);
  animation: pulse 0.45s ease-in-out infinite alternate;
}

.cube-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr;
  gap: 18px;
  flex: 1;
  min-height: 0;
}
/* 記憶フェーズ中は補助パネルを非表示にして、キューブに集中させる
   （面の名前はミニキューブで参照可能） */
.face-guide,
.game-anzu {
  display: none;
}

.cube-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  /* ビューポート高に対して上限を設けてはみ出しを防止 */
  height: min(560px, calc(100dvh - 220px));
  margin: 0 auto;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.92), rgba(245,240,232,0.52) 55%, rgba(78,191,207,0.12) 100%);
  border: 4px solid rgba(255,255,255,0.86);
  box-shadow: inset 0 0 30px rgba(78,191,207,0.16), var(--shadow);
  overflow: hidden;
  touch-action: none;
}

#cube-canvas, #blank-cube-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--secondary-dark);
  background: rgba(255,255,255,0.88);
  font-size: 16px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.face-guide {
  align-self: stretch;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  border: 3px solid rgba(255,255,255,0.92);
  box-shadow: var(--shadow);
}
.face-guide h2 { color: var(--primary); font-size: 24px; margin-bottom: 14px; }
.face-guide-list { display: grid; gap: 10px; }
.face-guide-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font-size: 17px;
  font-weight: 800;
}
.face-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(78,191,207,0.12);
  color: var(--secondary-dark);
  font-size: 18px;
  line-height: 1;
}
.face-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.game-anzu {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.quiz-main {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  flex: 1;
  min-height: 0;
}

.blank-cube-panel {
  min-height: 420px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255,255,255,0.78);
  border: 4px solid rgba(255,255,255,0.92);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--text-light);
  font-weight: 800;
}

#blank-cube-canvas { height: 320px; }

.question-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 28px;
  border-radius: 20px;
  background: rgba(255,255,255,0.86);
  border: 4px solid rgba(255,255,255,0.95);
  box-shadow: var(--shadow);
}

.question-text {
  color: var(--navy);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.35;
}

.answer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 72px;
  padding: 14px;
  border: 3px solid rgba(78,191,207,0.26);
  border-radius: 16px;
  background: #fff;
  color: var(--navy);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s, border 0.16s, background 0.16s;
}
.answer-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--secondary); }
.answer-btn:disabled { cursor: default; }
.answer-btn.correct { color: #fff; background: var(--success); border-color: var(--success); }
.answer-btn.wrong { color: #fff; background: var(--danger); border-color: var(--danger); }
.answer-btn.dimmed { opacity: 0.5; }
.color-chip {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(44,62,80,0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.55);
}

.quiz-feedback {
  min-height: 32px;
  color: var(--secondary-dark);
  font-size: 20px;
  font-weight: 800;
}

.result-content {
  gap: 20px;
  justify-content: center; /* スコア・本体・ボタンをひとかたまりで縦中央寄せ */
}
.result-header { display: flex; justify-content: center; }
.result-score-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 34px;
  border-radius: 22px;
  background: rgba(255,255,255,0.88);
  border: 4px solid rgba(255,255,255,0.96);
  box-shadow: var(--shadow-lg);
}
.result-score-label { color: var(--text-light); font-size: 18px; font-weight: 800; }
.result-total-score { color: var(--primary); font-size: 64px; font-weight: 800; line-height: 1; }
.result-score-max { color: var(--text-light); font-size: 24px; font-weight: 800; }
.result-rank {
  min-width: 90px;
  padding: 8px 20px;
  border: 4px solid var(--primary);
  border-radius: 18px;
  color: var(--primary);
  background: #fff;
  font-size: 44px;
  font-weight: 800;
  text-align: center;
}
.result-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  flex: 0 1 auto; /* result-content の justify-content:center で縦中央寄せされるよう、伸びないように */
  align-items: center;
}
.result-summary {
  padding: 26px;
  border-radius: 20px;
  background: rgba(255,255,255,0.86);
  border: 4px solid rgba(255,255,255,0.94);
  box-shadow: var(--shadow);
}
.result-summary h2 { color: var(--primary); font-size: 34px; margin-bottom: 10px; }
.result-summary p { color: var(--navy); font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.result-unfold {
  margin: 12px 0 16px;
  text-align: center;
}
.result-unfold-label {
  display: inline-block;
  margin-bottom: 8px !important;
  padding: 4px 14px;
  background: var(--secondary);
  color: #fff;
  border-radius: 999px;
  font-size: 14px !important;
  font-weight: 800 !important;
}
#result-unfold-canvas {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 0 auto;
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  padding: 8px;
}
@media (max-width: 520px) {
  #result-unfold-canvas { max-width: 100%; }
  .result-unfold-label { font-size: 13px !important; }
}
.result-answer-list { display: grid; gap: 8px; }
.result-answer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.result-answer.ok { border-left: 8px solid var(--success); }
.result-answer.ng { border-left: 8px solid var(--danger); }
.result-anzu-section { display: flex; justify-content: center; }
.result-actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }

/* 基準方向ミニキューブ（メモリ/クイズ画面で右下に固定表示） */
.mini-cube-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 110px;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mini-cube-wrap[hidden] { display: none; }
#mini-cube-canvas {
  display: block;
  width: 110px;
  height: 110px;
  background: rgba(255,255,255,0.6);
  border-radius: 14px;
  border: 2px solid rgba(78,191,207,0.32);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}
.mini-cube-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  color: var(--secondary-dark);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow);
}
@media (max-width: 520px) {
  .mini-cube-wrap { right: 8px; bottom: 8px; width: 80px; }
  #mini-cube-canvas { width: 80px; height: 80px; }
  .mini-cube-label { font-size: 10px; padding: 2px 8px; }
}

.fade-in { animation: fadeIn 0.45s ease both; }
.btn-pulse { animation: btnPulse 2.2s ease-in-out infinite; }
.anzu-bounce { animation: anzuBounce 2s ease-in-out infinite; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.85; transform: scale(1.25) rotate(12deg); }
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 4px 0 var(--primary-dark), 0 6px 16px rgba(240,100,73,0.25), 0 0 0 0 rgba(240,100,73,0.36); }
  50% { box-shadow: 0 4px 0 var(--primary-dark), 0 6px 16px rgba(240,100,73,0.25), 0 0 0 14px rgba(240,100,73,0); }
}
@keyframes anzuBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* PC: トップ画面を 2カラム（テキスト | キャラ）に */
@media (min-width: 901px) {
  .top-content {
    padding: 24px 48px;
    max-width: 960px;
    margin: 0 auto;
    gap: 10px;
  }
  .top-header { width: 100%; margin-top: -24px; }
  .top-body {
    flex-direction: row;
    align-items: stretch;
    gap: 24px;
    max-width: 760px;
  }
  .top-left {
    flex: 1;
    max-width: 420px;
    justify-content: space-between;
  }
  .top-right {
    flex: 0 0 280px;
    display: flex;
    justify-content: center;
  }
  .top-right .anzu-area {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 20px;
  }
  .anzu-top { width: 240px; height: auto; }
  .top-title { font-size: 68px; }
}

@media (max-width: 900px) {
  .screen {
    width: 100%;
    margin: 0 auto;
    min-height: 100dvh;
  }
  .top-content { padding: 28px 24px; }
  .top-title { font-size: 48px; }
  .top-body { grid-template-columns: 1fr; gap: 16px; }
  .top-right { order: -1; }
  .top-right .anzu-area { flex-direction: row-reverse; justify-content: center; }
  .anzu-top { width: 170px; }
  .speech-bubble { font-size: 17px; padding: 12px 16px; }
  .speech-bubble::after { display: none; }
  .top-subtitle { font-size: 22px; text-align: center; }
  .top-buttons-row .btn { flex: 1; min-width: 0; }
  .btn-large { padding: 15px 18px; font-size: 20px; }

  .game-content, .quiz-content, .result-content { padding: 16px; }
  .game-topbar, .quiz-header { flex-direction: column; align-items: stretch; }
  .countdown-area { width: 100%; min-width: 0; }
  .cube-stage { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .cube-wrap { height: min(440px, calc(100dvh - 200px)); }
  .game-anzu { display: none; }
  .face-guide h2 { font-size: 20px; }
  .face-guide-list { grid-template-columns: repeat(2, 1fr); }

  .quiz-main { grid-template-columns: 1fr; }
  .blank-cube-panel { min-height: auto; }
  #blank-cube-canvas { height: 220px; }
  .question-panel { padding: 20px; }
  .question-text { font-size: 26px; }
  .answer-options { grid-template-columns: 1fr; }
  .answer-btn { min-height: 58px; font-size: 20px; }

  .result-score-card { padding: 14px 18px; gap: 14px; flex-wrap: wrap; justify-content: center; }
  .result-total-score { font-size: 50px; }
  .result-rank { font-size: 34px; }
  .result-main { grid-template-columns: 1fr; }
  .result-anzu-section .anzu-area { flex-direction: row-reverse; }
  .result-anzu-section .anzu { width: 130px; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .top-title { font-size: 38px; }
  .top-subtitle { font-size: 16px; white-space: normal; }
  .top-content { padding: 22px 16px; }
  .level-selector { padding: 18px; }
  .level-label { font-size: 20px; }
  #level-display { font-size: 34px; }
  .top-buttons-row { flex-direction: column; }
  .brand-link { align-self: center; font-size: 16px; }
  .modal-content { padding: 22px; }
  .modal-title { font-size: 32px; }
  .step-title { font-size: 19px; }
  .step-desc { font-size: 15px; }

  .phase-badge, .level-chip, .score-mini { min-height: 34px; padding: 7px 12px; font-size: 15px; }
  .countdown-ring-wrap { width: 70px; height: 70px; }
  .countdown-number { font-size: 28px; }
  .cube-wrap { height: min(360px, calc(100dvh - 180px)); }
  .drag-hint { font-size: 14px; white-space: nowrap; }
  .face-guide { padding: 14px; }
  .face-guide-list { gap: 8px; }
  .face-guide-item { padding: 8px; font-size: 14px; }
  .face-tag { min-width: 44px; font-size: 12px; }
  .question-text { font-size: 23px; }
  .result-summary h2 { font-size: 28px; }
  .result-summary p { font-size: 18px; }
  .result-answer { font-size: 14px; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }
}
