@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@600;700;800;900&display=swap');
/*
  VOICE: alegre e acolhedor, para criança e adulto jogarem juntos.
  IDEA: um teatrinho de bonecos na oficina do Gepeto, com placas e botões de madeira pintada.
  PICTURE: o Pinóquio de madeira em cena, com luz da janela; o nariz é o grande protagonista.
  COLOUR/TYPE: madeira quente + vermelho, azul, amarelo e verde vivos; Fredoka nos títulos, Nunito no texto.
  LAYOUT: palco à esquerda, painel de escolhas à direita; no celular o palco fica fixo no topo.
*/
:root {
  color-scheme: light;
  --ink: #23343a; --muted: #4b5d61; --deep: #1f4f4b;
  --sun: #ffc23d; --coral: #ff6b57; --sky: #4f8cf0; --leaf: #46b67e; --grape: #8c6fd8;
  --wood: #d99a5c; --wood-dark: #8a4f22; --paper: #fffaf0;
  --pare: #ff5a5f; --pense: #ffc23d; --siga: #46c38a; --avalie: #9b7be0;
  --good: #1f7a4d; --bad: #c43d2f;
  --border: 3px solid var(--ink);
}
* { box-sizing: border-box; min-width: 0; }
body {
  margin: 0; color: var(--ink); font: 700 1rem/1.5 Nunito, system-ui, sans-serif;
  background:
    radial-gradient(circle at -2% 46%, #ffe08a 0 150px, transparent 151px),
    radial-gradient(circle at 92% 6%, #ffc9d6 0 90px, transparent 91px),
    radial-gradient(circle at 96% 70%, #c8ecdd 0 140px, transparent 141px),
    radial-gradient(#ffe7b0 1.5px, transparent 1.6px) 0 0 / 26px 26px,
    #fff3d9;
  overflow-x: clip;
}
button, select, textarea, input { font: inherit; color: var(--ink); }
input, textarea, select { background-color: #fff; color: var(--ink); -webkit-text-fill-color: var(--ink); }
input::placeholder, textarea::placeholder { color: #7b8a8d; -webkit-text-fill-color: #7b8a8d; }
:focus-visible { outline: 4px solid var(--grape); outline-offset: 3px; }
h1, h2, h3, .ending-title { font-family: Fredoka, Nunito, system-ui, sans-serif; }
.shell { width: min(1220px, calc(100% - 40px)); margin-inline: auto; }
.skip { position: absolute; left: 1rem; top: 0; transform: translateY(-150%); background: #fff; padding: .5rem; z-index: 60; }
.skip:focus { transform: none; }
.lk-back { position: fixed; z-index: 50; left: 12px; bottom: 12px; background: var(--ink); color: #fff; font-weight: 900; font-size: 14px; padding: 11px 16px; border-radius: 99px; text-decoration: none; box-shadow: 0 4px 0 #0005; }

.masthead { display: flex; justify-content: space-between; align-items: center; padding-block: 10px; }
.masthead img { width: 76px; height: auto; display: block; background: #fff; border-radius: 18px; padding: 4px 6px; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.masthead a { color: var(--ink); background: #fff; border: var(--border); border-radius: 99px; padding: 8px 16px; text-decoration: none; font-weight: 900; box-shadow: 0 4px 0 var(--ink); }
.masthead a:hover { transform: translateY(-1px); }

.titlebar { display: flex; justify-content: space-between; align-items: end; gap: 18px; flex-wrap: wrap; padding-block: 8px 18px; }
h1 { margin: 0; font-size: clamp(2.4rem, 5.4vw, 4rem); line-height: 1; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 4px 0 #ffffff; }
h1 span { color: var(--coral); }
.titlebar p { margin: 8px 0 0; color: var(--muted); font-size: 1.08rem; max-width: 52ch; }
.scene-picker { display: grid; gap: 6px; font-weight: 900; font-size: .92rem; }
.scene-picker select { min-height: 50px; min-width: 240px; padding: 8px 14px; border: var(--border); border-radius: 16px; background: #fff; color: var(--ink); font-weight: 900; font-size: 1rem; box-shadow: 0 4px 0 var(--ink); cursor: pointer; }

.game-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.theatre, .conversation { background: #fff; border: var(--border); border-radius: 28px; box-shadow: 0 8px 0 var(--ink); }
.theatre { padding: 12px; background: #7a3f18; }
.stage { position: relative; border-radius: 18px; overflow: hidden; background: #e39a55; }
.stage svg { display: block; width: 100%; height: auto; }
.confete { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confete i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; }
.nose-caption { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 7px 16px; border-radius: 99px; background: #fff; border: 2.5px solid var(--ink); color: var(--ink); font-weight: 900; font-size: .9rem; white-space: nowrap; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; box-shadow: 0 3px 0 var(--ink); }

.meter-wrap { padding: 14px 6px 4px; color: #fff; }
.meter-wrap p { margin: 0 0 8px; font-weight: 900; font-family: Fredoka, Nunito, sans-serif; font-size: 1.15rem; }
.meter { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px; border-radius: 10px;
  background: repeating-linear-gradient(90deg, #f6d29f 0 18px, #e9b878 18px 20px); border: 3px solid #4a250d; }
.meter i { height: 16px; border-radius: 6px; background: #ffffff55; transition: background .35s; }
.meter i.on { background: var(--wood); box-shadow: inset 0 -3px 0 #0002; }
.meter i.on:nth-child(n+5) { background: #ff9f43; }
.meter i.on:nth-child(n+6) { background: var(--coral); }
.meter-labels { display: flex; justify-content: space-between; font-size: .85rem; margin-top: 4px; color: #ffe3c4; }

/* Animações do boneco */
#pino { transform-box: view-box; transform-origin: 334px 570px; }
#cabeca { transform-box: view-box; transform-origin: 332px 320px; animation: balanca 4.5s ease-in-out infinite; }
#braco-esq { transform-box: view-box; transform-origin: 262px 352px; animation: braco-e 3.6s ease-in-out infinite; }
#braco-dir { transform-box: view-box; transform-origin: 402px 352px; animation: braco-d 3.6s ease-in-out infinite; }
#nariz-g { transform-box: view-box; transform-origin: 334px 230px; }
.palpebra { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); animation: pisca 4.2s infinite; }
.poeira circle { animation: flutua 6s ease-in-out infinite; }
.poeira circle:nth-child(2n) { animation-duration: 8s; animation-delay: -2s; }
@keyframes balanca { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
@keyframes braco-e { 0%, 100% { transform: rotate(2deg); } 50% { transform: rotate(-3deg); } }
@keyframes braco-d { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg); } }
@keyframes pisca { 0%, 90%, 100% { transform: scaleY(0); } 94% { transform: scaleY(1); } }
@keyframes flutua { 0%, 100% { transform: translate(0, 0); opacity: .9; } 50% { transform: translate(8px, -14px); opacity: .4; } }
#pino.festa { animation: pula .55s ease-in-out 3; }
#pino.festa #braco-esq { animation: festa-e .5s ease-out forwards; }
#pino.festa #braco-dir { animation: festa-d .5s ease-out forwards; }
@keyframes pula { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-34px) scaleY(1.02); } 70% { transform: translateY(0) scaleY(.97); } }
@keyframes festa-e { to { transform: rotate(150deg); } }
@keyframes festa-d { to { transform: rotate(-150deg); } }

/* Painel */
.conversation { padding: clamp(18px, 2.6vw, 28px); }
.scene-text h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.05; font-weight: 700; }
.scene-text p { margin: 8px 0 14px; color: var(--muted); font-weight: 700; }
.reply { position: relative; margin-left: 6px; padding: 12px 16px; border: var(--border); border-radius: 20px; background: #fff7d6; }
.reply::before { content: ""; position: absolute; left: -15px; top: 20px; border: 9px solid transparent; border-right: 12px solid var(--ink); }
.reply::after { content: ""; position: absolute; left: -9px; top: 22px; border: 7px solid transparent; border-right: 9px solid #fff7d6; }
.reply strong { font-size: .8rem; color: var(--coral); text-transform: none; }
.reply p { margin: 2px 0 0; font-weight: 800; font-size: 1.05rem; }

.semaforo { display: flex; gap: 10px; align-items: center; margin: 18px 0 10px; padding: 8px 14px; border-radius: 99px; background: var(--ink); width: fit-content; max-width: 100%; flex-wrap: wrap; box-shadow: 0 4px 0 #0003; }
.light { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: .85rem; color: #9fb0b3; }
.light::before { content: ""; width: 20px; height: 20px; border-radius: 50%; background: currentColor; opacity: .35; transition: opacity .3s, box-shadow .3s; }
.light.pare { color: var(--pare); } .light.pense { color: var(--pense); } .light.siga { color: var(--siga); } .light.avalie { color: var(--avalie); }
.light:not(.on) { filter: saturate(.4) brightness(.8); }
.light.on::before { opacity: 1; box-shadow: 0 0 0 3px #ffffff33, 0 0 16px currentColor; }

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0 0 16px; }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 900; font-size: .74rem; color: var(--muted); white-space: nowrap; text-align: center; }
.steps li::before { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 5px; background: #e8e0cd; border-radius: 4px; }
.steps li:first-child::before { display: none; }
.steps li span { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2.5px solid #cfc6b2; font-size: .85rem; }
.steps li.now { color: var(--ink); }
.steps li.now span { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); transform: scale(1.12); }
.steps li.now.pare span { background: #ff9a9c; } .steps li.now.pense span { background: var(--pense); } .steps li.now.siga span { background: var(--siga); } .steps li.now.avalie span { background: #c3b0f0; }
.steps li.done, .steps li.now { }
.steps li.done::before, .steps li.now::before { background: var(--leaf); }
.steps li.done { color: var(--good); }
.steps li.done span { background: var(--leaf); border-color: var(--good); color: #fff; }

.phase { margin: 0 0 6px; font-size: .82rem; font-weight: 900; display: inline-block; padding: 3px 12px; border-radius: 99px; border: 2px solid var(--ink); }
.phase.pare { background: #ffd3d4; } .phase.pense { background: #ffe9a8; } .phase.siga { background: #c9f0dc; } .phase.avalie { background: #e4daf8; }
#pergunta { margin: 0 0 12px; font-size: 1.3rem; line-height: 1.2; font-weight: 600; }
.choices { display: grid; gap: 10px; }
.choices button {
  position: relative; text-align: left; min-height: 54px; padding: 12px 16px 12px 52px;
  border: var(--border); border-radius: 18px; background: #fff; color: var(--ink);
  font-weight: 800; font-size: 1.02rem; cursor: pointer; box-shadow: 0 5px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, background .15s;
}
.choices { counter-reset: opcao; }
.choices button { counter-increment: opcao; }
.choices button::before { content: counter(opcao, upper-alpha); position: absolute; left: 12px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--sun); display: grid; place-items: center; font: 700 .9rem/1 Fredoka, Nunito, sans-serif; }
.choices button:hover { background: #fff7d6; transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.choices button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }

.free-idea { margin-top: 14px; border: 3px dashed #c9bfa8; border-radius: 18px; padding: 8px 14px; background: #fffdf6; }
.free-idea summary { cursor: pointer; font-weight: 900; min-height: 34px; display: flex; align-items: center; }
.free-idea label { display: block; font-weight: 800; font-size: .9rem; margin: 6px 0 4px; }
.free-idea textarea { width: 100%; font-size: 16px; padding: 10px; border: 2.5px solid var(--ink); border-radius: 12px; resize: vertical; }
.free-hint { margin: 8px 0 6px; font-size: .88rem; color: var(--muted); }
.free-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 8px; }

.primary, .ghost { min-height: 48px; padding: 10px 20px; border-radius: 99px; font-weight: 900; cursor: pointer; border: var(--border); box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s; }
.primary { background: var(--leaf); color: #fff; text-shadow: 0 1px 0 #0003; }
.ghost { background: #fff; color: var(--ink); }
.primary:active, .ghost:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.message { margin: 0 0 14px; padding: 10px 14px 10px 44px; border-radius: 16px; font-weight: 900; position: relative; border: 2.5px solid currentColor; }
.message:empty { display: none; }
.message::before { position: absolute; left: 12px; top: 9px; font-size: 1.2rem; line-height: 1; }
.message.good { color: var(--good); background: #e2f7ea; }
.message.good::before { content: "★"; color: var(--sun); text-shadow: 0 0 1px var(--good); }
.message.bad { color: var(--bad); background: #ffe6e1; }
.message.bad::before { content: "!"; font-weight: 900; }
.message.same { color: var(--muted); background: #f2efe6; }
.message.same::before { content: "…"; }

.ending { margin-top: 4px; padding: 18px; border-radius: 22px; border: var(--border); box-shadow: 0 6px 0 var(--ink);
  background: #ffe9a8; }
.ending-title { margin: 0 0 8px; font-size: 1.6rem; font-weight: 700; }
.recap-title { margin: 10px 0 8px; font-weight: 900; }
.recap { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.recap li { display: grid; grid-template-columns: 100px 1fr; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #fff; border-left: 8px solid var(--pare); font-size: .93rem; font-weight: 700; }
.recap li strong { font-weight: 900; }
.recap li.pense { border-color: var(--pense); } .recap li.siga { border-color: var(--siga); } .recap li.avalie { border-color: var(--avalie); }
.ending-talk { margin: 0 0 14px; font-weight: 700; }
.reset { margin-top: 16px; background: none; border: 0; padding: 8px 0; color: var(--deep); font-weight: 900; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

.guide { margin: 26px 0 10px; border-radius: 22px; background: #fff; border: var(--border); box-shadow: 0 6px 0 var(--ink); padding: 14px 20px; font-weight: 600; }
.guide summary { cursor: pointer; font-weight: 900; font-size: 1.05rem; }
.guide ol { padding-left: 1.2rem; }
.guide li { margin-bottom: 6px; }
.guide-ref { font-size: .85rem; color: var(--muted); }
.footer { padding-block: 14px 74px; color: var(--muted); font-size: .88rem; font-weight: 700; }

@media (max-width: 860px) {
  .game-grid { grid-template-columns: 1fr; gap: 16px; }
  .theatre { position: sticky; top: 0; z-index: 20; padding: 6px; border-radius: 0 0 22px 22px; box-shadow: 0 6px 0 var(--ink); }
  .meter-wrap { display: none; }
  .stage svg { width: 100%; height: max(30vh, 200px); }
  .nose-caption { bottom: 6px; font-size: .8rem; }
  .message { scroll-margin-top: calc(max(30vh, 200px) + 40px); }
}
@media (max-width: 560px) {
  .shell { width: calc(100% - 24px); }
  .scene-picker, .scene-picker select { width: 100%; }
  .steps li { font-size: .66rem; }
  .steps li span { width: 28px; height: 28px; }
  .steps li::before { top: 12px; }
  .recap li { grid-template-columns: 1fr; gap: 2px; }
  .semaforo { gap: 8px; padding: 6px 10px; }
  .light { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
  #cabeca, #braco-esq, #braco-dir, .palpebra, .poeira circle, #pino.festa, #pino.festa #braco-esq, #pino.festa #braco-dir { animation: none; }
  .choices button, .meter i { transition: none; }
}
