/* 100% Black Souls 1 (Jiwa Hitam 1) Authentic 640x480 (4:3) RPG Maker VX Ace Pitch-Black UI */
:root {
  --bg: #000000;
  --win-bg: rgba(4, 4, 8, 0.93);
  --win-bg-solid: #050509;
  --win-border-outer: #dcdce6;
  --win-border-inner: #363644;
  --sys-color: #84c0ff;
  --gold: #f0d060;
  --crimson: #b81d2f;
  --text: #f4f4f8;
  --muted: #9a9aa8;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, select {
  user-select: text;
  touch-action: auto;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  text-shadow: 1px 1px 0 #000;
  touch-action: none;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.86rem; }
.sys-label { color: var(--sys-color); font-size: 0.8rem; font-weight: 600; }
.gold-text { color: var(--gold); font-weight: 700; }
.sins-text { color: #ff6b7a; font-weight: 700; }

/* Authentic RPG Maker VX Ace Tinted-Black Windowskin Frame */
.vxa-window {
  background: linear-gradient(180deg, rgba(20, 20, 28, 0.92) 0%, rgba(3, 3, 6, 0.96) 100%);
  border: 2px solid var(--win-border-outer);
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 2px var(--win-border-inner),
    0 0 0 1px #000,
    0 8px 24px rgba(0, 0, 0, 0.9);
}

.vxa-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-image: url('../Graphics/System/IconSet.png');
  background-repeat: no-repeat;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}

.item-name-line {
  display: inline-flex;
  align-items: center;
}

/* Centered Authentic 4:3 (640x480) Black Souls Game Stage */
.overlay-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 40;
  padding: 6px;
}

.bs-frame-4x3 {
  position: relative;
  aspect-ratio: 4 / 3;
  width: min(100%, calc((100vh - 38px) * 4 / 3));
  max-width: 100%;
  max-height: 100%;
  background-color: #000;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  border: 1px solid #24242f;
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.98), 0 0 0 1px #0c0c12;
  z-index: 2;
}

/* Portrait -> Mandatory Landscape Prompt */
#portrait-guard {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 18px;
}
.portrait-card {
  width: 100%;
  max-width: 360px;
  padding: 22px 18px;
  text-align: center;
}
.portrait-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
  animation: tilt-phone 1.8s ease-in-out infinite;
}
@keyframes tilt-phone {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}
.portrait-card h2 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 1.15rem;
}
.portrait-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

/* Story Scrolling Text Overlay inside 640x480 viewport */
#scroll-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  z-index: 31;
  overflow: hidden;
  cursor: pointer;
}
#scroll-text-inner {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 100%;
  text-align: center;
  font-size: clamp(0.9rem, 2.5vw, 1.08rem);
  line-height: 1.75;
  white-space: pre-wrap;
  color: #f4f4f8;
}

.overlay-screen .bs-frame-4x3 {
  width: min(100%, calc((100vh - 12px) * 4 / 3));
}

.bs-frame-4x3.stretch-fill {
  aspect-ratio: auto;
  width: 100% !important;
  height: 100% !important;
  border: none;
}

.loader-card {
  width: 100%;
  max-width: 380px;
  padding: 18px 18px 20px;
  text-align: center;
}
.loader-banner {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid #48485a;
  margin-bottom: 12px;
}

/* Authentic Black Souls 1 Title Screen inside 640x480 4:3 frame */
#title-stage {
  display: flex;
}
.bs-title-layout {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 13% 16px 10%;
}

.bs-title-top { text-align: center; }

.bs-title-logo {
  margin: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(1.9rem, 5.5vw, 3.2rem);
  font-weight: 400;
  letter-spacing: 3px;
  color: #ffffff;
  text-shadow:
    0 2px 8px #000,
    0 0 20px rgba(0, 0, 0, 0.98);
}

.bs-title-tag {
  margin-top: 6px;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  color: rgba(214, 214, 230, 0.65);
  text-transform: uppercase;
}

.bs-subtitle { margin: 6px 0 16px; color: var(--muted); font-size: 0.9rem; }

.bs-title-window {
  width: min(215px, 60%);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-footer-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.title-corner-btn {
  pointer-events: auto;
  background: rgba(6, 6, 12, 0.84);
  border: 1px solid rgba(214, 214, 224, 0.45);
  border-radius: 4px;
  color: #dcdce6;
  padding: 4px 10px;
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.title-corner-btn:hover {
  background: rgba(34, 34, 48, 0.94);
  border-color: #fff;
  color: #fff;
}
.title-corner-btn strong { color: var(--gold); }

.credits-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.credit-card {
  background: rgba(12, 12, 18, 0.9);
  border: 1px solid #3c3c4c;
  border-radius: 4px;
  padding: 10px 12px;
}
.credit-card h3 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: var(--sys-color);
}
.credit-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
}
.credit-link:hover { text-decoration: underline; }
.discord-embed-box {
  margin-top: 6px;
  background: #1e2128;
  border: 1px solid #5865f2;
  border-left: 4px solid #5865f2;
  border-radius: 5px;
  padding: 10px 12px;
}
.discord-iframe {
  width: 100%;
  height: 260px;
  border: 0;
  border-radius: 4px;
  margin-top: 8px;
}

.bs-cmd-btn {
  position: relative;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text);
  padding: 6px 12px 6px 20px;
  font-size: clamp(0.82rem, 2.2vw, 0.96rem);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.bs-cmd-btn:hover:not(:disabled),
.bs-cmd-btn.active {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
  border-color: rgba(255, 255, 255, 0.78);
  color: #fff;
}

.bs-cmd-btn.active::before {
  content: '▸';
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 0.85em;
}

.bs-cmd-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#gameover-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12%;
}

.bs-go-menu {
  width: min(230px, 66%);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spinner {
  width: 32px; height: 32px;
  margin: 12px auto;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

button, .btn-primary, .btn-secondary, .btn-sm, .bs-cmd-btn, .item-row, .choice-btn {
  font-family: inherit;
  touch-action: manipulation;
}

button, .btn-primary, .btn-secondary, .btn-sm {
  border: 1px solid rgba(214, 214, 224, 0.55);
  border-radius: 4px;
  color: var(--text);
  background: #0c0c12;
  cursor: pointer;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-primary {
  background: #1a1a24;
  border-color: #e4e4ec;
  padding: 8px 16px;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled),
.btn-primary.active { background: #2d2d3c; border-color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.82rem; }
.btn-sm:hover:not(:disabled),
.btn-sm.active { background: #2a2a3b; border-color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,0.4); }

/* Game Stage */
#game-stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}

#top-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  padding: 3px 8px;
  background: linear-gradient(180deg, rgba(16, 16, 24, 0.96), rgba(4, 4, 8, 0.98));
  border-bottom: 1px solid #3c3c4c;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  z-index: 38;
  min-height: 30px;
}

.hud-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  min-width: 0;
}
.bs-hud-name { font-weight: 700; color: #fff; }
.hud-bars { width: 88px; display: flex; flex-direction: column; gap: 2px; }
.vxa-gauge {
  position: relative;
  height: 11px;
  background: #1b1b24;
  border: 1px solid #525264;
  overflow: hidden;
}
.vxa-gauge span {
  position: relative;
  z-index: 2;
  display: block;
  font-size: 0.65rem;
  line-height: 9px;
  text-align: center;
}
.mp-wrap { height: 4px; }
.ap-bar { height: 5px; margin-top: 2px; }
.hp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #b81d2f, #e84855); transition: width 0.15s; }
.mp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1b4d9e, #4895ef); transition: width 0.15s; }
.ap-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #c97a16, #f7d046); }

.loc-pill {
  color: var(--sys-color);
  font-size: 0.78rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
.hud-btn {
  background: linear-gradient(180deg, #161622, #08080e);
  border: 1px solid rgba(214, 214, 224, 0.52);
  box-shadow: inset 0 0 0 1px #2c2c3a;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 3px;
  touch-action: manipulation;
}
.hud-btn:hover { background: #222232; border-color: #fff; }
.hud-btn.active { border-color: var(--gold); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(240, 208, 96, 0.45); }

@media (max-width: 780px) {
  .hud-stats .loc-pill { display: none; }
  .hud-stats { font-size: 0.72rem; gap: 5px; }
  .hud-bars { width: 72px; }
  .hud-btn { padding: 4px 7px; font-size: 0.7rem; }
}

#canvas-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  padding: 4px;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}
#game-canvas.pixelated { image-rendering: pixelated; }

#map-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  padding: 5px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.25s, transform 0.25s;
}
#map-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Authentic VX Ace Dialogue Window + NameWindow inside 640x480 stage */
#dialogue-box {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 10px 14px;
  z-index: 32;
  cursor: pointer;
}
#dialogue-box.pos-top { top: 8px; bottom: auto; }
#dialogue-box.pos-mid { top: 50%; bottom: auto; transform: translateY(-50%); }
#dialogue-box.pos-bottom { top: auto; bottom: 8px; }

#dialogue-box.bg-dim {
  background: rgba(0, 0, 0, 0.72);
  border-color: transparent;
  box-shadow: none;
}
#dialogue-box.bg-transparent {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

#dialogue-speaker {
  position: absolute;
  top: -30px;
  left: 4px;
  padding: 3px 12px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
.dialogue-inner { display: flex; gap: 10px; align-items: flex-start; }
#dialogue-face {
  width: clamp(64px, 14%, 96px);
  height: auto;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  background: #000;
  border: 1px solid rgba(255,255,255,0.16);
}
.dialogue-content { flex: 1; min-height: 76px; }
#dialogue-text { font-size: clamp(0.84rem, 2.3vw, 1.02rem); line-height: 1.44; white-space: pre-wrap; color: #fff; }
.dialogue-pause-arrow {
  position: absolute;
  right: 12px;
  bottom: 4px;
  font-size: 0.78rem;
  color: var(--gold);
  animation: bob 0.9s infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

#dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.choice-btn {
  position: relative;
  text-align: left;
  padding: 6px 10px 6px 22px;
  background: rgba(12, 12, 18, 0.92);
  border: 1px solid #4c4c5a;
  font-size: clamp(0.82rem, 2.2vw, 0.94rem);
}
.choice-btn.active, .choice-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}
.choice-btn.active::before {
  content: '▸';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
}

/* Authentic Black Souls 1 640x480 ATB Battle Overlay inside #game-viewport */
#battle-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 25;
}
#battle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}
#battle-canvas.pixelated { image-rendering: pixelated; }

.battle-topbar {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
  z-index: 7;
}
#battle-log {
  flex: 1;
  padding: 5px 10px;
  font-size: clamp(0.72rem, 2vw, 0.84rem);
  min-height: 28px;
  max-height: 62px;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(14, 14, 22, 0.86), rgba(3, 3, 6, 0.9));
}
.battle-auto-pill {
  pointer-events: auto;
  flex-shrink: 0;
  padding: 5px 9px;
  background: rgba(10, 10, 16, 0.9);
  border-color: rgba(214, 214, 224, 0.55);
}
.battle-auto-pill.active {
  background: rgba(240, 208, 96, 0.22);
  border-color: var(--gold);
  color: var(--gold);
}

#battle-subpanel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 124px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 186px;
  overflow-y: auto;
  z-index: 6;
}
#battle-subpanel.target-mode {
  max-height: 78px;
  bottom: 122px;
  padding: 5px 8px;
  background: rgba(6, 6, 12, 0.9);
}
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #343446;
  padding-bottom: 4px;
}
.sub-title { font-size: 0.78rem; color: var(--sys-color); font-weight: 700; }
.sub-desc {
  font-size: 0.74rem;
  color: #d0d0de;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #2b2b3a;
  border-radius: 3px;
  padding: 4px 8px;
  min-height: 24px;
}
.sub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.b-entry-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px 6px 18px;
  text-align: left;
  background: rgba(14, 14, 22, 0.94);
  border: 1px solid #454558;
  border-radius: 3px;
  font-size: 0.8rem;
}
.b-entry-btn .b-entry-name {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.b-entry-btn .b-entry-cost {
  color: var(--sys-color);
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
}
.b-entry-btn:hover:not(:disabled),
.b-entry-btn.active:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
  color: #fff;
}
.b-entry-btn.active::before {
  content: '▸';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
}

.battle-bottom {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  height: 114px;
  display: flex;
  gap: 6px;
  align-items: stretch;
  z-index: 5;
}
#battle-commands {
  width: 178px;
  padding: 5px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  align-content: center;
}
#battle-commands .bs-cmd-btn {
  padding: 5px 6px 5px 16px;
  font-size: clamp(0.72rem, 1.9vw, 0.84rem);
  white-space: nowrap;
}
#battle-party {
  flex: 1;
  padding: 5px 8px;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
}
.party-card {
  flex: 1;
  min-width: 110px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.party-card.active-turn { border-color: #fff; background: rgba(255, 255, 255, 0.09); }
.party-card.dead { opacity: 0.45; }
.p-head { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 0.78rem; margin-bottom: 3px; }
.party-states { font-size: 0.65rem; color: var(--gold); font-weight: 700; margin-left: 4px; }
.mini-bar {
  position: relative;
  height: 12px;
  background: #17171f;
  border: 1px solid #484858;
  margin-bottom: 2px;
  overflow: hidden;
}
.tp-bar { height: 4px; margin-top: 2px; }
.tp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1098ad, #63e6be); }
.mini-bar span { position: relative; z-index: 2; display: block; font-size: 0.64rem; line-height: 10px; text-align: center; }
.victory-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; font-size: 0.86rem; }

/* Side-Docked Handheld Virtual Touch Gamepad (BLACK SOULS Gothic VX Ace Theme) */
#virtual-pad {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  pointer-events: none;
  z-index: 35;
}
.vpad-side {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.vpad-left {
  width: min(146px, 22vw);
}
#joy-zone {
  position: relative;
  width: min(124px, 20vw);
  height: min(124px, 20vw);
  pointer-events: auto;
  touch-action: none;
}
#joy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(24, 24, 34, 0.84) 0%, rgba(6, 6, 10, 0.94) 68%, rgba(2, 2, 4, 0.98) 100%);
  border: 2px solid var(--win-border-outer);
  box-shadow:
    inset 0 0 0 3px var(--win-border-inner),
    inset 0 0 18px rgba(0, 0, 0, 0.95),
    0 4px 16px rgba(0, 0, 0, 0.9);
}
#joy-ring::before,
#joy-ring::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(220, 220, 230, 0.14);
  pointer-events: none;
}
#joy-ring::before { width: 72%; height: 1px; }
#joy-ring::after { width: 1px; height: 72%; }
#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3e3e52, #12121a 68%, #06060a 100%);
  border: 2px solid var(--win-border-outer);
  box-shadow:
    inset 0 0 0 2px #4c4c60,
    0 2px 10px rgba(0, 0, 0, 0.95),
    0 0 8px rgba(240, 208, 96, 0.22);
}
.vpad-right { position: relative; width: min(172px, 26vw); height: 160px; pointer-events: none; }
.vbtn {
  position: absolute;
  pointer-events: auto;
  touch-action: manipulation;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(22, 22, 32, 0.92), rgba(4, 4, 8, 0.96));
  border: 2px solid var(--win-border-outer);
  color: var(--text);
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: 0.4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 0 0 2px var(--win-border-inner),
    0 4px 12px rgba(0, 0, 0, 0.92);
  transition: transform 0.08s, border-color 0.1s, box-shadow 0.1s;
}
.vbtn.pressed,
.vbtn:active {
  background: linear-gradient(180deg, rgba(56, 56, 76, 0.95), rgba(18, 18, 26, 0.98));
  border-color: #fff;
  transform: scale(0.92);
}
.vbtn-lg {
  width: 64px;
  height: 64px;
  right: 4px;
  bottom: 6px;
  font-size: 1.06rem;
  border-color: var(--gold);
  box-shadow:
    inset 0 0 0 2px rgba(184, 29, 47, 0.72),
    0 0 14px rgba(184, 29, 47, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.95);
}
.vbtn-lg small { font-size: 0.56rem; font-family: inherit; color: var(--gold); letter-spacing: 0.8px; }
.vbtn-sm { width: 46px; height: 46px; font-size: 0.68rem; }
.vbtn-sys { border-color: var(--sys-color); color: #e8f2ff; }
.vbtn-crimson { border-color: #d94a5c; color: #ffd9de; }
.vbtn-ok { border-color: #dcdce6; color: #fff; }
.vbtn-dash.active {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow:
    inset 0 0 0 2px rgba(240, 208, 96, 0.35),
    0 0 10px rgba(240, 208, 96, 0.32),
    0 4px 10px rgba(0, 0, 0, 0.92);
}
#vbtn-tas  { right: 10px; top: 2px; }
#vbtn-esc  { right: 66px; top: 6px; }
#vbtn-lari { right: 80px; bottom: 58px; }
#vbtn-ok   { right: 76px; bottom: 4px; }

@media (max-height: 460px) and (orientation: landscape) {
  #virtual-pad { align-items: flex-end; padding-bottom: 10px; }
  body.has-vpad .bs-frame-4x3 { width: min(calc(100% - 260px), calc((100vh - 34px) * 4 / 3)); }
}

/* Authentic 2-Column Black Souls Menu & Modals */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 10px;
}
.modal-card {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid #3c3c48;
}
.modal-header h2 { margin: 0; font-size: 1rem; color: var(--sys-color); }
.modal-kbd-hint { font-size: 0.72rem; color: var(--muted); margin-right: 10px; }
#modal-body { padding: 10px; overflow-y: auto; flex: 1; }

.bs-menu-shell { display: grid; grid-template-columns: 185px 1fr; gap: 8px; min-height: 360px; }
.bs-menu-sidebar { display: flex; flex-direction: column; gap: 6px; }
.bs-cmd-box { padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.bs-info-box { padding: 6px 10px; }
.bs-info-val { text-align: right; font-size: 0.94rem; font-weight: 700; }
.bs-menu-main { padding: 10px; overflow-y: auto; max-height: 68vh; }
.bs-menu-main.focused { border-color: #fff; box-shadow: inset 0 0 0 2px #52526a, 0 0 12px rgba(132, 192, 255, 0.25); }

.sub-tabs, .actor-pills, .shop-tabs, .save-tools { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.tab-btn, .pill-btn {
  background: #0a0a10;
  border: 1px solid #525264;
  padding: 5px 10px;
  font-size: 0.82rem;
}
.tab-btn.active, .pill-btn.active { background: rgba(255, 255, 255, 0.18); border-color: #fff; }

.list-grid { display: flex; flex-direction: column; gap: 5px; }
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(12, 12, 18, 0.88);
  border: 1px solid #32323e;
  border-radius: 3px;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
  transition: border-color 0.08s, background 0.08s;
}
.item-row:hover,
.item-row.active,
.item-row.kbd-focus {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.14);
}
.desc { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.badge { color: var(--sys-color); font-size: 0.8rem; }
.row-actions { display: flex; gap: 5px; }

.equip-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.equip-slots, .equip-candidates { display: flex; flex-direction: column; gap: 4px; max-height: 55vh; overflow-y: auto; }
.status-card { padding: 8px; }
.status-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #383846; padding-bottom: 8px; margin-bottom: 10px; }
.status-head h3 { margin: 0; color: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; font-size: 0.88rem; }
.settings-grid { display: flex; flex-direction: column; gap: 6px; }
.settings-grid label {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid #343440; background: #0a0a10;
}
.dark-input {
  width: 100%; max-width: 280px;
  background: #06060a; color: #fff; border: 1px solid #a8a8b8; padding: 7px 10px; font-size: 0.95rem;
}
.worldmap-box { text-align: center; overflow: auto; max-height: 70vh; }
.worldmap-img { max-width: 100%; height: auto; border: 1px solid #a8a8b8; }
.help-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help-columns h4 { margin: 0 0 6px; color: var(--sys-color); }
.help-columns ul { margin: 0; padding-left: 18px; font-size: 0.86rem; line-height: 1.55; }

#toast-container { position: fixed; top: 44px; right: 10px; display: flex; flex-direction: column; gap: 5px; z-index: 60; pointer-events: none; }
.toast {
  background: rgba(6, 6, 10, 0.95);
  border: 1px solid #c8c8d8;
  padding: 6px 12px;
  font-size: 0.84rem;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(0); }

@media (max-width: 640px) {
  .bs-menu-shell, .equip-layout, .help-columns { grid-template-columns: 1fr; }
  .battle-bottom { height: 96px; }
  #battle-subpanel { bottom: 106px; max-height: 164px; }
  #battle-subpanel.target-mode { bottom: 104px; max-height: 68px; }
  #battle-commands { width: 162px; }
  #dialogue-face { width: 58px; }
}
