/* Paleta de xilogravura ukiyo-e: céu de papel, azul da Prússia, espuma e o vermelho do sol. */
:root {
  --ceu: #d6dcd4;
  --papel: #e8e6dd;
  --ai: #1f3a5f;
  --ai-medio: #3e6a8f;
  --ai-fundo: #16294a;
  --ai-noite: #0f1e38;
  --espuma: #f3efe6;
  --sol: #c8432f;
  --sol-texto: #a8371f;
  --ai-texto: #2f5677;
  --tinta: #22252b;
  --tinta-suave: #3a3f48;
  --madeira: #5b3a22;
  --madeira-clara: #b98a5a;
  --gutter: clamp(16px, 5vw, 64px);
  --display: 'Zen Antique', 'Shippori Mincho B1', Georgia, serif;
  --mincho: 'Shippori Mincho B1', Georgia, serif;
  --corpo: 'Zen Kaku Gothic New', system-ui, sans-serif;
  --pixel: 'DotGothic16', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--ceu); color: var(--tinta); font-family: var(--corpo); overflow-x: hidden; -webkit-font-smoothing: antialiased; }

/* veio de madeira da prancha, sobre tudo */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .45; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .5' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .25 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--sol); outline-offset: 3px; }
canvas { display: block; image-rendering: pixelated; }

.pular { position: absolute; left: var(--gutter); top: -60px; z-index: 60; background: var(--tinta); color: var(--espuma); padding: 8px 14px; }
.pular:focus { top: 12px; }

/* topo */
.topo { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 26px var(--gutter); }
.marca { font-family: var(--display); font-size: 19px; color: var(--ai); text-decoration: none; }
.marca span { color: var(--sol); }
.topo nav { display: flex; gap: clamp(14px, 2.2vw, 30px); }
.topo nav a { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--ai-texto); text-decoration: none; padding: 6px 0; }
.topo nav a:hover { color: var(--sol); }
@media (max-width: 720px) { .topo nav a:not(:last-child) { display: none; } }

/* blocos comuns */
section { position: relative; }
.cabeca { position: relative; z-index: 2; padding: 0 var(--gutter); max-width: 760px; }
.olho { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--ai-texto); margin: 0 0 14px; }
h2 { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 6.4vw, 96px); line-height: .95; margin: 0; color: var(--ai); }
.lede { font-size: 15.5px; line-height: 1.75; color: var(--tinta-suave); max-width: 52ch; margin: 18px 0 0; }

/* 1. abertura */
.abertura { height: 100vh; height: 100svh; min-height: 640px; overflow: hidden; }
.abertura canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.sol { position: absolute; width: min(46vw, 60vh); aspect-ratio: 1; border-radius: 50%; background: var(--sol); right: 12vw; top: 16vh; }
.cartela { position: absolute; z-index: 2; right: var(--gutter); top: 104px; writing-mode: vertical-rl; background: var(--espuma); border: 2px solid var(--tinta); padding: 14px 8px; font-family: var(--mincho); font-weight: 600; font-size: clamp(16px, 1.6vw, 22px); letter-spacing: .3em; box-shadow: 4px 4px 0 var(--ai); }
.cartela small { font-size: .55em; color: var(--sol-texto); margin-top: 10px; letter-spacing: .2em; }
.abertura-texto { position: relative; z-index: 2; padding: clamp(110px, 17vh, 180px) var(--gutter) 0; max-width: 900px; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(52px, 9.5vw, 156px); line-height: .92; margin: 0; color: var(--ai); letter-spacing: -.01em; }
.cargo { display: inline-block; font-family: var(--display); font-size: clamp(20px, 2.2vw, 30px); margin: 26px 0 10px; background: var(--tinta); color: var(--espuma); padding: 4px 14px 6px; }
.abertura .lede { max-width: 34ch; margin-top: 0; }
.ninja-alvo { position: absolute; left: 0; top: 0; z-index: 3; background: none; border: 0; padding: 0; cursor: pointer; }

/* 2. dojo: continua o mar escuro */
.dojo { background: var(--ai-fundo); color: var(--espuma); padding: 90px 0 120px; }
.dojo h2, .dojo .lede { color: var(--espuma); }
.dojo .olho { color: #8fb0cc; }
.dojo .lede { color: #c6cfd8; }
.varal { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 2vw, 28px); margin: 64px var(--gutter) 0; padding-top: 26px; }
.varal::before { content: ""; position: absolute; left: -12px; right: -12px; top: 0; height: 14px; background: var(--madeira); border-bottom: 3px solid #3a2414; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.pergaminho { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--espuma); color: var(--tinta); border: 0; padding: 22px 8px 52px; cursor: pointer; font: inherit; min-height: 290px; transform-origin: top center; transition: transform .25s ease; box-shadow: 0 8px 0 rgba(0,0,0,.2); }
.pergaminho::before, .pergaminho::after { content: ""; position: absolute; left: -6px; right: -6px; height: 8px; background: var(--madeira); }
.pergaminho::before { top: -8px; }
.pergaminho::after { bottom: -8px; }
.pergaminho .kanji { font-family: var(--mincho); font-weight: 600; font-size: clamp(38px, 4vw, 60px); line-height: 1; color: var(--ai); }
.pergaminho .nome { writing-mode: vertical-rl; max-height: 180px; text-align: start; font-family: var(--display); font-size: clamp(15px, 1.3vw, 19px); letter-spacing: .12em; }
.pergaminho .selo { position: absolute; bottom: 14px; width: 18px; height: 18px; background: var(--sol); border-radius: 2px; }
.pergaminho:hover { transform: rotate(-1.5deg); }
.pergaminho[aria-selected="true"] { background: #fffaf0; transform: translateY(14px); box-shadow: 0 8px 0 rgba(0,0,0,.2), 0 0 0 3px var(--sol); }
.pergaminho[aria-selected="true"] .kanji { color: var(--sol); }
.rolo { position: relative; margin: 56px var(--gutter) 0; background: var(--espuma); color: var(--tinta); padding: clamp(24px, 4vw, 48px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); border-left: 12px solid var(--madeira); border-right: 12px solid var(--madeira); }
.rolo h3 { font-family: var(--display); font-weight: 400; font-size: clamp(32px, 4vw, 56px); margin: 0; color: var(--ai); }
.rolo .resumo { font-size: 17px; line-height: 1.6; margin: 12px 0 0; }
.rolo .para { font-size: 15px; line-height: 1.6; margin: 14px 0 0; padding-left: 14px; border-left: 3px solid var(--sol); color: var(--tinta-suave); }
.placar-produto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 26px; padding-bottom: 22px; border-bottom: 1px solid #c9c4b6; }
.placar-produto div { display: flex; flex-direction: column; }
.placar-produto dd { margin: 0; order: -1; font-family: var(--display); font-size: clamp(22px, 2.1vw, 32px); line-height: 1; color: var(--ai); white-space: nowrap; }
.placar-produto dt { font-size: 12px; line-height: 1.4; margin-top: 6px; color: var(--tinta-suave); }
.rolo .papel { font-size: 13px; color: var(--ai-medio); margin: 14px 0 0; letter-spacing: .02em; }
.rolo ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.rolo li { position: relative; padding-left: 22px; line-height: 1.6; font-size: 15px; }
.rolo li::before { content: ""; position: absolute; left: 0; top: .55em; width: 9px; height: 9px; background: var(--sol); }
.rolo .pilha { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.rolo .pilha span { font-family: var(--pixel); font-size: 12px; border: 1.5px solid var(--ai); color: var(--ai); padding: 3px 9px; }
.rolo .visitar { display: inline-block; margin-top: 22px; background: var(--ai); color: var(--espuma); padding: 10px 16px; text-decoration: none; font-weight: 500; }
.rolo .visitar:hover { background: var(--sol); }
.rolo .privado { margin-top: 22px; font-size: 13px; color: var(--tinta-suave); }
@media (prefers-reduced-motion: no-preference) {
  .rolo.abrindo { animation: desenrolar .45s ease-out; }
  @keyframes desenrolar { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0 0 0 0); } }
}
@media (max-width: 860px) {
  .varal { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 40px; padding-top: 18px; }
  .varal::before { left: -8px; right: -8px; height: 10px; }
  .pergaminho { min-height: 0; padding: 14px 3px 30px; gap: 8px; }
  .pergaminho::before, .pergaminho::after { left: -3px; right: -3px; height: 6px; }
  .pergaminho::before { top: -6px; }
  .pergaminho::after { bottom: -6px; }
  .pergaminho .kanji { font-size: clamp(26px, 8vw, 36px); }
  .pergaminho .nome { writing-mode: horizontal-tb; max-height: none; text-align: center; font-size: 10.5px; letter-spacing: .02em; line-height: 1.25; }
  .pergaminho .selo { width: 10px; height: 10px; bottom: 10px; }
  .pergaminho[aria-selected="true"] { transform: translateY(8px); }
  .rolo { grid-template-columns: 1fr; margin-top: 34px; scroll-margin-top: 16px; }
}

/* 3. missões: castelo na colina e estandartes nobori */
.missoes { padding: 120px 0 0; background: var(--ceu); overflow: hidden; }
.castelo { width: 100%; height: clamp(260px, 34vw, 560px); margin-top: -40px; }
.estandartes { list-style: none; margin: 0; padding: 0 var(--gutter) 110px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 22px); background: var(--ai); position: relative; }
.estandartes li { position: relative; background: var(--espuma); margin-top: -64px; padding: 26px 16px 30px; border-top: 10px solid var(--sol); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 92%, 0 100%); }
.estandartes li::before { content: ""; position: absolute; left: 50%; top: -34px; width: 4px; height: 24px; background: var(--madeira); }
.estandartes .num { font-family: var(--display); font-size: clamp(34px, 3.6vw, 54px); line-height: 1; color: var(--ai); white-space: nowrap; }
.estandartes .uni { font-family: var(--pixel); font-size: 13px; color: var(--sol-texto); margin-top: 8px; text-transform: lowercase; }
.estandartes .txt { font-size: 14px; line-height: 1.55; margin: 12px 0 0; color: var(--tinta-suave); }
@media (max-width: 860px) {
  .estandartes { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 22px; }
  .estandartes li { margin-top: 0; }
  .estandartes li:first-child { margin-top: -50px; }
  .estandartes li:nth-child(2) { margin-top: -50px; }
  .estandartes li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .castelo { margin-top: 24px; height: 380px; }
}

/* 4. passos: biombo shoji com papel tingido de índigo */
.passos { padding: 120px 0 110px; background: var(--papel); }
.caminho { width: calc(100% - 2 * var(--gutter)); height: clamp(36px, 7vw, 80px); margin: 40px var(--gutter) 0; }
.meses { position: relative; height: 18px; min-width: 760px; margin-top: 8px; }
.meses span { position: absolute; top: 0; font-family: var(--pixel); font-size: 11px; color: #f0dcc4; }
.shoji { position: relative; margin: 0 var(--gutter); background: var(--madeira); padding: 14px; border: 4px solid #3a2414; overflow-x: auto; }
.grade { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; min-width: 760px; }
.grade span { aspect-ratio: 1; background: #ede9df; }
.grade span[data-n="1"] { background: #b9c9d6; }
.grade span[data-n="2"] { background: #7fa1bf; }
.grade span[data-n="3"] { background: #3e6a8f; }
.grade span[data-n="4"] { background: var(--ai); }
.grade span.vazio { background: transparent; }
.grade span.futuro { background: #d9d4c7; }
.numeros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 40px var(--gutter) 0; }
.numeros div { border-top: 2px solid var(--ai); padding-top: 14px; }
.numeros dt { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--tinta-suave); }
.numeros dd { margin: 6px 0 0; font-family: var(--display); font-size: clamp(36px, 4.6vw, 64px); color: var(--ai); line-height: 1; order: -1; }
.numeros div { display: flex; flex-direction: column; }
.fonte { margin: 26px var(--gutter) 0; font-size: 13px; color: var(--tinta-suave); }
@media (max-width: 720px) { .numeros { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 5. placas: torii e emas penduradas */
.placas { padding: 120px 0 120px; background: var(--ceu); overflow: hidden; }
.santuario { position: relative; margin-top: 60px; padding-bottom: 30px; }
.santuario::before, .santuario::after { content: ""; position: absolute; top: 40px; bottom: 0; width: clamp(14px, 1.6vw, 24px); background: var(--sol); box-shadow: inset -5px 0 0 rgba(0,0,0,.12); }
.santuario::before { left: calc(var(--gutter) * .45); }
.santuario::after { right: calc(var(--gutter) * .45); }
.torii { position: relative; z-index: 1; display: block; width: calc(100% - var(--gutter) * .4); height: clamp(64px, 8vw, 110px); margin: 0 auto; }
.santuario .emas { margin-top: -18px; }
@media (max-width: 720px) { .santuario::before, .santuario::after { display: none; } }
.emas { list-style: none; margin: 0 var(--gutter); padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 2vw, 26px); }
.emas li { position: relative; padding-top: 46px; transform-origin: 50% 0; }
.emas li::before { content: ""; position: absolute; left: 50%; top: 0; width: 2px; height: 58px; margin-left: -1px; background: var(--sol); z-index: 1; }
.ema { position: relative; height: 100%; background: var(--madeira-clara); color: var(--tinta); padding: 34px 14px 18px; text-align: center; clip-path: polygon(50% 0, 100% 18%, 100% 100%, 0 100%, 0 18%); box-shadow: inset 0 -6px 0 rgba(58, 36, 20, .25); }
.ema::before { content: ""; position: absolute; left: 50%; top: 9px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--tinta); }
.emas .sigla { font-family: var(--display); font-size: clamp(26px, 2.6vw, 38px); color: var(--ai-fundo); }
.emas .nome { font-size: 13px; line-height: 1.45; margin: 8px 0 0; }
.emas .quem { font-family: var(--pixel); font-size: 12px; margin-top: 10px; color: #3d1a10; }

@media (prefers-reduced-motion: no-preference) {
  .emas li:hover { animation: balancar 1.2s ease-in-out; }
  @keyframes balancar { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(3deg); } 75% { transform: rotate(-2deg); } }
}
.formacao { list-style: none; margin: 56px var(--gutter) 0; padding: 0; display: grid; gap: 0; max-width: 820px; }
.formacao li { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 14px 0; border-bottom: 1px solid #b8bdb6; }
.formacao b { font-weight: 500; }
.formacao span { color: var(--tinta-suave); font-size: 14px; }
.formacao small { display: block; color: var(--ai-texto); font-size: 13px; margin-top: 2px; }
@media (max-width: 860px) { .emas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 6. vilarejo: Fuji vermelho e casas */
.vilarejo { min-height: 100vh; min-height: 100svh; padding: 120px 0 0; overflow: hidden; display: flex; flex-direction: column; }
.vilarejo > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.casas { position: relative; z-index: 2; list-style: none; margin: auto 0 0; padding: 0 var(--gutter) 70px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 3vw, 40px); }
.casa { position: relative; display: block; background: var(--espuma); color: var(--tinta); text-decoration: none; padding: 30px 20px 22px; border: 2px solid var(--tinta); box-shadow: 6px 6px 0 var(--tinta); }
.casa::before { content: ""; position: absolute; left: -18px; right: -18px; top: -26px; height: 26px; background: var(--ai); clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%); }
.casa .tipo { font-family: var(--pixel); font-size: 12px; color: var(--sol-texto); letter-spacing: .1em; text-transform: uppercase; }
.casa .valor { display: block; font-family: var(--display); font-size: clamp(18px, 1.8vw, 24px); margin-top: 8px; overflow-wrap: anywhere; color: var(--ai); }
.casa .acao { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 500; }
a.casa:hover, .casa:focus-within { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--tinta); }
.cerejeira { position: absolute; left: 0; top: 0; z-index: 3; background: none; border: 0; padding: 0; cursor: pointer; }
.lanterna { position: absolute; left: 0; top: 0; z-index: 3; background: none; border: 0; cursor: pointer; padding: 0; }
@media (max-width: 720px) { .casas { grid-template-columns: 1fr; gap: 44px; margin-top: 320px; } }
.vilarejo .olho { display: inline-block; color: var(--espuma); background: var(--tinta); padding: 4px 8px; }

/* jogo da velha */
.velha { border: 2px solid var(--tinta); background: var(--espuma); color: var(--tinta); padding: 28px; width: min(380px, calc(100vw - 32px)); box-shadow: 8px 8px 0 var(--ai); }
.velha::backdrop { background: rgba(15, 30, 56, .55); }
.velha h3 { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0; color: var(--ai); }
.velha .placar { font-family: var(--pixel); margin: 8px 0 18px; color: var(--tinta-suave); }
.tabuleiro { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--madeira); padding: 6px; }
.tabuleiro button { aspect-ratio: 1; border: 0; background: var(--espuma); font-family: var(--display); font-size: 44px; line-height: 1; cursor: pointer; color: var(--ai); }
.tabuleiro button[data-peca="O"] { color: var(--sol-texto); }
.tabuleiro button:not(:disabled):hover { background: #fffaf0; }
.tabuleiro button:disabled { cursor: default; }
.velha .resultado { min-height: 1.6em; margin: 16px 0 14px; line-height: 1.5; }
.velha .acoes { display: flex; gap: 10px; }
.velha .acoes button { font: 500 14px var(--corpo); border: 2px solid var(--ai); background: none; color: var(--ai); padding: 9px 14px; cursor: pointer; }
.velha .acoes .denovo { background: var(--ai); color: var(--espuma); }
.velha .acoes .fechar { border-color: var(--tinta-suave); color: var(--tinta-suave); }
