/* Kudaketa Teikoku: design tokens, base, and the shared pieces of the ink-and-washi interface.
   Palette: sumi ink, aged washi paper, shu vermilion (seals), kin gold leaf, ai indigo (the enemy), matsuba pine (health).
   Shapes come from src/view/ui/art.js (torn paper masks, brush strokes, ensō); nothing here draws a straight-edged box. */
:root {
  --sumi: #120d0b; --sumi-2: #1f1814; --sumi-3: #2e241e; --sumi-a: rgba(16, 11, 9, .86);
  --washi: #efe4cb; --washi-2: #e3d3b2; --washi-3: #cdb88f; --washi-ink: #2a1f18; --washi-faint: #6d5a49;
  --shu: #c1392b; --shu-deep: #8f2219; --beni: #a51e2e;
  --kin: #c9a24a; --kin-hi: #ecd08a; --kin-lo: #8a6a2a;
  --ai: #3f63b8; --ai-hi: #8fb0ff; --matsuba: #5e8a3c; --ki: #d6a93a;
  --paper-text: #f3e8d2; --paper-dim: rgba(243, 232, 210, .66);
  --font: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --brush: "Yuji Syuku", "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --ui: 1;
  --ease-ink: cubic-bezier(.2, .7, .1, 1);
}

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sumi); color: var(--paper-text); font: 15px/1.45 var(--font); user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased; }
canvas { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--kin-hi); outline-offset: 3px; border-radius: 999px; }
.icon { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -.22em; flex: none; }
.kanji { font-family: var(--brush); font-weight: 400; line-height: 1; }
[hidden] { display: none !important; }

/* body[data-state] drives what is on screen: loading / title (home screen), playing, paused (a menu over the frozen battle), over (end screen) */
body:not([data-state="playing"]):not([data-state="paused"]):not([data-state="over"]) #hud { visibility: hidden; }

/* ---------------------------------------------------------------------------------------- washi paper: torn silhouette + fibre texture */
.washi {
  position: relative; color: var(--washi-ink);
  background: url("img/washi.svg") 0 0 / 320px, radial-gradient(120% 90% at 30% 20%, var(--washi) 0%, var(--washi-2) 70%, var(--washi-3) 130%);
  -webkit-mask: var(--shape) 0 0 / 100% 100% no-repeat; mask: var(--shape) 0 0 / 100% 100% no-repeat;
}
.washi.aged { background: url("img/washi.svg") 0 0 / 320px, radial-gradient(140% 100% at 20% 0%, #f2e7cf 0%, #dcc69c 75%, #c3a777 130%); }
/* the shadow of a paper sheet lives on its wrapper (a mask would clip it) */
.lift { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45)) drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }

/* ---------------------------------------------------------------------------------------- ink: a brush stroke painted behind content */
.ink { position: relative; background: var(--ink) 0 0 / 100% 100% no-repeat; }

/* ---------------------------------------------------------------------------------------- hanko: round vermilion seals */
.seal {
  --s: 46px; width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fbeee0; background: radial-gradient(circle at 35% 30%, #d8503e, var(--shu) 55%, var(--shu-deep));
  box-shadow: inset 0 0 0 2px rgba(255, 230, 210, .35), inset 0 0 0 4px var(--shu), inset 0 0 0 5px rgba(255, 230, 210, .25), 0 2px 6px rgba(0, 0, 0, .4);
  font-family: var(--brush); font-size: calc(var(--s) * .52); line-height: 1;
  -webkit-mask: url("img/seal-grain.svg") center / cover; mask: url("img/seal-grain.svg") center / cover;
}
.seal.small { --s: 28px; }

/* ---------------------------------------------------------------------------------------- keys: little ink pebbles */
kbd { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .38em; box-sizing: border-box; border-radius: 1em; font: 600 .74em/1 var(--font); color: var(--washi); background: var(--sumi-3); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .5), 0 0 0 1px rgba(201, 162, 74, .35); vertical-align: .08em; }

/* ---------------------------------------------------------------------------------------- tooltips */
.tip { position: fixed; z-index: 60; pointer-events: none; max-width: 260px; padding: 14px 18px 15px; font-size: 13.5px; line-height: 1.4; opacity: 0; transform: translateY(4px); transition: opacity .14s, transform .14s var(--ease-ink); }
.tip.on { opacity: 1; transform: none; }
.tip h4 { margin: 0 0 3px; font-size: 16px; font-weight: 800; display: flex; align-items: baseline; gap: 8px; }
.tip h4 .kanji { font-size: 22px; color: var(--shu-deep); }
.tip p { margin: 0 0 6px; color: var(--washi-faint); }
.tip .row { display: flex; gap: 14px; font-weight: 600; }
.tip .why { margin-top: 6px; color: var(--shu-deep); font-weight: 700; }

/* ---------------------------------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.goodtip { max-width: 290px; }
.goodtip .gt { margin-top: 7px; display: grid; grid-template-columns: 34px 1fr; column-gap: 6px; row-gap: 2px; font-size: 12.5px; }
.goodtip .gt b { grid-row: 1 / span 3; color: var(--shu-deep); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding-top: 2px; }
.goodtip .gt span { grid-column: 2; color: var(--washi-ink); }
[data-good] { cursor: help; }
.worldtip { max-width: 280px; min-width: 210px; }
.worldtip .wt-bar { height: 7px; margin: 4px 0 6px; border-radius: 4px; background: rgba(60, 40, 20, .18); overflow: hidden; }
.worldtip .wt-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.worldtip .row { justify-content: space-between; }
.worldtip p { margin: 4px 0 0; }
.worldtip .wt-ok { margin-top: 6px; color: #3d6a34; font-weight: 700; }
