/* ==========================================================================
   スター・クエスト — クレイモルフィズム デザインシステム
   ========================================================================== */

:root {
  --color-bg: #FFF7ED;
  --color-ink: #4A3728;
  --color-orange: #F97316;
  --color-orange-dark: #C2410C;
  --color-blue: #2563EB;
  --color-blue-dark: #1D4ED8;
  --color-yellow: #FACC15;
  --color-green: #22C55E;
  --color-card: #FFFFFF;
  --color-locked: #E7DCCB;
  --color-pink: #F9A8D4;
  --color-pink-light: #FCE7F3;
  --color-key-yellow: #FEF08A;

  /* ペットのお部屋: 夢見ごこちなパステルカラー */
  --color-pastel-peach: #FFDAB4;
  --color-pastel-yellow: #FFF3B0;
  --color-pastel-pink: #FFCBE1;
  --color-pastel-blue: #BEE6F5;

  --border-thick: 3px solid var(--color-ink);
  --radius-lg: 24px;
  --radius-md: 20px;
  --radius-sm: 16px;

  /* クレイモルフィズム: 柔らかい3D風ドロップシャドウ */
  --shadow-clay: 0 6px 0 var(--color-ink), 0 10px 16px rgba(74, 55, 40, 0.25);
  --shadow-clay-sm: 0 4px 0 var(--color-ink), 0 6px 10px rgba(74, 55, 40, 0.2);
  --shadow-clay-pressed: 0 2px 0 var(--color-ink), 0 3px 6px rgba(74, 55, 40, 0.2);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 20% 8%, rgba(253, 230, 138, 0.45), transparent 22rem),
    radial-gradient(circle at 86% 22%, rgba(167, 216, 240, 0.48), transparent 18rem),
    linear-gradient(180deg, #fff8f0 0%, #fef0f6 44%, #effaf5 100%);
  color: var(--color-ink);
  font-family: "Comic Neue", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

.app[hidden],
.parent-view[hidden] {
  display: none;
}

.child-panel[hidden] {
  display: none;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.app-logo {
  margin: 0;
  font-family: "Baloo 2", "M PLUS Rounded 1c", sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.5px;
  color: var(--color-orange);
  -webkit-text-stroke: 2px var(--color-ink);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--color-ink), 0 6px 8px rgba(74, 55, 40, 0.3);
}

.app-logo-dash {
  color: var(--color-blue);
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: radial-gradient(120% 140% at 30% 20%, #FFFFFF 0%, var(--color-card) 55%, #FFF3E0 100%);
  border: var(--border-thick);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow-clay-sm), inset 0 -3px 0 rgba(74, 55, 40, 0.08), inset 0 2px 0 rgba(255, 255, 255, 0.8);
}

.badge-icon {
  font-size: 20px;
  filter: drop-shadow(0 2px 0 rgba(74, 55, 40, 0.2));
}

.badge-coin {
  color: var(--color-orange-dark);
}

.sound-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  font-size: 18px;
  border: var(--border-thick);
  border-radius: 50%;
  background: radial-gradient(120% 140% at 30% 20%, #FFFFFF 0%, var(--color-card) 55%, #FFF3E0 100%);
  box-shadow: var(--shadow-clay-sm), inset 0 -3px 0 rgba(74, 55, 40, 0.08), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.sound-toggle-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-clay-pressed);
}

.sound-toggle-btn.muted {
  color: #9CA3AF;
}

/* ---------- ペット表示エリア: 星降る子供部屋 ---------- */

.pet-room {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 35%),
    linear-gradient(180deg, var(--color-pastel-peach) 0%, #FFF7ED 70%);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 58px 20px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* 天井のガーランド */
.room-garland {
  position: absolute;
  top: 10px;
  left: 8px;
  right: 8px;
  height: 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 1;
}

.room-garland::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-ink);
  opacity: 0.35;
}

.flag {
  width: 18px;
  height: 20px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  animation: flag-sway 3.2s ease-in-out infinite;
  transform-origin: top center;
  filter: drop-shadow(1px 2px 0 rgba(74, 55, 40, 0.15));
}

.flag-pink { background: var(--color-pastel-pink); }
.flag-blue { background: var(--color-pastel-blue); }
.flag-yellow { background: var(--color-pastel-yellow); }
.flag-orange { background: var(--color-pastel-peach); }

.flag:nth-child(2n) { animation-delay: -1.1s; }
.flag:nth-child(3n) { animation-delay: -2s; }

@keyframes flag-sway {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}

/* ゆれるオーナメント（お月様・お星さま） */
.room-ornament {
  position: absolute;
  top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;
  animation: sway 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

.room-ornament-left {
  left: 14px;
  animation-delay: -1s;
}

.room-ornament-right {
  right: 14px;
  animation-delay: -2.3s;
}

.ornament-string {
  width: 2px;
  height: 20px;
  background: var(--color-ink);
  opacity: 0.35;
}

.ornament-icon {
  width: 24px;
  height: 24px;
  overflow: visible;
  filter: drop-shadow(0 3px 0 rgba(74, 55, 40, 0.2));
}

.ornament-icon path,
.ornament-icon polygon {
  stroke: var(--color-ink);
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.ornament-moon path {
  fill: var(--color-pastel-yellow);
}

.ornament-star polygon {
  fill: var(--color-pastel-peach);
}

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

/* おもちゃ棚のシルエット */
.room-shelf {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 64px;
  height: 46px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
}

.shelf-board {
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: 4px;
  height: 6px;
  background: var(--color-locked);
  border: 2px solid var(--color-ink);
  border-radius: 3px;
  box-shadow: 2px 3px 0 rgba(74, 55, 40, 0.15);
}

.shelf-item {
  position: absolute;
  bottom: 10px;
  border: 2px solid var(--color-ink);
  border-radius: 3px;
  box-shadow: 2px 3px 0 rgba(74, 55, 40, 0.15);
}

.shelf-book {
  width: 12px;
  height: 26px;
}

.shelf-book-1 {
  left: 4px;
  background: var(--color-pastel-blue);
  transform: rotate(-4deg);
}

.shelf-book-2 {
  left: 16px;
  height: 22px;
  background: var(--color-pastel-pink);
  transform: rotate(3deg);
}

.shelf-toy {
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-pastel-yellow);
  box-shadow: 2px 3px 0 rgba(74, 55, 40, 0.15);
}

.pet-message {
  position: relative;
  z-index: 2;
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  background: var(--color-card);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.pet-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pet {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
  cursor: pointer;
}

.pet:hover {
  transform: translateY(-4px);
}

.pet::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 74px;
  height: 16px;
  background: rgba(74, 55, 40, 0.15);
  border-radius: 50%;
  filter: blur(1px);
  z-index: -1;
}

.pet-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 6px 0 var(--color-ink)) drop-shadow(0 10px 12px rgba(74, 55, 40, 0.25));
}

.pet-head,
.pet-ear,
.pet-paw {
  fill: #FFFDF8;
  stroke: var(--color-ink);
  stroke-width: 3.5;
}

.pet-cheek {
  fill: #FFA3A3;
  opacity: 0.9;
  transform-box: fill-box;
  transform-origin: center;
}

.pet-collar {
  fill: none;
  stroke: #EF4444;
  stroke-width: 6;
  stroke-linecap: round;
}

.pet-star-charm-wrap {
  transform-origin: 100px 151px;
  animation: charm-jiggle 2.5s ease-in-out infinite;
}

.pet-star-charm {
  fill: #FBBF24;
  stroke: var(--color-ink);
  stroke-width: 2;
  stroke-linejoin: round;
}

@keyframes charm-jiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.pet-sparkle {
  fill: #FBBF24;
  animation: sparkle-pulse 1.8s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.pet-sparkle-1 {
  animation-delay: -0.4s;
}

.pet-sparkle-2 {
  animation-delay: -1.2s;
}

@keyframes sparkle-pulse {
  0%, 100% { transform: scale(0.85) rotate(-5deg); opacity: 0.7; }
  50% { transform: scale(1.15) rotate(15deg); opacity: 1; }
}

.pet-eye-shine-1,
.pet-eye-shine-2 {
  fill: #FFFFFF;
}

.pet-eyebrow {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.7;
}

.pet-eye {
  fill: var(--color-ink);
  transform-box: fill-box;
  transform-origin: center;
  animation: eye-blink 4.5s ease-in-out infinite;
}

.pet-mouth {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 3.5;
  stroke-linecap: round;
}

.pet-tongue {
  fill: #FFA3A3;
  stroke: var(--color-ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.pet-eye-happy {
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 4.5;
  stroke-linecap: round;
}

.pet-mouth-happy {
  fill: #EF4444;
  stroke: var(--color-ink);
  stroke-width: 3.5;
  stroke-linejoin: round;
}

.pet-tongue-happy {
  fill: #FFA3A3;
  stroke: var(--color-ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.pet-face-happy {
  display: none;
}

.pet.happy .pet-face-normal {
  display: none;
}

.pet.happy .pet-face-happy {
  display: block;
}

.pet.happy .pet-cheek {
  animation: cheek-glow 0.6s ease-in-out 2;
}

@keyframes cheek-glow {
  0%, 100% {
    fill: #FFA3A3;
    opacity: 0.9;
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 127, 155, 0));
  }
  50% {
    fill: #FF7F9B;
    opacity: 1;
    transform: scale(1.18);
    filter: drop-shadow(0 0 5px rgba(255, 127, 155, 0.85));
  }
}

@keyframes eye-blink {
  0%, 88%, 100% { transform: scaleY(1); }
  92% { transform: scaleY(0.1); }
}

.pet.reacting {
  animation: pet-bounce 0.6s ease;
}

@keyframes pet-bounce {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.18) rotate(-6deg); }
  50% { transform: scale(0.94) rotate(4deg); }
  75% { transform: scale(1.08) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.xp-bar-wrap {
  width: 100%;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.xp-bar-track {
  width: 100%;
  height: 18px;
  background: var(--color-card);
  border: 2px solid var(--color-ink);
  border-radius: 999px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-blue), #60A5FA);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.xp-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-ink);
}

/* ---------- パネル共通 ---------- */

.home-hub {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-map-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(145deg, #FEF3C7, #FFF7ED);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
}

.home-map-pet-svg {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  overflow: visible;
  filter: drop-shadow(0 3px 0 var(--color-ink));
  cursor: pointer;
  transition: transform 0.25s ease;
}

.home-map-pet-svg:hover {
  transform: translateY(-4px) scale(1.05);
}

.home-map-title {
  margin: 0 0 4px;
  font-size: 21px;
  line-height: 1.25;
}

.home-map-copy {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.panel {
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: 4px 2px;
}

.panel-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 12px 4px;
}

/* ---------- クエストリスト ---------- */

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quest-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.quest-card.locked {
  background: var(--color-locked);
  opacity: 0.65;
  filter: grayscale(0.3);
  pointer-events: none;
}

.quest-card.locked .btn-speak {
  pointer-events: auto;
}

.quest-card.completed {
  opacity: 0.55;
}

.quest-card.pending {
  background: #FEF3C7;
  opacity: 0.9;
}

.quest-pending-icon {
  font-size: 22px;
}

.quest-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quest-photo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: #FEF3C7;
}

.quest-info {
  flex: 1;
  min-width: 0;
}

.quest-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
}

.quest-rewards {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-orange-dark);
  margin-top: 2px;
}

.quest-lock-icon {
  font-size: 22px;
}

.quest-card-head .btn-speak {
  width: 40px;
  height: 40px;
  min-height: 40px;
  font-size: 16px;
  flex-shrink: 0;
}

.quest-status-icon {
  font-size: 22px;
  color: var(--color-green);
}

.quest-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- 感覚タイマー（円形ゲージ） ---------- */

.quest-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.timer-ring {
  --pct: 100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--color-blue) calc(var(--pct) * 1%), #E5E7EB 0);
  border: 2px solid var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s linear;
}

.timer-ring-inner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.timer-bar-track {
  flex: 1;
  height: 14px;
  background: #E5E7EB;
  border: 2px solid var(--color-ink);
  border-radius: 999px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--color-orange), var(--color-yellow));
  transition: width 1s linear;
}

/* ---------- ボタン（クレイモルフィズム） ---------- */

.btn {
  border: var(--border-thick);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  min-height: 48px;
  padding: 10px 16px;
  box-shadow: var(--shadow-clay-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  color: var(--color-ink);
}

.btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: var(--shadow-clay-pressed);
}

@media (hover: hover) {
  .btn:not(:disabled):hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: var(--shadow-clay);
  }
}

.btn-speak {
  background: #FEF3C7;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-timer {
  background: #DBEAFE;
  color: var(--color-blue-dark);
}

.btn-complete {
  background: var(--color-orange);
  color: #fff;
  flex: 1;
}

.btn-complete:disabled {
  background: #D6D3D1;
  color: #9CA3AF;
  cursor: not-allowed;
}

.btn-buy {
  background: var(--color-blue);
  color: #fff;
  width: 100%;
}

.btn-buy:disabled {
  background: #D6D3D1;
  color: #9CA3AF;
  cursor: not-allowed;
}

/* ---------- おたからストア ---------- */

.store-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.store-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.store-icon {
  font-size: 34px;
}

.store-name {
  font-weight: 700;
  font-size: 14px;
}

.store-price {
  font-weight: 800;
  color: var(--color-orange-dark);
  font-size: 14px;
}

/* ---------- ごほうびエフェクト ---------- */

.reward-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 55, 40, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.reward-overlay.show {
  display: flex;
}

.reward-card {
  position: relative;
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 28px 36px;
  text-align: center;
  animation: reward-pop 0.4s ease;
}

.reward-card::before,
.reward-card::after {
  content: "✨";
  position: absolute;
  font-size: 28px;
  pointer-events: none;
  animation: reward-sparkle 0.8s ease-in-out infinite alternate;
}

.reward-card::before {
  top: -20px;
  left: -16px;
}

.reward-card::after {
  right: -16px;
  bottom: -20px;
  animation-delay: 0.2s;
}

@keyframes reward-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes reward-sparkle {
  from { transform: scale(0.7) rotate(-12deg); opacity: 0.45; }
  to { transform: scale(1.25) rotate(12deg); opacity: 1; }
}

.reward-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--color-orange-dark);
}

.reward-praise-text {
  font-weight: 800;
  font-size: 15px;
  color: var(--color-orange-dark);
  margin: 0 0 10px;
}

.reward-praise-text:empty {
  display: none;
}

.reward-amounts {
  display: flex;
  gap: 20px;
  font-size: 18px;
  font-weight: 800;
  justify-content: center;
}

/* ---------- おうちのひと用ボタン ---------- */

.parent-lock-btn {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  height: 52px;
  border-radius: 999px;
  border: var(--border-thick);
  background: #FEF3C7;
  box-shadow: var(--shadow-clay);
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--color-ink);
  cursor: pointer;
  z-index: 50;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.parent-lock-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-clay-pressed);
}

/* ---------- おうちのひと用パネル ---------- */

.parent-view {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--color-pink-light) 0%, var(--color-bg) 260px);
}

.parent-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-back {
  background: #fff;
}

.parent-heading {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.parent-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tab-btn {
  flex: 1;
  border: var(--border-thick);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 6px;
  box-shadow: var(--shadow-clay-sm);
  cursor: pointer;
  color: var(--color-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.tab-btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: var(--shadow-clay-pressed);
}

@media (hover: hover) {
  .tab-btn:not(:disabled):hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: var(--shadow-clay);
  }
}

.tab-btn.active {
  background: var(--color-pink);
}

.approval-list,
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.approval-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.approval-actions {
  display: flex;
  gap: 10px;
}

.btn-approve {
  background: var(--color-green);
  color: #fff;
  flex: 1;
}

.btn-partial {
  background: #FBCFE8;
  color: var(--color-orange-dark);
  flex: 1;
}

.empty-message {
  text-align: center;
  font-weight: 700;
  opacity: 0.6;
  padding: 24px 4px;
}

/* ---------- おたから申請・こうかん履歴 ---------- */

.tab-section-title {
  font-size: 15px;
  font-weight: 800;
  margin: 4px 4px 10px;
}

.tab-section-title:not(:first-child) {
  margin-top: 22px;
}

.payout-list,
.payout-history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.payout-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.payout-icon {
  font-size: 30px;
  flex-shrink: 0;
}

.payout-info {
  flex: 1;
  min-width: 0;
}

.payout-name {
  font-weight: 700;
  font-size: 15px;
}

.payout-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-orange-dark);
  margin-top: 2px;
}

.btn-payout-complete {
  background: var(--color-green);
  color: #fff;
  flex-shrink: 0;
}

.payout-history-item {
  background: var(--color-card);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-clay-sm);
}

.payout-history-icon {
  font-size: 20px;
}

.payout-history-name {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.payout-history-date {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.7;
  white-space: nowrap;
}

.progress-row {
  background: var(--color-card);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  box-shadow: var(--shadow-clay-sm);
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 4px;
  margin: -4px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  text-align: left;
}

button.progress-info {
  cursor: pointer;
  transition: background 0.15s ease;
}

button.progress-info:hover,
button.progress-info:focus-visible {
  background: var(--color-pink-light);
}

button.progress-info:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}

.progress-photo {
  font-size: 20px;
}

.progress-title {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}

.progress-status {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.btn-progress-edit {
  background: #DBEAFE;
  color: var(--color-blue-dark);
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-clay-sm);
}

.btn-progress-delete {
  background: #FCA5A5;
  color: #7F1D1D;
  min-height: 36px;
  width: 36px;
  padding: 0;
  font-size: 15px;
  border-radius: 50%;
  box-shadow: var(--shadow-clay-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-progress-edit:disabled,
.btn-progress-delete:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.store-manage-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.store-manage-row {
  background: var(--color-card);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  box-shadow: var(--shadow-clay-sm);
}

.store-manage-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.store-manage-info {
  flex: 1;
  min-width: 0;
}

.store-manage-name {
  font-weight: 700;
  font-size: 14px;
}

.store-manage-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-orange-dark);
  margin-top: 2px;
}

/* ---------- モーダル共通 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 55, 40, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-overlay:not([hidden]) {
  display: flex;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 4px;
  text-align: center;
}

.modal-subtitle {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--color-ink);
  opacity: 0.8;
  text-align: center;
}

.btn-cancel {
  background: var(--color-locked);
  width: 100%;
  margin-top: 4px;
}

/* ---------- パスコードキーパッド ---------- */

.passcode-card {
  background: var(--color-key-yellow);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  animation: reward-pop 0.3s ease;
}

.passcode-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  background: #fff;
  transition: background 0.15s ease, transform 0.15s ease;
}

.dot.filled {
  background: var(--color-orange);
  transform: scale(1.15);
}

.passcode-keypad {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.key-btn {
  background: #fff;
  border: var(--border-thick);
  border-radius: 50%;
  font-family: inherit;
  font-weight: 800;
  font-size: 18px;
  width: 60px;
  height: 60px;
  box-shadow: var(--shadow-clay-sm);
  cursor: pointer;
  color: var(--color-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.key-btn:active {
  transform: translateY(4px);
  box-shadow: var(--shadow-clay-pressed);
}

.key-clear,
.key-back {
  background: #FCA5A5;
}

.shake {
  animation: shake-anim 0.4s ease;
}

@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ---------- 具体的称賛モーダル ---------- */

.praise-card {
  background: var(--color-pink-light);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: reward-pop 0.3s ease;
}

.praise-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.praise-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: #fff;
  border: var(--border-thick);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: var(--color-ink);
  box-shadow: var(--shadow-clay-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.praise-option-btn:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-clay-pressed);
}

.praise-option-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ---------- クエスト追加 ---------- */

.btn-add-quest {
  background: var(--color-orange);
  color: #fff;
  width: 100%;
  margin-bottom: 14px;
}

.add-quest-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  max-height: 86vh;
  max-height: 86dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: reward-pop 0.3s ease;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-ink);
  background: #fff;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-clay-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.35), var(--shadow-clay-sm);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row > div {
  flex: 1;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.emoji-opt {
  width: 44px;
  height: 44px;
  font-size: 20px;
  background: #fff;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-clay-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.emoji-opt:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-clay-pressed);
}

.emoji-opt.active {
  background: var(--color-key-yellow);
  transform: translateY(2px) scale(1.05);
  box-shadow: var(--shadow-clay-pressed);
}

.emoji-opt:focus-visible,
.modal-actions .btn:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 3px;
}

.day-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.day-opt {
  width: 40px;
  height: 40px;
  font-size: 14px;
  font-weight: 700;
  background: #fff;
  color: var(--color-ink);
  border: 2px solid var(--color-ink);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-clay-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease, color 0.15s ease;
}

.day-opt:active {
  transform: translateY(3px);
  box-shadow: var(--shadow-clay-pressed);
}

.day-opt.active {
  background: linear-gradient(135deg, var(--color-orange), var(--color-pink));
  color: #fff;
  transform: translateY(2px) scale(1.05);
  box-shadow: var(--shadow-clay-pressed);
}

.day-opt:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 3px;
}

.day-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-left: 4px;
}

.day-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-locked);
  color: var(--color-ink);
  opacity: 0.55;
}

.day-badge.active {
  background: var(--color-blue);
  color: #fff;
  opacity: 1;
}

.day-badge.everyday {
  background: var(--color-key-yellow);
  color: var(--color-ink);
  opacity: 1;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn {
  flex: 1;
  margin-top: 0;
}

/* ---------- 児童用ボトムナビゲーション ---------- */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--color-card);
  border-top: var(--border-thick);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 60;
  box-shadow: 0 -6px 16px rgba(74, 55, 40, 0.15);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  padding: 6px 2px;
  cursor: pointer;
  color: var(--color-ink);
  opacity: 0.55;
  transition: opacity 0.15s ease, transform 0.08s ease, background 0.15s ease;
}

.nav-btn:active {
  transform: translateY(2px);
}

.nav-btn.active {
  opacity: 1;
  background: var(--color-pink-light);
  border-color: var(--color-ink);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 800;
}

/* ---------- がんばりカレンダー ---------- */

.calendar-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 16px;
}

.calendar-month-label {
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 12px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.55;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-cell {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: #FFF7ED;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: inherit;
  padding: 0;
  cursor: default;
}

.calendar-cell.empty {
  background: transparent;
  border: none;
}

.calendar-cell.day {
  border-color: var(--color-ink);
}

.calendar-day-num {
  font-size: 11px;
  font-weight: 700;
}

.calendar-cell.today {
  background: var(--color-key-yellow);
}

.calendar-cell.future {
  opacity: 0.45;
}

.calendar-cell.has-stamp {
  cursor: pointer;
  background: #FCE7F3;
  box-shadow: var(--shadow-clay-sm);
}

.calendar-cell.has-stamp:active {
  transform: translateY(2px);
}

.calendar-stamp {
  font-size: 16px;
  position: absolute;
  bottom: 1px;
  animation: stamp-bounce 0.5s ease;
}

@keyframes stamp-bounce {
  0% { transform: scale(0) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

/* ---------- せいちょうグラフ ---------- */

.growth-card {
  background: linear-gradient(180deg, #DBEAFE 0%, var(--color-card) 70%);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 16px;
  margin-top: 16px;
}

.growth-graph {
  padding-top: 4px;
}

.growth-trail {
  display: block;
  width: 100%;
  overflow: visible;
}

.growth-mountain {
  fill: #DBEAFE;
  stroke: none;
}

.growth-line {
  fill: none;
  stroke: var(--color-orange);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 0 var(--color-ink));
}

.growth-marker {
  fill: var(--color-card);
  stroke: var(--color-ink);
  stroke-width: 2;
}

.growth-marker.earned {
  fill: var(--color-yellow);
}

.growth-star {
  font-size: 20px;
  text-anchor: middle;
}

.growth-day-label {
  font-size: 10px;
  font-weight: 700;
  fill: var(--color-ink);
  text-anchor: middle;
}

.growth-message {
  margin: -2px 0 0;
  padding: 9px 12px;
  border: 2px dashed var(--color-orange);
  border-radius: var(--radius-sm);
  background: #FFF7ED;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

/* ---------- がんばり: 日別詳細モーダル ---------- */

.day-detail-card {
  background: var(--color-card);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay);
  padding: 22px;
  max-width: 340px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: reward-pop 0.3s ease;
}

.day-detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 16px;
}

.day-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF3C7;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.day-detail-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.day-detail-title {
  flex: 1;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
}

.day-detail-reward {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-orange-dark);
  white-space: nowrap;
}

/* ---------- レスポンシブ (375px〜768px) ---------- */

@media (max-width: 400px) {
  .app {
    padding: 12px 10px calc(88px + env(safe-area-inset-bottom));
  }
  .app-logo {
    font-size: 21px;
  }
  .badge {
    padding: 6px 12px;
    font-size: 14px;
  }
  .pet-room {
    padding: 38px 14px 16px;
  }
  .flag {
    width: 14px;
    height: 16px;
  }
  .room-ornament .ornament-icon {
    width: 20px;
    height: 20px;
  }
  .room-shelf {
    width: 52px;
    height: 40px;
    right: 8px;
    bottom: 10px;
  }
  .pet {
    width: 108px;
    height: 108px;
  }
  .store-list {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .parent-view {
    padding: 12px 10px 90px;
  }
  .bottom-nav {
    gap: 2px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .nav-icon {
    font-size: 19px;
  }
  .nav-label {
    font-size: 9px;
  }
  .calendar-day-num {
    font-size: 10px;
  }
  .calendar-stamp {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
