:root { color-scheme: light; --ink: #23352e; --muted: #62736b; --paper: #fffdf8; --cream: #f3ead8; --moss: #31765a; --moss-dark: #245743; --gold: #d79d42; --line: #d9e0d5; --shadow: 0 16px 42px rgba(43, 72, 57, .12); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: linear-gradient(150deg, #edf5ed 0%, #fbf8ef 55%, #f2e8d5 100%); color: var(--ink); }
body { min-width: 320px; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.screen { min-height: 100vh; padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
#stageScreen, #battleScreen { padding: 0; }
#mainScreen { width: min(920px, 100%); margin: 0 auto; padding-inline: 0; }
.main-canvas, .stage-canvas, .battle-canvas { width: min(100%, 920px); margin: 0 auto; }
.main-canvas { padding: 8px 0 30px; }
.topbar, .panel-head, .mission-row, .settings-head, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.topbar { min-height: 50px; }
.wp-main-shell-header { display: grid; grid-template-columns: 58px 1fr 48px; align-items: center; gap: 12px; }
.wp-shell-return { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 48px; gap: 6px; color: var(--moss-dark); text-decoration: none; }
.wp-shell-return > span { font-size: 1.2rem; line-height: 1; }
.wp-shell-return img { width: 32px; height: 32px; object-fit: contain; }
.wp-shell-main-title { overflow: hidden; color: var(--moss-dark); font-size: .88rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.utilities { position: relative; }
.eyebrow { color: var(--moss); font-size: .74rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.icon-btn, .back-btn, .text-btn { border: 0; background: transparent; color: var(--moss-dark); font-weight: 800; min-height: 48px; }
.icon-btn { width: 48px; border-radius: 16px; background: rgba(255,255,255,.72); font-size: 1.15rem; }
.back-btn { flex: 0 0 64px; padding: 10px 4px; }
body[data-wp-game-id="animal-nest-weigh"] :is(button, a)[data-wp-return="stage"],
body[data-wp-game-id="animal-nest-weigh"] :is(button, a)[data-wp-return="battle"] { box-sizing: border-box !important; width: 64px !important; min-width: 64px !important; max-width: 64px !important; height: 48px !important; min-height: 48px !important; max-height: 48px !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 10px 4px !important; border: 0 !important; border-radius: 12px !important; background: rgba(255,255,255,.72) !important; color: var(--moss-dark) !important; box-shadow: none !important; font-size: 1rem !important; font-weight: 800 !important; line-height: 1 !important; text-decoration: none !important; overflow: visible !important; }
.text-btn { padding: 10px 2px; text-decoration: underline; text-underline-offset: 4px; }
.panel-utility { flex: 0 0 48px; }
.hero-card { display: grid; grid-template-columns: minmax(190px, 420px) 1fr; gap: clamp(22px, 5vw, 58px); align-items: center; margin: 14px 0 28px; padding: clamp(18px, 4vw, 34px); background: rgba(255,253,248,.86); border: 1px solid rgba(214, 224, 210, .9); border-radius: 30px; box-shadow: var(--shadow); }
.cover-art-frame { display: block; width: 100%; aspect-ratio: 1; }
.cover-art { display: block; width: 100%; height: 100%; margin: 0; border-radius: 24px; background: #dcebdc; object-fit: cover; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(2.25rem, 7vw, 4.9rem); line-height: .98; letter-spacing: -.06em; }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.035em; }
h3 { margin-bottom: 0; font-size: 1.08rem; }
.intro { max-width: 34rem; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.55; }
.progress, .small-stat, .progress-badge { color: var(--moss); font-size: .86rem; font-weight: 800; }
.main-progress { display: flex; min-height: 40px; align-items: center; }
.hero-actions, .compare-actions, .result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.primary-btn, .secondary-btn { min-height: 52px; padding: 12px 18px; border-radius: 16px; border: 1px solid transparent; font-weight: 850; }
.primary-btn { color: #fff; background: var(--moss); box-shadow: 0 8px 16px rgba(49,118,90,.2); }
.primary-btn:hover, .primary-btn:focus-visible { background: var(--moss-dark); }
.secondary-btn { color: var(--moss-dark); background: #f8fbf4; border-color: #c9d9c6; }
.guide { padding: 4px 2px; }
.guide h2 { margin-bottom: 12px; }
.guide-character, .result-character { display: block; width: min(100%, 180px); margin: 0 auto 14px; }
.guide-character img, .result-character img { display: block; width: 100%; height: auto; max-height: 190px; object-fit: contain; }
.game-info-character { display: flex; min-height: 120px; align-items: center; justify-content: center; padding: 10px; border-radius: 16px; background: linear-gradient(145deg, #edf5df, #f7ead1); }
.game-info-character picture, .game-info-character img { display: block; width: 100%; height: 100%; }
.game-info-character img { max-height: 180px; object-fit: contain; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.guide article, .request-card, .compare-card, .answer-card, .result-panel, .stage-card { background: rgba(255,253,248,.92); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 22px rgba(52, 75, 59, .06); }
.guide article { padding: 16px; }
.guide b { display: block; color: var(--moss-dark); }
.guide p, .panel-intro, .request-card p, .compare-card > p, .section-heading span { margin: 7px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.settings-panel { margin-top: 18px; padding: 18px; border-radius: 22px; background: #fff; border: 1px solid var(--line); }
.settings-head h2 { margin: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; color: var(--muted); font-weight: 750; }
select { min-height: 48px; max-width: 60%; padding: 8px 12px; border: 1px solid #c8d8c7; border-radius: 12px; color: var(--ink); background: #fbfdf8; }
.setting-sound { width: 100%; margin-top: 12px; }
#stageScreen { --wp-stage-art: url('assets/animal-nest-weigh-cover.png'); }
.stage-canvas, .battle-canvas { width: min(920px, 100%); height: calc(100vh - 56px); min-height: 0; margin: 0 auto; overflow-x: hidden; overflow-y: auto; padding: 20px 18px; border-radius: 0; }
.stage-canvas { background-image: linear-gradient(rgba(255,253,248,.82), rgba(255,253,248,.82)), var(--wp-stage-art); background-position: center 96px; background-repeat: no-repeat; background-size: min(480px, 60vw); }
.battle-canvas { background-color: #d8c39f; background-image: linear-gradient(rgba(255,253,248,.84), rgba(255,253,248,.84)), var(--wp-battle-art); background-position: center; background-repeat: no-repeat; background-size: cover; }
.panel-head { min-height: 58px; }
.panel-head h2 { margin: 0; text-align: center; flex: 1; }
.stage-list { display: grid; gap: 12px; margin-top: 24px; }
.stage-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 17px; text-align: start; color: var(--ink); }
.stage-card strong { font-size: 1rem; }
.stage-card > span:not(.stage-number) { grid-column: 2; color: var(--muted); font-size: .88rem; }
.stage-card b { grid-column: 3; grid-row: 1 / span 2; color: var(--moss); font-size: .78rem; }
.stage-card.complete { border-color: #a3cba7; background: #f5fbf2; }
.stage-number { min-width: 74px; color: var(--moss); font-weight: 850; }
.stage-tabs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 24px 0 0; color: var(--moss-dark); font-weight: 800; text-align: center; }
.stage-tabs button { min-height: 48px; padding: 12px 16px; border: 0; border-radius: 14px; color: var(--moss-dark); background: rgba(255,253,248,.78); font-weight: 800; }
.stage-tabs span { height: 1px; background: #cad9c8; }
.game-ad-reserve { width: min(920px, 100%); height: 56px; min-height: 56px; margin: 0 auto; pointer-events: none; }
.battle-canvas { padding-bottom: 18px; }
.mission-row { margin: 22px 0 12px; align-items: end; }
.mission-row .panel-intro { margin: 5px 0 0; }
.progress-badge { padding: 8px 11px; border-radius: 999px; background: #e1f0e0; white-space: nowrap; }
.request-card, .compare-card, .answer-card, .result-panel { padding: clamp(16px, 3vw, 24px); margin-top: 12px; }
.request-card strong { display: block; margin-top: 8px; color: var(--moss-dark); font-size: clamp(1.2rem, 3vw, 1.65rem); }
.compare-card > p { margin-bottom: 14px; }
.tray-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tray-card { display: flex; min-width: 0; min-height: 112px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 10px 8px; color: var(--ink); background: #fafcf5; border: 2px solid #d5e0d2; border-radius: 17px; text-align: center; }
.tray-card.selected { border-color: var(--gold); background: #fff8e8; box-shadow: 0 0 0 3px rgba(215,157,66,.16); }
.tray-card strong { overflow-wrap: anywhere; }
.tray-card small { color: var(--muted); font-size: .72rem; line-height: 1.2; }
.tray-icon { display: block; width: 80px; height: 64px; background-image: var(--wp-material-atlas); background-repeat: no-repeat; background-size: 500% 200%; background-position: 0% 0%; }
.tray-icon.material-twig { background-position: 0% 0%; }
.tray-icon.material-reed { background-position: 25% 0%; }
.tray-icon.material-feather { background-position: 50% 0%; }
.tray-icon.material-bark { background-position: 75% 0%; }
.tray-icon.material-moss { background-position: 100% 0%; }
.tray-icon.material-grass { background-position: 0% 100%; }
.tray-icon.material-down { background-position: 25% 100%; }
.compare-actions { margin-top: 14px; }
.compare-actions .primary-btn { flex: 1; }
.comparison { min-height: 24px; margin: 12px 0 0; padding: 11px 13px; border-radius: 12px; background: #eef6ea; color: var(--moss-dark); font-weight: 750; line-height: 1.4; }
.comparison.has-comparison::before, .feedback.is-wrong::before, .result-panel::before { content: ""; display: inline-block; width: 28px; height: 28px; margin-inline-end: 8px; vertical-align: -8px; background-image: var(--wp-material-atlas); background-repeat: no-repeat; background-size: 500% 200%; }
.comparison.has-comparison::before { background-position: 50% 100%; }
.feedback.is-wrong::before { background-position: 75% 100%; }
.answer-card { background: #fffdf8; }
.section-heading { align-items: baseline; }
.answer-grid { margin: 16px 0; }
.full-btn { width: 100%; margin-top: 10px; }
.feedback { min-height: 24px; margin: 14px 2px 0; color: var(--moss-dark); font-weight: 750; line-height: 1.45; }
.result-panel { padding-block: 30px; text-align: center; }
.result-panel::before { width: 88px; height: 58px; margin: 0 auto 8px; display: block; vertical-align: initial; background-position: 100% 100%; }
.result-panel h2 { margin: 10px 0; }
.result-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.result-stats { display: inline-block; margin: 6px auto; padding: 10px 14px; border-radius: 12px; background: #eef6ea; color: var(--moss-dark); font-weight: 800; }
.result-actions { justify-content: center; }
.toast { position: fixed; inset-inline: 16px; bottom: 18px; z-index: 5; padding: 12px 16px; border-radius: 13px; background: var(--ink); color: #fff; text-align: center; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
button:focus-visible, select:focus-visible { outline: 3px solid #e0a94d; outline-offset: 3px; }
@media (min-width: 700px) and (max-width: 899px) { .hero-card { grid-template-columns: minmax(0, 420px) 1fr; gap: 22px; } }
@media (max-width: 680px) { .screen { padding-inline: 14px; } #stageScreen, #battleScreen { padding-inline: 0; } .hero-card { grid-template-columns: 1fr; gap: 18px; border-radius: 24px; } .hero-copy { text-align: start; } .guide-grid { grid-template-columns: 1fr; } .stage-card { grid-template-columns: auto 1fr; } .stage-card b { grid-column: 2; grid-row: 3; justify-self: start; } .stage-card > span:not(.stage-number) { grid-column: 2; } }
@media (max-width: 420px) { h1 { font-size: 2.45rem; } .hero-actions > button { width: 100%; } .tray-card { min-height: 104px; } .section-heading { align-items: start; flex-direction: column; gap: 4px; } }
@media (min-width: 900px) { .screen { padding-top: 32px; } #stageScreen, #battleScreen { padding: 0; } .main-canvas { padding-top: 14px; } }

/* Keep the full first-lesson decision inside the owning Battle Canvas on
   phone-sized surfaces. The lesson remains fully authored; only its
   presentation density changes so comparison, answer, and recovery controls
   stay reachable without shifting the persistent shell. */
@media (max-width: 699px) {
  #battleScreen .battle-canvas { padding: 10px 14px 12px; }
  #battleScreen .panel-head { min-height: 48px; height: 48px; }
  #battleScreen .mission-row { margin: 6px 0; }
  #battleScreen .mission-row .panel-intro { margin-top: 3px; font-size: .8rem; line-height: 1.2; }
  #battleScreen .request-card,
  #battleScreen .compare-card,
  #battleScreen .answer-card { margin-top: 6px; padding: 10px; }
  #battleScreen .request-card strong { margin-top: 4px; font-size: 1.12rem; }
  #battleScreen .request-card p { margin-top: 4px; font-size: .8rem; line-height: 1.25; }
  #battleScreen .compare-card > p { margin-bottom: 6px; font-size: .8rem; }
  #battleScreen .tray-grid { gap: 6px; }
  #battleScreen .tray-card { min-height: 76px; padding: 6px 4px; gap: 2px; }
  #battleScreen .tray-card strong { font-size: .82rem; }
  #battleScreen .tray-card small { display: none; }
  #battleScreen .tray-icon { width: 44px; height: 34px; }
  #battleScreen .compare-actions { margin-top: 6px; gap: 6px; }
  #battleScreen .comparison { min-height: 20px; margin-top: 6px; padding: 6px 8px; font-size: .78rem; }
  #battleScreen .answer-grid { margin: 6px 0; }
  #battleScreen .full-btn { min-height: 44px; height: 44px; margin-top: 6px; padding-block: 8px; }
  #battleScreen .feedback { min-height: 20px; margin-top: 6px; font-size: .82rem; }
}

/* At desktop widths the two decision surfaces share a row, leaving the
   complete Battle flow inside the fixed-height Canvas instead of pushing the
   answer controls below the reserve. */
@media (min-width: 900px) {
  #battleScreen .battle-canvas {
    display: grid;
    grid-template-rows: 58px minmax(0, 1fr);
    align-content: start;
    overflow: hidden;
  }
  #battleScreen .panel-head { min-height: 58px; height: 58px; }
  #battleScreen #battlePanel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 8px 12px;
    min-height: 0;
    overflow: visible;
  }
  #battleScreen .mission-row { grid-column: 1 / -1; grid-row: 1; margin: 0; }
  #battleScreen .request-card { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  #battleScreen .compare-card { grid-column: 1; grid-row: 3; min-height: 0; margin: 0; overflow: hidden; }
  #battleScreen .answer-card { grid-column: 2; grid-row: 3; min-height: 0; margin: 0; overflow: visible; }
  #battleScreen .battleStatus { grid-column: 1 / -1; grid-row: 4; margin: 0; }
  #battleScreen .compare-card,
  #battleScreen .answer-card { padding: 12px; }
  #battleScreen .tray-grid { gap: 6px; }
  #battleScreen .tray-card { min-height: 84px; padding: 6px 4px; gap: 2px; }
  #battleScreen .tray-icon { width: 48px; height: 38px; }
  #battleScreen .tray-card small { font-size: .68rem; }
  #battleScreen .compare-actions { margin-top: 6px; gap: 6px; }
  #battleScreen .compare-actions .primary-btn,
  #battleScreen .compare-actions .text-btn { min-height: 44px; height: 44px; padding-block: 8px; }
  #battleScreen .comparison { min-height: 20px; margin-top: 6px; padding: 6px 8px; font-size: .8rem; }
  #battleScreen .answer-grid { margin: 6px 0; }
  #battleScreen .full-btn { min-height: 44px; height: 44px; margin-top: 6px; padding-block: 8px; }
}

/* The compact landscape envelope has enough width for three bounded Battle
   lanes. This keeps the request, comparison, and answer controls visible in
   one stable row while the shared 56px reserve remains below the Canvas. */
@media (min-width: 700px) and (orientation: landscape) and (max-height: 560px) {
  #mainScreen .hero-card { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
  #battleScreen .battle-canvas {
    display: grid;
    grid-template-rows: 48px minmax(0, 1fr);
    align-content: start;
    padding: 4px 12px 2px;
    overflow: hidden;
  }
  #battleScreen .panel-head { min-height: 48px; height: 48px; }
  #battleScreen #battlePanel {
    display: grid;
    grid-template-columns: minmax(145px, .85fr) minmax(0, 1.15fr) minmax(0, 1.15fr);
    grid-template-rows: 32px minmax(0, 1fr) 18px;
    gap: 4px 8px;
    min-height: 0;
    overflow: hidden;
  }
  #battleScreen .mission-row { grid-column: 1 / -1; grid-row: 1; min-height: 32px; margin: 0; align-items: center; }
  #battleScreen .mission-row .panel-intro { margin-top: 2px; font-size: .7rem; line-height: 1.1; }
  #battleScreen .request-card { grid-column: 1; grid-row: 2; min-height: 0; margin: 0; padding: 8px; overflow: hidden; }
  #battleScreen .compare-card { grid-column: 2; grid-row: 2; min-height: 0; margin: 0; padding: 8px; overflow: hidden; }
  #battleScreen .answer-card { grid-column: 3; grid-row: 2; min-height: 0; margin: 0; padding: 8px; overflow: hidden; }
  #battleScreen .battleStatus { grid-column: 1 / -1; grid-row: 3; height: 18px; min-height: 18px; margin: 0; overflow: hidden; font-size: .72rem; line-height: 18px; white-space: nowrap; }
  #battleScreen .request-card strong { margin-top: 4px; font-size: 1rem; }
  #battleScreen .request-card p { margin-top: 4px; font-size: .7rem; line-height: 1.15; }
  #battleScreen .section-heading { gap: 3px; }
  #battleScreen .section-heading h3 { font-size: .78rem; }
  #battleScreen .section-heading span { font-size: .64rem; line-height: 1.1; }
  #battleScreen .compare-card > p { margin: 4px 0; font-size: .68rem; line-height: 1.1; }
  #battleScreen .tray-grid { gap: 4px; }
  #battleScreen .tray-card { min-height: 62px; padding: 4px 2px; gap: 2px; border-radius: 12px; }
  #battleScreen .tray-card strong { font-size: .7rem; }
  #battleScreen .tray-card small { font-size: .56rem; }
  #battleScreen .tray-icon { width: 38px; height: 28px; }
  #battleScreen .compare-actions { flex-wrap: nowrap; gap: 4px; margin-top: 4px; }
  #battleScreen .compare-actions .primary-btn { min-height: 40px; height: 40px; padding: 6px 8px; font-size: .7rem; }
  #battleScreen .compare-actions .text-btn { min-height: 40px; height: 40px; padding: 6px 2px; font-size: .66rem; }
  #battleScreen .comparison { min-height: 18px; margin: 4px 0 0; padding: 4px 6px; font-size: .64rem; line-height: 1.1; overflow: hidden; }
  #battleScreen .answer-grid { margin: 4px 0; }
  #battleScreen .full-btn { min-height: 40px; height: 40px; margin-top: 4px; padding: 6px 8px; font-size: .7rem; }
}
