/* KIZUKI — Taisho-era ink and lantern light. Dark, high-contrast, sparse. */

:root {
  --accent: #3aa6ff;
  --accent-dim: #1b5c94;
  --ink: #05070e;
  --ink-2: #0b0f1c;
  --paper: #ded3ba;
  --paper-dim: #8f8877;
  --crimson: #c81e3c;
  --crimson-hot: #ff3d5e;
  --gold: #d9a441;
  --jade: #6fd6a4;
  --hud-blur: blur(7px);
  --font-display: 'Hiragino Mincho ProN', 'Yu Mincho', 'Songti SC', Georgia, 'Times New Roman', serif;
  --font-ui: 'Avenir Next', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: default;
}

#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
#hud, #screens, #toasts { position: absolute; inset: 0; pointer-events: none; }
#screens > * { pointer-events: auto; }

/* ── Boot ─────────────────────────────────────────────────────────────── */
#boot {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 45%, #16192c 0%, #05070e 70%);
  transition: opacity .6s ease;
}
#boot.gone { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; }
.boot-kanji {
  font-family: var(--font-display); font-size: 92px; color: var(--crimson);
  text-shadow: 0 0 40px rgba(200,30,60,.5); animation: pulse 2.4s ease-in-out infinite;
}
.boot-title { font-family: var(--font-display); font-size: 34px; letter-spacing: .5em; margin: 12px 0 6px 18px; }
.boot-sub { font-size: 13px; color: var(--paper-dim); letter-spacing: .18em; }
.boot-sub.err { color: var(--crimson-hot); letter-spacing: 0; line-height: 1.6; max-width: 520px; }
.boot-sub code { background: #1a1020; padding: 2px 6px; border-radius: 3px; font-size: 12px; }
@keyframes pulse { 0%,100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }

/* ── Shared chrome ────────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(160deg, rgba(12,16,30,.94), rgba(6,8,16,.97));
  border: 1px solid rgba(222,211,186,.14);
  box-shadow: 0 24px 70px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05);
}
.kanji-mark {
  font-family: var(--font-display);
  position: absolute; color: rgba(222,211,186,.05); pointer-events: none;
  font-size: 260px; line-height: .8; right: -20px; bottom: -50px; z-index: 0;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; }
.eyebrow { font-size: 10px; letter-spacing: .34em; text-transform: uppercase; color: var(--paper-dim); }
.rule { height: 1px; background: linear-gradient(90deg, rgba(222,211,186,.3), transparent); margin: 10px 0; }

button {
  font-family: var(--font-ui); font-size: 13px; letter-spacing: .08em;
  color: var(--paper); background: rgba(222,211,186,.06);
  border: 1px solid rgba(222,211,186,.2); padding: 10px 20px;
  cursor: pointer; transition: all .16s ease; text-transform: uppercase;
}
button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #04070d; }
button:disabled { opacity: .32; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #04070d; font-weight: 600; }
button.primary:hover { filter: brightness(1.18); }
button.danger:hover { background: var(--crimson); border-color: var(--crimson); color: #fff; }

/* ── HUD ──────────────────────────────────────────────────────────────── */
.hud-tl { position: absolute; top: 22px; left: 24px; width: 300px; }
.bar { position: relative; height: 13px; background: rgba(0,0,0,.6); border: 1px solid rgba(222,211,186,.22); overflow: hidden; }
.bar > i { position: absolute; inset: 0; transform-origin: left; transition: transform .12s linear; }
.bar.hp > i { background: linear-gradient(90deg, #8b1226, #e8354f); }
.bar.hp > .ghost { background: rgba(255,120,140,.35); transition: transform .5s ease .18s; }
.bar.breath { height: 9px; margin-top: 6px; }
.bar.breath > i { background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.bar.breath.constant > i { background: linear-gradient(90deg, var(--accent), #fff); box-shadow: 0 0 14px var(--accent); }
/* Guard: breath is the block's resource, so the bar itself becomes the guard
   meter — steel while it holds, crimson once it has broken and is locked out. */
.bar.breath.guard { border-color: rgba(255,230,160,.65); }
.bar.breath.guard > i { background: linear-gradient(90deg, #b9a06a, #ffe6a0); }
.bar.breath.broken { border-color: rgba(255,80,110,.8); animation: guardBreak .5s ease-out; }
.bar.breath.broken > i { background: linear-gradient(90deg, #7a1526, #e8354f); }
@keyframes guardBreak {
  0% { transform: translateX(-3px); } 25% { transform: translateX(4px); }
  55% { transform: translateX(-3px); } 100% { transform: none; }
}
.bar-label { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .2em; color: var(--paper-dim); margin-bottom: 4px; }
.bar-label b { color: var(--paper); font-weight: 500; }

.constant-tag {
  display: inline-block; margin-top: 7px; font-family: var(--font-display); font-size: 12px;
  letter-spacing: .3em; color: var(--accent); border: 1px solid var(--accent);
  padding: 2px 9px; text-shadow: 0 0 12px var(--accent); animation: pulse 1.8s ease-in-out infinite;
}

.hud-tr { position: absolute; top: 22px; right: 24px; text-align: right; width: 280px; }
.clock-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.moon-track { position: relative; width: 150px; height: 3px; background: rgba(222,211,186,.16); }
.moon-dot { position: absolute; top: -5px; width: 13px; height: 13px; border-radius: 50%; background: #e6efff; box-shadow: 0 0 14px #b9d2ff; transform: translateX(-50%); }
.clock-num { font-family: var(--font-display); font-size: 26px; min-width: 66px; }
.clock-num.warn { color: var(--gold); animation: pulse .8s ease-in-out infinite; }
.objective { margin-top: 9px; font-size: 12px; letter-spacing: .1em; color: var(--paper); }
.objective .oi { color: var(--accent); }
.mission-title { font-family: var(--font-display); font-size: 15px; color: var(--paper-dim); margin-top: 2px; }

.hud-bl { position: absolute; bottom: 24px; left: 24px; display: flex; gap: 8px; align-items: flex-end; }
.form-slot {
  width: 62px; height: 62px; border: 1px solid rgba(222,211,186,.2);
  background: rgba(6,9,18,.72); position: relative; backdrop-filter: var(--hud-blur);
  display: grid; place-items: center; transition: all .15s ease;
}
.form-slot .key { position: absolute; top: 3px; left: 5px; font-size: 9px; color: var(--paper-dim); }
.form-slot .num { font-family: var(--font-display); font-size: 25px; color: var(--accent); }
.form-slot .nm { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 7.5px; letter-spacing: .04em; color: var(--paper-dim); padding: 0 2px; line-height: 1.15; }
.form-slot.ready { border-color: var(--accent); box-shadow: 0 0 18px rgba(58,166,255,.22) inset; }
.form-slot.poor { opacity: .38; }
.form-slot.empty .num { color: rgba(222,211,186,.16); }
.form-slot.fire { animation: slotFire .3s ease; }
@keyframes slotFire { 0% { transform: scale(1); } 40% { transform: scale(1.16); box-shadow: 0 0 26px var(--accent); } 100% { transform: scale(1); } }

.consumables { display: flex; flex-direction: column; gap: 6px; margin-left: 6px; }
.consumable { font-size: 10px; letter-spacing: .1em; color: var(--paper-dim); border: 1px solid rgba(222,211,186,.16); padding: 4px 8px; background: rgba(6,9,18,.7); }
.consumable b { color: var(--paper); }

.hud-br { position: absolute; bottom: 26px; right: 24px; text-align: right; }
.combo { font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--paper); text-shadow: 0 0 24px rgba(255,255,255,.28); }
.combo small { font-size: 13px; letter-spacing: .2em; color: var(--paper-dim); }
.combo.hidden { opacity: 0; }
.combo.bump { animation: comboBump .2s ease; }
@keyframes comboBump { 0% { transform: scale(1.32); } 100% { transform: scale(1); } }

/* Boss bar */
.boss-bar { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); width: 560px; text-align: center; opacity: 0; transition: opacity .4s ease; }
.boss-bar.show { opacity: 1; }
.boss-name { font-family: var(--font-display); font-size: 20px; letter-spacing: .22em; color: var(--crimson-hot); text-shadow: 0 0 22px rgba(255,61,94,.5); }
.boss-rank { font-size: 10px; letter-spacing: .34em; color: var(--paper-dim); margin-bottom: 7px; }
.boss-posture { height: 8px; background: rgba(0,0,0,.72); border: 1px solid rgba(255,61,94,.45); position: relative; overflow: hidden; }
.boss-posture > i { position: absolute; inset: 0; background: linear-gradient(90deg, #7a0f22, var(--crimson-hot)); transform-origin: left; transition: transform .16s ease; }
.boss-phases { display: flex; gap: 5px; justify-content: center; margin-top: 6px; }
.boss-phases span { width: 26px; height: 3px; background: rgba(255,61,94,.25); }
.boss-phases span.on { background: var(--crimson-hot); box-shadow: 0 0 9px var(--crimson-hot); }

/* Behead prompt */
.behead-prompt {
  position: absolute; left: 50%; top: 70%; transform: translateX(-50%);
  text-align: center; opacity: 0; transition: opacity .12s ease;
}
.behead-prompt.show { opacity: 1; }
.behead-key {
  font-family: var(--font-display); font-size: 15px; letter-spacing: .28em; color: #fff;
  border: 2px solid var(--crimson-hot); padding: 8px 22px; background: rgba(140,10,30,.5);
  text-shadow: 0 0 18px #fff; animation: beheadPulse .55s ease-in-out infinite;
}
@keyframes beheadPulse { 0%,100% { transform: scale(1); box-shadow: 0 0 22px rgba(255,61,94,.4); } 50% { transform: scale(1.06); box-shadow: 0 0 44px rgba(255,61,94,.8); } }

/* Damage vignette + slow-mo tint */
.vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s ease; box-shadow: inset 0 0 200px 60px rgba(160,10,30,.85); }
.slowtint { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .1s linear; background: radial-gradient(ellipse at center, transparent 35%, rgba(10,20,50,.75) 100%); }
.screenflash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: #fff; mix-blend-mode: screen; }
.lowhp { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 160px 40px rgba(200,20,45,.9); }
.lowhp.on { animation: lowhpPulse 1.1s ease-in-out infinite; }
@keyframes lowhpPulse { 0%,100% { opacity: .25; } 50% { opacity: .72; } }

/* Centre announce */
.announce { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; }
.announce .big { font-family: var(--font-display); font-size: 52px; letter-spacing: .18em; color: var(--paper); text-shadow: 0 4px 40px rgba(0,0,0,.9); }
.announce .sub { font-size: 13px; letter-spacing: .36em; color: var(--paper-dim); margin-top: 8px; }
.announce.art .big { color: var(--crimson-hot); text-shadow: 0 0 40px rgba(255,61,94,.7); }
.announce-anim { animation: announceIn 2.2s cubic-bezier(.15,.9,.2,1) forwards; }
@keyframes announceIn {
  0% { opacity: 0; transform: scale(1.3) translateY(14px); letter-spacing: .5em; }
  16% { opacity: 1; transform: scale(1) translateY(0); }
  76% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* ── Hub progression strip ────────────────────────────────────────────── */
.hubbar {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  display: none; align-items: center; gap: 16px;
  padding: 9px 20px; background: rgba(6,9,18,.72); backdrop-filter: var(--hud-blur);
  border: 1px solid rgba(222,211,186,.14);
}
.hb-rank { display: flex; align-items: center; gap: 9px; }
.hb-kanji { font-family: var(--font-display); font-size: 26px; color: var(--accent); line-height: 1; text-shadow: 0 0 16px rgba(58,166,255,.35); }
.hb-name { font-family: var(--font-display); font-size: 14px; letter-spacing: .2em; }
.hb-xp { width: 140px; height: 4px; background: rgba(0,0,0,.6); border: 1px solid rgba(222,211,186,.18); position: relative; overflow: hidden; }
.hb-xp > i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transform-origin: left; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.hb-xptext { font-size: 10px; letter-spacing: .16em; color: var(--paper-dim); min-width: 96px; }
.hb-wallet { display: flex; align-items: baseline; gap: 6px; font-size: 10px; letter-spacing: .18em; color: var(--paper-dim); }
.hb-wallet span { font-family: var(--font-display); font-size: 17px; }
.hb-merit { color: var(--gold); }
.hb-ore { color: var(--crimson-hot); margin-left: 8px; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
#toasts { display: flex; flex-direction: column; align-items: center; padding-top: 96px; gap: 7px; }
.toast {
  background: rgba(6,9,18,.9); border-left: 3px solid var(--accent);
  padding: 8px 18px; font-size: 12px; letter-spacing: .1em;
  animation: toastIn .3s ease, toastOut .4s ease 2.4s forwards;
  backdrop-filter: var(--hud-blur);
}
.toast.gold { border-color: var(--gold); color: var(--gold); }
.toast.crimson { border-color: var(--crimson-hot); color: var(--crimson-hot); }
.toast.jade { border-color: var(--jade); color: var(--jade); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ── Screens ──────────────────────────────────────────────────────────── */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, rgba(24,28,48,.97), rgba(4,6,12,.99));
  animation: screenIn .3s ease;
}
@keyframes screenIn { from { opacity: 0; } }
.screen-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 26px 44px 16px; border-bottom: 1px solid rgba(222,211,186,.12); }
.screen-head h1 { font-size: 27px; letter-spacing: .2em; }
.screen-head .sub { font-size: 11px; letter-spacing: .26em; color: var(--paper-dim); margin-top: 4px; }
.screen-body { flex: 1; overflow-y: auto; padding: 24px 44px; }
.screen-foot { padding: 16px 44px 24px; display: flex; gap: 12px; justify-content: flex-end; border-top: 1px solid rgba(222,211,186,.1); }

.screen-body::-webkit-scrollbar { width: 7px; }
.screen-body::-webkit-scrollbar-thumb { background: rgba(222,211,186,.2); }

.rankbadge { display: flex; align-items: center; gap: 14px; }
.rankbadge .k { font-family: var(--font-display); font-size: 42px; color: var(--accent); line-height: 1; text-shadow: 0 0 22px rgba(58,166,255,.35); }
.rankbadge .n { font-family: var(--font-display); font-size: 19px; letter-spacing: .2em; }
.rankbadge .x { font-size: 10px; letter-spacing: .2em; color: var(--paper-dim); }
.xpbar { width: 190px; height: 5px; background: rgba(0,0,0,.6); border: 1px solid rgba(222,211,186,.18); margin-top: 5px; position: relative; overflow: hidden; }
.xpbar > i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transform-origin: left; transition: transform .8s cubic-bezier(.2,.8,.2,1); }

.wallet { display: flex; gap: 22px; align-items: center; }
.coin { text-align: right; }
.coin .v { font-family: var(--font-display); font-size: 21px; }
.coin .l { font-size: 9px; letter-spacing: .22em; color: var(--paper-dim); }
.coin.merit .v { color: var(--gold); }
.coin.ore .v { color: var(--crimson-hot); }

/* Hub nav */
.hubgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; max-width: 1080px; margin: 0 auto; }
.hubcard {
  position: relative; overflow: hidden; padding: 26px 22px; min-height: 158px;
  border: 1px solid rgba(222,211,186,.14); background: linear-gradient(150deg, rgba(16,20,36,.9), rgba(7,10,20,.95));
  cursor: pointer; transition: all .2s ease; display: flex; flex-direction: column; justify-content: space-between;
}
.hubcard:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 16px 44px rgba(0,0,0,.55); }
.hubcard h3 { font-size: 19px; letter-spacing: .16em; }
.hubcard p { font-size: 11.5px; color: var(--paper-dim); line-height: 1.55; margin-top: 7px; }
.hubcard .k { position: absolute; right: 8px; bottom: -14px; font-family: var(--font-display); font-size: 92px; color: rgba(222,211,186,.055); }
.hubcard .badge { position: absolute; top: 12px; right: 12px; font-size: 9px; letter-spacing: .18em; background: var(--crimson); color: #fff; padding: 3px 8px; }

/* Mission board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 15px; max-width: 1180px; margin: 0 auto; }
.scroll {
  position: relative; padding: 20px 22px; cursor: pointer; overflow: hidden;
  background: linear-gradient(155deg, rgba(20,17,14,.95), rgba(9,8,7,.97));
  border: 1px solid rgba(222,211,186,.16); border-left: 3px solid var(--rc, #c9d4ea);
  transition: all .2s ease;
}
.scroll:hover { transform: translateX(4px); border-color: rgba(222,211,186,.4); border-left-color: var(--rc); box-shadow: 0 12px 36px rgba(0,0,0,.5); }
.scroll.kizuki { background: linear-gradient(155deg, rgba(46,10,20,.95), rgba(14,5,9,.97)); animation: kizukiGlow 2.6s ease-in-out infinite; }
@keyframes kizukiGlow { 0%,100% { box-shadow: 0 0 0 rgba(255,61,106,0); } 50% { box-shadow: 0 0 34px rgba(255,61,106,.28); } }
.scroll.locked { opacity: .4; cursor: not-allowed; }
.scroll .rar { font-size: 9px; letter-spacing: .28em; color: var(--rc, #c9d4ea); text-transform: uppercase; }
.scroll h3 { font-size: 18px; margin: 5px 0 3px; letter-spacing: .06em; }
.scroll .region { font-size: 11px; color: var(--paper-dim); letter-spacing: .12em; }
.scroll .desc { font-size: 12px; color: rgba(222,211,186,.72); line-height: 1.55; margin: 12px 0; min-height: 36px; }
/* Mission modifiers — the night's conditions. Rare enough that a chip on a
   scroll should catch the eye before the reward numbers do. */
.mods { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 11px; position: relative; }
.mod {
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--mc, #c9d4ea); border: 1px solid var(--mc, #c9d4ea);
  border-radius: 2px; padding: 3px 7px; background: rgba(0,0,0,.25);
  box-shadow: 0 0 12px -4px var(--mc, #c9d4ea);
}
.modblurb { flex: 1 1 100%; font-size: 11.5px; color: rgba(222,211,186,.62); line-height: 1.5; font-style: italic; }
.scroll .meta { display: flex; gap: 16px; font-size: 10.5px; color: var(--paper-dim); letter-spacing: .1em; padding-top: 11px; border-top: 1px solid rgba(222,211,186,.1); }
.scroll .meta b { color: var(--paper); font-weight: 500; }
.scroll .tier { position: absolute; top: 18px; right: 20px; font-family: var(--font-display); font-size: 13px; letter-spacing: .16em; color: var(--paper-dim); }
.scroll .k { position: absolute; right: -6px; bottom: -30px; font-family: var(--font-display); font-size: 110px; color: rgba(222,211,186,.05); }

.crow { display: flex; gap: 14px; align-items: center; max-width: 1180px; margin: 0 auto 22px; padding: 13px 18px; background: rgba(10,13,24,.7); border: 1px dashed rgba(222,211,186,.2); }
.crow .bird { font-size: 26px; }
.crow .say { font-family: var(--font-display); font-size: 14px; letter-spacing: .1em; color: var(--gold); }

/* Skill tree */
.styletabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.styletab { padding: 9px 18px; border: 1px solid rgba(222,211,186,.18); cursor: pointer; font-size: 12px; letter-spacing: .14em; transition: all .16s; display: flex; align-items: center; gap: 8px; }
.styletab .k { font-family: var(--font-display); font-size: 17px; }
.styletab:hover { border-color: var(--sc); }
.styletab.on { background: var(--sc); border-color: var(--sc); color: #04070d; font-weight: 600; }
.styletab.locked { opacity: .3; cursor: not-allowed; }

.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 13px; }
.formcard { position: relative; padding: 15px 17px; border: 1px solid rgba(222,211,186,.13); background: rgba(10,13,24,.75); transition: all .18s; }
.formcard.owned { border-color: var(--sc); background: linear-gradient(150deg, rgba(20,30,50,.85), rgba(8,11,20,.9)); }
.formcard.buyable { cursor: pointer; }
.formcard.buyable:hover { border-color: var(--sc); transform: translateY(-2px); }
.formcard.locked { opacity: .42; }
.formcard .fn { font-family: var(--font-display); font-size: 12px; color: var(--sc); letter-spacing: .18em; }
.formcard h4 { font-size: 14.5px; margin: 3px 0; font-family: var(--font-display); letter-spacing: .05em; }
.formcard .jp { font-size: 10px; color: var(--paper-dim); letter-spacing: .12em; }
.formcard .d { font-size: 11.5px; color: rgba(222,211,186,.68); line-height: 1.5; margin: 9px 0; }
.formcard .st { display: flex; gap: 12px; font-size: 10px; color: var(--paper-dim); letter-spacing: .08em; }
.formcard .st b { color: var(--paper); }
.formcard .buy { margin-top: 10px; font-size: 11px; letter-spacing: .16em; color: var(--gold); }
.formcard .buy.no { color: var(--paper-dim); }
.formcard .eq { position: absolute; top: 10px; right: 12px; font-size: 9px; letter-spacing: .16em; color: var(--sc); border: 1px solid var(--sc); padding: 2px 6px; }

.loadout { display: flex; gap: 10px; margin: 18px 0 6px; flex-wrap: wrap; }
.ldslot { width: 132px; height: 74px; border: 1px dashed rgba(222,211,186,.24); display: flex; flex-direction: column; justify-content: center; padding: 8px 10px; cursor: pointer; transition: all .15s; }
.ldslot:hover { border-color: var(--sc); }
.ldslot.filled { border-style: solid; border-color: var(--sc); background: rgba(20,30,50,.6); }
.ldslot .kk { font-size: 9px; color: var(--paper-dim); letter-spacing: .18em; }
.ldslot .nn { font-size: 11.5px; margin-top: 4px; line-height: 1.3; }
.ldslot.lockedslot { opacity: .3; cursor: not-allowed; border-style: dotted; }

/* Swordsmith */
.temperlist { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; max-width: 1000px; }
.temper { padding: 17px 19px; border: 1px solid rgba(222,211,186,.14); background: rgba(10,13,24,.75); }
.temper h4 { font-size: 16px; letter-spacing: .1em; display: flex; justify-content: space-between; align-items: center; }
.temper .ic { font-size: 20px; color: var(--gold); }
.temper .d { font-size: 11.5px; color: rgba(222,211,186,.7); margin: 8px 0 11px; line-height: 1.5; }
.pips { display: flex; gap: 4px; margin-bottom: 11px; }
.pips i { width: 20px; height: 5px; background: rgba(222,211,186,.16); }
.pips i.on { background: var(--gold); box-shadow: 0 0 8px rgba(217,164,65,.6); }

/* Results */
.result-wrap { max-width: 840px; margin: 0 auto; text-align: center; }
.grade { font-family: var(--font-display); font-size: 128px; line-height: 1; margin: 6px 0; }
.grade.S { color: var(--gold); text-shadow: 0 0 60px rgba(217,164,65,.6); }
.grade.A { color: var(--accent); text-shadow: 0 0 44px rgba(58,166,255,.45); }
.grade.B { color: var(--jade); }
.grade.C, .grade.D { color: var(--paper-dim); }
.result-status { font-family: var(--font-display); font-size: 30px; letter-spacing: .32em; }
.result-status.won { color: var(--paper); }
.result-status.lost { color: var(--crimson-hot); }
.result-status.dawn { color: var(--gold); }
.statrow { display: flex; justify-content: center; gap: 34px; margin: 22px 0; flex-wrap: wrap; }
.statrow .s { text-align: center; }
.statrow .s .v { font-family: var(--font-display); font-size: 25px; }
.statrow .s .l { font-size: 9px; letter-spacing: .22em; color: var(--paper-dim); margin-top: 3px; }
.rewards { display: flex; justify-content: center; gap: 20px; margin: 22px 0; flex-wrap: wrap; }
.reward { min-width: 152px; padding: 15px; border: 1px solid rgba(222,211,186,.16); background: rgba(10,13,24,.7); }
.reward .v { font-family: var(--font-display); font-size: 29px; }
.reward .l { font-size: 9px; letter-spacing: .22em; color: var(--paper-dim); }
.reward.merit .v { color: var(--gold); }
.reward.xp .v { color: var(--accent); }
.reward.ore .v { color: var(--crimson-hot); }
.reward.pop { animation: rewardPop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes rewardPop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.nextgoal { margin: 26px auto 6px; max-width: 520px; padding: 16px 20px; border: 1px solid rgba(222,211,186,.18); background: linear-gradient(150deg, rgba(20,26,46,.8), rgba(8,11,20,.9)); }
.nextgoal .t { font-family: var(--font-display); font-size: 17px; letter-spacing: .12em; color: var(--accent); }
.nextgoal .s { font-size: 11.5px; color: var(--paper-dim); margin-top: 5px; letter-spacing: .1em; }

/* Promotion ceremony */
.promo { position: fixed; inset: 0; z-index: 900; background: #04060c; display: grid; place-items: center; animation: promoBg .5s ease; }
@keyframes promoBg { from { opacity: 0; } }
.promo-inner { text-align: center; }
.promo .eyebrow { animation: fadeUp .7s ease .2s both; }
.promo-kanji { font-family: var(--font-display); font-size: 190px; line-height: 1; color: var(--accent); text-shadow: 0 0 90px rgba(58,166,255,.55); animation: stamp .8s cubic-bezier(.15,1.5,.4,1) .35s both; }
@keyframes stamp { 0% { transform: scale(3.4) rotate(-9deg); opacity: 0; filter: blur(14px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.promo-name { font-family: var(--font-display); font-size: 40px; letter-spacing: .4em; margin-left: .4em; animation: fadeUp .7s ease .95s both; }
.promo-unlocks { margin-top: 26px; }
.promo-unlocks div { font-size: 12.5px; letter-spacing: .2em; color: var(--gold); margin: 7px 0; animation: fadeUp .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
.promo-hint { margin-top: 40px; font-size: 11px; letter-spacing: .3em; color: var(--paper-dim); animation: fadeUp .6s ease 2s both; }

/* Hashira gate */
.gate { max-width: 620px; margin: 20px auto 0; padding: 18px 22px; border: 1px solid rgba(255,61,94,.35); background: linear-gradient(150deg, rgba(38,10,20,.7), rgba(8,5,10,.85)); }
.gate h4 { font-family: var(--font-display); font-size: 15px; letter-spacing: .3em; color: var(--crimson-hot); }
.gate .row { display: flex; align-items: center; gap: 12px; margin-top: 11px; }
.gate .row .lbl { font-size: 11px; letter-spacing: .14em; color: var(--paper-dim); min-width: 130px; }
.gate .row .b { flex: 1; height: 6px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,61,94,.3); position: relative; overflow: hidden; }
.gate .row .b > i { position: absolute; inset: 0; background: linear-gradient(90deg, #7a0f22, var(--crimson-hot)); transform-origin: left; }
.gate .row .n { font-size: 11px; min-width: 56px; text-align: right; }
.gate .or { text-align: center; font-size: 10px; letter-spacing: .3em; color: var(--paper-dim); margin: 7px 0; }

/* Logbook */
.logsec { max-width: 1000px; margin: 0 auto 30px; }
.logsec h3 { font-size: 16px; letter-spacing: .2em; margin-bottom: 12px; color: var(--paper-dim); }
.loggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 11px; }
.logcard { padding: 13px 15px; border: 1px solid rgba(222,211,186,.12); background: rgba(10,13,24,.7); }
.logcard.unknown { opacity: .3; }
.logcard h4 { font-size: 13.5px; letter-spacing: .06em; }
.logcard .jp { font-size: 10px; color: var(--paper-dim); }
.logcard .c { font-size: 11px; color: var(--gold); margin-top: 7px; letter-spacing: .1em; }
.logcard .bl { font-size: 10.5px; color: rgba(222,211,186,.6); line-height: 1.5; margin-top: 6px; }

/* Pause + tutorial */
.modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4,6,12,.86); }
.modal .box { width: min(560px, 90vw); padding: 32px 36px; }
.modal h2 { font-size: 23px; letter-spacing: .24em; margin-bottom: 6px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 18px 0; font-size: 12px; }
.keys .k { font-family: var(--font-display); color: var(--accent); letter-spacing: .1em; }
.keys .v { color: rgba(222,211,186,.78); }
.modal .btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.hint { font-size: 11px; color: var(--paper-dim); letter-spacing: .1em; line-height: 1.7; }
.hint b { color: var(--accent); }

@media (max-width: 720px) {
  .screen-head, .screen-body, .screen-foot { padding-left: 18px; padding-right: 18px; }
  .hud-tl, .hud-tr { width: 210px; }
  .grade { font-size: 84px; }
  .promo-kanji { font-size: 120px; }
}

/* ── Dialogue & interaction prompt ────────────────────────────────────── */
/* Owned by ui/dialogue.js. Appended section — no rule above is touched. */

/* pointer-events lives on the base rule, not only on the #screens override: this
   layer is inset:0, so under any other root it would sit over the canvas and eat
   the click that re-acquires pointer lock. The box is keyboard-driven only. */
.dlg-layer { position: absolute; inset: 0; pointer-events: none; }
/* #screens > * turns pointer events back on; a prompt you walk past must not
   swallow a click. */
#screens > .dlg-layer { pointer-events: none; }

/* Centred with auto margins rather than left:50%: an absolutely positioned
   shrink-to-fit box only gets HALF the width to lay out in, which wraps
   "Mission Board" onto two lines. */
.dlg-prompt {
  position: absolute; left: 0; right: 0; bottom: 15%;
  width: fit-content; max-width: 90vw; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 7px 18px 7px 8px;
  background: rgba(6,9,18,.74); border: 1px solid rgba(222,211,186,.18);
  backdrop-filter: var(--hud-blur);
  opacity: 0; transform: translateY(7px);
  transition: opacity .18s ease, transform .18s ease;
}
.dlg-prompt.show { opacity: 1; transform: translateY(0); }
.dlg-key {
  font-family: var(--font-display); font-size: 13px; letter-spacing: .12em;
  color: var(--accent); border: 1px solid var(--accent); background: rgba(58,166,255,.08);
  padding: 3px 10px; text-shadow: 0 0 12px var(--accent);
}
.dlg-what { display: flex; align-items: baseline; gap: 11px; }
.dlg-lbl { font-family: var(--font-display); font-size: 14px; letter-spacing: .18em; }
.dlg-sub { font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--paper-dim); }

.dlg-box {
  position: absolute; left: 50%; bottom: 6%;
  width: min(720px, 92vw); padding-bottom: 13px;
  opacity: 0; transform: translate(-50%, 16px);
  transition: opacity .22s ease, transform .26s cubic-bezier(.2,.8,.2,1);
}
.dlg-box.show { opacity: 1; transform: translate(-50%, 0); }
.dlg-plate {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 22px 12px; border-bottom: 1px solid rgba(222,211,186,.1);
}
.dlg-bar { flex: none; width: 3px; height: 32px; background: var(--nc, var(--accent)); box-shadow: 0 0 14px var(--nc, var(--accent)); }
.dlg-who { flex: 1; }
.dlg-name { font-family: var(--font-display); font-size: 17px; letter-spacing: .2em; }
.dlg-title { font-size: 9.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--paper-dim); margin-top: 4px; }
.dlg-style { font-size: 9px; letter-spacing: .3em; color: var(--nc, var(--accent)); }

/* min-height holds the box still between a one-line and a three-line reply. */
.dlg-text {
  padding: 15px 24px 0; min-height: 4.6em;
  font-size: 13.5px; line-height: 1.85; letter-spacing: .04em; color: rgba(222,211,186,.9);
}
.dlg-rest { visibility: hidden; }   /* unrevealed tail still occupies layout — see _paint() */

.dlg-next {
  padding: 6px 24px 0; text-align: right; font-size: 10px; letter-spacing: .28em;
  color: var(--paper-dim); opacity: 0; transition: opacity .2s ease;
}
.dlg-next.on { opacity: 1; animation: dlgNudge 1.7s ease-in-out infinite; }
@keyframes dlgNudge { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

@media (max-width: 720px) {
  .dlg-prompt { bottom: 19%; }
  .dlg-box { width: 94vw; bottom: 4%; }
  .dlg-plate { padding: 11px 16px 10px; }
  .dlg-text { padding: 13px 16px 0; font-size: 12.5px; }
  .dlg-next { padding-right: 16px; }
}

/* The typewriter counts as motion too — dialogue.js reveals the whole line at
   once here, so the affordance must stop bobbing to match. */
@media (prefers-reduced-motion: reduce) {
  .dlg-prompt, .dlg-box { transition-duration: .01ms; }
  .dlg-next.on { animation: none; }
}

/* ── Combat feel layer ────────────────────────────────────────────────── */
/* Appended section — floaters, posture bars, hit direction, kill cut,
   dash speed lines. Owned by ui/floaters.js and ui/hud.js. */

.floaters { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.floater {
  position: absolute; left: 0; top: 0; will-change: transform, opacity;
  font-family: var(--font-display); font-size: 17px; font-weight: 600;
  color: #f3ead8; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 14px rgba(0,0,0,.6);
  letter-spacing: .04em;
}
.floater.heavy { font-size: 23px; color: var(--gold); text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 18px rgba(217,164,65,.55); }
.floater.break {
  font-size: 27px; letter-spacing: .3em; color: var(--crimson-hot);
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 26px rgba(255,61,94,.85);
}
.floater.heal { font-size: 15px; color: var(--jade); }
.floater.hurt { font-size: 19px; color: var(--crimson-hot); }

.pbar {
  position: absolute; left: 0; top: 0; width: 46px; height: 4px; will-change: transform;
  background: rgba(0,0,0,.62); border: 1px solid rgba(255,240,220,.22);
}
.pbar i {
  display: block; height: 100%; transform-origin: left;
  background: linear-gradient(90deg, #7a0f22, var(--crimson-hot));
}

/* Radial streaks toward the screen edges while dashing. Masked out of the
   centre so the character stays readable. */
.speedlines {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  transition: opacity .09s linear;
  background: repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(255,255,255,0) 0deg 5.5deg, rgba(255,255,255,.08) 5.5deg 6.5deg);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 0 34%, #000 74%);
  mask-image: radial-gradient(ellipse at center, transparent 0 34%, #000 74%);
}

/* One clean line across the screen on a behead. Center-out, angled per kill. */
.killslash { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.killslash i {
  position: absolute; left: -90vmax; top: -1px; width: 180vmax; height: 2px;
  background: linear-gradient(90deg, transparent, #fff 16%, #fff 84%, transparent);
  box-shadow: 0 0 22px rgba(255,255,255,.9), 0 0 60px rgba(255,255,255,.5);
  transform: scaleX(0); opacity: 0;
}
.killslash.boss i { height: 4px; top: -2px; }
.killslash.cut i { animation: killCut .32s cubic-bezier(.1,.9,.2,1) forwards; }
@keyframes killCut {
  0% { transform: scaleX(0); opacity: 1; }
  40% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* Screen-edge arc pointing at whatever just hit you. Rotated from JS. */
.dirhit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; pointer-events: none; }
.dirhit .arc {
  position: absolute; left: -80px; top: -195px; width: 160px; height: 54px;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  border-top: 5px solid var(--crimson-hot);
  filter: drop-shadow(0 0 12px rgba(255,61,94,.85));
}
.dirhit.on { animation: dirhitFade .7s ease forwards; }
@keyframes dirhitFade { 0% { opacity: .95; } 70% { opacity: .6; } 100% { opacity: 0; } }

/* ── Gamepad menu focus ───────────────────────────────────────────────── */
/* Owned by ui/menuNav.js. Applied to whatever element the pad is pointing at,
   which may be a button, a mission scroll, a form card or a loadout slot — so
   this has to read clearly on all of them without assuming a background. */
.gp-focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 26px rgba(58,166,255,.42);
  position: relative; z-index: 1;
}
button.gp-focus { background: var(--accent); border-color: var(--accent); color: #04070d; }
.scroll.gp-focus, .hubcard.gp-focus { transform: translateX(4px); border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .scroll.gp-focus, .hubcard.gp-focus { transform: none; }
}

/* ── The trial ────────────────────────────────────────────────────────── */
/* One beat's prompt. Lives in the HUD ROOT (see ui/trialCard.js) — parked in
   #screens it would be wiped by the first Screens.show() and would eat the click
   that re-acquires pointer lock. */
.trial-card {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 15%;
  min-width: 420px; max-width: min(680px, 80vw);
  padding: 14px 26px; text-align: center; pointer-events: none;
}
.trial-card .n { font-family: var(--font-display); font-size: 20px; color: var(--accent); letter-spacing: .2em; }
.trial-card .prompt { font-size: 15px; letter-spacing: .04em; margin-top: 6px; line-height: 1.65; }
.trial-card .prompt b { color: var(--accent); font-family: var(--font-display); font-size: 17px; font-weight: 400; }
.trial-card .sub { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--paper-dim); margin-top: 9px; }
.trial-card.in { animation: trialIn .32s cubic-bezier(.16,1,.3,1); }
.trial-card.pass { animation: trialPass .5s ease forwards; }
@keyframes trialIn { from { opacity: 0; transform: translateX(-50%) translateY(14px); } }
@keyframes trialPass { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* ── Cinema layer ─────────────────────────────────────────────────────── */
/* Mounted on document.body, NOT inside #app. hud.setVisible(false) is a
   display:none on the HUD root and the cutscene hides the HUD; Screens.show()
   wipes #screens; and #hud/#screens/#toasts stack by DOM order inside #app, so a
   toast would paint straight over the letterbox. z-index 950 sits above the
   promotion overlay (900) and below the boot veil (999).
   Animate transform and opacity ONLY — a relayout at 60 Hz over a full-screen
   WebGL canvas is the one way to make this a performance problem. */
#cinema {
  position: fixed; inset: 0; z-index: 950; pointer-events: none;
  overflow: hidden; opacity: 0; transition: opacity .25s linear;
  font-family: var(--font-body);
}
#cinema.on { opacity: 1; }

.cin-bars { position: absolute; inset: 0; }
.cin-bars > i {
  position: absolute; left: 0; right: 0; display: block;
  height: calc(var(--lb, .13) * 100vh); background: #000;
  transform: translateY(-100%);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.cin-bars > i.top { top: 0; }
.cin-bars > i.bot { bottom: 0; transform: translateY(100%); }
.cin-bars.in > i { transform: translateY(0); }

.cin-fade { position: absolute; inset: 0; background: #000; opacity: 0; }
.cin-drench { position: absolute; inset: 0; mix-blend-mode: multiply; opacity: 0; background: currentColor; }
.cin-flash { position: absolute; inset: 0; mix-blend-mode: screen; opacity: 0; background: #fff; }

.cin-card { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; opacity: 0; }
.cin-card.on { opacity: 1; }
.cin-card .kanji {
  font-family: var(--font-display); font-size: clamp(96px, 17vh, 190px); line-height: 1;
  color: var(--paper); text-shadow: 0 0 90px rgba(0,0,0,.9);
}
.cin-card.on .kanji { animation: cinStamp .8s cubic-bezier(.15,1.5,.4,1) both; }
.cin-card .title {
  font-family: var(--font-display); font-size: clamp(22px, 3.4vh, 38px);
  letter-spacing: .42em; margin: 18px 0 0 .42em; color: var(--paper);
}
.cin-card.on .title { animation: cinFadeUp .7s ease .38s both; }
.cin-card .sub {
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--paper-dim); margin-top: 12px; max-width: 60ch; justify-self: center;
}
.cin-card.on .sub { animation: cinFadeUp .7s ease .62s both; }

/* Constrained and centred rather than edge-to-edge: at a narrow viewport a
   full-width line runs straight into the skip pill in the bottom-right. */
.cin-line {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 19%;
  width: min(64ch, 68vw); text-align: center;
  opacity: 0; transition: opacity .5s ease;
  font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: var(--paper-dim);
  line-height: 1.9;
}
.cin-line.sub {
  text-transform: none; letter-spacing: .06em; font-size: 15px;
  color: var(--paper); font-family: var(--font-display);
}
.cin-line.on { opacity: 1; }

.cin-fall { position: absolute; inset: -8% -4%; }
.cin-mote { position: absolute; width: 4px; height: 4px; border-radius: 50%; opacity: .55; animation: cinFall linear infinite; }
.cin-fall.ember .cin-mote { background: #ff8a3c; box-shadow: 0 0 6px rgba(255,138,60,.8); animation-direction: reverse; }
.cin-fall.ash .cin-mote { background: #d8c0a0; }

/* Sits INSIDE the bottom letterbox bar. Parked above it, it shares a line with
   the lower-third text and the two collide at any narrow viewport — and an
   affordance like this is chrome, so the bar is where it belongs anyway. */
.cin-skip {
  position: absolute; right: 34px; bottom: calc(var(--lb, .13) * 34vh);
  pointer-events: auto; cursor: pointer; opacity: 0; transition: opacity .4s ease;
  display: flex; align-items: center; gap: 9px;
  font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--paper-dim);
}
.cin-skip.on { opacity: .85; }
.cin-skip .fill { display: block; width: 26px; height: 2px; background: var(--paper-dim); transform: scaleX(0); transform-origin: left; }

/* Deliberately a COPY of `stamp`, not a reuse: the promotion ceremony and the
   cinema layer must be able to diverge without one breaking the other. */
@keyframes cinStamp {
  0% { transform: scale(3.4) rotate(-9deg); opacity: 0; filter: blur(14px); }
  60% { opacity: 1; filter: blur(0); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes cinFadeUp { from { opacity: 0; transform: translateY(16px); } }
@keyframes cinFall { from { transform: translate3d(0, -12vh, 0); } to { transform: translate3d(4vw, 112vh, 0); } }

@media (prefers-reduced-motion: reduce) {
  .cin-bars > i { transition-duration: .01ms; }
  .cin-card.on .kanji, .cin-card.on .title, .cin-card.on .sub { animation-duration: .01ms; }
  .cin-mote { animation: none; opacity: .25; }
  .trial-card.in, .trial-card.pass { animation-duration: .01ms; }
}
