/* Nihongo no Mori — aguarela, céu, relva e papel. Estilo próprio, inspirado na luz dos filmes de animação japoneses. */
:root {
  --sky: #cfe6ee; --sky-2: #eaf4ee; --paper: #fffaf0; --paper-2: #f6efdc; --line: #e6dbbc;
  --ink: #2f4a3c; --ink-2: #5b7566; --ink-3: #8a9c90;
  --leaf: #7fb069; --leaf-d: #4f8a5b; --leaf-dd: #3b6e47; --forest: #2f6b50;
  --sun: #f4c95d; --sun-d: #e0a93a; --blush: #f2a7a0; --tori: #d9695f; --tori-d: #b5483f; --water: #6fb3c4; --water-d: #3f8fa3;
  --good: #4f8a5b; --good-bg: #e3f2dc; --bad: #c2563f; --bad-bg: #fbe5df;
  --r: 22px;
  --font: 'Zen Maru Gothic', 'Yu Gothic', 'Meiryo', 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  --kana: 'Klee One', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.5; min-height: 100vh;
  background: linear-gradient(180deg, #bfe0ec 0%, #dcefe9 42%, #f4f1dc 100%) fixed;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--forest); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
.jp { font-family: var(--kana); }
.loading { text-align: center; padding: 3rem; color: var(--ink-2); }

/* ---------- cenário ---------- */
#scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#scene .hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 34vh; min-height: 180px; }
.cloud { position: absolute; background: #fff; border-radius: 999px; opacity: .85; filter: blur(.4px); animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud.c1 { width: 190px; height: 48px; top: 11%; left: -220px; animation-duration: 120s; }
.cloud.c1::before { width: 84px; height: 84px; left: 26px; top: -40px; } .cloud.c1::after { width: 62px; height: 62px; left: 98px; top: -26px; }
.cloud.c2 { width: 140px; height: 36px; top: 24%; left: -180px; animation-duration: 170s; animation-delay: -60s; opacity: .7; }
.cloud.c2::before { width: 60px; height: 60px; left: 20px; top: -30px; } .cloud.c2::after { width: 46px; height: 46px; left: 70px; top: -20px; }
.cloud.c3 { width: 230px; height: 56px; top: 6%; left: -260px; animation-duration: 210s; animation-delay: -120s; opacity: .6; }
.cloud.c3::before { width: 100px; height: 100px; left: 34px; top: -50px; } .cloud.c3::after { width: 74px; height: 74px; left: 120px; top: -32px; }
@keyframes drift { to { transform: translateX(calc(100vw + 520px)); } }
.leaf { position: absolute; top: -30px; width: 14px; height: 9px; background: var(--leaf); border-radius: 0 100% 0 100%; opacity: .7; animation: fall linear infinite; }
.leaf.l1 { left: 12%; animation-duration: 26s; } .leaf.l2 { left: 34%; animation-duration: 34s; animation-delay: -12s; background: #a8c97a; }
.leaf.l3 { left: 58%; animation-duration: 30s; animation-delay: -5s; } .leaf.l4 { left: 78%; animation-duration: 38s; animation-delay: -20s; background: #f2a7a0; }
.leaf.l5 { left: 92%; animation-duration: 29s; animation-delay: -9s; background: #a8c97a; }
@keyframes fall { 0% { transform: translate(0, -5vh) rotate(0); } 50% { transform: translate(40px, 55vh) rotate(180deg); } 100% { transform: translate(-30px, 108vh) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cloud, .leaf, .pulse, .mic.rec { animation: none !important; } }

/* ---------- topo ---------- */
#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; padding: .6rem 1rem; background: rgba(255, 250, 240, .86); backdrop-filter: blur(8px); border-bottom: 2px solid var(--line); }
body.focus #top { display: none; }
.logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); font-weight: 700; white-space: nowrap; }
.logo svg { width: 38px; height: 32px; }
.logo small { display: block; font-weight: 500; font-size: .7rem; color: var(--ink-2); margin-top: -2px; }
.nav { display: flex; gap: .2rem; margin-left: .6rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { text-decoration: none; padding: .45rem .8rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--paper-2); } .nav a.on { background: var(--leaf); color: #fff; }
.chips { display: flex; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: .2rem .65rem; font-weight: 700; font-size: .9rem; white-space: nowrap; }
@media (max-width: 720px) {
  .logo small, .chip.lv { display: none; }
  #top { flex-wrap: wrap; row-gap: .3rem; }
  .logo { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 0; }
  .nav a { padding: .4rem .7rem; font-size: .9rem; }
}

main { max-width: 900px; margin: 0 auto; padding: 1.2rem 1rem 6rem; }
body.focus main { max-width: 760px; padding-top: .8rem; }

/* ---------- cartões e botões ---------- */
.card { background: var(--paper); border: 2px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.3rem; box-shadow: 0 5px 0 rgba(150, 125, 70, .12), 0 20px 32px -22px rgba(47, 74, 60, .45); position: relative; }
.card + .card { margin-top: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 0; cursor: pointer; border-radius: 999px; padding: .7rem 1.5rem; font-weight: 700; background: var(--leaf-d); color: #fff; box-shadow: 0 4px 0 var(--leaf-dd); text-decoration: none; transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--leaf-dd); }
.btn.sun { background: var(--sun); color: #5a4300; box-shadow: 0 4px 0 var(--sun-d); }
.btn.water { background: var(--water-d); box-shadow: 0 4px 0 #2d6f80; }
.btn.ghost { background: var(--paper); color: var(--ink); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.bad { background: var(--tori); box-shadow: 0 4px 0 var(--tori-d); }
.btn.sm { padding: .4rem .95rem; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.center { text-align: center; } .muted { color: var(--ink-2); } .small { font-size: .88rem; }
.tag { display: inline-block; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .6rem; font-size: .78rem; color: var(--ink-2); }

/* ---------- Início ---------- */
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 1.1rem; align-items: center; }
.hero .kumo { width: 108px; filter: drop-shadow(0 8px 6px rgba(47, 74, 60, .18)); animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.hero h1 { font-size: 1.5rem; } .hero p { margin: 0 0 .7rem; color: var(--ink-2); }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--sun) calc(var(--p) * 1%), #efe6c9 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 9px; background: var(--paper); border-radius: 50%; }
.ring span { position: relative; text-align: center; font-weight: 700; line-height: 1.1; } .ring small { display: block; font-size: .68rem; color: var(--ink-2); font-weight: 500; }
@media (max-width: 620px) { .hero { grid-template-columns: auto 1fr; } .hero .ring { grid-column: 1 / -1; justify-self: center; } .hero .kumo { width: 84px; } }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.quick .card { margin: 0; display: flex; gap: .9rem; align-items: center; }
.quick .ico { font-size: 2rem; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--sky-2); flex: none; }
.quick h3 { margin: 0; font-size: 1.05rem; } .quick p { margin: .1rem 0 .5rem; font-size: .9rem; color: var(--ink-2); }

.track { margin-top: 1.4rem; overflow: hidden; }
.track-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.track-head .big { font-family: var(--kana); font-size: 2rem; width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: var(--tc, var(--leaf-d)); flex: none; }
.track-head h2 { margin: 0; font-size: 1.25rem; } .track-head p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.prog { margin-left: auto; text-align: right; font-size: .85rem; color: var(--ink-2); font-weight: 700; }
.path { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1.05rem; padding: .8rem 0 .4rem; }
.path::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 3px dotted #d2c59d; }
.section-label { position: relative; z-index: 1; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .8rem; font-size: .8rem; color: var(--ink-2); font-weight: 700; margin-top: .4rem; }
.node { position: relative; z-index: 1; text-decoration: none; text-align: center; color: var(--ink); }
.node .c { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; font-family: var(--kana); font-size: 1.7rem; font-weight: 600; background: var(--paper); border: 3px solid #d9ccA6; box-shadow: 0 5px 0 #d9ccA6; transition: transform .1s; }
.node:hover .c { transform: translateY(-2px); }
.node.done .c { background: var(--leaf); border-color: var(--leaf-dd); box-shadow: 0 5px 0 var(--leaf-dd); color: #fff; }
.node.next .c { background: var(--sun); border-color: var(--sun-d); box-shadow: 0 5px 0 var(--sun-d); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }
.node small { display: block; margin-top: .45rem; font-size: .76rem; color: var(--ink-2); max-width: 120px; line-height: 1.2; }
.node .stars { color: var(--sun-d); letter-spacing: 1px; font-size: .85rem; line-height: 1; margin-top: .3rem; }
.path .node:nth-of-type(4n+2) { transform: translateX(-42px); } .path .node:nth-of-type(4n+4) { transform: translateX(42px); }
.badges { display: flex; flex-wrap: wrap; gap: .6rem; }
.badge { display: inline-block; text-align: left; padding: .5rem .8rem; border-radius: 14px; background: var(--paper-2); border: 2px dashed var(--line); font-size: .85rem; opacity: .55; }
.badge.on { opacity: 1; background: #fff4cf; border: 2px solid var(--sun); } .badge b { display: block; }

/* ---------- lição ---------- */
.p-top { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; }
.p-top .x { background: var(--paper); border: 2px solid var(--line); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }
.bar { flex: 1; height: 16px; background: rgba(255, 250, 240, .8); border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--leaf), #a8d572); border-radius: 999px; transition: width .35s; }
.p-title { font-size: .85rem; color: var(--ink-2); font-weight: 700; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-prompt { font-size: 1.15rem; font-weight: 700; margin: 0 0 .8rem; }
.q-prompt.jp { font-family: var(--kana); font-size: 1.55rem; font-weight: 600; text-align: center; }
.q-sub { color: var(--ink-2); margin: -.4rem 0 .8rem; font-size: .95rem; }
.glyph { font-family: var(--kana); font-size: clamp(4.5rem, 20vw, 7.5rem); line-height: 1.1; text-align: center; margin: .2rem 0 .6rem; }
.glyph.w { font-size: clamp(2.2rem, 10vw, 3.6rem); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .8rem; }
.opts.list { grid-template-columns: 1fr; }
.opt { background: var(--paper); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 16px; padding: .85rem .6rem; cursor: pointer; font-weight: 700; text-align: center; transition: background .12s, transform .06s; }
.opt.g { font-family: var(--kana); font-size: 2.3rem; padding: .5rem; }
.opts.list .opt { text-align: left; padding-left: 1.1rem; }
.opt:hover { background: #fff; border-color: var(--leaf); } .opt:active { transform: translateY(2px); }
.opt.sel { border-color: var(--water-d); background: #e6f4f8; }
.opt.right { background: var(--good-bg); border-color: var(--good); } .opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.opt kbd { font-size: .7rem; color: var(--ink-3); margin-right: .5rem; border: 1px solid var(--line); border-radius: 6px; padding: 0 .35rem; }
.speaker { background: var(--water-d); color: #fff; border: 0; border-radius: 50%; width: 52px; height: 52px; font-size: 1.3rem; cursor: pointer; box-shadow: 0 4px 0 #2d6f80; }
.speaker.slow { background: var(--paper); color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.intro-grid { display: grid; gap: .3rem; justify-items: center; text-align: center; }
.intro .rom { font-size: 1.6rem; font-weight: 700; color: var(--forest); }
.intro .word { margin-top: .6rem; padding: .7rem 1rem; background: var(--sky-2); border-radius: 16px; }
.intro .word b { font-family: var(--kana); font-size: 1.5rem; }
.read-line { font-size: .95rem; color: var(--ink-2); }
.kv { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: .4rem 0; }

/* escrita */
.pad-wrap { display: grid; place-items: center; margin: .4rem 0; }
.pad-canvas { width: min(100%, 320px); aspect-ratio: 1; background: #fffdf5; border: 3px solid var(--line); border-radius: 18px; box-shadow: inset 0 0 0 6px rgba(240, 230, 200, .5); cursor: crosshair; }
.pad-tools { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: .7rem; }

/* fala */
.say-big { text-align: center; margin: .3rem 0 .4rem; }
.say-big .jp { font-size: clamp(1.6rem, 6.5vw, 2.4rem); line-height: 1.35; }
.say-big .rom { color: var(--forest); font-weight: 500; margin-top: .1rem; } .say-big .pt { color: var(--ink-2); margin-top: .2rem; }
.hidden-jp { padding: .9rem; border: 2px dashed var(--line); border-radius: 14px; color: var(--ink-3); text-align: center; margin: .5rem 0; }
.mic-zone { display: grid; place-items: center; gap: .6rem; margin: 1rem 0 .3rem; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: 0; font-size: 2rem; cursor: pointer; background: var(--tori); color: #fff; box-shadow: 0 6px 0 var(--tori-d); position: relative; transition: transform .08s; }
.mic:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--tori-d); }
.mic.rec { animation: pulse 1s ease-in-out infinite; background: #e0483d; }
.mic.busy { background: var(--ink-3); box-shadow: 0 6px 0 #6f8076; cursor: progress; }
.meter { width: 160px; height: 8px; background: #efe6c9; border-radius: 99px; overflow: hidden; } .meter i { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .08s; }
.status { min-height: 1.4em; text-align: center; color: var(--ink-2); font-weight: 500; }
.heard { text-align: center; padding: .7rem; background: var(--paper-2); border-radius: 14px; margin-top: .6rem; }
.heard .score { height: 8px; background: #efe6c9; border-radius: 99px; overflow: hidden; margin: .5rem auto 0; max-width: 240px; } .heard .score i { display: block; height: 100%; background: var(--leaf); }
.notice { background: #fff4cf; border: 2px solid var(--sun); border-radius: 14px; padding: .6rem .9rem; font-size: .9rem; margin: .6rem 0; }
.notice.bad { background: var(--bad-bg); border-color: var(--bad); }
.type-in { width: 100%; font-size: 1.25rem; padding: .7rem 1rem; border-radius: 14px; border: 3px solid var(--line); background: #fffdf5; outline: none; } .type-in:focus { border-color: var(--water-d); }
.type-preview { min-height: 2.2rem; font-family: var(--kana); font-size: 1.5rem; margin: .5rem 0; text-align: center; }

/* feedback */
.fb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 1rem; animation: up .2s ease-out; border-top: 3px solid; }
.fb.good { background: var(--good-bg); border-color: var(--good); } .fb.bad { background: var(--bad-bg); border-color: var(--bad); }
.fb-in { max-width: 760px; margin: 0 auto; display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.fb strong { font-size: 1.15rem; } .fb.good strong { color: var(--good); } .fb.bad strong { color: var(--bad); } .fb p { margin: .15rem 0 0; }
@keyframes up { from { transform: translateY(100%); } }

/* resultado */
.result { text-align: center; }
.result .stars { font-size: 3rem; color: var(--sun-d); letter-spacing: .3rem; }
.result .kumo { width: 130px; animation: bob 4s ease-in-out infinite; }
.stat-row { display: flex; justify-content: center; gap: .8rem; flex-wrap: wrap; margin: 1rem 0; }
.stat { background: var(--paper-2); border-radius: 16px; padding: .5rem 1rem; font-weight: 700; } .stat small { display: block; color: var(--ink-2); font-weight: 500; }

/* tabelas */
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: .4rem 1rem; cursor: pointer; font-weight: 700; color: var(--ink-2); } .tabs button.on { background: var(--leaf-d); color: #fff; border-color: var(--leaf-dd); }
.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .5rem; }
.kcell { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: .4rem; text-align: center; cursor: pointer; font-family: var(--kana); }
.kcell:hover { border-color: var(--leaf); background: #fff; } .kcell b { display: block; font-size: 1.7rem; font-weight: 600; } .kcell small { font-family: var(--font); color: var(--ink-2); font-size: .72rem; display: block; }
.kcell.seen { background: #eef7e8; }
dialog { border: 0; padding: 0; background: transparent; max-width: min(520px, 94vw); width: 100%; } dialog::backdrop { background: rgba(47, 74, 60, .4); backdrop-filter: blur(3px); }
dialog .card { margin: 0; max-height: 90vh; overflow: auto; }

/* ajustes */
.set { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; padding: .7rem 0; border-bottom: 1px dashed var(--line); } .set:last-child { border: 0; }
.set label { font-weight: 700; } .set .hint { grid-column: 1 / -1; color: var(--ink-2); font-size: .85rem; margin-top: -.3rem; }
select, input[type=range] { max-width: 100%; } select { padding: .4rem .7rem; border-radius: 12px; border: 2px solid var(--line); background: #fffdf5; }
.switch { width: 52px; height: 30px; border-radius: 99px; background: #d7cfb8; position: relative; cursor: pointer; border: 0; } .switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); } .switch.on { background: var(--leaf-d); } .switch.on::after { left: 25px; }
.progress { height: 10px; background: #efe6c9; border-radius: 99px; overflow: hidden; margin-top: .4rem; } .progress i { display: block; height: 100%; background: var(--water-d); width: 0; transition: width .2s; }
.checks li { margin: .2rem 0; } .checks .ok { color: var(--good); } .checks .ko { color: var(--bad); font-weight: 700; }
#toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; opacity: 0; transition: .25s; z-index: 60; pointer-events: none; max-width: 90vw; text-align: center; font-size: .92rem; }
#toast.show { opacity: 1; transform: translateX(-50%); }
table.res { width: 100%; border-collapse: collapse; } table.res td, table.res th { padding: .45rem .5rem; border-bottom: 1px dashed var(--line); text-align: left; } table.res td:last-child, table.res th:last-child { text-align: right; }
.confetti i { position: fixed; top: -20px; width: 10px; height: 14px; border-radius: 0 100% 0 100%; animation: fall 3.2s linear forwards; z-index: 50; pointer-events: none; }
