/* 子ども画面 — 明るくカラフル・大きなタップ領域 */

body[data-page='child'] {
  background:
    radial-gradient(120% 80% at 8% 0%, #fff1d8 0%, rgba(255, 241, 216, 0) 55%),
    radial-gradient(110% 70% at 100% 8%, #ffe3f1 0%, rgba(255, 227, 241, 0) 52%),
    radial-gradient(120% 90% at 50% 100%, #e4f4ff 0%, rgba(228, 244, 255, 0) 60%),
    #fdf8f4;
  min-height: 100dvh;
}

.child-app {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px calc(20px + var(--safe-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.child-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px;
}

.child-head--plain {
  justify-content: center;
}

.child-head__who {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(72, 52, 96, 0.06);
}

.child-head__emoji {
  font-size: 24px;
  line-height: 1;
}

.child-head__names {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.child-head__name {
  font-weight: 800;
  font-size: 15px;
}

.child-head__family {
  font-size: 11px;
  color: var(--muted);
}

.btn--scan {
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #ffc93c, #ff9a5a);
  color: #4a2b00;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 6px 14px rgba(255, 154, 90, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------------------------------------------------------------- メイン */

.child-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.score-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 28px;
  padding: 18px 18px 20px;
  box-shadow: 0 12px 30px rgba(120, 90, 60, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 3px solid #fff;
}

.score-card__label {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.score-card__value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
}

.score-card__number {
  font-size: clamp(44px, 15vw, 64px);
  font-weight: 900;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(160deg, #ff8a4c, #f2549b 70%, #7c5cf0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.score-card__unit {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink-soft);
}

.egg-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.egg-stage__caption {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 700;
}

.egg-stage__caption strong {
  font-size: 17px;
  color: var(--brand-strong);
  font-variant-numeric: tabular-nums;
}

.egg {
  width: min(46vw, 190px);
  height: auto;
  filter: drop-shadow(0 10px 16px rgba(120, 90, 60, 0.16));
  animation: egg-wobble 4.2s ease-in-out infinite;
  transform-origin: 50% 92%;
}

.egg__fill,
.egg__surface {
  /* SVG のジオメトリ属性（y / height）は CSS でアニメーションできる */
  transition: y 0.8s cubic-bezier(0.22, 1, 0.36, 1), height 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease;
}

.egg--ready {
  animation: egg-wobble 1.5s ease-in-out infinite, egg-glow 1.8s ease-in-out infinite;
}

@keyframes egg-wobble {
  0%,
  100% {
    transform: rotate(0deg);
  }
  8% {
    transform: rotate(-3deg);
  }
  16% {
    transform: rotate(3deg);
  }
  24% {
    transform: rotate(-1.5deg);
  }
  32% {
    transform: rotate(0deg);
  }
}

@keyframes egg-glow {
  0%,
  100% {
    filter: drop-shadow(0 10px 16px rgba(120, 90, 60, 0.16));
  }
  50% {
    filter: drop-shadow(0 0 22px rgba(255, 201, 60, 0.85));
  }
}

.score-card .progress {
  width: 100%;
  height: 14px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #f4effa;
  color: var(--ink-soft);
}

.badge--hatch {
  background: #fff4d8;
  color: #7a4a00;
}

.badge--count {
  background: #eef6ff;
  color: #2f5fbf;
}

/* ---------------------------------------------------------------- ごほうび */

.rewards-card .card__title {
  font-size: 15px;
}

.reward-list,
.request-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-list__caption {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.reward-item,
.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fbf8ff;
}

.reward-item__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.reward-item__title,
.request-item__title {
  font-weight: 700;
  font-size: 14px;
}

.reward-item__note {
  font-size: 12px;
  color: var(--muted);
}

.request-item__status {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eee8f7;
  color: var(--ink-soft);
  white-space: nowrap;
}

.request-item--approved .request-item__status {
  background: #e2f6ec;
  color: var(--ok);
}

.request-item--rejected .request-item__status {
  background: #f7e7ea;
  color: var(--danger);
}

.request-item--requested .request-item__status {
  background: #fff3d6;
  color: #8a5a00;
}

/* ---------------------------------------------------------------- Phase 2 注記 */

.phase2 {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px dashed #e3d5ee;
}

.phase2__tag {
  flex: none;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ede4ff;
  color: #5b3bc4;
}

.phase2__text {
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- 履歴 */

.card__title {
  font-size: 15px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fbf8ff;
}

.history-item__points {
  flex: none;
  min-width: 56px;
  text-align: right;
  font-weight: 900;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}

.history-item__points.is-minus {
  color: var(--danger);
}

.history-item__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.history-item__name {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__date {
  font-size: 12px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- フッター */

.child-foot {
  text-align: center;
  padding: 6px 0 4px;
}

.child-foot__link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
}

/* ---------------------------------------------------------------- 未ペアリング */

.onboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 12px 6px 0;
}

.onboard__egg .egg {
  width: min(52vw, 200px);
  opacity: 0.9;
}

.onboard__title {
  font-size: 26px;
  font-weight: 900;
}

.onboard__text {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 30ch;
}

.onboard__note {
  max-width: 32ch;
}

/* ---------------------------------------------------------------- 演出 */

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fx-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 22px 34px;
  border-radius: 28px;
  background: linear-gradient(140deg, #ffd166, #ff8fab 60%, #c9a2ff);
  color: #fff;
  box-shadow: 0 18px 50px rgba(150, 90, 160, 0.35);
  animation: fx-pop 0.42s cubic-bezier(0.2, 1.4, 0.4, 1);
  text-shadow: 0 2px 10px rgba(90, 40, 90, 0.25);
}

.fx-score--minus {
  background: linear-gradient(140deg, #b8c6d8, #8fa3bb);
}

.fx-score--out {
  opacity: 0;
  transform: translateY(-22px) scale(0.92);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fx-score__label {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.fx-score__value {
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.fx-score__unit {
  font-size: 16px;
  font-weight: 800;
}

@keyframes fx-pop {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-6deg);
  }
  70% {
    transform: scale(1.06) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.fx-hatch {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 30px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.96);
  border: 4px solid #ffd166;
  box-shadow: 0 20px 60px rgba(200, 130, 40, 0.35);
  animation: fx-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  text-align: center;
}

.fx-hatch--out {
  opacity: 0;
  transform: translateY(-16px) scale(0.94);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.fx-hatch__egg {
  font-size: 58px;
  animation: egg-wobble 0.9s ease-in-out infinite;
  display: block;
}

.fx-hatch__label {
  font-size: 20px;
  font-weight: 900;
  color: var(--brand-strong);
}

.fx-hatch__value {
  font-size: 17px;
  font-weight: 900;
  color: #6b3fc9;
}

.fx-hatch__note {
  font-size: 12px;
  color: var(--ink-soft);
}

.fx-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.fx-confetti--out {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.fx-confetti__bit {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: confetti-fall 2.2s linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(105vh) rotate(540deg);
    opacity: 0.2;
  }
}

/* ---------------------------------------------------------------- 情報シート */

.info-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- 幅の調整 */

@media (max-width: 359px) {
  .child-app {
    padding: 10px 10px calc(16px + var(--safe-bottom));
  }
  .score-card {
    padding: 14px 12px 16px;
    border-radius: 22px;
  }
  .btn--scan {
    padding: 8px 12px;
    font-size: 14px;
  }
  .child-head__name {
    font-size: 14px;
  }
  .badge {
    font-size: 12px;
    padding: 5px 10px;
  }
  .fx-score__value {
    font-size: 48px;
  }
}
