/* ── さんすう うちゅうたんけん
   レイアウトは縦1カラム固定（2026-07-20決定）。
   コンテンツエリア（パネル）: PC 1100px / スマホ 画面幅-24px（最大560px）。
   その外側は宇宙の背景画像。
   アイコンは支給素材のPNG、板（パネル・ボタン）は伸縮に耐えるようCSSで描く ── */

:root {
  --sa-panel-w: 770px;
  --sa-ink: #241f4d;
  --sa-purple: #8b5cf6;
  --sa-purple-soft: #b6a8f5;
  --sa-plate: #eae7fb;
  --sa-plate-line: #b9a7e8;
  --sa-plate-on: #fdf3cf;
  --sa-gold: #f2c230;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0a0f22 url('/assets/images/sansu/bg-space.jpg') center top / cover no-repeat fixed;
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* ── コンテンツエリア（パネル）── */
.app-paper {
  position: relative;
  width: 100%;
  max-width: var(--sa-panel-w);
  margin: 26px auto;
  padding: 0 0 14px;
  border: 3px solid var(--sa-purple);
  border-radius: 30px;
  background: linear-gradient(180deg, #101a3f 0%, #0c1332 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .06) inset,
    0 0 26px rgba(139, 92, 246, .45),
    0 18px 50px rgba(0, 0, 0, .5);
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.sa-app {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 26px 22px 8px;
  color: #fff;
}
.sa-app *, .sa-app *::before, .sa-app *::after { box-sizing: border-box; }

/* ── タイトル ── */
.sa-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.sa-head-badge { width: 92px; height: 92px; flex: none; }
.sa-title {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .02em;
}
.sa-lead {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, .8);
}

.sa-total {
  margin: 0 0 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, .9);
}
.sa-total strong { font-size: 22px; color: var(--sa-gold); }

/* ── グループ見出し（— けいさんの しゅるい —）── */
.sa-group { margin-bottom: 18px; }
.sa-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--sa-purple-soft);
}
.sa-group-title::before,
.sa-group-title::after {
  content: '';
  height: 1px;
  background: rgba(182, 168, 245, .5);
}
.sa-group-title::before { width: 18px; }
.sa-group-title::after { flex: 1; max-width: 26px; }

/* ── 選択カード ── */
.sa-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.sa-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 48px 16px 20px;
  min-height: 78px;
  border: 0;
  background: transparent;
  color: var(--sa-ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  /* 支給素材の板を9スライスで敷く（中央だけ伸縮・角は固定）*/
  border-image: url('/assets/images/sansu/buttons/choice-default.png') 40 44 50 44 fill / 20px 22px 25px 22px / 0 stretch;
  transition: transform .12s;
}
.sa-choice:hover { transform: translateY(-2px); }
.sa-choice:active { transform: translateY(2px); }
.sa-choice.is-on {
  color: #4a3d1a;
  border-image: url('/assets/images/sansu/buttons/choice-selected.png') 40 44 54 44 fill / 20px 22px 27px 22px / 0 stretch;
}
.sa-choice.is-disabled {
  border-image: none;
  border: 2px dashed rgba(255, 255, 255, .3);
  border-radius: 16px;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .55);
  cursor: default;
}
.sa-choice.is-disabled:hover { transform: none; }

.sa-choice-icon {
  height: 46px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
}
.sa-choice.is-disabled .sa-choice-icon { filter: grayscale(1); opacity: .5; }
.sa-choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sa-choice-label { font-size: 18px; font-weight: 800; }
.sa-choice-note { font-size: 13px; font-weight: 700; color: #6f6a90; }
.sa-choice.is-on .sa-choice-note { color: #9a7d33; }
.sa-choice.is-disabled .sa-choice-note { color: rgba(255, 255, 255, .5); }
.sa-choice-check {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
}

/* ── さくらんぼざんの リファレンスボタン（さくらんぼの となり）── */
.sa-ref {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 16px;
  min-height: 78px;
  border: 2px solid #f0973f;
  border-radius: 16px;
  background: linear-gradient(160deg, #ff9d4d, #ef7f2e);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(120, 55, 10, .5);
  transition: transform .12s, box-shadow .12s;
}
.sa-ref:hover { transform: translateY(-2px); }
.sa-ref:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(120, 55, 10, .5); }
.sa-ref-icon { height: 40px; width: auto; flex-shrink: 0; }
.sa-ref .sa-choice-label { font-size: 17px; font-weight: 800; }
.sa-ref .sa-choice-note { font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .9); }

/* ── リファレンス画面 ── */
.sa-ref-card { padding: 24px 22px 26px; }
.sa-ref-lead {
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  color: #4a4668;
}
.sa-ref-example-title {
  margin: 0 0 16px;
  padding: 8px 0;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--sa-purple);
  background: #f4f1ff;
  border-radius: 12px;
}
.sa-ref-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-top: 1px dashed #ddd7f2;
}
.sa-ref-step-no {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sa-purple);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}
.sa-ref-step-body { flex: 1; min-width: 0; }
.sa-ref-step-text {
  margin: 4px 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #2a2350;
}
.sa-ref-cherry {
  justify-content: flex-start;
  margin: 0;
  font-size: 34px;
}
.sa-ref-formula {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: #2a2350;
}
.sa-ref-answer {
  margin: 18px 0 6px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #2f9469;
}
.sa-ref-tip {
  margin: 0 0 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #8b86a6;
}

/* ── スタート（金具付きの支給ボタン。端の金具は固定・中央のみ伸縮）── */
.sa-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin-top: 24px;
  padding: 20px 70px 24px;
  border: 0;
  background: transparent;
  color: #3a2c10;
  font-family: inherit;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .06em;
  cursor: pointer;
  border-image: url('/assets/images/sansu/buttons/start-button.png') 46 70 54 70 fill / 34px 52px 40px 52px / 0 stretch;
  transition: transform .12s;
}
.sa-start:active { transform: translateY(3px); }
.sa-start-icon { width: 46px; height: 46px; }

.sa-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px auto 6px;
  padding: 12px 28px 14px;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-image: url('/assets/images/sansu/buttons/reset-button.png') 34 40 38 40 fill / 16px 20px 18px 20px / 0 stretch;
  transition: transform .12s;
}
.sa-reset:active { transform: translateY(2px); }
.sa-reset-icon { width: 22px; height: 22px; }

/* ── プレイ画面 ── */
.sa-play-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.sa-back {
  flex: none;
  padding: 8px 16px;
  border: 2px solid #6f5fc4;
  border-radius: 999px;
  background: rgba(16, 26, 63, .7);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.sa-back:hover { background: rgba(139, 92, 246, .25); }
.sa-play-mode { font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .85); }

/* COMBO バッジ（連続正解。2連から表示）*/
.sa-combo {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff6b4a, #ffb03c);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
  box-shadow: 0 0 14px rgba(255, 138, 46, .6);
  opacity: 0;
  transform: scale(.6);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.sa-combo.is-show { opacity: 1; transform: scale(1); }
.sa-combo.is-pop { animation: sa-combo-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes sa-combo-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(-3deg); }
  100% { transform: scale(1); }
}

.sa-result-combo {
  margin: -4px 0 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: #ef7f2e;
}

/* もどるボタン（プレイ画面の一番下・中央）*/
.sa-play-foot { display: flex; justify-content: center; margin-top: 18px; }

.sa-track-card {
  padding: 14px 18px 18px;
  margin-bottom: 18px;
  border: 1px solid rgba(139, 92, 246, .45);
  border-radius: 20px;
  background: rgba(255, 255, 255, .06);
}
.sa-track-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, .85);
}
.sa-track {
  position: relative;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}
.sa-track-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f4553f, #ffc93c);
  transition: width .5s cubic-bezier(.34, 1.56, .64, 1);
}
.sa-rocket {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  transition: left .5s cubic-bezier(.34, 1.56, .64, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}
.sa-track-goal {
  position: absolute;
  top: 50%; right: 6px;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  font-size: 20px;
  object-fit: contain;
  z-index: 1;
}
.sa-track-start {
  position: absolute;
  top: 50%; left: 6px;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  font-size: 18px;
  object-fit: contain;
  opacity: .9;
  z-index: 1;
}
/* スタート地点（地球）は大きな★ */
.sa-track-start.is-star {
  left: 2px;
  width: auto; height: auto;
  font-size: 30px;
  line-height: 1;
  color: var(--sa-gold);
  opacity: 1;
  text-shadow: 0 0 8px rgba(255, 217, 61, .8);
}

/* とことんの太陽系航路（星＝到達地点。バーの上に配置）*/
.sa-route {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4px;
  margin-bottom: 12px;
  padding: 0 2px;
  min-height: 34px;
}
.sa-route-stop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s;
}
/* 到着アナウンス（惑星アイコンの上にポップ）*/
.sa-route-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: 6px;
  padding: 4px 9px;
  border-radius: 10px;
  background: var(--sa-gold);
  color: #3a2c10;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
  transform: translateX(-50%);
  z-index: 3;
  animation: sa-bubble-pop 1.6s ease-out forwards;
}
.sa-route-bubble::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--sa-gold);
}
@keyframes sa-bubble-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(6px) scale(.7); }
  18% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
  30% { transform: translateX(-50%) translateY(0) scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(1); }
}
.sa-route-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: .35;
  filter: grayscale(.7);
  transition: opacity .3s, filter .3s;
}
.sa-route-stop.is-done .sa-route-img { opacity: .95; filter: none; }
.sa-route-stop.is-now {
  animation: sa-route-pulse 1.1s ease-in-out infinite;
}
.sa-route-stop.is-now .sa-route-img { opacity: 1; filter: none; }
@keyframes sa-route-pulse {
  0%, 100% { transform: scale(1.15); }
  50% { transform: scale(1.4); }
}

/* ── もんだいカード ── */
.sa-card {
  padding: 26px 22px;
  border-radius: 24px;
  background: #fff;
  color: var(--sa-ink);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
}
.sa-question-text {
  margin: 0 0 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: #6f6a90;
}
.sa-problem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
  font-size: 48px;
  font-weight: 800;
}
.sa-op { color: #a08ef0; }
.sa-qmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 72px;
  padding: 0 10px;
  border-radius: 18px;
  background: #f0eefc;
  color: var(--sa-purple);
  font-size: 40px;
}

/* ── さくらんぼ算：分ける数の真下にぶら下げる ── */
.sa-problem-cherry { align-items: flex-start; }
/* こたえるまで「= ?」を伏せる（場所は確保して跳ねさせない） */
.sa-eq-late { visibility: hidden; }
.sa-cherry-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sa-term { line-height: 1.1; }
.sa-cherry-top { color: #f4553f; }
.sa-cherry-stem { width: 2px; height: 16px; margin-top: 6px; background: #c9c4e6; }
.sa-cherry-pair {
  position: relative;
  display: flex;
  gap: 40px;
  padding-top: 18px;
}
.sa-cherry-pair::before,
.sa-cherry-pair::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 40px;
  height: 2px;
  background: #c9c4e6;
  transform-origin: left center;
}
.sa-cherry-pair::before { transform: rotate(151deg); }
.sa-cherry-pair::after { transform: rotate(29deg); }
.sa-cherry-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sa-cherry-ball {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #f0eefc;
  color: #8b7ef0;
  font-size: 24px;
  font-weight: 800;
}
.sa-cherry-ball.is-target {
  background: #fff4d6;
  color: #d98b12;
  box-shadow: 0 0 0 3px var(--sa-gold);
}
.sa-cherry-ball.is-filled { background: #e6f7ee; color: #2f9469; box-shadow: none; }
.sa-cherry-ball.is-target.is-filled { box-shadow: 0 0 0 3px #7ad0a8; }
.sa-cherry-cap {
  font-size: 11px;
  font-weight: 800;
  color: #d98b12;
  white-space: nowrap;
}

/* ── こたえのボタン ── */
.sa-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.sa-opt {
  padding: 22px 0 26px;
  border: 0;
  background: transparent;
  color: var(--sa-ink);
  font-family: inherit;
  font-size: 30px;
  font-weight: 800;
  cursor: pointer;
  border-image: url('/assets/images/sansu/buttons/choice-default.png') 40 44 50 44 fill / 20px 22px 25px 22px / 0 stretch;
  transition: transform .12s;
}
.sa-opt:active { transform: translateY(2px); }
.sa-opt:disabled { cursor: default; }
/* 正解・不正解は素材を外してベタ塗りで色替え */
.sa-opt.is-correct { border-image: none; border-radius: 16px; background: #3fb380; color: #fff; }
.sa-opt.is-wrong { border-image: none; border-radius: 16px; background: #ff5c6c; color: #fff; }

.sa-feedback {
  margin-top: 16px;
  min-height: 30px;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
}
.sa-feedback.is-ok { color: #2f9469; }
.sa-feedback.is-ng { color: #e04555; }

/* ── けっか ── */
.sa-result { text-align: center; }
.sa-result-emoji { font-size: 60px; line-height: 1.1; }
.sa-result-score { margin: 10px 0 0; font-size: 19px; font-weight: 700; }
.sa-result-score strong { font-size: 32px; color: var(--sa-purple); }
.sa-result-stars { margin: 8px 0 10px; font-size: 32px; letter-spacing: 6px; }
.sa-result-msg { margin: 10px 0 22px; font-size: 15px; font-weight: 700; color: #6f6a90; }

.sa-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.sa-btn {
  padding: 13px 22px;
  border: 2px solid var(--sa-plate-line);
  border-radius: 999px;
  background: var(--sa-plate);
  color: var(--sa-ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.sa-btn:hover { background: #e0dbf7; }
.sa-btn-primary { background: var(--sa-purple); border-color: #6f5fc4; color: #fff; }
.sa-btn-primary:hover { background: #a08ef0; }

/* 紙面下部：しょうかいページ（LP）への導線 */
.paper-about {
  margin: auto 0 0;
  padding: 10px 22px 0;
  text-align: center;
}
.paper-about a {
  font-size: 13px;
  font-weight: 700;
  color: var(--sa-purple-soft);
  text-decoration: none;
  border-bottom: 1px dotted rgba(182, 168, 245, .6);
  padding-bottom: 2px;
}
.paper-about a:hover { color: #fff; border-bottom-color: #fff; }

/* 紙面の一番下に置く更新日 */
.paper-release {
  margin: 6px 0 0;
  padding: 4px 22px 4px;
  text-align: right;
  font-size: 11px;
  color: rgba(255, 255, 255, .5);
}

/* ── スマホ：コンテンツエリアは画面幅-24px（最大560px）── */
@media (max-width: 700px) {
  .app-paper {
    max-width: 560px;
    margin: 12px auto;
    border-radius: 22px;
  }
  .sa-app { padding: 20px 14px 6px; }
  .sa-head { gap: 10px; margin-bottom: 12px; }
  .sa-head-badge { width: 62px; height: 62px; }
  .sa-title { font-size: 21px; }
  .sa-lead { font-size: 12px; }
  .sa-choices { grid-template-columns: 1fr; gap: 10px; }
  .sa-choice { min-height: 64px; padding: 10px 42px 10px 12px; gap: 10px; }
  .sa-choice-icon { width: 42px; height: 36px; }
  .sa-choice-label { font-size: 16px; }
  .sa-choice-note { font-size: 12px; }
  .sa-start { font-size: 24px; padding: 15px 0; }
  .sa-start-icon { width: 36px; height: 36px; }
  .sa-card { padding: 20px 14px; }
  .sa-problem { font-size: 36px; gap: 8px; }
  .sa-qmark { min-width: 56px; height: 56px; font-size: 30px; }
  .sa-opt { font-size: 26px; padding: 16px 0; }
  .sa-cherry-pair { gap: 26px; }
  .sa-cherry-ball { width: 42px; height: 42px; font-size: 20px; }
  .sa-cherry-cap { font-size: 10px; }
}
