:root {
  --bg: #15111f; --bg2: #1d1730; --card: #251c3a; --card2: #2e2448; --line: #40345f;
  --text: #f5effc; --muted: #b9abd3; --accent: #b98cff; --accent2: #ff7ab0;
  --red: #e5484d; --gold: #ecbd52; --green: #4fd18a; --blue: #46a8ff;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-size: 16px; line-height: 1.4; min-height: 100dvh; overscroll-behavior-y: none;
  background: radial-gradient(1200px 600px at 50% -10%, #3a2560 0%, transparent 60%), var(--bg);
}
#app { max-width: 980px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t)) 0 calc(16px + var(--safe-b)); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
small { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: .4rem 0; }
.center { text-align: center; }
.pad { padding: 0 16px; }
.warn { background: #4a1f2a; border: 1px solid #8a3040; color: #ffd6dc; border-radius: 10px; padding: 10px 12px; margin: 10px 16px; font-size: .92rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 600; text-align: left;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, #c040608a, #a0304a), #a0304a; border-color: #e0607a; }
.btn.danger { background: #3a1820; border-color: #8a3040; color: #ffc4cc; }
.btn.big { width: 100%; min-height: 58px; justify-content: flex-start; font-size: 1.05rem; flex-wrap: wrap; }
.btn.big small { width: 100%; font-weight: 400; font-size: .82rem; margin-top: -2px; }
.btn.glow, .glow { box-shadow: 0 0 0 2px var(--gold), 0 0 22px #ecbd5255; animation: pulse 2.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 8px #ecbd5222; } }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1.3rem; display: grid; place-items: center; flex: none; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; position: sticky; top: 0; z-index: 20; background: #15111fe6; backdrop-filter: blur(8px); }
.topbar h1 { flex: 1; font-size: 1.15rem; text-align: center; }
.topbar > span { min-width: 44px; text-align: right; color: var(--muted); font-weight: 700; }

/* ---------- title ---------- */
.title-screen { padding: 24px 16px; max-width: 560px; margin: 0 auto; }
.logo { text-align: center; margin: 12px 0 22px; }
.logo-kanji { display: inline-grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; border: 5px solid var(--red); font-size: 52px; font-weight: 800; box-shadow: 0 0 40px #e5484d44; background: #ffffff08; }
.logo h1 { font-size: 2.2rem; margin-top: 12px; letter-spacing: .02em; background: linear-gradient(90deg, #ffd6f0, var(--accent), #8fd0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo p { color: var(--muted); margin: 6px 0 0; }
.slots { display: grid; gap: 10px; }
.slot { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); width: 100%; text-align: left; }
.slot.empty { border-style: dashed; background: transparent; min-height: 78px; }
.slot .plus { width: 56px; height: 56px; display: grid; place-items: center; font-size: 1.8rem; color: var(--accent); }
.slot b, .slot small { display: block; }
.slot-face { width: 58px; height: 58px; border-radius: 50%; overflow: hidden; background: #ffffff10; flex: none; }
.slot-info { flex: 1; min-width: 0; }
.slot-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-btns { display: flex; gap: 6px; }
.title-actions { display: grid; gap: 10px; margin-top: 18px; }
.file-btn { cursor: pointer; justify-content: center; }
.foot { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 22px; }

/* ---------- creator ---------- */
.creator { display: block; }
.stage { position: sticky; top: 64px; z-index: 10; height: 36dvh; min-height: 230px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: radial-gradient(circle at 50% 70%, #ffffff14, transparent 60%), linear-gradient(180deg, #2a1f45, #1a1428); border-bottom: 1px solid var(--line); }
.stage-avatar { height: 100%; display: flex; justify-content: center; }
.stage-avatar svg { height: 100%; width: auto; filter: drop-shadow(0 8px 12px #0008); }
.pose-btn { position: absolute; left: 10px; bottom: 10px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #000a; font-size: .8rem; }
.pose-btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.stage-weapon { width: 46%; max-width: 300px; }
.stage-weapon svg { width: 100%; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; position: sticky; top: calc(64px + max(36dvh, 230px)); z-index: 9; background: var(--bg); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: .92rem; }
.tab[aria-selected="true"] { background: var(--accent); color: #1a1030; border-color: var(--accent); }
.panel { padding: 4px 16px 24px; }
.group { margin: 14px 0; }
.group h3 { font-size: .95rem; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: .9rem; min-height: 40px; }
.chip.on { border-color: var(--gold); background: #3a2d18; box-shadow: inset 0 0 0 1px var(--gold); }
.chip-big { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; width: 84px; font-size: .78rem; }
.chip-prev { width: 70px; height: 70px; border-radius: 10px; overflow: hidden; background: #ffffff0d; display: block; }
.chip-prev svg { width: 100%; height: 100%; }
.guard-prev { display: grid; place-items: center; }
.guard-prev svg { width: 46px; height: 46px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #ffffff30; background: var(--c); padding: 0; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 3px var(--gold); }
.sw-none { width: auto; border-radius: 999px; padding: 0 12px; background: var(--card); font-size: .8rem; }
.sw-custom { display: grid; place-items: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); color: #fff; font-weight: 800; text-shadow: 0 0 3px #000; cursor: pointer; position: relative; }
.sw-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.panel-next { margin-top: 18px; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.lib-card { display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.lib-card svg { width: 100%; height: 150px; }
.lib-card b { font-size: .85rem; } .lib-card small { font-size: .72rem; }
.weapon-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wcard { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); text-align: left; }
.wcard.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: #2f2618; }
.wcard small { font-size: .76rem; }
.wstats { display: grid; gap: 2px; font-size: .72rem; color: var(--muted); }
.wstats > span { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mini-bar { flex: 1; max-width: 70px; height: 5px; border-radius: 3px; background: #ffffff18; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--gold); }
.text-in { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1.05rem; }
.weapon-svg { width: 100%; height: auto; display: block; }

@media (min-width: 820px) {
  .creator { display: grid; grid-template-columns: minmax(300px, 40%) 1fr; align-items: start; }
  .stage { top: 64px; height: calc(100dvh - 80px); flex-direction: column; border: 0; border-radius: var(--radius); margin: 0 0 0 16px; }
  .stage-avatar { height: 70%; }
  .stage-weapon { width: 90%; }
  .tabs { top: 64px; flex-wrap: wrap; }
}

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: #08060fcc; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(440px, 100%); max-height: 88dvh; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 20px 60px #000a; }
.modal h2 { font-size: 1.3rem; margin-bottom: 10px; }
.modal-body p { margin: .5rem 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-actions .btn { flex: 1 1 auto; justify-content: center; }
.modal .xp { font-size: 1.5rem; font-weight: 800; color: var(--gold); text-align: center; }
.rank-up { background: #2f2618; border: 1px solid var(--gold); border-radius: 12px; padding: 10px; text-align: center; }
.score { font-size: 1.3rem; font-weight: 700; text-align: center; }
.gains { color: var(--green); font-weight: 700; text-align: center; font-size: 1.1rem; }
.form-ol { padding-left: 1.4rem; margin: .4rem 0; }
.form-ol li { margin: 3px 0; }
.form-ol li.locked { color: var(--muted); font-style: italic; }
.boss-prev svg { width: 150px; display: block; margin: 0 auto; }
.dialog-ov { align-items: flex-end; padding-bottom: calc(16px + var(--safe-b)); cursor: pointer; background: #08060f88; }
.dialog-box { width: min(640px, 100%); display: flex; gap: 12px; background: #1d1730f2; border: 2px solid var(--accent); border-radius: 16px; padding: 14px; box-shadow: 0 10px 40px #000c; }
.dialog-portrait { width: 72px; height: 72px; flex: none; border-radius: 12px; overflow: hidden; background: #ffffff10; }
.dialog-portrait svg { width: 100%; height: 100%; }
.dialog-body { flex: 1; }
.dialog-who { font-weight: 800; color: var(--gold); }
.dialog-text { margin: 4px 0 6px; font-size: 1.05rem; }
.dialog-next { font-size: .8rem; color: var(--muted); text-align: right; animation: pulse-t 1.4s infinite; }
@keyframes pulse-t { 50% { opacity: .4; } }
#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 30px); opacity: 0; transition: .25s; background: #2e2448; border: 1px solid var(--accent); padding: 10px 16px; border-radius: 999px; z-index: 200; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- bars ---------- */
.bar { position: relative; height: 18px; border-radius: 9px; background: #00000066; border: 1px solid #ffffff22; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #2fb070, var(--green)); transition: width .35s; }
.bar.bp .bar-fill { background: linear-gradient(90deg, #2a6fd0, #6ac0ff); }
.bar.demon .bar-fill { background: linear-gradient(90deg, #a01f3a, var(--red)); }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .72rem; font-weight: 700; text-shadow: 0 1px 2px #000; }
.bar.sm { height: 14px; } .bar.sm span { font-size: .65rem; }
.xpbar { position: relative; height: 12px; margin-top: 4px; border-radius: 6px; background: #00000066; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #b08a20, var(--gold)); }
.xpbar span { position: absolute; inset: 0; font-size: .6rem; display: grid; place-items: center; font-weight: 700; text-shadow: 0 1px 2px #000; }

/* ---------- HUD & map ---------- */
.hud { display: flex; align-items: center; gap: 10px; padding: 10px 16px; position: sticky; top: 0; z-index: 20; background: #15111fee; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.hud-me { position: relative; border: 0; background: none; padding: 0; flex: none; }
.hud-face { display: block; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: #ffffff12; border: 2px solid var(--accent); }
.hud-face svg { width: 100%; height: 100%; }
.rank-badge { position: absolute; right: -6px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font-size: .8rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.rank-badge.big { position: static; display: inline-grid; width: 34px; height: 34px; font-size: 1.1rem; }
.hud-main { flex: 1; min-width: 0; }
.hud-name { font-weight: 800; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-name small { font-weight: 600; margin-left: 4px; }
.regions { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.region { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: .88rem; font-weight: 600; }
.region.on { background: #2f8f5b; border-color: #5fd090; }
.region.locked { color: var(--muted); }
.crow-msg { display: flex; align-items: center; gap: 10px; margin: 10px 16px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.crow-msg p { margin: 0; font-size: .95rem; }
.crow { width: 46px; height: 46px; flex: none; }
.locs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 6px 16px 16px; }
.loc { position: relative; display: flex; align-items: center; gap: 12px; min-height: 92px; padding: 14px; border-radius: 16px; border: 1px solid #ffffff22; text-align: left; overflow: hidden;
  background: linear-gradient(135deg, #00000055, #00000000), var(--lb, var(--card)); }
.loc b { display: block; font-size: 1.08rem; text-shadow: 0 1px 3px #000; }
.loc small { color: #e9e0f7; }
.loc-icon { font-size: 2.3rem; filter: drop-shadow(0 2px 4px #0008); }
.loc.locked { filter: grayscale(.85) brightness(.7); }
.loc.done b::after { content: ''; }
.lock { position: absolute; right: 12px; top: 10px; }
.loc-home { --lb: linear-gradient(160deg, #6b3f2a, #2a1a14); }
.loc-mentor { --lb: linear-gradient(160deg, #4a6a8a, #1a2a3a); }
.loc-selection { --lb: linear-gradient(160deg, #9b6cd6, #3a2050); }
.loc-patrol { --lb: linear-gradient(160deg, #2f6f4b, #10261a); }
.loc-boss { --lb: linear-gradient(160deg, #a0303a, #2a0a14); }
.loc-lab { --lb: linear-gradient(160deg, #3a8a8a, #102a2a); }

.scene { position: relative; height: 40dvh; min-height: 260px; display: flex; align-items: flex-end; justify-content: center; gap: 0; overflow: hidden; }
.scene-avatar { height: 92%; display: flex; position: relative; z-index: 1; }
.scene-avatar svg { height: 100%; width: auto; filter: drop-shadow(0 10px 12px #000a); }
.scene-avatar.small { height: 80%; }
.scene-forest { background: linear-gradient(180deg, #0d1a2e, #1d3a3a 70%, #e8f0f8 70.5%, #c8d8e8); }
.scene-forest.night { height: 100dvh; align-items: flex-start; padding-top: 8dvh;
  background: radial-gradient(circle at 80% 12%, #fff8d8 0 22px, #fff8d833 23px, transparent 60px), linear-gradient(180deg, #0d1a2e, #1d3a3a 62%, #e8f0f8 62.5%, #c8d8e8); }
.scene-forest.night .scene-avatar { height: 62%; margin-top: 20dvh; }
.scene-avatar svg { max-width: 92vw; }
.scene-home { background: radial-gradient(circle at 50% 40%, #ffb05a33, transparent 50%), linear-gradient(180deg, #3a2418, #5a3a24 75%, #3a2418 75.5%); }
.scene-mountain { background: linear-gradient(180deg, #8ab0d8, #c8d8e8 55%, #6a7a8a 55.5%, #4a5a6a); }
.scene::before { content: ''; position: absolute; inset: auto 0 0; height: 12%; background: linear-gradient(0deg, var(--bg), transparent); z-index: 1; }
.scene .scene-avatar { margin-bottom: 4%; }
.menu-list { display: grid; gap: 10px; padding: 14px 16px; max-width: 640px; margin: 0 auto; }

/* ---------- breathing choice ---------- */
.breath-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px 16px 24px; }
.breath-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; text-align: left; border: 2px solid var(--c); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 35%, transparent), var(--card) 70%); }
.breath-card b { color: var(--c); font-size: 1.02rem; filter: brightness(1.2); }
.breath-card em { font-size: .76rem; color: #fff; opacity: .8; }
.breath-card.on { box-shadow: 0 0 0 3px var(--gold); }

/* ---------- patrol / lab ---------- */
.missions, .lab-list { display: grid; gap: 10px; padding: 6px 16px; }
.mission, .lab-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.mission-face { width: 72px; height: 80px; flex: none; overflow: hidden; border-radius: 10px; background: #00000040; }
.mission-face svg { width: 100%; height: 100%; }
.mission-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.art-tag { align-self: flex-start; font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--c); color: var(--c); }
.diff { color: var(--gold); letter-spacing: 2px; }
.lab-btns { display: flex; flex-direction: column; gap: 6px; }
.lab-btns .btn { min-height: 36px; padding: 6px 12px; justify-content: center; }
.demon-stage svg { height: 100%; }
.art-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.art-card { display: flex; flex-direction: column; gap: 3px; padding: 10px; text-align: left; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, transparent), var(--card) 70%); }
.art-card b { color: var(--c); } .art-card small { font-size: .74rem; }
.art-card.on { box-shadow: 0 0 0 2px var(--gold); }

/* ---------- training ---------- */
.mini { padding: 10px 16px; display: grid; gap: 14px; max-width: 520px; margin: 0 auto; }
.breath-box { position: relative; aspect-ratio: 1; width: min(80vw, 340px); margin: 0 auto; }
.ring { position: absolute; left: 50%; top: 50%; width: 50%; height: 50%; border-radius: 50%; transform: translate(-50%, -50%); }
.ring.goal { border: 6px solid var(--gold); box-shadow: 0 0 20px #ecbd5266; }
.ring.mover { border: 4px solid var(--blue); background: #46a8ff1a; }
.breath-msg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; pointer-events: none; }
.breath-msg.good { color: var(--gold); } .breath-msg.ok { color: var(--green); } .breath-msg.bad { color: var(--red); }
.slash-box { position: relative; height: 56dvh; border-radius: 18px; background: linear-gradient(180deg, #2a4a3a, #13261c); border: 1px solid var(--line); overflow: hidden; touch-action: manipulation; }
.target { position: absolute; width: 64px; height: 64px; margin: -8px; font-size: 2.4rem; border: 0; background: radial-gradient(circle, #ffffff22, transparent 70%); border-radius: 50%; animation: pop .2s; }
.target.cut { animation: cut .25s forwards; }
@keyframes pop { from { transform: scale(0); } }
@keyframes cut { to { transform: scale(1.6) rotate(40deg); opacity: 0; } }
.score-live { font-size: 1.2rem; }

/* ---------- battle ---------- */
.battle { display: flex; flex-direction: column; height: calc(100dvh - var(--safe-t) - var(--safe-b)); max-width: 640px; margin: 0 auto; }
.arena { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #070b1c; }
.backdrop { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.scene-svg { width: 100%; height: 100%; display: block; }
.enemy-info { position: relative; padding: 10px 16px 18px; display: grid; gap: 4px; z-index: 2; background: linear-gradient(180deg, #000000b0, #00000060 70%, transparent); }
.e-name { font-weight: 800; font-size: 1.05rem; text-shadow: 0 2px 4px #000; }
.e-name small { font-weight: 500; color: #ddd; }
.tag.boss { background: var(--red); color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 6px; margin-right: 6px; vertical-align: middle; }
.art-chip { justify-self: start; font-size: .75rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--art); background: #000000a0; color: var(--art); }
.battle-stage { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 2% 7%; }
.player-sprite { height: 62%; flex: none; position: relative; filter: drop-shadow(0 6px 6px #000c); }
.player-sprite svg { height: 100%; width: auto; }
.enemy-sprite { height: 96%; flex: 1; min-width: 0; display: flex; justify-content: flex-end; align-items: flex-end; filter: drop-shadow(0 8px 10px #000d); }
.enemy-sprite svg { height: 100%; max-width: 100%; width: auto; }
.player-sprite::after, .enemy-sprite::after { content: ''; position: absolute; bottom: -4px; left: 15%; right: 15%; height: 10px; border-radius: 50%; background: #000; opacity: .45; filter: blur(3px); z-index: -1; }
.enemy-sprite { position: relative; }
.enemy-sprite.hit svg { animation: shake .3s; }
.battle.hurt .player-sprite svg { animation: shake .3s; }
.scene-name { position: absolute; right: 10px; bottom: 6px; z-index: 2; font-size: .68rem; color: #fff; opacity: .7; text-shadow: 0 1px 3px #000; letter-spacing: .05em; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); filter: brightness(2); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
/* scene animation */
.pt-fall { animation: ptfall linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ptfall { from { transform: translate(0, -20px) rotate(0deg); } to { transform: translate(var(--sx), 620px) rotate(360deg); } }
.pt-glow { animation: ptglow ease-in-out infinite; }
@keyframes ptglow { 0%, 100% { opacity: .1; transform: translate(0, 0); } 50% { opacity: 1; transform: translate(var(--dx), var(--dy)); } }
.pt-rise { animation: ptrise linear infinite; }
@keyframes ptrise { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--sx), -520px); opacity: 0; } }
.pt-smoke { animation: smoke 4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes smoke { from { transform: translate(0, 0) scale(.6); opacity: .45; } to { transform: translate(24px, -90px) scale(1.7); opacity: 0; } }
.drift { animation: drift ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-50px); } to { transform: translateX(50px); } }
.flicker { animation: flicker 2.6s infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .72; } 50% { opacity: .95; } 70% { opacity: .68; } }
.twinkle { animation: flicker 3s infinite; }
.spin { animation: spin 24s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.sway { animation: sway 4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: top center; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.slash { position: absolute; left: 50%; top: 52%; width: 120%; height: 10px; margin-left: -60%; border-radius: 50%;
  background: linear-gradient(90deg, transparent, var(--c), #fff, var(--c), transparent); box-shadow: 0 0 18px var(--c); transform: rotate(var(--r)) scaleX(0); animation: slash .45s ease-out forwards; }
@keyframes slash { 30% { transform: rotate(var(--r)) scaleX(1); opacity: 1; } to { transform: rotate(var(--r)) scaleX(1.1); opacity: 0; } }
.floater { position: absolute; font-weight: 900; font-size: 1.6rem; text-shadow: 0 2px 0 #000, 0 0 8px #000; animation: float 1.1s ease-out forwards; }
.floater.dmg { color: #fff; } .floater.crit { color: var(--gold); font-size: 2.2rem; } .floater.miss { color: var(--muted); }
.floater.pdmg { color: var(--red); } .floater.heal { color: var(--green); } .floater.regen { color: #8aff8a; font-size: 1rem; }
.floater.burn { color: #ff8a3c; } .floater.poison { color: #c08aff; }
@keyframes float { to { transform: translateY(-50px); opacity: 0; } }
.art-banner { position: absolute; left: 0; right: 0; top: 40%; z-index: 4; padding: 12px 16px; text-align: center; font-weight: 900; font-size: 1.15rem;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 55%, #000), transparent); text-shadow: 0 2px 4px #000; animation: banner .9s ease-out; }
@keyframes banner { from { transform: translateX(-30%); opacity: 0; } 25% { transform: none; opacity: 1; } 80% { opacity: 1; } to { opacity: 0; } }
.dissolve { animation: dissolve 1.5s forwards; }
@keyframes dissolve { to { opacity: 0; filter: blur(6px) grayscale(1) brightness(.4); transform: translateY(-20px) scale(.95); } }
.ash { position: absolute; width: 6px; height: 6px; border-radius: 1px; background: #3a3038; animation: ash 1.4s ease-out forwards; }
@keyframes ash { to { transform: translate(var(--dx), -120px) rotate(200deg); opacity: 0; } }
.battle.hurt { animation: hurt .35s; }
@keyframes hurt { 30% { box-shadow: inset 0 0 80px #e5484d; } }
.log { min-height: 3.3em; padding: 6px 16px; background: #0d0a16; border-top: 1px solid var(--line); font-size: .88rem; }
.log p { margin: 2px 0; }
.log p:last-child { color: #fff; } .log p:not(:last-child) { color: var(--muted); }
.player-row { padding: 6px 16px 2px; background: var(--bg2); }
.p-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.p-name .sts { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.p-portrait { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: #ffffff10; flex: none; border: 2px solid var(--accent); }
.p-portrait svg { width: 100%; height: 100%; }
.p-bars { flex: 1; display: grid; gap: 2px; }
.p-bars label { font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.p-name { font-weight: 800; font-size: .9rem; }
.sts { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.st { font-size: .7rem; background: #00000066; border: 1px solid #ffffff22; border-radius: 999px; padding: 1px 7px; }
.st small { margin-left: 3px; color: #ddd; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px calc(10px + var(--safe-b)); background: var(--bg2); }
.btn.act { flex-direction: column; gap: 0; min-height: 54px; font-size: 1.3rem; justify-content: center; text-align: center; }
.btn.act span { font-size: .82rem; }
.btn.act.strike { background: linear-gradient(180deg, #c04060, #8a2a40); border-color: #e0607a; }
.actions .btn[data-act="forms"]:not(:disabled) { border-color: var(--c); box-shadow: inset 0 0 18px color-mix(in srgb, var(--c) 35%, transparent); }
.forms-list { grid-column: 1 / -1; display: grid; gap: 6px; max-height: 34dvh; overflow: auto; }
.form-btn { flex-direction: column; align-items: flex-start; gap: 0; border-color: var(--c); }
.form-btn b { font-size: .88rem; } .form-btn small { font-size: .74rem; }
.actions > .btn:only-child, .actions > .btn[data-act="back"] { grid-column: 1 / -1; }

/* ---------- profile ---------- */
.profile { padding: 0 16px 24px; display: grid; gap: 12px; max-width: 720px; margin: 0 auto; }
.profile-hero { display: flex; gap: 12px; align-items: center; }
.profile-hero .scene-avatar { height: 240px; flex: none; }
.profile-hero p { margin: 4px 0; font-size: .92rem; }
.rank-line { font-size: 1.1rem !important; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card h3 { font-size: 1rem; margin-bottom: 8px; }
.card.soon { border-style: dashed; color: var(--muted); }
.card.soon p { margin: 0; line-height: 1.8; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.stats div { background: #00000033; border-radius: 10px; padding: 6px 2px; }
.stats b { display: block; font-size: 1.2rem; }
.stats small { font-size: .68rem; }
.ranks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; }
.ranks li { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 8px; color: var(--muted); font-size: .88rem; }
.ranks li span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #ffffff10; font-weight: 700; }
.ranks li.past { color: var(--text); } .ranks li.past span { background: #2f8f5b; }
.ranks li.now { color: #fff; background: #3a2d18; font-weight: 800; } .ranks li.now span { background: var(--red); }
.bestiary { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.beast { text-align: center; } .beast svg { width: 100%; height: 80px; } .beast small { font-size: .7rem; display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.mini .btn.big { justify-content: center; font-size: 1.2rem; }
.actions > .btn.act:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 48px; flex-direction: row; gap: 8px; }
.diff-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.diff-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; text-align: left; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.diff-card.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: #2f2618; }
.diff-card small { font-size: .78rem; }
.wart { display: block; margin: -2px -2px 6px; border-radius: 8px; overflow: hidden; }
.manga-svg { width: 100%; height: auto; display: block; }
.stage-weapon .manga-svg, .manga-reveal .manga-svg { border-radius: 10px; box-shadow: 0 6px 18px #0008; }
.manga-reveal { transform: rotate(-2deg); margin: 6px 0 12px; }
.in-row { display: flex; gap: 8px; align-items: center; } .in-row .icon-btn { height: 48px; width: 48px; }
.logo-jp { color: var(--gold) !important; font-weight: 700; letter-spacing: .1em; }
.logo-jp { font-size: 1.3rem; display: inline-flex; align-items: center; gap: 8px; }
.say-btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; width: 36px; height: 36px; font-size: 1rem; }
.logo .logo-say { margin-top: 4px; font-size: .92rem; }
.logo-say b { color: var(--text); }
.logo .logo-sub { font-style: italic; color: var(--accent); margin-top: 2px; }
.topbar-btns { display: flex; gap: 6px; }
/* Version: shown under the logo and as a faint corner badge on every screen. */
.logo .ver-line { font-size: .78rem; margin-top: 6px; letter-spacing: .05em; }
#ver { position: fixed; left: 8px; bottom: calc(4px + var(--safe-b)); z-index: 150; font-size: .66rem; color: var(--muted); opacity: .6; pointer-events: none; }
#app.screen-battle ~ #ver { display: none; } /* battle shows it beside the scene name */
#app.screen-title ~ #ver { display: none; }
/* Demon Lab */
.lab-h { font-size: 1rem; color: var(--muted); padding: 14px 16px 2px; }
.stage { position: sticky; }
.stage-rank { position: absolute; right: 10px; bottom: 10px; }
.rank-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #3a0a14cc; border: 1px solid #ff5a6a; color: #ffd0d4; font-weight: 700; font-size: .8rem; }
.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.rank-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; }
.rank-chip b { font-size: 1.1rem; color: #ff8a94; letter-spacing: .1em; }
.chip-tall .chip-prev { height: 120px; }
