/* かずのもり — 画面レイアウトとシーン装飾 */

/* ============ ホーム ============ */
#screen-home {
  background: linear-gradient(#CBE9F4 0%, #E7F5E4 42%, #F3EDD8 68%, var(--bg) 100%);
}

.scene-sky { position: absolute; inset: 0; pointer-events: none; }
.sun {
  position: absolute; top: 6%; right: 9%;
  width: clamp(70px, 9vw, 116px); height: clamp(70px, 9vw, 116px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFF3C4, #FFD976);
  box-shadow: 0 0 60px rgba(255, 217, 118, 0.75);
}
.cloud {
  position: absolute;
  width: 130px; height: 40px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 32px -14px 0 4px #fff, -30px -8px 0 0 #fff;
  opacity: 0.92;
  animation: drift 70s linear infinite;
}
.cloud-1 { top: 9%; left: -12%; }
.cloud-2 { top: 19%; left: 28%; animation-duration: 95s; scale: 0.75; }
.cloud-3 { top: 5%; left: 60%; animation-duration: 80s; scale: 1.1; }
@keyframes drift { to { margin-left: 120vw; } }

.scene-hill { position: absolute; border-radius: 50%; pointer-events: none; }
.hill-back { left: -12%; right: -12%; height: 46vh; bottom: -20vh; background: #BCDCA9; }
.hill-front { left: -30%; right: 24%; height: 40vh; bottom: -24vh; background: #A5CF97; }
.scene-trees {
  position: absolute; bottom: 21vh; left: 4%;
  font-size: clamp(38px, 6vw, 62px);
  letter-spacing: -10px;
  pointer-events: none;
  filter: drop-shadow(0 4px 3px rgba(74, 59, 46, 0.15));
}

.home-header { position: relative; z-index: 2; text-align: center; margin-top: 4vh; }
.title-board {
  display: inline-block;
  background: linear-gradient(#C89B6B, #B98A5E);
  color: #FFF9EC;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 12px 44px;
  border-radius: 26px;
  border: 6px solid #A87B4F;
  box-shadow: 0 8px 0 rgba(74, 59, 46, 0.2);
  transform: rotate(-2deg);
  text-shadow: 0 2px 0 rgba(74, 59, 46, 0.25);
}

.home-menu {
  position: relative; z-index: 2;
  display: flex;
  gap: clamp(14px, 3vw, 34px);
  justify-content: center;
  align-items: stretch;
  margin: auto 0;
  padding: 0 4vw;
  flex-wrap: wrap;
}
.menu-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--panel);
  border-radius: 30px;
  border-top: 10px solid transparent;
  padding: 28px 30px 22px;
  width: clamp(190px, 23vw, 264px);
  box-shadow: 0 10px 0 rgba(74, 59, 46, 0.12);
  transition: transform 0.1s;
}
.menu-card:active { transform: scale(0.95); }
.accent-coral { border-top-color: #F2788F; }
.accent-sky { border-top-color: #5FA8E8; }
.accent-leaf { border-top-color: #7DC87E; }
.menu-icon { font-size: clamp(52px, 7vw, 80px); line-height: 1.15; }
.menu-label { font-size: clamp(19px, 2.3vw, 25px); font-weight: 800; word-break: keep-all; text-align: center; }

.home-tet {
  position: absolute; left: 3%; bottom: 4%;
  z-index: 3;
  display: flex; align-items: flex-end; gap: 6px;
}
.tet-emoji {
  font-size: clamp(64px, 9vw, 110px);
  line-height: 1;
  display: inline-block;
  cursor: pointer;
  filter: drop-shadow(0 5px 4px rgba(74, 59, 46, 0.2));
}
.tet-bubble {
  background: var(--panel);
  border-radius: 18px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: clamp(15px, 2vw, 21px);
  box-shadow: var(--shadow);
  margin-bottom: 44px;
}
.parent-link {
  position: absolute; top: 14px; right: 14px;
  z-index: 4;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 253, 246, 0.72);
  font-size: 26px;
  opacity: 0.8;
}

/* ============ 画面共通ヘッダー ============ */
.session-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 6px;
}
.head-spacer { width: 64px; }
.head-title { font-size: clamp(20px, 2.6vw, 26px); font-weight: 800; }

.session-progress { display: flex; gap: 10px; }
.prog-acorn {
  font-size: clamp(24px, 3.4vw, 34px);
  filter: grayscale(1) opacity(0.3);
  transition: filter 0.3s;
}
.prog-acorn.got { filter: none; animation: pulse 0.45s; }

/* ============ アクティビティ ============ */
.activity-stage {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 3vw 1.5vh;
}
.act-field {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2.5vh;
  min-height: 0;
  position: relative;
}

/* A1 かぞえて あげよう */
.count-layout { flex-direction: row; align-items: stretch; gap: 2vw; }
.count-ground {
  flex: 1.35;
  position: relative;
  background: linear-gradient(#F0F7E3, #E3F0CE);
  border-radius: 28px;
  box-shadow: inset 0 0 0 4px #DBE8C0;
  min-height: 220px;
}
.acorn {
  position: absolute;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 50px;
  line-height: 1;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.15));
}
.count-side {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
}
.count-tet { font-size: clamp(56px, 7vw, 80px); line-height: 1; }
.tet-happy { animation: bounce 0.6s 2; }
.count-basket { --cell: 52px; }

/* A2 どっちが おおい？ */
.compare-row {
  display: flex;
  gap: clamp(20px, 5vw, 70px);
  align-items: center;
  justify-content: center;
}
.compare-card {
  position: relative;
  background: var(--panel);
  border-radius: 30px;
  padding: clamp(14px, 2.4vw, 28px);
  box-shadow: 0 8px 0 rgba(74, 59, 46, 0.12);
  transition: transform 0.1s;
}
.compare-card:active { transform: scale(0.97); }
.compare-card .tray { box-shadow: none; border-color: #F0E3C2; }
.big-num {
  display: block;
  font-size: clamp(80px, 12vw, 120px);
  font-weight: 800;
  color: var(--c, var(--wood-dark));
  padding: 4px 36px;
}
.crown {
  position: absolute;
  top: -36px; left: 50%;
  transform: translateX(-50%);
  font-size: 52px;
  animation: pop-in 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* A3 すうじは どれ？ */
.numcard-row, .traypick-row {
  display: flex;
  gap: clamp(18px, 4vw, 50px);
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}
.traypick-card {
  position: relative;
  background: var(--panel);
  border-radius: 26px;
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.1s;
}
.traypick-card:active { transform: scale(0.97); }
.traypick-card.wrong { opacity: 0.4; animation: shake 0.4s; }
.traypick-card .tray { box-shadow: none; border-color: #F0E3C2; }

/* A4 がっちゃん！ */
.gacchan-row {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(14px, 3vw, 40px);
  min-height: 200px;
}
.gacchan-spark { font-size: clamp(36px, 5vw, 56px); animation: spark-pulse 1.3s infinite; }
@keyframes spark-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.3); opacity: 1; }
}
.merge-left { animation: merge-left 0.7s forwards ease-in; }
.merge-right { animation: merge-right 0.7s forwards ease-in; }
@keyframes merge-left { to { transform: translateX(70%) scale(0.55); opacity: 0; } }
@keyframes merge-right { to { transform: translateX(-70%) scale(0.55); opacity: 0; } }
.spark-go { animation: spark-go 0.7s forwards; }
@keyframes spark-go { to { transform: scale(2.4); opacity: 0; } }
.result-pop { animation: pop-in 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }

/* A5 わけっこ */
.split-layout { gap: 1.5vh; }
.split-rowwrap { position: relative; padding: 56px 30px 10px; }
.split-row { display: flex; gap: 14px; }
.split-dot { width: clamp(48px, 6vw, 64px); height: clamp(48px, 6vw, 64px); transition: transform 0.3s; }
.split-row-small .split-dot { width: clamp(36px, 4.4vw, 48px); height: clamp(36px, 4.4vw, 48px); }
.split-row-small { gap: 10px; }
.split-dot.side-left { transform: translateY(-10px); }
.leaf-divider {
  position: absolute;
  left: 50%;
  top: -14px;
  margin-left: -36px;
  font-size: 58px;
  line-height: 1;
  padding: 4px 12px;
  z-index: 5;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.2));
}
.leaf-divider::after {
  content: '';
  position: absolute;
  left: 50%; top: 62px;
  transform: translateX(-50%);
  width: 6px; height: 92px;
  border-radius: 4px;
  background: var(--leaf-dark);
  opacity: 0.75;
}
.split-plates { display: flex; gap: clamp(60px, 16vw, 220px); }
.split-plate {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  background: #FFF9EC;
  border: 3px solid #E8D3A8;
  border-radius: 999px;
  padding: 10px 26px;
  box-shadow: var(--shadow);
}
.plate-animal { font-size: clamp(40px, 5vw, 54px); line-height: 1; }
.plate-badge {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--c, #D9C193);
  color: #fff;
  font-weight: 800;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
}

/* A6/A7 しき */
.eq-layout { gap: 1vh; }
.eq-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(10px, 2vw, 26px);
}
.eq-row .eq-op { margin-top: clamp(24px, 3vw, 34px); }
.eq-row > .num-card { flex-shrink: 0; }
.eq-item { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.peek-tray { min-height: 8px; }
.peek-tray .tray { --cell: 32px; padding: 8px; }

/* A7 ひきざん（お話） */
.substory-layout { position: relative; }
.crow {
  position: absolute;
  top: 4%;
  right: -150px;
  font-size: clamp(52px, 7vw, 76px);
  line-height: 1;
  z-index: 5;
  transition: transform 1.4s ease;
}
.crow-in { transform: translateX(calc(-45vw + 0px)); }
.crow-out { transform: translate(-92vw, -34vh) scale(0.7); }

/* ============ はこにわ ============ */
#screen-sandbox { background: var(--bg); }
.sandbox-body { flex: 1; display: flex; min-height: 0; }
.sandbox-field {
  flex: 1;
  position: relative;
  margin: 4px 10px 12px 12px;
  border-radius: 30px;
  background: linear-gradient(#F2F8E6, #E5F0D1);
  box-shadow: inset 0 0 0 4px #DCE9C4;
  overflow: hidden;
}
.stone-rail {
  width: 92px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 4px 12px 12px 0;
  overflow-y: auto;
}
.stone {
  flex-shrink: 0;
  width: 62px; height: 62px;
  border-radius: 22px;
  background: var(--c, #B98A5E);
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  box-shadow: 0 5px 0 rgba(74, 59, 46, 0.25);
  transition: transform 0.08s;
}
.stone:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(74, 59, 46, 0.25); }

.cluster { position: absolute; z-index: 2; }
.cluster-single { width: 62px; height: 62px; }
.cluster .tray { --cell: 36px; padding: 8px; }
.spawn-pop { animation: pop-in 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); }
.sweep-away {
  transition: transform 0.5s ease-in, opacity 0.5s !important;
  transform: translateY(80vh) rotate(50deg) !important;
  opacity: 0;
}

/* ============ もり ============ */
#screen-forest { background: var(--bg); }
.forest-body { flex: 1; position: relative; min-height: 0; padding: 4px 12px 12px; }
.forest-scene {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(#CBE9F4, #E7F5E4 38%, #D3E8BE 68%, #BFDFAA);
}
.forest-sun {
  position: absolute; top: 7%; left: 7%;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFF3C4, #FFD976);
  box-shadow: 0 0 40px rgba(255, 217, 118, 0.65);
}
.forest-treeline {
  position: absolute;
  top: 22%;
  width: 100%;
  text-align: center;
  font-size: clamp(40px, 8vw, 84px);
  letter-spacing: 8px;
  filter: drop-shadow(0 4px 3px rgba(74, 59, 46, 0.15));
  pointer-events: none;
}
.forest-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  z-index: 2;
}
.spot-emoji { font-size: clamp(38px, 5.5vw, 60px); line-height: 1.15; }
.spot-name {
  font-size: 15px;
  font-weight: 800;
  background: rgba(255, 253, 246, 0.88);
  border-radius: 999px;
  padding: 2px 12px;
  margin-top: 2px;
}
.forest-spot.locked { opacity: 0.3; }
.forest-spot.bounce .spot-emoji { animation: bounce 0.6s; }
.forest-acorns {
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 800;
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 20px;
  box-shadow: var(--shadow);
}

/* ============ セッション完走カード・親ゲート ============ */
.end-card, .gate-card {
  background: var(--panel);
  border-radius: 30px;
  padding: 34px 44px;
  text-align: center;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
  max-width: min(92vw, 560px);
  animation: pop-in 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.end-title { font-size: clamp(30px, 4.4vw, 42px); font-weight: 800; }
.end-friend { font-size: clamp(72px, 10vw, 100px); margin: 10px 0 4px; line-height: 1.2; }
.end-text {
  font-size: clamp(19px, 2.6vw, 24px);
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 22px;
}
.end-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.gate-title { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.gate-note { font-size: 15px; color: var(--ink-soft); line-height: 1.8; margin-bottom: 16px; }
.gate-note strong { color: var(--ink); }
.btn-hold {
  position: relative;
  overflow: hidden;
  width: 210px; height: 66px;
  border-radius: 999px;
  background: #E4DCCB;
  font-weight: 800;
  font-size: 19px;
  margin-bottom: 6px;
}
.hold-fill { position: absolute; inset: 0; width: 0; background: #7DC87E; }
.btn-hold.holding .hold-fill { animation: hold-fill 2s linear forwards; }
@keyframes hold-fill { to { width: 100%; } }
.hold-label { position: relative; z-index: 1; }
.gate-dots { display: flex; gap: 18px; justify-content: center; margin: 8px 0 4px; }
.gate-dot {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #EFE8D8;
  font-size: 20px;
  color: #B49A72;
  box-shadow: 0 4px 0 rgba(74, 59, 46, 0.14);
}
.gate-dot:active { transform: translateY(3px); }
.gate-close { margin-top: 12px; }

/* ============ おうちのかた ============ */
.parent-theme { background: #F4F1EA; }
.parent-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px clamp(16px, 4vw, 48px) 70px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}
.p-head { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; flex-wrap: wrap; }
.p-title { font-size: clamp(19px, 2.6vw, 24px); font-weight: 800; }
.p-privacy {
  background: #EAF3E6;
  border: 1px solid #C9DEC0;
  color: #3E5A38;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 20px;
}
.p-section {
  background: #fff;
  border-radius: 18px;
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.p-section-title { font-weight: 800; font-size: 17px; margin-bottom: 14px; }

.p-skill {
  display: grid;
  grid-template-columns: 44px minmax(110px, 1.1fr) minmax(90px, 1fr) auto auto;
  gap: 2px 14px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #F0EBE0;
  font-size: 15px;
}
.p-skill:last-child { border-bottom: none; }
.p-skill-icon { font-size: 26px; text-align: center; }
.p-skill-name { font-weight: 700; }
.p-skill-name small { display: block; color: #B0A48E; font-weight: 400; font-size: 12px; }
.p-skill-bar { height: 10px; background: #EFE8D8; border-radius: 99px; overflow: hidden; }
.p-skill-fill { display: block; height: 100%; background: #7DC87E; border-radius: 99px; }
.p-skill-lv { font-size: 13px; color: #8A7B66; white-space: nowrap; }
.p-skill-status {
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 12px;
  text-align: center;
  white-space: nowrap;
}
.st-locked { background: #F0EBE0; color: #A79A82; }
.st-active { background: #E3F0FB; color: #3D7DBF; }
.st-master { background: #FFF3D6; color: #B8860B; }
.p-skill-recent { grid-column: 2 / -1; color: #8A7B66; font-size: 13px; }

.p-days { display: flex; gap: clamp(8px, 2vw, 18px); align-items: flex-end; height: 140px; padding: 0 6px; }
.p-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; width: 46px; height: 100%; }
.p-day-v { font-size: 12px; color: #8A7B66; height: 16px; }
.p-day-bar { width: 22px; background: #5FA8E8; border-radius: 8px 8px 3px 3px; }
.p-day-label { font-size: 12px; color: #8A7B66; }
.p-total { margin-top: 14px; font-size: 14px; color: #6E604E; }

.p-setting {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #F0EBE0;
  flex-wrap: wrap;
}
.p-setting:last-child { border-bottom: none; }
.p-setting-label { font-weight: 700; font-size: 15px; }
.p-toggle {
  min-width: 88px;
  padding: 10px 20px;
  border-radius: 999px;
  background: #E4DCCB;
  font-weight: 700;
}
.p-toggle.on { background: #7DC87E; color: #fff; }
.p-seg { display: flex; background: #EFE8D8; border-radius: 999px; padding: 4px; gap: 4px; }
.p-seg-btn { padding: 8px 18px; border-radius: 999px; font-weight: 700; color: #8A7B66; font-size: 14px; }
.p-seg-btn.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.p-danger {
  background: #F8E3E0;
  color: #B3564A;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  text-align: left;
}
.p-engine {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.p-engine-note { font-size: 13px; color: #8A7B66; max-width: 340px; line-height: 1.6; }
.p-select {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: #EFE8D8;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
}

/* ============ 縦持ち・小さい画面 ============ */
@media (max-width: 740px), (orientation: portrait) {
  .home-menu { flex-direction: column; align-items: center; gap: 13px; }
  .menu-card {
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
    width: min(86vw, 430px);
    padding: 16px 26px;
    border-top-width: 7px;
  }
  .menu-icon { font-size: 42px; }
  .tet-bubble { display: none; }
  .count-layout { flex-direction: column; }
  .count-ground { width: 100%; min-height: 180px; flex: 1; }
  .count-side { flex-direction: row; flex-wrap: wrap; gap: 10px; }
  .count-tet { order: 1; }
  .count-basket { order: 2; --cell: 44px; }
  .count-side .btn-primary { order: 3; }
  .compare-row { gap: 14px; }
  .split-plates { gap: 30px; }
  .eq-row { flex-wrap: wrap; }
  .stone-rail { width: 76px; }
  .stone { width: 54px; height: 54px; font-size: 24px; }
}
