:root {
  color-scheme: dark;
  --bg: #100808;
  --ink: #f3ead5;
  --muted: #c6b895;
  --line: #5b442f;
  --panel: #2d231d;
  --panel-soft: #3a2f27;
  --accent: #f0c56e;
  --danger: #df6f56;
  --operator-cyan: #6df7ff;
  --operator-cyan-soft: rgba(109, 247, 255, 0.16);
  --operator-cyan-line: rgba(109, 247, 255, 0.78);
  --operator-bg: rgba(3, 12, 18, 0.88);
  --button-wood-fill: url("/assets/shinobi/images/button-wood-fill.png");
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(216, 165, 93, 0.16), transparent 42%),
    linear-gradient(180deg, #1d1110 0%, #100808 100%);
  color: var(--ink);
  overflow: hidden;
}

.app-shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 14px;
  position: relative;
}

.stage-column {
  position: relative;
  min-width: 0;
}

#game {
  width: 100%;
  height: calc(100vh - 28px);
  display: block;
  border: 2px solid var(--line);
  background: #1b2b1f;
  image-rendering: pixelated;
}

.panel {
  border: 1px solid rgba(91, 68, 47, 0.86);
  background:
    linear-gradient(180deg, rgba(28, 21, 16, 0.68), rgba(8, 7, 6, 0.82)),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 229, 165, 0.08),
    inset 0 0 0 1px rgba(5, 6, 8, 0.68);
  padding: 10px;
}

.stage-topbar {
  position: absolute;
  left: auto;
  top: 10px;
  right: 10px;
  width: min(430px, calc(100% - 20px));
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  pointer-events: none;
  z-index: 16;
  border-color: var(--operator-cyan-line);
  background:
    linear-gradient(180deg, rgba(7, 32, 42, 0.9), rgba(2, 9, 14, 0.92)),
    #061017;
  box-shadow:
    inset 0 0 0 1px rgba(174, 238, 255, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.86),
    0 0 16px rgba(109, 247, 255, 0.18);
  opacity: 0.94;
}

.stage-topbar > div {
  min-width: 0;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(109, 247, 255, 0.25);
  padding: 5px 6px;
}

.stage-topbar .label {
  color: #9beeff;
}

.stage-topbar strong {
  color: #f7feff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.label, dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
strong { display: block; margin-top: 2px; font-size: 14px; }

.debug-editor-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  width: min(340px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  z-index: 30;
  background:
    linear-gradient(180deg, rgba(8, 28, 38, 0.72), rgba(2, 8, 12, 0.9)),
    #07151d;
  border-color: var(--operator-cyan);
  box-shadow:
    inset 0 0 0 1px rgba(174, 238, 255, 0.12),
    0 0 0 2px rgba(0, 0, 0, 0.8),
    0 0 18px rgba(109, 247, 255, 0.24);
}

.debug-editor-panel.hidden { display: none; }

.debug-editor-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.debug-editor-header .panel-title {
  color: var(--operator-cyan);
  margin-bottom: 6px;
}

.debug-editor-header span {
  color: #aeeeff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  white-space: nowrap;
}

.debug-editor-toolbar {
  position: static;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 36px;
  margin: 4px 0 10px;
  padding: 7px;
  border: 1px solid var(--operator-cyan-line);
  background: rgba(3, 12, 18, 0.78);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.72);
  color: #f7feff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.debug-editor-toolbar.hidden { display: none; }

.debug-editor-toolbar button {
  min-height: 28px;
  border-color: var(--operator-cyan);
  background: #10263a;
  color: #f7feff;
  font-weight: 800;
}

.debug-editor-toolbar button[aria-pressed="true"] {
  border-color: #f7feff;
  background: #0f3b4a;
  color: #f7feff;
}

.debug-editor-toolbar button:disabled {
  cursor: not-allowed;
  border-color: #394a54;
  background: #111820;
  color: #6d7f89;
}

.debug-editor-box {
  position: fixed;
  z-index: 23;
  pointer-events: none;
  border: 2px solid var(--operator-cyan);
  background: rgba(109, 247, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.88),
    0 0 16px rgba(109, 247, 255, 0.28);
}

.debug-editor-box.hidden { display: none; }

.debug-editor-box::before,
.debug-editor-box::after {
  content: "";
  position: absolute;
  background: #6df7ff;
}

.debug-editor-box::before {
  left: 50%;
  top: -8px;
  width: 1px;
  height: calc(100% + 16px);
}

.debug-editor-box::after {
  left: -8px;
  top: 50%;
  width: calc(100% + 16px);
  height: 1px;
}

.debug-editor-box-label {
  position: absolute;
  left: 0;
  top: -24px;
  padding: 2px 5px;
  background: #061017;
  border: 1px solid var(--operator-cyan);
  color: #f7feff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  white-space: nowrap;
}

.debug-editor-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #061017;
  background: var(--operator-cyan);
  pointer-events: auto;
}

.debug-editor-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.debug-editor-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.debug-editor-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.debug-editor-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.debug-editor-preselect {
  outline: 2px dashed var(--operator-cyan) !important;
  outline-offset: 2px;
}

.debug-editor-grid {
  gap: 6px;
}

.debug-editor-grid > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.debug-editor-grid dd {
  margin: 0;
  color: #f8eed8;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.debug-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.debug-editor-status {
  margin-top: 8px;
  color: #aeeeff;
  font-size: 12px;
  min-height: 16px;
}

.hud-column {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding-right: 3px;
  opacity: 1;
}

.operator-mode-active .hud-column {
  position: relative;
  z-index: 1;
}

.brand {
  color: var(--accent);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.05;
}

.panel-title {
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 7px;
}

.hero-panel {
  padding: 11px 12px;
  background:
    linear-gradient(180deg, rgba(72, 39, 25, 0.72), rgba(22, 14, 10, 0.9)),
    #231713;
}

.hero-panel .menu-copy {
  font-size: 12px;
}

.resource-panel {
  order: 1;
}

.shop-panel {
  order: 2;
}

.house-panel {
  order: 3;
}

.local-actions-panel {
  order: 4;
}

.controls-panel {
  order: 5;
}

.resource-grid,
.house-status {
  display: grid;
  gap: 5px;
}

.resource-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resource-grid > div,
.house-status > div,
.tool-line {
  min-width: 0;
  border: 1px solid rgba(91, 68, 47, 0.72);
  background: rgba(0, 0, 0, 0.18);
  padding: 5px 6px;
}

.resource-grid span,
.house-status span,
.tool-line span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.resource-grid strong,
.house-status strong,
.tool-line strong {
  color: #f3ead5;
  font-size: 12px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-line {
  margin-top: 6px;
}

.tab-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.tab-row button {
  min-height: 30px;
  font-size: 13px;
}

.tab-row button.active {
  border-color: var(--accent);
  background: rgba(240, 197, 110, 0.18);
}

.shop-listings {
  display: grid;
  gap: 7px;
}

.shop-listing {
  min-height: 46px;
  text-align: left;
  padding: 7px;
}

.shop-listing strong,
.shop-listing em {
  display: block;
}

.shop-listing em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.compact-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.menu-copy {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.actions { display: grid; gap: 6px; margin-top: 8px; }
button {
  min-height: 32px;
  border: 2px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
dl { display: grid; gap: 6px; margin: 0; }
dd { margin: 2px 0 0; font-size: 12px; }

.shinobi-button {
  --button-border: #2f1a12;
  --button-highlight: rgba(235, 184, 94, 0.54);
  --button-shadow: #1c0d08;
  position: relative;
  isolation: isolate;
  min-height: 46px;
  border: 3px solid var(--button-border);
  border-radius: 3px;
  padding: 0 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 231, 151, 0.16), rgba(75, 30, 16, 0.1)),
    var(--button-wood-fill) center / 256px 256px repeat;
  color: #160c07;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 224, 141, 0.4);
  box-shadow:
    inset 0 2px 0 var(--button-highlight),
    inset 0 -3px 0 rgba(44, 19, 10, 0.42),
    0 4px 0 var(--button-shadow),
    0 8px 16px rgba(0, 0, 0, 0.3);
}

.shinobi-button::before,
.shinobi-button::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.shinobi-button::before {
  inset: 3px;
  box-shadow: inset 0 0 0 1px rgba(73, 35, 19, 0.28);
}

.shinobi-button::after {
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 241, 171, 0.1), transparent 48%, rgba(39, 15, 8, 0.18));
}

.shinobi-button:hover {
  border-color: #735035;
  filter: saturate(1.08) brightness(1.04);
}

.shinobi-button:active,
.shinobi-button.is-pressed,
.shinobi-button[aria-pressed="true"] {
  transform: translateY(3px);
  background:
    linear-gradient(180deg, rgba(50, 19, 9, 0.34), rgba(231, 170, 82, 0.1)),
    var(--button-wood-fill) center / 256px 256px repeat;
  color: #f7e5b6;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
  box-shadow:
    inset 0 4px 7px rgba(23, 9, 4, 0.62),
    inset 0 -1px 0 rgba(255, 226, 133, 0.22),
    0 1px 0 var(--button-shadow),
    0 5px 10px rgba(0, 0, 0, 0.34);
}

.shinobi-button:disabled,
.shinobi-button.is-disabled,
.shinobi-button[aria-disabled="true"] {
  cursor: not-allowed;
  border-color: #241b16;
  background:
    linear-gradient(180deg, rgba(70, 64, 57, 0.42), rgba(16, 13, 11, 0.28)),
    var(--button-wood-fill) center / 256px 256px repeat;
  color: rgba(225, 215, 194, 0.45);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.58);
  filter: grayscale(0.74) brightness(0.62);
  transform: none;
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.54),
    0 2px 0 #12100d;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 5, 0.72);
  z-index: 20;
}

.overlay.hidden { display: none; }

.operator-only {
  display: none !important;
}

.operator-mode-active .operator-only {
  display: revert !important;
}

.operator-mode-active .stage-topbar.operator-only {
  display: grid !important;
}

.operator-mode-active button.operator-only,
.operator-mode-active .operator-only button {
  border-color: var(--operator-cyan);
  background:
    linear-gradient(180deg, rgba(24, 70, 84, 0.72), rgba(5, 19, 26, 0.92)),
    #07151d;
  color: #f7feff;
  box-shadow:
    inset 0 0 0 1px rgba(174, 238, 255, 0.12),
    0 0 12px rgba(109, 247, 255, 0.14);
}

.operator-mode-active .operator-only dt,
.operator-mode-active .operator-only .label,
.operator-mode-active .operator-only span {
  color: #9beeff;
}

.operator-mode-active .operator-only dd,
.operator-mode-active .operator-only strong {
  color: #f7feff;
}

.startup-overlay,
.setup-screen {
  background-color: #090604;
  background-image:
    linear-gradient(rgba(9, 6, 4, 0.3), rgba(9, 6, 4, 0.3)),
    url("/assets/shinobi/images/shuriken-menu-pattern.png");
  background-position: center, center;
  background-repeat: no-repeat, repeat;
  background-size: cover, clamp(192px, 24vmin, 320px) clamp(192px, 24vmin, 320px);
}

.menu-card {
  width: min(600px, calc(100vw - 28px));
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.pause-card {
  width: min(440px, calc(100vw - 28px));
}

.pause-card .actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.startup-card {
  width: min(760px, calc(100vw - 28px));
  backdrop-filter: blur(2px);
}

.loading-card {
  border-color: #7e6a4a;
}

.loading-portrait {
  width: 100%;
  max-height: min(58vh, 430px);
  object-fit: cover;
  border: 2px solid var(--line);
  image-rendering: auto;
}

.menu-flow {
  width: min(1120px, calc(100vw - 24px));
  min-height: min(720px, calc(100vh - 24px));
  position: relative;
  display: grid;
  place-items: center;
}

.menu-screen {
  position: absolute;
  inset: 0;
  display: none;
}

.menu-screen.active {
  display: grid;
  place-items: center;
}

.main-menu-board {
  width: min(1120px, calc(100vw - 24px), calc((100vh - 24px) * 1379 / 752));
  aspect-ratio: 1379 / 752;
  position: relative;
  background: url("/assets/shinobi/images/mainmenu.png") center / contain no-repeat;
  image-rendering: auto;
}

.main-menu-title-logo {
  position: absolute;
  left: 50%;
  top: 3.2%;
  z-index: 2;
  margin: 0;
  transform: translate(-50%, -34%) rotate(-1deg);
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(8px, 1.15vw, 18px);
  min-width: 52%;
  padding: clamp(2px, 0.25vw, 4px) clamp(18px, 3vw, 36px) clamp(8px, 1vw, 12px);
  pointer-events: none;
  color: #fff0a8;
  font-family: "Copperplate Gothic Bold", Copperplate, "Arial Black", Impact, sans-serif;
  font-size: clamp(30px, 5.25vw, 74px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.9;
  text-align: center;
  text-transform: uppercase;
  text-shadow:
    0 0 2px #fff2b8,
    0 3px 0 #2c120d,
    0 5px 0 #6c2b19,
    0 8px 12px rgba(0, 0, 0, 0.72);
  filter: drop-shadow(0 2px 0 rgba(255, 230, 140, 0.28));
}

.main-menu-title-logo::before,
.main-menu-title-logo::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: clamp(5px, 0.9vw, 12px);
  background: linear-gradient(90deg, transparent 0%, #5b140e 8%, #bb3822 50%, #6b160e 92%, transparent 100%);
  box-shadow: 0 2px 0 #2a0d08, 0 4px 10px rgba(0, 0, 0, 0.58);
  transform: skewX(-18deg);
  z-index: -1;
}

.main-menu-title-logo::after {
  left: 19%;
  right: 17%;
  bottom: clamp(3px, 0.55vw, 7px);
  height: clamp(2px, 0.35vw, 5px);
  background: linear-gradient(90deg, transparent 0%, #ffd182 18%, #ffe8a8 48%, #c25a30 78%, transparent 100%);
  opacity: 0.86;
}

.main-menu-logo-kunai-art {
  position: absolute;
  left: 50%;
  top: 116%;
  width: clamp(320px, 35vw, 500px);
  aspect-ratio: 1100 / 679;
  transform: translate(-50%, -50%);
  background: url("/assets/shinobi/images/title-kunai-clash.png") center / contain no-repeat;
  z-index: 0;
  filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.82));
}

.main-menu-title-shinobi,
.main-menu-title-clash {
  position: relative;
  z-index: 1;
  display: inline-block;
  -webkit-text-stroke: clamp(1px, 0.22vw, 3px) #150905;
}

.main-menu-title-shinobi {
  color: #fff0ad;
  text-shadow:
    0 0 5px rgba(255, 242, 176, 0.62),
    0 3px 0 #2c120d,
    0 5px 0 #7f3619,
    0 8px 12px rgba(0, 0, 0, 0.72);
}

.main-menu-title-clash {
  color: #ffcf58;
  transform: translate(-0.1em, 0.2em) skewX(-8deg);
  text-shadow:
    0 0 6px rgba(255, 232, 128, 0.66),
    0 3px 0 #250b08,
    0 5px 0 #a93615,
    0 8px 12px rgba(0, 0, 0, 0.72);
}

.main-menu-actions {
  position: absolute;
  left: 30.8%;
  top: 87.4%;
  width: 38.4%;
  height: 8.8%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 14px);
  align-content: center;
  padding: clamp(3px, 0.55vw, 7px);
}

.main-menu-actions .shinobi-button {
  min-height: 0;
  height: 100%;
  padding: 0 clamp(8px, 1.15vw, 15px);
  font-size: clamp(10px, 1.22vw, 15px);
  white-space: nowrap;
}

.setup-panel {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  border: 2px solid var(--line);
  background:
    linear-gradient(180deg, rgba(28, 24, 22, 0.94), rgba(16, 13, 12, 0.96)),
    var(--panel);
  box-shadow: inset 0 0 0 1px rgba(5, 6, 8, 0.82), 0 16px 44px rgba(0, 0, 0, 0.54);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.setup-panel.wide {
  width: min(930px, calc(100vw - 28px));
}

.setup-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.setup-heading-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.setup-heading-actions > button {
  min-height: 40px;
}

.setup-heading h2,
.setup-panel h2,
.choice-detail h3 {
  margin: 0;
  color: var(--accent);
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.menu-progress {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.menu-progress span {
  width: 42px;
  height: 5px;
  background: rgba(247, 224, 160, 0.28);
  border: 1px solid rgba(247, 224, 160, 0.35);
}

.menu-progress span.active {
  background: var(--accent);
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.clan-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.boss-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.terrain-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-button {
  min-height: 74px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.choice-button.selected {
  border-color: var(--accent);
  background: rgba(240, 197, 110, 0.14);
}

.choice-button img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line);
  image-rendering: pixelated;
}

.boss-choice-grid .choice-button,
.terrain-choice-grid .choice-button {
  grid-template-columns: 1fr;
}

.choice-button strong,
.choice-button span {
  display: block;
}

.choice-button span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.character-setup-panel {
  width: min(1060px, calc(100vw - 28px));
  gap: 10px;
}

.character-setup-grid {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(360px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.character-choice-column,
.character-review-column {
  min-width: 0;
}

.character-choice-column {
  display: grid;
  gap: 12px;
}

.character-review-column {
  display: grid;
  gap: 12px;
}

.character-summary {
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
}

.character-summary img {
  width: 96px;
  height: 96px;
}

.customize-inline-panel {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 2px solid rgba(240, 197, 110, 0.28);
  background: rgba(0, 0, 0, 0.18);
  padding: 10px;
}

.loadout-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.loadout-summary span {
  min-width: 0;
  border: 1px solid rgba(91, 68, 47, 0.72);
  background: rgba(0, 0, 0, 0.2);
  color: #e8dcc0;
  font-size: 11px;
  line-height: 1.12;
  padding: 5px;
}

.loadout-summary strong {
  color: var(--accent);
  font-size: 10px;
  margin: 0 0 3px;
  text-transform: uppercase;
}

.debug-mission-options {
  display: none;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  border: 2px solid var(--operator-cyan-line);
  background:
    linear-gradient(180deg, rgba(6, 31, 42, 0.72), rgba(2, 10, 15, 0.82)),
    #061017;
  box-shadow:
    inset 0 0 0 1px rgba(174, 238, 255, 0.12),
    0 0 14px rgba(109, 247, 255, 0.12);
  padding: 8px;
}

.debug-mission-options .choice-grid {
  gap: 6px;
}

.debug-mission-options .choice-button {
  min-height: 38px;
  padding: 6px;
  border-color: rgba(109, 247, 255, 0.48);
  background: rgba(3, 18, 26, 0.82);
  color: #f7feff;
}

.debug-mission-options .choice-button span,
.debug-mission-options .menu-copy {
  font-size: 10px;
  line-height: 1.15;
}

.debug-mission-options .choice-detail {
  margin-top: 6px;
  padding: 6px;
}

.debug-mission-options h3 {
  font-size: 14px;
  color: var(--operator-cyan);
}

.debug-mode-active .debug-mission-options {
  display: grid;
}

.start-adventure-button {
  width: clamp(160px, 18vw, 230px);
  justify-self: end;
}

.choice-detail {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 2px solid rgba(240, 197, 110, 0.38);
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
}

.choice-detail.compact {
  grid-template-columns: 1fr;
}

.choice-detail img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border: 2px solid var(--line);
  image-rendering: pixelated;
}

.stat-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.stat-chip-row span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 7px;
  font-size: 12px;
}

.passive-copy {
  margin-top: 10px;
  color: #e8dcc0;
  font-size: 13px;
}

.customize-preview {
  width: 96px;
  height: 96px;
  justify-self: center;
  border: 2px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  image-rendering: pixelated;
}

.color-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.color-control {
  display: grid;
  gap: 7px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid #1f1a16;
  padding: 0;
}

.color-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 197, 110, 0.25);
}

.menu-card h2 {
  margin: 0;
  color: var(--accent);
  font-size: 24px;
}

.party-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.party-slot-card {
  min-height: 56px;
  border: 2px solid var(--line);
  padding: 10px;
  display: grid;
  align-content: center;
  background: rgba(255, 255, 255, 0.03);
}

.go-banner {
  position: absolute;
  right: 336px;
  bottom: 16px;
  z-index: 18;
  border: 2px solid #f9e07b;
  background: rgba(25, 18, 10, 0.92);
  color: #f9e07b;
  padding: 10px 14px;
  font-size: 21px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(249, 224, 123, 0.45);
}

.go-banner.hidden { display: none; }

.portrait-hud {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 218px;
  height: 92px;
  z-index: 12;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  overflow: hidden;
  padding: 8px;
  pointer-events: none;
  background: rgba(29, 24, 20, 0.9);
}

.portrait-hud .stat-row {
  display: none;
}

.portrait-head {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 0;
}

.portrait-head img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 2px solid var(--line);
  image-rendering: pixelated;
}

.portrait-title {
  width: 100%;
  min-width: 0;
}

.portrait-name {
  color: #efe4cc;
  font-size: 13px;
  line-height: 1.1;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portrait-sub {
  display: none;
}

.portrait-level {
  display: none;
}

.portrait-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
}

.portrait-info-grid > div {
  min-width: 0;
  border: 1px solid rgba(91, 68, 47, 0.7);
  background: rgba(0, 0, 0, 0.22);
  padding: 4px 5px;
}

.portrait-info-grid span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  text-transform: uppercase;
}

.portrait-info-grid strong {
  color: #f3e7ca;
  font-size: 12px;
  line-height: 1.05;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-row { display: grid; gap: 4px; }

.stat-label-line {
  display: flex;
  justify-content: space-between;
  color: #e7d8b6;
  font-size: 14px;
}

.bar-track {
  border: 2px solid #1f1a16;
  background: #0f0e0d;
  height: 18px;
  padding: 2px;
}

.bar-fill {
  height: 100%;
  width: 100%;
}

.bar-track.hp .bar-fill {
  background: linear-gradient(90deg, #6a1d1a, #b8473f);
}

.bar-track.mp .bar-fill {
  background: linear-gradient(90deg, #1f3259, #3a73bc);
}

@media (max-width: 960px) {
  body { overflow: auto; }
  .app-shell {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #game { height: 66vh; }
  .hud-column {
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-panel,
  .local-actions-panel,
  .controls-panel {
    grid-column: 1 / -1;
  }
  .stage-topbar {
    width: min(360px, calc(100% - 20px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .go-banner { right: 18px; bottom: 18px; }
  .main-menu-actions {
    left: 28%;
    top: 86.6%;
    width: 44%;
  }
  .clan-choice-grid,
  .boss-choice-grid,
  .terrain-choice-grid {
    grid-template-columns: 1fr;
  }
  .character-setup-grid,
  .debug-mission-options {
    grid-template-columns: 1fr;
  }
  .choice-detail {
    grid-template-columns: 1fr;
  }
  .choice-detail img {
    width: 120px;
    height: 120px;
  }
  .customize-inline-panel {
    grid-template-columns: 1fr;
  }
  .start-adventure-button {
    width: auto;
  }
}

@media (max-width: 620px) {
  .debug-editor-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-height: min(58vh, 460px);
    transform: none;
  }
  .hud-column {
    grid-template-columns: 1fr;
  }
  .stage-topbar {
    left: 10px;
    right: 10px;
    width: auto;
  }
  .main-menu-actions {
    gap: 5px;
    padding: 4px;
  }
  .main-menu-actions .shinobi-button {
    font-size: 11px;
    box-shadow: inset 0 0 0 1px rgba(255, 245, 190, 0.18), 0 2px 0 #5a2b16;
  }
  .menu-progress {
    display: none;
  }
  .loadout-summary {
    grid-template-columns: 1fr;
  }
  .setup-heading,
  .setup-heading-actions {
    display: grid;
  }
  .setup-heading-actions {
    grid-template-columns: 1fr;
  }
  .color-control-grid {
    grid-template-columns: 1fr;
  }
}
