/* Big Questions — shared look. Palette and rules are described in STYLE.md. */
:root {
  --bg: #f3efe6; --ink: #3b3a36; --soft: #6d6a61;
  --paper: #fbf6e3; --paper-edge: #c9bb92;
  --sky: #dfeef5; --water: #7ec4ee; --bit: #4a90d9;
  --cold: #9fd0ff; --mid: #ffe9a8; --warm: #ff8a5c; --sun: #ffd23f;
  --btn: 60px; --top: 72px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; overflow: hidden;
}
[hidden] { display: none !important; }

/* corner buttons and the caption */
.bq-chrome {
  position: fixed; z-index: 5; top: 0; left: 0; right: 0; min-height: 72px;
  display: flex; align-items: center; gap: 8px;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  pointer-events: none;
}
.bq-btn {
  pointer-events: auto; flex: none; width: var(--btn); height: var(--btn); padding: 12px;
  border-radius: 50%; border: 3px solid var(--ink); background: #fff; color: var(--ink);
  touch-action: manipulation; cursor: pointer;
}
.bq-btn:active { transform: scale(.94); }
.bq-btn svg { width: 100%; height: 100%; display: block; }
.bq-caption {
  flex: 1; min-width: 0; margin: 0; align-self: center; text-align: center;
  font-size: clamp(15px, 2.4vw, 24px); line-height: 1.25; font-weight: 500;
}
.bq-caption b { font-weight: 800; background: linear-gradient(transparent 62%, var(--sun) 62%); }
.bq-chrome .bq-caption[hidden] { display: block !important; visibility: hidden; }
.bq-nudge { animation: bq-wiggle 1.6s ease-in-out infinite; border-color: var(--bit); }
@keyframes bq-wiggle {
  0%, 60%, 100% { transform: rotate(0); }
  68% { transform: rotate(-14deg) scale(1.08); } 76% { transform: rotate(12deg) scale(1.08); }
  84% { transform: rotate(-8deg); } 92% { transform: rotate(5deg); }
}

/* parts of a guide */
.part { position: fixed; inset: var(--top) 0 0 0;
        padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.stage { position: absolute; inset: 0 max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-radius: 16px; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.page { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 8px 20px 40px; }
.page > * { max-width: 760px; margin-left: auto; margin-right: auto; }

/* Give captions their own row when four large controls would squeeze the words. */
@media (max-width: 560px) {
  .bq-chrome { display: grid; grid-template-columns: repeat(4, var(--btn)); justify-content: space-between; }
  .bq-btn[data-act="home"] { grid-column: 1; grid-row: 1; }
  .bq-btn[data-act="toy"] { grid-column: 2; grid-row: 1; }
  .bq-btn[data-act="reset"] { grid-column: 3; grid-row: 1; }
  .bq-btn[data-act="sound"] { grid-column: 4; grid-row: 1; }
  .bq-caption { grid-column: 1 / -1; grid-row: 2; font-size: 16px; }
  .bq-chrome .bq-caption[hidden] { display: none !important; }
}
:focus-visible { outline: 4px solid var(--bit); outline-offset: 3px; }

/* On a phone held upright the pictures are small. A brief, wordless nudge to turn it. */
.bq-turn { display: none; }
@media (orientation: portrait) and (max-width: 560px) {
  body[data-scene="yes"] .bq-turn {
    display: grid; place-items: center; position: fixed; left: 50%; bottom: 18%; width: 84px; height: 84px; margin-left: -42px;
    border-radius: 50%; background: rgba(255,255,255,.92); border: 3px solid var(--ink); color: var(--ink);
    pointer-events: none; opacity: 0; animation: bq-turn-show 5s ease-in-out 0.6s 1 both;
  }
  .bq-turn svg { width: 56px; height: 56px; }
  .bq-turn-phone { transform-box: fill-box; transform-origin: center; animation: bq-turn-tip 1.6s ease-in-out 0.8s 3 both; }
}
@keyframes bq-turn-show { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bq-turn-tip { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

@media (prefers-reduced-motion: reduce) {
  .bq-nudge, .ambient, .bq-turn-phone { animation: none !important; }
}

/* ---------- guide cover, tiles and reading pages (shared by every guide) ---------- */
/* cover */
.cover { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overflow-y: auto; }
.cover h1 { margin: 0; font-size: clamp(22px, 4.6vw, 44px); font-weight: 800; text-align: center; }
.cover-art { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; text-decoration: none; }
.cover-art svg { height: 100%; max-width: 100%; border-radius: 22px; border: 4px solid var(--ink); background: var(--sky); }
.shelf-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tile { width: clamp(74px, 13vw, 104px); display: grid; justify-items: center; gap: 2px; padding: 8px 4px 6px;
        border-radius: 18px; border: 3px solid var(--ink); background: #fff; color: var(--ink);
        text-decoration: none; font-size: 13px; font-weight: 600; text-align: center; position: relative;
        touch-action: manipulation; cursor: pointer; font-family: inherit; }
.tile svg { width: 46px; height: 46px; }
.tile:active { transform: scale(.95); }
.tile.grown { background: var(--bg); border-style: dashed; color: var(--soft); }
.tile.grown::after { content: ""; position: absolute; left: 0; bottom: 0; height: 6px; width: 0; background: var(--bit); border-radius: 0 0 0 14px; }
.tile.grown.holding::after { width: 100%; transition: width 1.2s linear; }
@media (max-height: 430px) {
  .cover { flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: center; }
  .cover h1 { width: 100%; font-size: 20px; }
  .cover-art { flex: none; width: auto; height: 68%; }
  .shelf-row { max-width: 52%; }
  .tile { width: 70px; font-size: 11px; padding: 4px; } .tile svg { width: 34px; height: 34px; }
}


/* reading pages */
.page h1 { font-size: clamp(24px, 4vw, 34px); margin: 4px auto 12px; }
.page h2 { font-size: 20px; margin: 26px auto 8px; }
.page p, .page li { font-size: 18px; line-height: 1.5; }
.big li { font-size: clamp(20px, 3vw, 28px); margin: 16px 0; list-style: none; padding-left: 0; }
.big { padding-left: 0; }
.steps li { margin: 8px 0; }
.card { background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 14px 18px; }
.grown { -webkit-user-select: text; user-select: text; }
.grown li { margin: 10px 0; font-size: 16px; }
.grown p { font-size: 16px; }
.grown a { color: #1f5fa8; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
       padding: 2px 8px; border-radius: 999px; margin-right: 6px; vertical-align: 2px; white-space: nowrap; }
.fact { background: #d6efd8; color: #1d5a27; }
.simp { background: #ffe9a8; color: #6b4a00; }
.unsure { background: #e4dcf7; color: #47307a; }
