/* =========================================================
   STORY — legend dialog
   ========================================================= */
.dialog { display: grid; gap: 12px; margin: 6px 0 22px; max-width: 600px; }
.q { display: flex; gap: 16px; align-items: flex-start; padding: 16px 20px; border-radius: 20px; border: 1px solid var(--line); background: rgba(243, 230, 207, .035); }
.q-nin { margin-left: clamp(0px, 4vw, 48px); background: linear-gradient(90deg, rgba(227, 20, 27, .12), rgba(243, 230, 207, .02)); border-color: rgba(227, 20, 27, .35); }
.q-av { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 900 22px/1 var(--f-jp); background: var(--paper); color: var(--red); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.q-nin .q-av { background: var(--ink); color: var(--red2); border: 2px solid var(--red); }
.q small { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.q blockquote { margin: 0; font: 700 clamp(17px, 1.6vw, 21px)/1.35 var(--f-display); color: var(--paper); }
.q blockquote::before { content: "— "; color: var(--red2); }
.story-khan { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 6px 0 4px; padding: 18px 22px; border-radius: 20px; background: linear-gradient(110deg, rgba(201, 162, 107, .16), transparent); border-left: 3px solid var(--gold); }
.story-khan p { margin: 0; flex: 1 1 260px; color: var(--paper); font-weight: 600; }
.story-khan b { color: var(--gold); }

/* =========================================================
   CUTTING BOARD
   ========================================================= */
.board-sec { padding-top: 40px; }
.board-picks { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 6px 2px 18px; margin-bottom: 8px; }
.board-picks::-webkit-scrollbar { display: none; }
.pick { flex: none; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px 0 6px; border-radius: 100px; border: 1px solid var(--line); background: rgba(243, 230, 207, .03); font-weight: 700; font-size: 13.5px; color: rgba(243, 230, 207, .85); transition: background .3s, border-color .3s, transform .4s var(--ease); }
.pick-art { width: 46px; flex: none; transition: transform .5s var(--ease); }
.pick:hover { border-color: rgba(227, 20, 27, .5); transform: translateY(-2px); }
.pick:hover .pick-art { transform: rotate(-12deg) scale(1.1); }
.pick.on { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 8px 24px -8px rgba(227, 20, 27, .9); }
.board {
  position: relative; height: clamp(340px, 46vw, 560px); border-radius: 30px; overflow: hidden; isolation: isolate;
  background: url(../img/wood.svg) center / 100% 100% no-repeat, #c98a4b;
  border: 3px solid #140c0a;
  box-shadow: inset 0 -16px 0 rgba(90, 50, 20, .55), inset 0 3px 0 rgba(255, 255, 255, .28), inset 0 0 80px rgba(80, 40, 10, .45), 0 50px 90px -30px rgba(0, 0, 0, .9), 0 0 0 10px rgba(243, 230, 207, .03);
}
.board::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(255, 220, 160, .18), transparent 70%); }
#boardCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; touch-action: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M3 37 L26 8 Q31 2 36 4 Q38 9 32 14 L7 38 Z' fill='%23e8eef2' stroke='%23140c0a' stroke-width='2'/%3E%3Cpath d='M26 8 L36 4' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 3 37, crosshair;
}
.board-stamp { position: absolute; z-index: 1; right: 26px; top: 22px; width: 58px; height: 58px; border-radius: 12px; display: grid; place-items: center; font: 900 30px/1 var(--f-jp); color: rgba(200, 20, 25, .75); border: 3px solid rgba(200, 20, 25, .7); transform: rotate(8deg); mix-blend-mode: multiply; }
.board-knife {
  position: absolute; z-index: 1; left: 26px; top: 26px; width: 220px; height: 32px; transform: rotate(-4deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 34'%3E%3Cpath d='M70 8 L228 12 Q238 16 228 22 L70 26 Z' fill='%23dfe6ea' stroke='%23140c0a' stroke-width='2.5'/%3E%3Cpath d='M76 12 L226 15' stroke='%23fff' stroke-width='2'/%3E%3Crect x='6' y='9' width='66' height='16' rx='6' fill='%235a2e14' stroke='%23140c0a' stroke-width='2.5'/%3E%3Crect x='62' y='7' width='10' height='20' rx='2' fill='%23c9a26b' stroke='%23140c0a' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .35));
}
.board-hint { position: absolute; z-index: 3; left: 50%; top: 18px; transform: translateX(-50%); margin: 0; padding: 10px 18px; border-radius: 40px; background: rgba(10, 7, 7, .8); color: var(--paper); font-size: 13.5px; font-weight: 700; white-space: nowrap; pointer-events: none; transition: opacity .5s, transform .5s var(--ease); animation: hintPulse 2s ease-in-out infinite; }
.board-hint.gone { opacity: 0; transform: translate(-50%, -12px); }
@keyframes hintPulse { 50% { box-shadow: 0 0 0 8px rgba(227, 20, 27, .25); } }
.board-hud { position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none; }
.board-hud > * { pointer-events: auto; }
.board-count { padding: 10px 16px; border-radius: 40px; background: rgba(10, 7, 7, .8); font-weight: 700; font-size: 14px; color: var(--paper); }
.board-count b { color: var(--red2); font-family: var(--f-display); }
.board-btns { display: flex; gap: 8px; }
.board-btns .btn-ghost { background: rgba(10, 7, 7, .72); }

/* =========================================================
   PLAY — teaser
   ========================================================= */
.play { overflow: hidden; background: radial-gradient(ellipse 60% 70% at 75% 50%, rgba(227, 20, 27, .2), transparent 70%); }
.play-kanji { position: absolute; right: -3vw; top: 50%; transform: translateY(-50%); font: 900 clamp(260px, 38vw, 560px)/1 var(--f-jp); color: transparent; -webkit-text-stroke: 1.5px rgba(243, 230, 207, .06); pointer-events: none; }
.play-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }
.play-title { font-size: clamp(46px, 7vw, 104px); text-transform: uppercase; letter-spacing: -.03em; }
.rules { list-style: none; padding: 0; margin: 28px 0 32px; display: grid; gap: 10px; }
.rules li { display: flex; align-items: center; gap: 14px; font-weight: 600; color: rgba(243, 230, 207, .85); }
.rules i { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 14px; background: rgba(243, 230, 207, .05); border: 1px solid var(--line); font-style: normal; }
.rules i img { width: 40px; }
.rules i.gold { box-shadow: 0 0 22px rgba(255, 207, 74, .45); border-color: rgba(255, 207, 74, .5); }
.rules li.bad { color: #ff9a9a; }
.rules li.bad i { border-color: rgba(255, 77, 85, .4); background: rgba(255, 77, 85, .08); }
.rules .combo-ic { font: 900 14px var(--f-display); color: #ffd23a; }
.play-cta { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.play-best { display: flex; flex-direction: column; padding-left: 18px; border-left: 2px solid var(--red); }
.play-best small { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.play-best b { font: 800 28px/1.1 var(--f-display); color: var(--paper); }
.play-demo { position: relative; aspect-ratio: 1; max-width: 560px; width: 100%; justify-self: center; }
.play-demo::before { content: ""; position: absolute; inset: 8%; background: url(../img/brush-sun.svg) center / contain no-repeat; opacity: .9; animation: spin 60s linear infinite; }
.demo-p { position: absolute; width: 34%; filter: drop-shadow(0 20px 20px rgba(0, 0, 0, .5)); }
.demo-p img { width: 100%; display: block; }
.demo-p .half { position: absolute; inset: 0; animation: halfA 3.2s var(--ease) infinite; }
.demo-p .half:first-child { position: relative; }
.demo-p .h1 { clip-path: polygon(0 0, 100% 0, 100% 30%, 0 70%); }
.demo-p .h2 { clip-path: polygon(0 70%, 100% 30%, 100% 100%, 0 100%); animation-name: halfB; }
.d0 { left: 6%; top: 20%; } .d1 { left: 50%; top: 8%; width: 40%; } .d2 { left: 40%; top: 50%; }
.d1 .half { animation-delay: .25s; } .d2 .half { animation-delay: .5s; }
.demo-hz { width: 20%; animation: bob 5s ease-in-out infinite; }
.d3 { left: 4%; top: 64%; } .d4 { right: 2%; top: 60%; animation-delay: -2s; }
@keyframes halfA { 0%, 35% { transform: none; opacity: 1; } 55% { transform: translate(-14px, -16px) rotate(-12deg); opacity: 1; } 80%, 100% { transform: translate(-30px, -30px) rotate(-20deg); opacity: 0; } }
@keyframes halfB { 0%, 35% { transform: none; opacity: 1; } 55% { transform: translate(12px, 18px) rotate(10deg); opacity: 1; } 80%, 100% { transform: translate(26px, 40px) rotate(18deg); opacity: 0; } }
.demo-slash { position: absolute; left: -5%; right: -5%; top: 48%; height: 4px; border-radius: 4px; background: linear-gradient(90deg, transparent, #fff 40%, #fff 60%, transparent); box-shadow: 0 0 20px 4px rgba(255, 45, 51, .9); transform: rotate(-22deg) scaleX(0); transform-origin: left; animation: dslash 3.2s var(--ease) infinite; }
@keyframes dslash { 0%, 25% { transform: rotate(-22deg) scaleX(0); opacity: 1; } 38% { transform: rotate(-22deg) scaleX(1); opacity: 1; } 50%, 100% { transform: rotate(-22deg) scaleX(1); opacity: 0; } }

/* =========================================================
   GAME OVERLAY
   ========================================================= */
.game { position: fixed; inset: 0; z-index: 260; visibility: hidden; opacity: 0; transition: opacity .5s, visibility 0s .5s; background: radial-gradient(ellipse at 50% 60%, #2a0a0b, var(--ink) 70%); overflow: hidden; }
.game.open { visibility: visible; opacity: 1; transition: opacity .5s; }
.game:not(.open), .game:not(.open) * { pointer-events: none !important; visibility: hidden !important; }
.game .g-hud { z-index: 6; }
.game-sun { position: absolute; left: 50%; top: 52%; width: min(70vw, 70vh); aspect-ratio: 1; transform: translate(-50%, -50%); background: url(../img/brush-sun.svg) center / contain no-repeat; opacity: .5; }
.game-kanji { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font: 900 min(40vw, 40vh)/1 var(--f-jp); color: rgba(10, 7, 7, .35); pointer-events: none; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: none; z-index: 2; }
.g-flash { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: radial-gradient(circle, transparent 30%, rgba(227, 20, 27, .9)); }
.g-hud { position: absolute; z-index: 4; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(14px, 3vw, 34px); pointer-events: none; }
.g-hud > * { pointer-events: auto; }
.g-score small, .g-best small { display: block; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.g-score b { font: 900 clamp(34px, 5vw, 54px)/1 var(--f-display); color: var(--paper); text-shadow: 0 0 30px rgba(227, 20, 27, .6); }
.g-best b { font: 800 22px/1 var(--f-display); color: var(--gold); }
.g-lives { display: flex; gap: 8px; font-size: clamp(26px, 3.4vw, 36px); }
.g-lives span { display: inline-block; color: var(--red2); filter: drop-shadow(0 0 10px rgba(255, 45, 51, .7)); transition: transform .4s var(--ease), opacity .4s, filter .4s; }
.g-lives span.lost { opacity: .2; filter: grayscale(1); transform: scale(.8); }
.g-lives span.hit { animation: lifeHit .6s var(--ease); }
@keyframes lifeHit { 30% { transform: scale(1.6) rotate(-15deg); } }
.g-right { display: flex; align-items: center; gap: 12px; }
.g-mute { font-size: 18px; }
.game .x { position: static; }
.g-over { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(5, 3, 3, .62); opacity: 0; visibility: hidden; transition: opacity .5s, visibility 0s .5s; }
.g-over.show { opacity: 1; visibility: visible; transition: opacity .5s; }
.g-card { width: min(440px, 100%); text-align: center; padding: 30px 28px; border-radius: 30px; background: linear-gradient(160deg, var(--ink3), var(--ink2)); border: 1px solid var(--line); box-shadow: 0 50px 100px rgba(0, 0, 0, .8); transform: translateY(40px) scale(.94); transition: transform .7s var(--ease); }
.g-over.show .g-card { transform: none; }
.g-logo { width: 170px; margin: -6px auto 6px; }
.g-card h3 { margin: 0; font: 900 34px var(--f-display); color: var(--paper); }
.g-new { margin: 8px 0 0; color: #ffd23a; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; animation: beat 1.2s infinite; }
.g-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.g-stats div { padding: 14px 6px; border-radius: 16px; background: rgba(243, 230, 207, .05); }
.g-stats small { display: block; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.g-stats b { font: 800 20px/1.3 var(--f-display); color: var(--paper); }
.g-btns { display: grid; gap: 10px; }
body.in-game .toasts { display: none; }

@media (max-width: 1024px) {
  .play-grid { grid-template-columns: 1fr; }
  .play-demo { max-width: 420px; order: -1; }
}
@media (max-width: 760px) {
  .board { height: 400px; border-radius: 22px; }
  .board-knife { width: 130px; left: 12px; top: 64px; }
  .board-hud { flex-direction: column; align-items: stretch; }
  .board-count { align-self: flex-start; }
  .board-btns .btn { flex: 1; padding: 0 12px; }
  .board-hint { font-size: 12px; white-space: normal; text-align: center; width: max-content; max-width: 86%; }
  .board-stamp { width: 44px; height: 44px; font-size: 22px; right: 16px; top: 64px; }
  .g-best { display: none; }
  .q-nin { margin-left: 0; }
}
