/* ==========================================================================
   Shards of Aether — UI styles
   Dark glass panels, cyan aether accents, gold highlights.
   ========================================================================== */
:root {
  --bg: #05040a;
  --panel: rgba(14, 18, 40, 0.78);
  --panel-solid: #11152e;
  --panel-2: rgba(28, 34, 72, 0.6);
  --border: rgba(160, 190, 255, 0.18);
  --border-strong: rgba(160, 210, 255, 0.4);
  --text: #eef1ff;
  --muted: #9aa3c7;
  --accent: #6ee7ff;
  --accent-2: #b28dff;
  --gold: #f5c66b;
  --hp: #5be38a;
  --hp-low: #ff6b6b;
  --mp: #5aa8ff;
  --danger: #ff6b7d;
  --radius: 0.7em;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'Cinzel', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { font-family: var(--font); color: var(--text); -webkit-font-smoothing: antialiased; user-select: none; }

#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0f1230 0%, #05040a 70%); }
#stage { position: relative; overflow: hidden; background: #000; box-shadow: 0 0 80px rgba(0,0,0,0.8); line-height: 1.3; }
#screen { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
#fx, #ui, #overlay { position: absolute; inset: 0; pointer-events: none; }
#fx > *, #ui > *, #overlay > * { pointer-events: auto; }
#fx > * { pointer-events: none; }
#fx > .hitbox { pointer-events: auto; }
#fade { position: absolute; inset: 0; background: #000; opacity: 1; pointer-events: none; z-index: 50; }
.flash { position: absolute; inset: 0; z-index: 49; pointer-events: none; opacity: 0.85; }
canvas.sprite, .portrait-img, .slot-face, .cmp-face, .status-sprite { image-rendering: pixelated; }

/* ------------------------------------------------------------------ boot */
#boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1em; z-index: 60; background: #05040a; color: var(--muted); }
.boot-gem, .logo-gem { width: 2.2em; height: 3em; background: linear-gradient(160deg, #e6fdff, var(--accent) 45%, #2a8ab8); clip-path: polygon(50% 0, 100% 40%, 50% 100%, 0 40%); filter: drop-shadow(0 0 12px rgba(110,231,255,0.8)); animation: gem 3s ease-in-out infinite; }
@keyframes gem { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-0.3em) rotate(4deg); } }

/* ------------------------------------------------------------------ panels & menus */
.panel {
  background: linear-gradient(160deg, rgba(30, 38, 84, 0.82), rgba(10, 12, 30, 0.86));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 0.6em 2em rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.menu { display: grid; gap: 0.2em; outline: none; align-content: start; }
.mi {
  position: relative; display: flex; align-items: center; gap: 0.5em;
  padding: 0.38em 0.8em 0.38em 1.1em; border-radius: 0.45em; cursor: pointer;
  color: var(--text); transition: background 0.12s, color 0.12s, transform 0.12s;
  white-space: nowrap;
}
.mi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.mi-icon { width: 1.1em; text-align: center; color: var(--accent); opacity: 0.85; font-size: 0.95em; }
.mi-right { color: var(--muted); font-variant-numeric: tabular-nums; }
.mi-right small { opacity: 0.7; }
.mi.sel { background: linear-gradient(90deg, rgba(110, 231, 255, 0.24), rgba(110, 231, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(110, 231, 255, 0.35); }
.mi.sel::before { content: ''; position: absolute; left: 0.35em; top: 50%; width: 0.35em; height: 0.35em; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); transform: translateY(-50%); }
.menu.active .mi.sel { animation: selpulse 1.6s ease-in-out infinite; }
@keyframes selpulse { 50% { box-shadow: inset 0 0 0 1px rgba(110, 231, 255, 0.6), 0 0 14px rgba(110, 231, 255, 0.15); } }
.menu.inactive .mi.sel { background: rgba(255, 255, 255, 0.07); box-shadow: none; }
.menu.inactive .mi.sel::before { background: var(--muted); box-shadow: none; }
.mi.disabled, .mi.muted { color: rgba(238, 241, 255, 0.38); }
.mi.disabled .mi-icon, .mi.muted .mi-icon { opacity: 0.4; }
.mi-sep { height: 1px; margin: 0.25em 0.6em; background: var(--border); }
.mi-value { display: flex; align-items: center; gap: 0.5em; min-width: 9em; justify-content: space-between; color: var(--gold); }
.mi-arrow { color: var(--accent); padding: 0 0.3em; font-size: 1.2em; line-height: 1; cursor: pointer; opacity: 0.8; }
.mi-arrow:hover { opacity: 1; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
em { font-style: normal; color: var(--gold); }

.ico { font-style: normal; display: inline-block; width: 1.3em; text-align: center; margin-right: 0.25em; }
.ico-consumable { color: var(--hp); }
.ico-weapon { color: #ffb36b; }
.ico-armor { color: #8fb6ff; }
.ico-accessory { color: var(--accent-2); }
.ico-key { color: var(--gold); }

.bar { position: relative; height: 0.42em; background: rgba(0, 0, 0, 0.5); border-radius: 1em; overflow: hidden; flex: 1; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
.bar .fill { height: 100%; border-radius: 1em; transition: width 0.45s cubic-bezier(.2,.8,.2,1); }
.bar.hp .fill { background: linear-gradient(90deg, #2fbf6a, var(--hp)); }
.bar.hp.low .fill { background: linear-gradient(90deg, #d63b4a, var(--hp-low)); }
.bar.mp .fill { background: linear-gradient(90deg, #2f6fd6, var(--mp)); }
.stat-row { display: flex; align-items: center; gap: 0.45em; font-size: 0.82em; }
.stat-row .lbl { width: 1.8em; color: var(--muted); font-weight: 800; font-size: 0.85em; }
.stat-row .num { min-width: 4.6em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.stat-row .num small { color: var(--muted); font-weight: 600; }

.btn { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border-strong); padding: 0.5em 1.4em; border-radius: 2em; cursor: pointer; }
.btn:hover { background: rgba(110,231,255,0.15); }

/* ------------------------------------------------------------------ title */
.title-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.logo { display: flex; flex-direction: column; align-items: center; margin-top: -2em; animation: logoIn 1.2s cubic-bezier(.2,.8,.2,1); }
@keyframes logoIn { from { opacity: 0; transform: translateY(-1em) scale(0.96); filter: blur(6px); } }
.logo .logo-gem { width: 1.8em; height: 2.5em; margin-bottom: 0.4em; }
.logo-title { font-family: var(--font-title); font-weight: 900; font-size: 3.6em; letter-spacing: 0.06em; line-height: 1;
  display: flex; align-items: baseline; gap: 0.25em;
  background: linear-gradient(180deg, #ffffff 10%, #bfefff 45%, #6ee7ff 70%, #3a7ac0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0.08em 0 rgba(10, 20, 60, 0.9)) drop-shadow(0 0 0.35em rgba(110, 231, 255, 0.45)); }
.logo-title .of { font-size: 0.42em; font-weight: 700; letter-spacing: 0.15em; background: linear-gradient(180deg, #fff3c8, var(--gold)); -webkit-background-clip: text; background-clip: text; }
.logo-sub { margin-top: 0.6em; font-family: var(--font-title); font-size: 0.85em; letter-spacing: 0.5em; text-transform: uppercase; color: var(--gold); opacity: 0.9; text-shadow: 0 0 10px rgba(245,198,107,0.4); }
.press-start { margin-top: 3em; font-size: 1em; letter-spacing: 0.3em; text-transform: uppercase; color: var(--text); animation: blink 1.6s ease-in-out infinite; cursor: pointer; text-shadow: 0 0 10px rgba(110,231,255,0.6); }
@keyframes blink { 50% { opacity: 0.25; } }
.title-menu-wrap { margin-top: 2em; animation: fadeUp 0.6s ease both 0.1s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(0.8em); } }
.title-menu { min-width: 13em; padding: 0.6em; }
.title-menu .mi { justify-content: center; font-weight: 700; letter-spacing: 0.08em; font-size: 1.05em; padding: 0.42em 1.4em; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }
.title-menu .mi-label { flex: none; }
.title-menu .mi.sel { background: linear-gradient(90deg, transparent, rgba(110, 231, 255, 0.25), transparent); box-shadow: none; }
.title-menu .mi.sel::before { left: 0.6em; }
.title-footer { position: absolute; bottom: 0.8em; left: 1.2em; right: 1.2em; display: flex; justify-content: space-between; font-size: 0.7em; color: rgba(238, 241, 255, 0.5); letter-spacing: 0.06em; }
.goodbye { display: flex; flex-direction: column; align-items: center; gap: 0.6em; text-align: center; }
.goodbye h2 { font-family: var(--font-title); font-size: 2em; margin: 0.4em 0 0; }
.goodbye p { color: var(--muted); margin: 0 0 1em; }

/* ------------------------------------------------------------------ screens / overlays */
.screen { position: absolute; inset: 0; padding: 1.4em 1.8em 2.6em; background: rgba(5, 6, 16, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.2s ease; display: flex; flex-direction: column; gap: 0.8em; }
.screen.show { opacity: 1; }
.screen-header { display: flex; align-items: center; gap: 1.2em; }
.screen-header h2 { margin: 0; font-family: var(--font-title); font-weight: 700; font-size: 1.6em; letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 14px rgba(110,231,255,0.35); }
.screen-header h2::after { content: ''; display: block; height: 2px; width: 2.4em; margin-top: 0.15em; background: linear-gradient(90deg, var(--accent), transparent); }
.screen-hint { position: absolute; bottom: 0.7em; right: 1.8em; font-size: 0.72em; color: var(--muted); display: flex; gap: 1.2em; }
kbd { display: inline-block; min-width: 1.6em; padding: 0.05em 0.4em; margin-right: 0.3em; text-align: center; border-radius: 0.3em; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-bottom-width: 2px; font-family: var(--font); font-size: 0.9em; color: var(--text); }

.options-panel { width: min(36em, 100%); align-self: center; padding: 1em; display: flex; flex-direction: column; gap: 0.6em; }
.options-menu .mi { padding-top: 0.45em; padding-bottom: 0.45em; }
.options-menu .mi.back { justify-content: center; }
.options-menu .mi.back .mi-label { flex: none; }
.vol { display: inline-flex; gap: 2px; }
.vol i { display: inline-block; width: 0.42em; height: 0.85em; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.vol i.on { background: linear-gradient(180deg, #bfefff, var(--accent)); box-shadow: 0 0 4px rgba(110,231,255,0.5); }
.options-desc { min-height: 1.4em; padding: 0.4em 0.8em; font-size: 0.82em; color: var(--muted); border-top: 1px solid var(--border); }
.controls-help { font-size: 0.72em; color: var(--muted); padding: 0 0.8em; line-height: 1.9; }

.slots-panel { width: min(38em, 100%); align-self: center; }
.slots-menu { gap: 0.6em; }
.slots-menu .mi { padding: 0; }
.slots-menu .mi.sel::before { display: none; }
.slot { width: 100%; display: flex; align-items: center; gap: 1em; padding: 0.8em 1.1em; border-radius: var(--radius); background: linear-gradient(160deg, rgba(30, 38, 84, 0.82), rgba(10, 12, 30, 0.86)); border: 1px solid var(--border); }
.mi.sel .slot { border-color: rgba(110, 231, 255, 0.55); box-shadow: 0 0 18px rgba(110,231,255,0.15); }
.slot-num { font-family: var(--font-title); font-weight: 700; color: var(--gold); min-width: 4.2em; }
.slot-faces { display: flex; gap: 0.2em; min-width: 6em; }
.slot-face { width: 2em; height: auto; }
.slot-info { display: flex; flex-direction: column; gap: 0.1em; }
.slot-loc { font-weight: 800; }
.slot-meta, .slot-date { font-size: 0.78em; color: var(--muted); }
.slot.empty .slot-empty { color: var(--muted); font-style: italic; }

.modal-backdrop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); z-index: 30; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { min-width: 20em; max-width: 30em; padding: 1.2em 1.4em 1em; text-align: center; animation: pop 0.2s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.modal.danger { border-color: rgba(255, 107, 125, 0.4); }
.modal-msg { margin-bottom: 1em; line-height: 1.5; }
.modal-menu .mi { justify-content: center; }
.modal-menu .mi-label { flex: none; }

/* ------------------------------------------------------------------ dialogue */
.dialog { position: absolute; left: 4%; right: 4%; bottom: 4%; min-height: 7.2em; display: flex; gap: 1em; padding: 1em 1.4em;
  background: linear-gradient(160deg, rgba(22, 28, 66, 0.92), rgba(8, 10, 26, 0.94)); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 0.8em 2.4em rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1); backdrop-filter: blur(6px); z-index: 20;
  transform: translateY(0.6em); opacity: 0; transition: transform 0.18s ease, opacity 0.18s ease; cursor: pointer; }
.dialog.show { transform: none; opacity: 1; }
.dialog::before { content: ''; position: absolute; inset: 3px; border-radius: calc(var(--radius) - 3px); border: 1px solid rgba(110, 231, 255, 0.08); pointer-events: none; }
.dialog-portrait { display: none; flex: none; width: 5.2em; height: 5.2em; border-radius: 0.6em; overflow: hidden; background: radial-gradient(circle at 50% 35%, rgba(110,231,255,0.25), rgba(20,24,60,0.9)); border: 1px solid var(--border-strong); }
.dialog.has-portrait .dialog-portrait { display: block; }
.dialog-portrait .portrait-img { width: 100%; height: 100%; }
.dialog-body { flex: 1; min-width: 0; }
.dialog-name { display: inline-block; font-family: var(--font-title); font-weight: 700; color: var(--gold); margin-bottom: 0.3em; letter-spacing: 0.05em; padding-bottom: 0.1em; border-bottom: 1px solid rgba(245,198,107,0.3); }
.dialog-text { font-size: 1.05em; line-height: 1.5; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.dialog-text .ghost { visibility: hidden; }
.dialog-next { position: absolute; right: 1.1em; bottom: 0.7em; width: 0; height: 0; border-left: 0.4em solid transparent; border-right: 0.4em solid transparent; border-top: 0.5em solid var(--accent); opacity: 0; filter: drop-shadow(0 0 4px var(--accent)); }
.dialog-next.show { opacity: 1; animation: bounce 0.9s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translateY(0.25em); } }
.choice-box { position: absolute; right: 5%; bottom: calc(4% + 8.2em); padding: 0.5em; min-width: 11em; z-index: 21; animation: pop 0.15s ease; }

.narration { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 12%; background: rgba(0, 0, 0, 0.82); z-index: 25; opacity: 0; transition: opacity 0.4s ease; cursor: pointer; }
.narration.show { opacity: 1; }
.narration-text { font-family: var(--font-title); font-size: 1.15em; line-height: 1.9; text-align: center; color: #e9ecff; text-shadow: 0 0 18px rgba(110, 231, 255, 0.35); }
.chapter-card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5em; background: radial-gradient(ellipse at center, rgba(10,12,30,0.92), rgba(0,0,0,0.98)); z-index: 26; opacity: 0; transition: opacity 0.7s ease; }
.chapter-card.show { opacity: 1; }
.chapter-line { width: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); transition: width 1.2s ease 0.2s; }
.chapter-card.show .chapter-line { width: 22em; }
.chapter-sub { font-family: var(--font-title); letter-spacing: 0.5em; color: var(--gold); font-size: 0.9em; text-transform: uppercase; }
.chapter-title { font-family: var(--font-title); font-weight: 900; font-size: 2.2em; letter-spacing: 0.06em; color: #fff; text-shadow: 0 0 20px rgba(110, 231, 255, 0.5); }

/* ------------------------------------------------------------------ toasts / banners / floats */
.toasts { position: absolute; top: 1em; right: 1em; display: flex; flex-direction: column; gap: 0.4em; align-items: flex-end; z-index: 40; pointer-events: none !important; }
.toast { padding: 0.45em 1em; border-radius: 2em; background: rgba(14, 18, 40, 0.9); border: 1px solid var(--border-strong); font-size: 0.85em; transform: translateX(1em); opacity: 0; transition: all 0.3s ease; }
.toast.show { transform: none; opacity: 1; }
.toast.heal { border-color: rgba(91, 227, 138, 0.5); color: #b6ffd0; }
.toast.mp { border-color: rgba(90, 168, 255, 0.5); color: #bcdcff; }
.location-banner { position: absolute; top: 10%; left: 0; padding: 0.5em 3em 0.6em 2em; background: linear-gradient(90deg, rgba(8, 10, 26, 0.85), rgba(8, 10, 26, 0.6) 70%, transparent);
  border-top: 1px solid rgba(245, 198, 107, 0.4); border-bottom: 1px solid rgba(245, 198, 107, 0.15); transform: translateX(-100%); opacity: 0; transition: transform 0.6s cubic-bezier(.2,.8,.2,1), opacity 0.6s ease; pointer-events: none !important; z-index: 15; }
.location-banner.show { transform: none; opacity: 1; }
.lb-sub { font-size: 0.7em; letter-spacing: 0.35em; text-transform: uppercase; color: var(--gold); }
.lb-title { font-family: var(--font-title); font-weight: 700; font-size: 1.5em; letter-spacing: 0.05em; }

.float { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 1.25em; pointer-events: none; z-index: 12; white-space: nowrap;
  text-shadow: 0 2px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8); animation: floatUp 1.1s cubic-bezier(.2,.8,.3,1) forwards; font-variant-numeric: tabular-nums; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -80%) scale(1.15); } 30% { transform: translate(-50%, -70%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -160%); } }
.float.dmg { color: #fff; }
.float.crit { color: #ffd36a; font-size: 1.6em; }
.float.heal { color: #7dffa8; }
.float.mp { color: #8fc4ff; }
.float.miss { color: #c0c6e0; font-size: 1em; }
.float.weak { color: #ff9a52; font-size: 0.8em; letter-spacing: 0.1em; }
.float.resist { color: #9aa3c7; font-size: 0.8em; }
.float.buff { color: #ffd36a; font-size: 0.85em; }
.float.debuff { color: #c49aff; font-size: 0.85em; }
.float.info { color: #bfefff; font-size: 0.85em; }

/* ------------------------------------------------------------------ pause menu */
.pause-menu { flex-direction: row; gap: 1em; padding: 1.4em 1.6em 2.4em; background: rgba(5, 6, 16, 0.6); }
.pm-left { width: 26%; display: flex; flex-direction: column; gap: 0.8em; }
.pm-menu-panel { padding: 0.6em; }
.pm-menu .mi { font-weight: 700; }
.pm-info { padding: 0.8em 1em; display: flex; flex-direction: column; gap: 0.35em; font-size: 0.85em; margin-top: auto; }
.pm-info-row { display: flex; justify-content: space-between; gap: 0.5em; }
.pm-info-row span { color: var(--muted); }
.pm-info-row.gold b { color: var(--gold); }
.pm-main { flex: 1; padding: 1em 1.2em; display: flex; flex-direction: column; gap: 0.7em; min-width: 0; overflow: hidden; }
.pm-title { font-family: var(--font-title); font-weight: 700; font-size: 1.15em; letter-spacing: 0.05em; color: #fff; }
.pm-title small { font-family: var(--font); font-size: 0.7em; color: var(--muted); margin-left: 0.6em; }
.sub-title { font-family: var(--font-title); font-weight: 700; font-size: 0.85em; color: var(--gold); margin: 0.6em 0 0.2em; letter-spacing: 0.05em; }
.pcards { display: flex; flex-direction: column; gap: 0.55em; }
.pcards.menu .mi { padding: 0; }
.pcards.menu .mi.sel::before { display: none; }
.pcard { display: flex; gap: 1em; align-items: center; padding: 0.7em 0.9em; border-radius: var(--radius); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); width: 100%; }
.mi.sel .pcard { border-color: rgba(110, 231, 255, 0.55); background: rgba(110, 231, 255, 0.08); }
.mi.disabled .pcard { opacity: 0.45; }
.pcard.ko { filter: grayscale(0.8); }
.pcard-portrait { width: 3.8em; height: 3.8em; border-radius: 0.6em; overflow: hidden; flex: none; background: radial-gradient(circle at 50% 35%, rgba(110,231,255,0.25), rgba(20,24,60,0.9)); border: 1px solid var(--border-strong); }
.pcard-portrait .portrait-img, .equip-head .portrait-img { width: 100%; height: 100%; }
.pcard-info { flex: 1; display: flex; flex-direction: column; gap: 0.15em; min-width: 0; }
.pcard-top { display: flex; justify-content: space-between; align-items: baseline; }
.pcard-name { font-weight: 800; font-size: 1.05em; }
.pcard-name.big { font-family: var(--font-title); font-size: 1.4em; }
.pcard-lv { color: var(--muted); font-size: 0.85em; }
.pcard-lv b { color: var(--gold); font-size: 1.15em; }
.pcard-class { color: var(--accent); font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; }
.pcard-exp { font-size: 0.75em; color: var(--muted); }
.pcard-exp b { color: var(--text); }
.item-list { gap: 0.2em 0.6em; overflow-y: auto; max-height: 15em; padding-right: 0.3em; }
.item-list::-webkit-scrollbar { width: 4px; } .item-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.desc-bar { margin-top: auto; padding: 0.6em 0.9em; min-height: 2.6em; border-radius: 0.5em; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); font-size: 0.85em; color: #d6dbf5; }
.empty-note { color: var(--muted); font-style: italic; padding: 1em; }
.equip-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.2em; }
.equip-head { display: flex; gap: 0.8em; align-items: center; margin-bottom: 0.6em; }
.equip-head .portrait-img { width: 3.2em; height: 3.2em; border-radius: 0.5em; border: 1px solid var(--border-strong); background: rgba(110,231,255,0.1); }
.slot-name { display: inline-block; min-width: 6.5em; color: var(--muted); font-size: 0.85em; }
.equip-stats { padding: 0.7em 0.9em; border-radius: 0.6em; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border); }
.stat-table { display: grid; grid-template-columns: 1fr; gap: 0.15em; }
.st { display: flex; justify-content: space-between; gap: 0.8em; font-size: 0.85em; padding: 0.1em 0; }
.st > span:first-child { color: var(--muted); }
.st b { font-variant-numeric: tabular-nums; }
.up { color: #7dffa8 !important; } .down { color: #ff8a8a !important; }
.arrow { color: var(--muted); }
.status-layout { display: grid; grid-template-columns: 0.9fr 1.3fr; gap: 1.4em; overflow: hidden; }
.status-left { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.3em; }
.status-sprite-wrap { padding: 0.8em 1.6em; border-radius: 50%; background: radial-gradient(circle, rgba(110,231,255,0.18), transparent 70%); }
.status-sprite { width: 5em; height: auto; }
.status-bio { font-size: 0.8em; color: var(--muted); line-height: 1.5; margin-top: 0.4em; }
.status-right { display: flex; flex-direction: column; gap: 0.2em; overflow-y: auto; padding-right: 0.3em; }
.status-right .stat-table { grid-template-columns: 1fr 1fr; column-gap: 1.4em; margin-top: 0.4em; }
.status-skills { display: flex; flex-wrap: wrap; gap: 0.3em; }
.chip { font-size: 0.75em; padding: 0.2em 0.65em; border-radius: 2em; background: rgba(110, 231, 255, 0.1); border: 1px solid rgba(110, 231, 255, 0.3); color: #cff6ff; }

/* ------------------------------------------------------------------ shop */
.shop-screen .screen-header { justify-content: space-between; }
.shop-menu { grid-auto-flow: column; }
.shop-menu .mi { padding: 0.35em 1.2em 0.35em 1.4em; font-weight: 700; }
.shop-gold { position: absolute; top: 1.5em; right: 1.8em; padding: 0.4em 1em; border-radius: 2em; background: rgba(0,0,0,0.35); border: 1px solid rgba(245,198,107,0.35); display: flex; gap: 0.8em; font-size: 0.9em; }
.shop-gold span { color: var(--muted); } .shop-gold b { color: var(--gold); }
.shop-screen .screen-header { padding-right: 9em; }
.shop-body { flex: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 1em; min-height: 0; }
.shop-left, .shop-right { padding: 1em 1.1em; display: flex; flex-direction: column; gap: 0.5em; min-height: 0; }
.shop-left .item-list { max-height: none; flex: 1; }
.shop-welcome { color: var(--muted); font-style: italic; padding: 0.6em; }
.shop-desc { margin: 0; }
.detail-title { font-weight: 800; font-size: 1.05em; margin-bottom: 0.3em; }
.compare { display: flex; flex-direction: column; gap: 0.4em; margin-top: 0.5em; }
.cmp { display: flex; align-items: center; gap: 0.6em; font-size: 0.8em; padding: 0.3em 0.5em; border-radius: 0.5em; background: rgba(255, 255, 255, 0.04); }
.cmp span { display: flex; flex-wrap: wrap; gap: 0.2em 0.7em; }
.cmp.no { opacity: 0.45; }
.cmp-face { width: 1.6em; height: auto; }
.tag { font-style: normal; font-size: 0.85em; color: var(--accent); border: 1px solid rgba(110,231,255,0.35); border-radius: 1em; padding: 0 0.5em; }
.qty-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 1em 1.6em; text-align: center; z-index: 30; min-width: 14em; animation: pop 0.15s ease; }
.qty-title { font-weight: 800; margin-bottom: 0.4em; }
.qty-row { display: flex; align-items: center; justify-content: center; gap: 1em; font-size: 1.6em; }
.qty-row b { min-width: 2em; }
.qty-total { color: var(--muted); font-size: 0.85em; margin-top: 0.3em; }
.qty-total b { color: var(--gold); }

/* ------------------------------------------------------------------ battle */
.battle-ui { position: absolute; inset: 0; pointer-events: none !important; }
.battle-ui > * { pointer-events: auto; }
.b-msg { position: absolute; top: 4%; left: 50%; transform: translate(-50%, -0.5em); padding: 0.45em 1.6em; border-radius: 2em; background: linear-gradient(90deg, rgba(8,10,26,0.2), rgba(8,10,26,0.9) 20%, rgba(8,10,26,0.9) 80%, rgba(8,10,26,0.2));
  border-top: 1px solid rgba(110, 231, 255, 0.35); border-bottom: 1px solid rgba(110, 231, 255, 0.15); font-weight: 800; letter-spacing: 0.04em; opacity: 0; transition: all 0.2s ease; white-space: nowrap; pointer-events: none !important; }
.b-msg.show { opacity: 1; transform: translate(-50%, 0); }
.b-timeline { position: absolute; top: 3%; right: 1.5%; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25em; pointer-events: none !important; }
.tl-label { font-size: 0.6em; letter-spacing: 0.25em; text-transform: uppercase; color: var(--muted); }
.tl-list { display: flex; gap: 0.25em; }
.tl-item { width: 1.9em; height: 1.9em; border-radius: 0.4em; background: rgba(10, 12, 30, 0.8); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tl-item canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.tl-item.party { border-color: rgba(110, 231, 255, 0.45); }
.tl-item.enemy { border-color: rgba(255, 107, 125, 0.45); }
.tl-item.now { transform: scale(1.25); margin-right: 0.3em; box-shadow: 0 0 10px rgba(245, 198, 107, 0.6); border-color: var(--gold); }
.b-bottom { position: absolute; left: 1%; right: 1%; bottom: 1.5%; height: 24%; display: grid; grid-template-columns: 30% 1fr; gap: 0.6em; }
.b-enemies { padding: 0.5em 0.8em; display: flex; flex-direction: column; gap: 0.15em; font-size: 0.85em; overflow: hidden; }
.b-erow { display: flex; align-items: center; gap: 0.4em; padding: 0.1em 0.4em; border-radius: 0.3em; cursor: pointer; font-weight: 700; }
.b-erow.active { background: rgba(255, 107, 125, 0.18); }
.b-party { padding: 0.4em 0.7em; display: flex; flex-direction: column; justify-content: center; gap: 0.15em; }
.b-prow { display: grid; grid-template-columns: 6.5em 4.5em 1fr; align-items: center; gap: 0.5em; padding: 0.12em 0.5em; border-radius: 0.4em; cursor: pointer; transition: background 0.2s; }
.b-prow.active { background: linear-gradient(90deg, rgba(245, 198, 107, 0.22), rgba(245, 198, 107, 0.02)); box-shadow: inset 2px 0 0 var(--gold); }
.b-prow.ko { opacity: 0.5; } .b-prow.ko .b-pname { color: var(--hp-low); text-decoration: line-through; }
.b-pname { font-weight: 800; }
.b-pbars { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8em; }
.b-pbars .stat-row { font-size: 0.78em; }
.b-status { display: flex; gap: 0.2em; flex-wrap: wrap; }
.st-ico { font-style: normal; font-size: 0.62em; font-weight: 800; padding: 0.05em 0.35em; border-radius: 0.3em; background: rgba(0,0,0,0.4); }
.st-ico.up { color: #ffd36a; } .st-ico.down { color: #c49aff; } .st-ico.poison { color: #c06aff; } .st-ico.guard { color: var(--accent); }
.b-cmd { position: absolute; right: 25%; bottom: 27%; }
.b-cmd-panel { padding: 0.5em; min-width: 10.5em; animation: slideIn 0.18s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(1em); } }
.b-cmd-name { font-family: var(--font-title); font-weight: 700; color: var(--gold); font-size: 0.85em; padding: 0.1em 0.8em 0.3em; border-bottom: 1px solid var(--border); margin-bottom: 0.3em; }
.b-cmd-menu .mi { font-weight: 700; padding-top: 0.3em; padding-bottom: 0.3em; }
.b-list-panel { position: absolute; left: 1%; right: 43%; bottom: 27%; padding: 0.6em; display: flex; flex-direction: column; gap: 0.4em; animation: slideIn 0.18s ease; max-height: 45%; }
.b-list { overflow-y: auto; max-height: 7.5em; gap: 0.15em 0.6em; }
.b-list-panel .desc-bar { margin: 0; min-height: 1.8em; }
.target-cursor { position: absolute; width: 0; height: 0; border-left: 0.55em solid transparent; border-right: 0.55em solid transparent; border-top: 0.75em solid var(--gold); transform: translate(-50%, -100%); filter: drop-shadow(0 0 6px rgba(245,198,107,0.8)); animation: cursorBob 0.6s ease-in-out infinite; z-index: 11; }
.target-cursor.ally { border-top-color: var(--accent); filter: drop-shadow(0 0 6px rgba(110,231,255,0.8)); }
@keyframes cursorBob { 50% { transform: translate(-50%, -60%); } }
.b-hitboxes { position: absolute; inset: 0; pointer-events: none !important; }
.hitbox { position: absolute; cursor: pointer; pointer-events: auto; }
.victory-panel { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -45%) scale(0.95); min-width: 24em; padding: 1.1em 1.4em; opacity: 0; transition: all 0.3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; gap: 0.6em; z-index: 20; }
.victory-panel.show { opacity: 1; transform: translate(-50%, -50%); }
.victory-title { font-family: var(--font-title); font-weight: 900; font-size: 1.8em; text-align: center; letter-spacing: 0.1em; background: linear-gradient(180deg, #fff3c8, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 10px rgba(245,198,107,0.4)); }
.victory-gains { display: flex; justify-content: center; gap: 2em; }
.victory-gains div { display: flex; gap: 0.5em; align-items: baseline; } .victory-gains span { color: var(--muted); font-size: 0.85em; } .victory-gains b { color: var(--gold); font-size: 1.2em; }
.victory-drops { text-align: center; font-size: 0.9em; }
.victory-party { display: flex; flex-direction: column; gap: 0.4em; }
.vp-row { display: flex; gap: 0.7em; align-items: center; padding: 0.3em 0.5em; border-radius: 0.5em; background: rgba(255,255,255,0.04); }
.vp-row.ko { opacity: 0.45; }
.vp-row .portrait-img { width: 2.4em; height: 2.4em; border-radius: 0.4em; background: rgba(110,231,255,0.12); }
.levelup { color: #7dffa8; font-weight: 900; letter-spacing: 0.1em; font-size: 0.85em; animation: blink 0.8s ease-in-out 3; }
.learned { color: var(--accent); font-size: 0.8em; }
.press-hint { text-align: center; font-size: 0.75em; color: var(--muted); animation: blink 1.6s ease-in-out infinite; }

/* ------------------------------------------------------------------ game over & credits */
.gameover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6em; background: radial-gradient(ellipse at center, rgba(60, 10, 20, 0.5), transparent 70%); }
.go-title { font-family: var(--font-title); font-weight: 900; font-size: 3em; letter-spacing: 0.15em; color: #ff6b7d; text-shadow: 0 0 24px rgba(255, 60, 90, 0.6); animation: logoIn 2s ease; }
.go-sub { color: var(--muted); margin-bottom: 1.4em; }
.go-menu { min-width: 13em; }
.go-menu .mi { justify-content: center; font-weight: 700; } .go-menu .mi-label { flex: none; }
.credits { position: absolute; inset: 0; overflow: hidden; }
.credits-inner { position: absolute; left: 0; right: 0; top: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.6em; text-align: center; animation: roll 32s linear forwards; }
@keyframes roll { to { transform: translateY(calc(-100% - 28em)); } }
.credits-end { font-family: var(--font-title); font-weight: 900; font-size: 2.4em; color: #fff; text-shadow: 0 0 20px rgba(110, 231, 255, 0.5); }
.credits-sub { font-family: var(--font-title); color: var(--gold); letter-spacing: 0.3em; text-transform: uppercase; }
.credit-role { font-size: 0.75em; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); }
.credit-name { font-size: 1.2em; font-weight: 700; }
.credits-thanks { font-family: var(--font-title); font-size: 1.4em; margin-top: 4em; color: var(--gold); }

/* ------------------------------------------------------------------ field hud */
.field-hud { position: absolute; inset: 0; pointer-events: none !important; }

/* ------------------------------------------------------------------ playtest */
.playtest-badge { position: absolute; top: 0.5em; left: 50%; transform: translateX(-50%); z-index: 45; pointer-events: none; font-size: 0.65em; font-weight: 900; letter-spacing: 0.3em; padding: 0.2em 0.9em; border-radius: 1em; background: rgba(255, 107, 125, 0.85); color: #fff; }

/* ------------------------------------------------------------------ mobile / touch */
body.touch { touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#app.rotated { right: auto; bottom: auto; transform-origin: 0 0; }
.touch-ui { position: absolute; inset: 0; pointer-events: none; z-index: 70; --tc: min(34vmin, 170px); }
.touch-ui > * { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.tc-dpad { position: absolute; left: max(2vmin, env(safe-area-inset-left)); bottom: 4vmin; width: var(--tc); height: var(--tc); border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 26, 60, 0.35), rgba(20, 26, 60, 0.18)); border: 2px solid rgba(160, 200, 255, 0.22); }
.tc-arrow { position: absolute; width: 0; height: 0; border: calc(var(--tc) * 0.075) solid transparent; opacity: 0.55; }
.tc-up { left: 50%; top: 7%; transform: translateX(-50%); border-bottom-color: #fff; border-top-width: 0; }
.tc-down { left: 50%; bottom: 7%; transform: translateX(-50%); border-top-color: #fff; border-bottom-width: 0; }
.tc-left { top: 50%; left: 7%; transform: translateY(-50%); border-right-color: #fff; border-left-width: 0; }
.tc-right { top: 50%; right: 7%; transform: translateY(-50%); border-left-color: #fff; border-right-width: 0; }
.tc-dpad[data-dir="up"] .tc-up, .tc-dpad[data-dir="down"] .tc-down, .tc-dpad[data-dir="left"] .tc-left, .tc-dpad[data-dir="right"] .tc-right { opacity: 1; filter: drop-shadow(0 0 6px var(--accent)); }
.tc-knob { position: absolute; left: 50%; top: 50%; width: 38%; height: 38%; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 40% 35%, rgba(255,255,255,0.45), rgba(110,231,255,0.25)); border: 1px solid rgba(255,255,255,0.35); transition: transform 0.05s; }
.tc-actions { position: absolute; right: max(2vmin, env(safe-area-inset-right)); bottom: 4vmin; width: calc(var(--tc) * 1.05); height: var(--tc); }
.tc-btn { position: absolute; display: flex; align-items: center; justify-content: center; border-radius: 50%; font: 800 calc(var(--tc) * 0.16) var(--font);
  color: rgba(255,255,255,0.9); background: rgba(20, 26, 60, 0.38); border: 2px solid rgba(160, 200, 255, 0.3); box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: transform 0.06s, background 0.06s; }
.tc-btn.down { transform: scale(0.9); background: rgba(110, 231, 255, 0.4); }
.tc-a { width: 48%; height: 48%; right: 0; top: 10%; border-color: rgba(110, 231, 255, 0.6); }
.tc-b { width: 40%; height: 40%; left: 0; bottom: 4%; border-color: rgba(255, 140, 160, 0.5); }
.tc-top { position: absolute; top: 3vmin; right: max(2vmin, env(safe-area-inset-right)); display: flex; gap: 2vmin; }
.tc-small { position: relative; width: calc(var(--tc) * 0.3); height: calc(var(--tc) * 0.3); font-size: calc(var(--tc) * 0.13); }
.tc-run.on { background: rgba(245, 198, 107, 0.45); border-color: var(--gold); }
body.touch .screen-hint, body.touch .controls-help { display: none; }
