/* Learning journey components. Home artwork and individual game layouts stay in styles.css. */
:root {
  --experience-radius: 24px;
  --experience-shadow: 0 5px 0 rgba(73, 95, 67, .12);
}

.garden-menu { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: clamp(10px, 2vh, 22px); }
.garden-menu > * { min-width: 0; }
.garden-menu .topbar { height: clamp(48px, 10vh, 72px); }
.garden-menu .topbar-title { text-align: left; padding-left: 8px; color: var(--forest); }
.garden-welcome { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 54px; }
.garden-greeting { display: flex; align-items: center; gap: 12px; min-width: 0; }
.garden-greeting img { width: clamp(50px, 11vh, 82px); height: clamp(50px, 11vh, 82px); object-fit: contain; }
.garden-greeting span { display: grid; gap: 4px; }
.garden-greeting small { font-size: 12px; color: var(--wood); }
.garden-greeting strong { font-size: clamp(18px, 3vh, 26px); color: var(--forest); }
.garden-resume { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-width: 230px; max-width: 48%; min-height: 56px; padding: 9px 20px; border: 0; border-radius: 18px; background: var(--forest); color: white; box-shadow: var(--experience-shadow); text-align: left; }
.garden-resume span { min-width: 0; font-size: 20px; font-weight: 800; }
.garden-resume small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; font-size: 12px; font-weight: 500; }
.garden-resume b { font-size: 28px; }
.garden-invitation { color: var(--wood); font-size: clamp(13px, 2.3vh, 20px); }
.garden-invitation span { padding: 0 12px; }
.garden-doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 2vw, 28px); min-height: 0; padding: 7px 3px; }
.garden-door { --door-color: #e8c68d; --door-paper: #fff6df; position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto auto auto; justify-items: center; gap: 7px; min-width: 0; min-height: 0; border: 2px solid var(--door-color); border-radius: 46% 46% 22px 22px / 19% 19% 22px 22px; padding: 16px 16px 12px; background: radial-gradient(ellipse at 50% 14%, #fffefa 15%, transparent 72%), var(--door-paper); box-shadow: 0 7px 0 color-mix(in srgb, var(--door-color) 42%, transparent); transition: transform .15s; }
.garden-door:active { transform: translateY(3px); }
.domain-moji { --door-color: #d6ad9c; --door-paper: #f8e9df; }
.domain-kazu { --door-color: #d8bc73; --door-paper: #fcf0cc; }
.domain-chie { --door-color: #a6bea0; --door-paper: #e9f1dc; }
.domain-riddle { --door-color: #9fbfc0; --door-paper: #e3f0ed; }
.door-symbol { position: absolute; top: 9%; left: 13%; color: var(--forest); opacity: .6; font-size: clamp(22px, 5vh, 44px); font-weight: 800; transform: rotate(-9deg); letter-spacing: -.03em; }
.door-animal { display: grid; place-items: center; min-height: 0; height: 100%; width: 100%; padding-top: 12px; }
.door-animal img { display: block; width: 90%; height: 100%; max-height: 220px; min-height: 0; object-fit: contain; filter: drop-shadow(0 6px 1px rgba(99, 82, 54, .08)); }
.garden-door > strong { font-size: clamp(22px, 4vh, 36px); color: var(--forest); line-height: 1.1; }
.garden-door > small { font-size: clamp(12px, 1.8vh, 15px); color: #765c47; }
.door-progress { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 5px; padding-top: 9px; border-top: 1px solid var(--door-color); color: var(--forest); font-size: 12px; }
.door-progress b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.7); font-size: 23px; }
.garden-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.garden-album { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 7px 18px; border: 1.5px solid #cfb589; border-radius: 18px; background: #fffdf5; box-shadow: var(--experience-shadow); color: var(--forest); }
.garden-album strong { font-size: 17px; }
.garden-album small { font-size: 12px; color: var(--wood); }
.mini-capsule { width: 30px; height: 34px; border: 2px solid #c59543; border-radius: 45%; background: linear-gradient(#fff8dc 47%, #d9ad55 48% 53%, #edc96e 54%); transform: rotate(-15deg); }
.parent-entry { border: 0; background: transparent; color: #775f4c; padding: 12px; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }

/* Book selection has a single, large selector instead of a tiny scrolling tab strip. */
.shelf--guided .topbar { height: clamp(48px, 10vh, 70px); }
.shelf--guided .domain-tab { min-height: 44px; min-width: 78px; padding: 7px 16px; font-size: 17px; }
.shelf--guided .workbook-picker { grid-template-columns: 46px minmax(0, 1fr) 46px; }
.current-book-button { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-width: 0; min-height: 48px; padding: 5px 16px; border: 1.5px solid #cab79a; border-radius: 14px; color: var(--forest); background: #fffdf6; text-align: left; }
.current-book-button span { min-width: 0; }
.current-book-button small { display: block; color: var(--wood); font-size: 10px; }
.current-book-button strong { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.current-book-button b { white-space: nowrap; font-size: 13px; }
.shelf--guided:not(.reviewing) .stage-card { grid-template-rows: minmax(0, 1fr) auto auto; padding: 32px 12px 10px; border-width: 2px; }
.shelf--guided .stage-number { position: absolute; left: 10px; top: 8px; font-size: 15px; width: 25px; height: 25px; }
.shelf--guided .stage-card img { width: min(105px, 21vh); height: min(105px, 21vh); max-height: 100%; object-fit: contain; }
.shelf--guided .stage-title { font-size: clamp(15px, 2.8vh, 22px); line-height: 1.3; }
.stage-operation { display: flex; justify-content: space-between; width: 100%; padding-top: 5px; color: #80634b; font-size: 12px; }
.stage-operation b { color: var(--forest); font-size: 17px; }

/* Separate music from read-aloud; keep the question's work area as large as possible. */
.question-step { white-space: nowrap; font-size: 20px; font-weight: 800; color: var(--forest); }
.question-step small { font-size: 12px; color: var(--wood); }
.speak-button, .guide-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.speak-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.speak-button small, .guide-button small { font-size: 9px; line-height: 1.1; white-space: nowrap; }
.question .menu-fullscreen-button { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; }
.question .menu-fullscreen-button span { font-size: 20px; }
.question .menu-fullscreen-button small { display: block; font-size: 10px; white-space: nowrap; }
.garden-menu .menu-fullscreen-button, .garden-menu .menu-install-button { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; }
.garden-menu .menu-fullscreen-button span, .garden-menu .menu-install-button span { font-size: 19px; }
.garden-menu .menu-fullscreen-button small, .garden-menu .menu-install-button small { font-size: 9px; white-space: nowrap; }
.evidence-content > .asset-group[data-count="1"] img { width: clamp(70px, 23vh, 142px); height: clamp(70px, 23vh, 142px); }
.evidence-content > .asset-group[data-count="2"] img { width: clamp(58px, 18vh, 105px); height: clamp(58px, 18vh, 105px); }
.evidence-content > .asset-group[data-count="3"] img { width: clamp(48px, 15vh, 85px); height: clamp(48px, 15vh, 85px); }
.evidence-content > .asset-group .count-marker { width: auto; height: auto; min-width: 48px; min-height: 48px; }
.choice-card .asset-group[data-count="3"] img:last-child { grid-column: auto; }
.guide-button { font-size: 21px; color: var(--forest); }
.question .topbar-end { gap: 6px; }
.question .topbar-end .icon-button, .question .menu-fullscreen-button { min-width: 46px; width: 46px; min-height: 46px; height: 46px; padding: 2px; border-radius: 15px; }
.question .topbar-end .bgm-button { font-size: 25px; }
.question .topbar-title { line-height: 1.2; }
.needs-hint .evidence-board { box-shadow: inset 0 0 0 3px rgba(233,185,79,.22); }
.needs-hint .hint.active { padding: 4px 8px; border-radius: 10px; background: #fff1c4; color: #735221; }
.success-stamps { display: flex; justify-content: center; gap: 9px; margin: 12px 0; }
.success-stamps span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #ccbe9f; background: #f4eddc; font-size: 25px; }
.success-stamps .earned { color: #a56834; background: #f6d985; }
.completion-friend { display: flex; align-items: center; justify-content: center; gap: 12px; }
.completion-friend img { width: clamp(55px, 15vh, 100px); height: clamp(55px, 15vh, 100px); object-fit: contain; }
.completion-friend p { font-size: 17px; color: var(--forest); }
.complete .complete-actions { flex-wrap: wrap; justify-content: center; max-width: 100%; gap: 10px; }
.completion-reward { background: #fff0c5; }

.experience-backdrop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgba(39, 58, 44, .38); backdrop-filter: blur(5px); }
.experience-dialog { width: min(760px, 100%); max-height: 100%; min-height: 0; overflow: hidden; border: 2px solid #ccb48e; border-radius: 28px; padding: 24px; background: #fffaf0; box-shadow: 0 20px 80px rgba(35, 54, 32, .2); }
.experience-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.experience-dialog h2 { margin: 0; color: var(--forest); font-size: clamp(22px, 4vh, 32px); }
.experience-dialog header button { flex-shrink: 0; width: 46px; height: 46px; border: 1.5px solid #c6ae91; border-radius: 50%; background: #fffdf6; font-size: 25px; }
.book-dialog, .parent-dialog { display: flex; flex-direction: column; }
.book-picker-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; min-height: 0; overflow-y: auto; padding: 5px; overscroll-behavior: contain; }
.book-choice { display: grid; gap: 9px; min-height: 84px; padding: 12px; border: 1.5px solid #cebda1; border-radius: 16px; background: #fffdf9; text-align: left; }
.book-choice strong { color: var(--forest); font-size: 17px; }
.book-choice small { color: #80634c; font-size: 12px; }
.book-choice.selected { border: 2px solid var(--forest); background: #e9f0df; }
.parent-content { overflow-y: auto; min-height: 0; font-size: 15px; line-height: 1.8; user-select: text; }
.parent-content ul { padding-left: 1.4em; }
.parent-content li { margin-block: 8px; }
.parent-highlight { padding: 12px 20px; background: #edf1e1; border-radius: 16px; color: var(--forest); }
.parent-highlight strong { font-size: 28px; padding-left: 10px; }
.save-warning { position: fixed; left: 12px; bottom: 12px; z-index: 160; max-width: calc(100% - 24px); border: 1px solid #ae613b; border-radius: 12px; padding: 10px 16px; color: #68381e; background: #fff0dd; }
.save-error { border: 1px solid #ae613b; padding: 12px; color: #68381e; background: #fff0dd; }
.guide-dialog { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; }
.guide-copy > small { color: var(--wood); font-size: 13px; }
.guide-copy h2 { margin-top: 9px; font-size: clamp(26px, 5vh, 40px); }
.guide-copy p { font-size: clamp(16px, 2.7vh, 21px); line-height: 1.7; }
.guide-copy .primary-button { min-width: 170px; min-height: 48px; }
.guide-demo { position: relative; height: clamp(160px, 35vh, 250px); border-radius: 25px; background: #eff2df; overflow: hidden; }
.guide-demo-object { position: absolute; top: 33%; left: 18%; display: grid; place-items: center; width: 56px; height: 56px; background: #f3cb70; border: 2px solid #c7973a; border-radius: 15px; font-size: 38px; color: #986636; }
.guide-demo-target { position: absolute; top: 33%; right: 13%; width: 65px; height: 65px; border: 3px dashed #7e9c7a; border-radius: 18px; }
.guide-hand { position: absolute; top: 43%; left: 26%; width: 47px; height: 58px; fill: #fff8e5; stroke: #826747; stroke-width: 2; filter: drop-shadow(1px 3px 1px #adac9480); }
.guide-demo-label { position: absolute; bottom: 13px; left: 0; width: 100%; text-align: center; font-size: 13px; color: var(--forest); }
.motion-drag .guide-hand { animation: guide-drag 2.6s ease-in-out infinite; }
.motion-drag .guide-demo-object { animation: guide-object 2.6s ease-in-out infinite; }
.motion-drag-left .guide-demo-target { left: 13%; right: auto; border-radius: 50%; }
.motion-drag-left .guide-demo-object { left: calc(82% - 56px); animation: guide-object-left 2.6s ease-in-out infinite; }
.motion-drag-left .guide-hand { left: 69%; animation: guide-drag-left 2.6s ease-in-out infinite; }
.motion-tap .guide-hand { animation: guide-tap 2s ease-in-out infinite; }
.motion-tap .guide-demo-target { display: none; }
.motion-tap .guide-demo-object { left: calc(50% - 28px); }
.motion-tap .guide-hand { left: 52%; }
.motion-path .guide-demo-path { position: absolute; left: 20%; top: 46%; width: 55%; border-bottom: 5px dotted #82a38a; }
.motion-path .guide-demo-object { width: 30px; height: 30px; font-size: 20px; top: 40%; }
.motion-path .guide-demo-target { width: 32px; height: 32px; top: 40%; border-radius: 50%; }
.motion-path .guide-hand { animation: guide-drag 2.6s ease-in-out infinite; }
@keyframes guide-drag { 0%, 15%, 100% { left: 26%; transform: rotate(-10deg); } 60%, 80% { left: 69%; transform: rotate(3deg); } }
@keyframes guide-object { 0%, 15%, 100% { left: 18%; } 60%, 80% { left: calc(87% - 60px); } }
@keyframes guide-drag-left { 0%, 15%, 100% { left: 69%; transform: rotate(3deg); } 60%, 80% { left: 26%; transform: rotate(-10deg); } }
@keyframes guide-object-left { 0%, 15%, 100% { left: calc(82% - 56px); } 60%, 80% { left: 15%; } }
@keyframes guide-tap { 0%, 100% { transform: translateY(8px); } 40%, 60% { transform: translateY(-5px) scale(.94); } }

@media (max-height: 480px) {
  .garden-menu { gap: 7px; }
  .garden-menu .topbar .icon-button, .garden-menu .menu-fullscreen-button, .garden-menu .menu-install-button { width: 46px; min-width: 46px; height: 46px; min-height: 46px; }
  .garden-menu .topbar-end { gap: 7px; }
  .garden-menu .topbar-title { font-size: 20px; }
  .garden-greeting img { width: 48px; height: 48px; }
  .garden-greeting small { font-size: 10px; }
  .garden-greeting strong { font-size: 17px; }
  .garden-resume { min-height: 48px; padding-block: 5px; }
  .garden-resume span { font-size: 17px; }
  .garden-door { padding: 10px 12px 8px; gap: 4px; border-radius: 40% 40% 17px 17px / 17% 17% 17px 17px; }
  .door-animal { padding-top: 3px; }
  .door-symbol { top: 8%; left: 10%; font-size: 24px; }
  .garden-door > strong { font-size: 22px; }
  .garden-door > small { font-size: 11px; }
  .door-progress { padding-top: 4px; margin-top: 1px; font-size: 10px; }
  .door-progress b { width: 21px; height: 21px; font-size: 18px; }
  .garden-album { min-height: 44px; padding: 4px 14px; }
  .garden-album strong { font-size: 15px; }
  .garden-album small { font-size: 11px; }
  .mini-capsule { height: 29px; width: 25px; }
  .shelf--guided { gap: 6px; }
  .shelf--guided .shelf-heading { gap: 5px; }
  .shelf--guided .stage-card img { height: min(65px, 17vh); }
  .shelf--guided .shelf-footer .icon-button { width: 44px; min-height: 36px; height: 36px; }
  .shelf--guided .workbook-completion { font-size: 10px; }
  .experience-dialog { padding: 18px; border-radius: 23px; }
  .experience-dialog header { margin-bottom: 9px; }
  .guide-dialog { gap: 20px; }
  .guide-copy p { margin-block: 9px; }
  .question .topbar { gap: 8px; height: 54px; }
  .question .topbar-start { gap: 7px; }
  .question .topbar-title { font-size: 19px; }
  .question .topbar-title.compact { font-size: 16px; }
  .complete .complete-badge { font-size: 40px; }
  .complete h1 { font-size: 36px; margin-block: 6px; }
  .complete .complete-actions button { min-height: 46px; min-width: 110px; padding: 6px 13px; font-size: 16px; }
  .completion-friend img { width: 45px; height: 45px; }
}
@media (max-height: 330px) {
  .garden-welcome { min-height: 43px; }
  .garden-greeting img { width: 40px; height: 40px; }
  .garden-greeting small, .garden-album small { display: none; }
  .garden-door > small { display: none; }
  .garden-footer { padding-top: 0; }
  .garden-doors { padding-top: 3px; }
  .garden-door { gap: 3px; padding-bottom: 5px; }
  .door-progress { border: 0; }
  .shelf--guided .workbook-completion { display: none; }
  .current-book-button small { display: none; }
  .shelf--guided .stage-operation { display: none; }
}
@media (max-width: 700px) {
  .garden-greeting strong { font-size: 15px; }
  .garden-invitation { font-size: 12px; }
  .garden-album small { display: none; }
  .garden-door > strong { font-size: 20px; }
  .garden-menu .topbar-title { font-size: 17px; }
  .shelf--guided .domain-tab { min-width: 68px; padding-inline: 10px; font-size: 15px; }
  .shelf--guided .workbook-completion { display: none; }
  .book-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question .topbar-end { gap: 4px; }
  .question .topbar-title { font-size: 17px; }
  .question .topbar-title.compact { font-size: 14px; }
}
@media (orientation: portrait) and (min-width: 600px) {
  .garden-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .guide-hand, .guide-demo-object { animation: none !important; }
  .garden-door { transition: none; }
}
