:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090c12;
  color: #f6f2e9;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img, svg {
  -webkit-user-drag: none;
  user-drag: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(182, 73, 39, 0.22), transparent 34rem),
    linear-gradient(180deg, #111827 0%, #090c12 72%);
}

.mobile-gate { display: none; }

html.mobile-viewport,
html.mobile-viewport body {
  min-height: 100%;
  overflow: auto;
}

html.mobile-viewport body {
  background: #030912;
}

html.mobile-viewport body > main { display: none; }

html.mobile-viewport .mobile-gate {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: clamp(22px, 6vw, 48px) 18px;
  background:
    linear-gradient(180deg, rgba(2, 7, 15, .32), rgba(2, 7, 15, .94)),
    url("assets/village/aldea.webp?v=0.20.0") center / cover no-repeat;
}

.mobile-gate::before,
.mobile-gate::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(104, 202, 255, .16);
  border-radius: 50%;
  pointer-events: none;
}

.mobile-gate::before { width: 76vw; aspect-ratio: 1; top: -35vw; right: -30vw; }
.mobile-gate::after { width: 90vw; aspect-ratio: 1; bottom: -52vw; left: -38vw; }

.mobile-gate-glow {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(70, 190, 255, .2), transparent 32%),
    radial-gradient(circle at 12% 92%, rgba(240, 140, 62, .16), transparent 34%);
  pointer-events: none;
}

.mobile-gate-card {
  width: min(100%, 480px);
  border: 1px solid rgba(105, 198, 245, .48);
  border-radius: 22px;
  padding: clamp(28px, 8vw, 48px) clamp(22px, 7vw, 42px);
  background: linear-gradient(155deg, rgba(8, 24, 42, .96), rgba(3, 10, 20, .96));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .62), inset 0 0 0 1px rgba(255, 255, 255, .035);
  text-align: center;
}

.mobile-gate-emblem {
  display: grid;
  width: 92px;
  height: 92px;
  margin: 0 auto 22px;
  place-items: center;
  border: 1px solid rgba(240, 174, 87, .62);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 145, 61, .18), rgba(6, 19, 34, .92) 68%);
  box-shadow: 0 0 38px rgba(73, 191, 245, .16);
}

.mobile-gate-emblem img { width: 62px; height: 62px; object-fit: contain; }
.mobile-gate-kicker { margin: 0 0 9px; color: #74d4ff; font-size: .66rem; font-weight: 900; letter-spacing: .22em; }
.mobile-gate-card h1 { margin: 0; color: #f8f1e5; font-family: Cinzel, Georgia, serif; font-size: clamp(1.7rem, 8vw, 2.6rem); line-height: 1.08; }
.mobile-gate-card h1 span { color: #f0a957; }
.mobile-gate-card > p:not(.mobile-gate-kicker) { margin: 20px auto 0; color: #b9c9d8; font-size: clamp(.92rem, 3.8vw, 1.08rem); line-height: 1.55; }
.mobile-gate-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 26px 0 17px; color: #f0a957; }
.mobile-gate-divider span { height: 1px; background: linear-gradient(90deg, transparent, rgba(112, 207, 250, .52)); }
.mobile-gate-divider span:last-child { transform: scaleX(-1); }
.mobile-gate-divider b { font-size: .7rem; }
.mobile-gate-card small { color: #7f98aa; font-size: .58rem; font-weight: 850; letter-spacing: .16em; }

main {
  position: relative;
  width: min(100% - 24px, 1060px);
  margin: 0 auto;
  padding: 12px 0 40px;
}

.game-heading {
  position: absolute;
  z-index: 120;
  top: 18px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}
.game-brand { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.game-settings { position: relative; }
.game-settings summary {
  width: 96px;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(8,12,20,.86);
  box-shadow: 0 8px 28px rgba(0,0,0,.38);
  color: #f8ead8;
  font-size: .76rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
  backdrop-filter: blur(10px);
}
.game-settings summary::-webkit-details-marker { display: none; }
.game-settings summary:hover, .game-settings[open] summary { border-color: #f5a357; background: #171d29; }
.game-settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(390px, calc(100vw - 30px));
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 13px;
  padding: 13px;
  background: rgba(8,12,20,.96);
  box-shadow: 0 22px 65px rgba(0,0,0,.62);
  backdrop-filter: blur(14px);
}

h1 { margin: 0; font-size: clamp(1.55rem, 4vw, 2.4rem); font-weight: 700; letter-spacing: -0.035em; }
h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.9rem); }
h3 { display: flex; justify-content: space-between; gap: 10px; margin: 24px 0 10px; font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.08em; }
h3 span { color: #f5a357; }
.eyebrow { margin: 0 0 4px; color: #ff9e52; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; }
.hint { max-width: 410px; margin: 0; color: #aeb6c6; font-size: 0.9rem; text-align: right; }

.game-options { display: grid; gap: 8px; }
.option-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  background: rgba(11,16,24,0.72);
  color: #f6f2e9;
  font-size: 0.84rem;
  font-weight: 650;
  user-select: none;
}
.mode-switch input { width: 17px; height: 17px; accent-color: #f5a357; }
.volume-control, .theme-control {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  padding: 7px 11px;
  color: #dfe5ef;
  font-size: 0.78rem;
}
.volume-control input { width: 150px; accent-color: #f5a357; }
.theme-control select {
  min-width: 170px;
  border: 1px solid rgba(245, 163, 87, .45);
  border-radius: 7px;
  padding: 6px 9px;
  background: #111925;
  color: #f6f2e9;
  font: inherit;
}
.game-settings .hint { max-width: none; margin: 0; font-size: .7rem; text-align: left; }

#game {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: #111827;
  box-shadow: 0 20px 70px rgba(0,0,0,0.42);
}

#game canvas { display: block; width: 100% !important; height: auto !important; image-rendering: auto; }

.mission-investigation-overlay {
  position: absolute;
  z-index: 120;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #06101e;
  isolation: isolate;
  animation: mission-investigation-enter .24s ease both;
}
.mission-investigation-overlay.leaving { animation: mission-investigation-leave .22s ease both; pointer-events: none; }
.mission-investigation-background,
.mission-investigation-shade,
.mission-investigation-hotspots { position: absolute; inset: 0; width: 100%; height: 100%; }
.mission-investigation-background { z-index: -3; object-fit: fill; }
.mission-investigation-shade { z-index: -2; background: linear-gradient(180deg, rgba(2,9,20,.25), rgba(2,9,20,.03) 48%, rgba(2,9,20,.25)); pointer-events: none; }
.mission-investigation-header {
  position: absolute;
  z-index: 5;
  top: 3.5%;
  left: 50%;
  display: grid;
  width: min(64%, 780px);
  justify-items: center;
  border: 1px solid rgba(85,201,255,.78);
  border-left: 5px solid #3fcaff;
  border-radius: 6px;
  padding: 12px 20px 14px;
  background: rgba(3,18,32,.94);
  box-shadow: 0 18px 55px rgba(0,0,0,.5);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.mission-investigation-header p { margin: 0; color: #83d8ff; font: 800 clamp(.72rem, 1.3vw, 1rem) Cinzel, Georgia, serif; letter-spacing: .08em; }
.mission-investigation-header h2 { margin: 3px 0 5px; color: #f7f0e5; font-size: clamp(.82rem, 1.35vw, 1.08rem); }
.mission-investigation-header strong { color: #f0b85c; font-size: clamp(.65rem, 1vw, .82rem); }
.mission-investigation-hotspots { z-index: 2; overflow: visible; pointer-events: none; }
.mission-investigation-region { cursor: pointer; outline: none; }
.mission-investigation-region path {
  fill: rgba(255,158,82,0);
  stroke: rgba(255,199,130,0);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  transition: fill .14s ease, stroke .14s ease, stroke-width .14s ease, filter .14s ease;
}
.mission-investigation-region:hover path,
.mission-investigation-region:focus-visible path {
  fill: rgba(255,142,55,.2);
  stroke: #ffd59a;
  stroke-width: 4;
  filter: drop-shadow(0 0 5px rgba(255,191,112,.75));
}
.mission-investigation-region.found path,
.mission-investigation-region.found:hover path,
.mission-investigation-region.found:focus-visible path { fill: rgba(54,211,155,.15); stroke: #79e8b5; stroke-width: 4; }
.mission-investigation-region.discarded path,
.mission-investigation-region.discarded:hover path,
.mission-investigation-region.discarded:focus-visible path { fill: rgba(125,144,158,.08); stroke: rgba(174,189,202,.66); stroke-width: 3; filter: none; }
.mission-investigation-label {
  position: absolute;
  z-index: 4;
  top: var(--label-y);
  left: var(--label-x);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .14s ease, transform .14s ease;
}
.mission-investigation-label.visible { opacity: 1; transform: translate(-50%, 0); }
.mission-investigation-label strong { display: block; border: 1px solid rgba(255,190,112,.82); border-radius: 5px; padding: 6px 10px; background: rgba(3,12,22,.94); color: #fff2db; font: 800 clamp(.55rem, .9vw, .72rem) Cinzel, Georgia, serif; white-space: nowrap; box-shadow: 0 7px 22px rgba(0,0,0,.58); }
.mission-investigation-log {
  position: absolute;
  z-index: 5;
  bottom: 8.2%;
  left: 50%;
  width: min(55%, 650px);
  margin: 0;
  border: 1px solid rgba(85,201,255,.48);
  border-radius: 5px;
  padding: 9px 15px;
  background: rgba(3,18,32,.92);
  color: #eaf4fb;
  font-size: clamp(.66rem, 1vw, .84rem);
  font-weight: 750;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.mission-investigation-master { position: absolute; z-index: 3; right: -1%; bottom: -1%; width: 18%; height: 52%; object-fit: contain; object-position: center bottom; pointer-events: none; filter: drop-shadow(0 12px 18px rgba(0,0,0,.7)); }
.mission-investigation-continue {
  position: absolute;
  z-index: 6;
  bottom: 2.4%;
  left: 50%;
  min-width: 210px;
  border: 1px solid #55c9ff;
  border-radius: 4px;
  padding: 9px 20px;
  background: linear-gradient(180deg, #164d70, #073653);
  color: #f4f8fb;
  font: 800 clamp(.65rem, 1vw, .8rem) Cinzel, Georgia, serif;
  letter-spacing: .05em;
  transform: translateX(-50%);
  cursor: pointer;
}
.mission-investigation-continue:disabled { border-color: rgba(85,201,255,.28); background: rgba(3,30,46,.68); color: #718494; cursor: not-allowed; }
.mission-investigation-continue:not(:disabled):hover,
.mission-investigation-continue:not(:disabled):focus-visible { outline: none; border-color: #9fe7ff; box-shadow: 0 0 18px rgba(63,202,255,.34); }
@keyframes mission-investigation-enter { from { opacity: 0; transform: scale(1.015); } }
@keyframes mission-investigation-leave { to { opacity: 0; transform: scale(.992); } }

@media (max-width: 650px) {
  .mission-investigation-header { top: 2%; width: 78%; padding: 7px 12px 8px; }
  .mission-investigation-header h2 { margin-block: 1px 2px; }
  .mission-investigation-log { bottom: 9%; width: 66%; padding: 6px 9px; }
  .mission-investigation-master { right: -3%; width: 21%; height: 45%; }
  .mission-investigation-continue { bottom: 2%; min-width: 170px; padding-block: 6px; }
}

#meta[hidden], #game[hidden] { display: none; }
.dojo-layout { display: grid; grid-template-columns: minmax(340px, .88fr) minmax(0, 1.32fr); gap: 14px; }
.dojo-card {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 22px;
  background: linear-gradient(145deg, rgba(26,35,52,0.98), rgba(10,15,23,0.98));
  box-shadow: 0 20px 70px rgba(0,0,0,0.3);
}
.creator-card { width: min(100%, 660px); margin: 40px auto; padding: clamp(24px, 5vw, 48px); }
.lead { color: #aeb6c6; line-height: 1.55; }
.creator-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 26px; }
.creator-form label:first-child, .creator-form .primary-button { grid-column: 1 / -1; }
.affinity-picker { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 0; border: 0; padding: 0; }
.affinity-picker legend { margin-bottom: 8px; color: #cbd3e0; font-size: .78rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.affinity-choice { position: relative; display: flex !important; grid-column: auto !important; align-items: center; gap: 8px !important; border: 1px solid #303d50; border-radius: 10px; padding: 8px; background: #111925; cursor: pointer; }
.affinity-choice:has(input:checked) { border-color: #f5a357; background: #24202a; box-shadow: inset 0 0 0 1px rgba(245,163,87,.2); }
.affinity-choice input { position: absolute; opacity: 0; pointer-events: none; }
.affinity-choice img { width: 42px; height: 42px; object-fit: contain; }
.affinity-choice span { display: grid; gap: 2px; }
.affinity-choice small { color: #8492a6; font-size: .61rem; letter-spacing: 0; text-transform: none; }
.creator-form label, .equipment-grid label, .cosmetic-grid label { display: grid; gap: 7px; color: #cbd3e0; font-size: 0.78rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; }
input, select, button { font: inherit; }
.creator-form input, .creator-form select, .equipment-grid select, .cosmetic-grid select {
  min-width: 0;
  border: 1px solid #3b4658;
  border-radius: 8px;
  padding: 11px 12px;
  background: #101722;
  color: #f6f2e9;
}
.creator-form input[type="color"] { width: 100%; height: 43px; padding: 4px; }
.primary-button {
  border: 0;
  border-radius: 9px;
  padding: 13px 18px;
  background-color: #131a26;
  background-image: url("assets/ui/nav-button-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  color: #ffe1a8;
  text-shadow: 0 2px 3px #000;
  font-weight: 850;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.primary-button:disabled { opacity: 0.4; cursor: not-allowed; }
.profile-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.profile-heading { justify-content: flex-start; }
.avatar-swatch { width: 56px; height: 56px; border-radius: 50%; background: var(--avatar); border: 4px solid #28354a; box-shadow: inset 0 -12px rgba(0,0,0,0.2); }
.affinity-label { color: #f6c080; font-weight: 700; }
.progress-track { height: 8px; overflow: hidden; border-radius: 10px; background: #080c12; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, #f17b45, #f5bd64); }
.compact { color: #aeb6c6; font-size: 0.82rem; }
.attribute-list { display: grid; gap: 7px; }
.attribute-list button { display: flex; align-items: center; justify-content: space-between; border: 1px solid #344154; border-radius: 8px; padding: 9px 11px; background: #151e2b; color: #f4f7fb; font-weight: 700; cursor: pointer; }
.attribute-list button:disabled { cursor: default; opacity: 0.58; }
.attribute-list small { color: #9eabba; font-weight: 500; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 18px; }
.stat-grid span { padding: 10px 4px; border-radius: 7px; background: rgba(255,255,255,0.055); color: #fff; font-size: 1.05rem; font-weight: 800; text-align: center; }
.stat-grid small { display: block; color: #8e9bad; font-size: 0.58rem; letter-spacing: 0.1em; }
.section-heading > strong { color: #f5a357; font-size: 0.8rem; }
.customizer { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 14px; }
.character-preview { position: relative; width: 180px; aspect-ratio: 1; overflow: hidden; border: 1px solid #344154; border-radius: 12px; background: radial-gradient(circle at 50% 38%, #2a3548, #101722 72%); }
.character-preview svg { display: block; width: 100%; height: 100%; }
.cosmetic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 20px; }
.dojo-heading { margin-bottom: 14px; }
.dojo-section { margin-top: 10px; border: 1px solid rgba(89,113,146,.42); border-radius: 12px; padding: 12px; background: rgba(5,11,19,.6); }
.dojo-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dojo-section-heading h3 { margin: 0 0 3px; color: #f3c080; }
.dojo-section-heading p, .skill-tree-heading p { margin: 0; color: #7f8da1; font-size: .65rem; }
.dojo-section-heading > span { border: 1px solid rgba(245,163,87,.35); border-radius: 99px; padding: 4px 8px; color: #f5b978; font-size: .61rem; font-weight: 850; text-transform: uppercase; }
.equipment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.gear-slot { position: relative; display: grid !important; min-width: 0; aspect-ratio: 1; align-content: center; justify-items: center; gap: 7px !important; border: 0; border-radius: 12px; padding: 22% 18% 18% !important; background-color: #101824; background-image: url("assets/ui/equipment-slot-frame.webp?v=0.20.0"); background-position: center; background-size: 100% 100%; color: #e9eef5; text-align: center; cursor: pointer; filter: drop-shadow(0 7px 9px rgba(0,0,0,.34)); transition: filter .16s ease, transform .16s ease; }
.gear-slot:hover:not(:disabled), .gear-slot:focus-visible { outline: none; filter: drop-shadow(0 0 7px rgba(245,163,87,.5)); transform: translateY(-2px); }
.gear-slot.empty { color: #aab5c5; }
.gear-slot.locked { cursor: not-allowed; opacity: .48; }
.gear-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(245,163,87,.32); border-radius: 10px; background: rgba(245,163,87,.08); color: #f5b36f; font-size: 1.15rem; }
.gear-copy { display: grid; min-width: 0; width: 100%; gap: 3px; }
.gear-copy small { color: #8290a4; font-size: .56rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.gear-copy strong { overflow: hidden; color: #dce4ee; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.gear-copy em { color: #707f93; font-size: .56rem; font-style: normal; }
.gear-action { position: absolute; top: 7px; right: 8px; color: #6d7c91; font-size: .8rem; font-weight: 900; }
.equipment-modal { position: absolute; z-index: 80; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(3,7,13,.8); backdrop-filter: blur(6px); }
.equipment-modal[hidden] { display: none; }
.equipment-modal-card { width: min(520px, 100%); max-height: min(620px, calc(100% - 30px)); overflow: auto; border: 1px solid rgba(245,163,87,.42); border-radius: 16px; padding: 18px; background: linear-gradient(145deg, #151e2d, #080e17); box-shadow: 0 28px 90px rgba(0,0,0,.72); }
.equipment-modal-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.equipment-modal-heading button { border: 1px solid #3b485c; border-radius: 50%; width: 34px; height: 34px; background: #111a27; color: #cad3df; font-size: 1.2rem; cursor: pointer; }
.equipment-modal-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.equipment-option { position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 76px; border: 1px solid #34445a; border-radius: 11px; padding: 10px; background: #0e1724; color: #e9eef5; text-align: left; cursor: pointer; }
.equipment-option:hover, .equipment-option.selected { border-color: #f5a357; background: rgba(245,163,87,.09); }
.equipment-option > span:nth-child(2) { display: grid; gap: 3px; }
.equipment-option strong { font-size: .75rem; }
.equipment-option small { color: #8290a4; font-size: .6rem; }
.equipment-option em { position: absolute; top: 6px; right: 7px; color: #f5a357; font-size: .48rem; font-style: normal; font-weight: 900; text-transform: uppercase; }
.jutsu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.jutsu-card { position: relative; display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 5px 8px; border: 1px solid #303d50; border-radius: 8px; padding: 10px; background: #111925; cursor: pointer; }
.jutsu-card.selected { border-color: #f5a357; background: #23202a; }
.jutsu-card.locked { opacity: 0.42; cursor: not-allowed; }
.jutsu-card input { accent-color: #f5a357; }
.jutsu-card strong { font-size: 0.84rem; }
.jutsu-card small { grid-column: 3; color: #9eabba; font-size: 0.67rem; }
.element-icon { width: 34px; height: 34px; object-fit: contain; }
.affinity-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.affinity-slot { position: relative; display: grid; grid-template-columns: 24px 36px minmax(0, 1fr); align-items: center; gap: 6px; min-height: 57px; border: 1px solid #303d50; border-radius: 9px; padding: 7px; background: #111925; color: #dfe7f2; text-align: left; }
.affinity-slot.selected { border-color: #67e8c3; background: linear-gradient(145deg, rgba(36,87,79,.42), rgba(12,27,34,.9)); }
.affinity-slot.empty { grid-template-columns: 24px minmax(0, 1fr) auto; border-style: dashed; }
.affinity-slot.locked { grid-template-columns: 24px minmax(0, 1fr) auto; opacity: .52; cursor: not-allowed; }
.affinity-slot img { width: 36px; height: 36px; object-fit: contain; }
.affinity-slot span { display: grid; min-width: 0; }
.affinity-slot strong { overflow: hidden; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.affinity-slot small { color: #8e9daf; font-size: .54rem; line-height: 1.25; }
.slot-index { display: grid !important; width: 20px; height: 20px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.08); color: #8795a8; font-size: .57rem; font-weight: 900; }
.slot-edit { color: #74cfba; font-size: .5rem; font-weight: 850; text-transform: uppercase; }
.slot-add { color: #67e8c3; font-size: 1.1rem; }
.slot-lock { color: #718096; font-size: .9rem; }
.affinity-change-note { margin: 8px 1px 0; color: #77869a; font-size: .56rem; line-height: 1.4; }
.affinity-slot-choices { display: flex !important; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.affinity-slot-choices button { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(94,205,255,.42); border-radius: 5px; padding: 5px 7px; background: rgba(8,42,62,.72); color: #dff5ff; font-size: .58rem; font-weight: 800; cursor: pointer; }
.affinity-slot-choices button:hover { border-color: #75dcff; background: rgba(15,75,103,.8); }
.affinity-slot-choices img { width: 18px; height: 18px; object-fit: contain; }
.affinity-selector { margin-top: 9px; border: 1px solid rgba(103,232,195,.3); border-radius: 10px; padding: 10px; background: #09121d; }
.affinity-selector[hidden] { display: none; }
.affinity-selector > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.affinity-selector > div:first-child strong { color: #e9eef5; font-size: .72rem; }
.affinity-selector > div:first-child small { color: #748297; font-size: .58rem; }
.affinity-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.affinity-option { display: flex; align-items: center; gap: 6px; border: 1px solid #314158; border-radius: 8px; padding: 6px; background: #111b29; color: #dfe7f2; text-align: left; cursor: pointer; }
.affinity-option:hover:not(:disabled) { border-color: #67e8c3; }
.affinity-option:disabled { opacity: .42; cursor: not-allowed; }
.affinity-option img { width: 30px; height: 30px; object-fit: contain; }
.affinity-option span { display: grid; min-width: 0; }
.affinity-option strong { font-size: .62rem; }
.affinity-option small { color: #8391a4; font-size: .5rem; }
.affinity-close { margin-top: 7px; border: 0; padding: 4px 0; background: transparent; color: #8f9db0; font-size: .58rem; cursor: pointer; }
.skill-tree { margin: 10px 0; border: 1px solid #34455c; border-radius: 12px; padding: 12px; background: radial-gradient(circle at 50% 0, rgba(59,112,169,.16), transparent 48%), rgba(6,11,19,.72); }
.skill-tree-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.skill-tree-heading h3 { margin: 0 0 3px; color: #f3c080; }
.tree-legend { display: flex; align-items: center; gap: 5px; color: #75849a; font-size: .52rem; white-space: nowrap; }
.tree-legend i { width: 7px; height: 7px; border-radius: 50%; background: #67e8c3; }
.tree-legend i:nth-of-type(2) { margin-left: 4px; background: #4a5668; }
.skill-branches { display: grid; gap: 9px; }
.technique-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.technique-slot { position: relative; display: grid; min-width: 0; min-height: 48px; align-content: center; gap: 2px; border: 1px solid rgba(103,232,195,.3); border-radius: 8px; padding: 6px 6px 6px 28px; background: rgba(18,34,43,.68); }
.technique-slot > span { position: absolute; top: 7px; left: 7px; display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: rgba(103,232,195,.13); color: #67e8c3; font-size: .48rem; font-weight: 900; }
.technique-slot strong { overflow: hidden; color: #dce5ee; font-size: .57rem; text-overflow: ellipsis; white-space: nowrap; }
.technique-slot small { color: #748297; font-size: .47rem; }
.technique-slot.locked { border-style: dashed; border-color: #3d4858; opacity: .52; }
.technique-slot.locked > span { background: rgba(255,255,255,.06); color: #8390a2; }
.skill-branch { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: stretch; gap: 7px; }
.skill-branch > header { display: flex; align-items: center; gap: 6px; border: 1px solid color-mix(in srgb, var(--branch-color) 56%, transparent); border-radius: 9px; padding: 7px; background: color-mix(in srgb, var(--branch-color) 10%, #0b1420); }
.skill-branch > header img { width: 34px; height: 34px; object-fit: contain; }
.skill-branch > header span { display: grid; min-width: 0; }
.skill-branch > header strong { font-size: .66rem; }
.skill-branch > header small { overflow: hidden; color: #8492a6; font-size: .48rem; text-overflow: ellipsis; white-space: nowrap; }
.skill-path { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 13px; overflow: visible; padding: 1px 2px 5px; }
.skill-node { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 6px; min-width: 112px; border: 1px solid #39485c; border-radius: 9px; padding: 7px; background: linear-gradient(145deg, rgba(22,33,48,.96), rgba(9,15,24,.98)); cursor: pointer; }
.skill-node + .skill-node::before { content: ""; position: absolute; top: -7px; left: 50%; width: 2px; height: 7px; background: #3d526c; }
.skill-node.available { border-color: color-mix(in srgb, var(--branch-color) 55%, #33445b); }
.skill-node.available .skill-step { border-color: var(--branch-color); color: var(--branch-color); }
.skill-node.selected { border-color: #f5a357; box-shadow: inset 0 0 16px rgba(245,163,87,.1); }
.skill-node.locked { opacity: .46; cursor: not-allowed; }
.skill-node input { position: absolute; opacity: 0; pointer-events: none; }
.skill-step { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid #536176; border-radius: 50%; color: #8795a8; font-size: .55rem; font-weight: 900; }
.skill-copy { display: grid; min-width: 0; }
.skill-copy strong { overflow: hidden; font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.skill-copy small { color: #8290a4; font-size: .5rem; }
.skill-state { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.06); padding-top: 4px; color: #718096; font-size: .47rem; font-weight: 900; letter-spacing: .06em; }
.skill-node.selected .skill-state { color: #f5a357; }
.appearance-panel { margin-top: 10px; border: 1px solid rgba(72,88,112,.55); border-radius: 10px; background: rgba(8,14,23,.55); }
.appearance-panel summary { display: flex; justify-content: space-between; padding: 10px 12px; color: #aab5c4; font-size: .66rem; font-weight: 800; cursor: pointer; list-style: none; text-transform: uppercase; letter-spacing: .06em; }
.appearance-panel summary::-webkit-details-marker { display: none; }
.appearance-panel summary span { color: #65748a; font-size: .55rem; }
.appearance-panel .customizer { padding: 0 12px 12px; }
.appearance-panel > .dojo-section-heading { padding: 12px 12px 0; }
.master-selection { margin-top: 12px; border: 1px solid rgba(72,88,112,.55); border-radius: 10px; padding: 12px; background: rgba(8,14,23,.68); }
.master-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.master-option { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 92px; border: 1px solid #34455c; border-radius: 10px; padding: 9px; background: linear-gradient(145deg, rgba(22,33,48,.96), rgba(9,15,24,.98)); color: #e8edf4; text-align: left; cursor: pointer; }
.master-option:hover:not(:disabled), .master-option:focus-visible { border-color: #f5a357; outline: none; }
.master-option.selected { border-color: #67c8e8; box-shadow: inset 0 0 20px rgba(71,185,225,.12); }
.master-option:disabled { cursor: not-allowed; filter: saturate(.55); opacity: .7; }
.master-option img { width: 58px; height: 72px; object-fit: cover; object-position: top; border-radius: 7px; background: #111a27; }
.master-option span { display: grid; min-width: 0; gap: 3px; }
.master-option strong { font: 700 .72rem "Cinzel", Georgia, serif; }
.master-option small { color: #83d8ff; font-size: .58rem; font-weight: 800; text-transform: uppercase; }
.master-option em { color: #8e9daf; font-size: .57rem; font-style: normal; line-height: 1.35; }
.master-option b { position: absolute; top: 7px; right: 8px; color: #f5b978; font-size: .47rem; letter-spacing: .06em; }

.save-selector { width: min(1120px, calc(100% - 40px)); margin: 42px auto; padding: 34px; border: 1px solid rgba(85,201,255,.62); border-radius: 14px; background: linear-gradient(145deg, rgba(3,18,32,.98), rgba(5,12,23,.96)); box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.save-selector > h2 { margin: 4px 0 8px; color: #f4f0e8; font-family: "Cinzel", Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.55rem); }
.save-selector > .lead { max-width: 720px; color: #aebfcb; }
.save-slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.save-slot { min-height: 285px; padding: 22px; border: 1px solid rgba(71,113,142,.7); border-radius: 10px; background: rgba(6,20,34,.9); display: flex; flex-direction: column; align-items: flex-start; position: relative; overflow: hidden; }
.save-slot::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #315b77; }
.save-slot.active { border-color: #55c9ff; box-shadow: inset 0 0 24px rgba(40,154,211,.09); }
.save-slot.active::before { background: #55c9ff; }
.save-slot-number { color: #83d8ff; font-size: .68rem; font-weight: 800; letter-spacing: .14em; }
.save-slot-avatar, .save-slot-empty { width: 70px; height: 70px; margin: 22px 0 15px; border: 2px solid #55c9ff; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--slot-color, #233f57) 75%, white), var(--slot-color, #142638)); color: #f4f8fb; font: 700 1.8rem "Cinzel", Georgia, serif; }
.save-slot-empty { border-style: dashed; color: #7095ac; background: rgba(16,39,57,.45); }
.save-slot h3 { margin: 0 0 7px; color: #f4f0e8; font: 700 1.15rem "Cinzel", Georgia, serif; }
.save-slot p { margin: 0 0 20px; color: #9fb1be; line-height: 1.45; }
.save-slot > .primary-button, .save-slot-actions { margin-top: auto; }
.save-slot-actions { width: 100%; display: flex; gap: 9px; align-items: center; }
.save-slot-delete { min-height: 42px; padding: 0 12px; border: 1px solid rgba(239,107,114,.6); border-radius: 5px; background: rgba(93,28,34,.24); color: #efaaa5; font-size: .68rem; font-weight: 800; letter-spacing: .06em; cursor: pointer; }
.save-slot-delete:hover { background: rgba(143,42,50,.45); color: #fff; }
.save-slots-trigger { min-height: 38px; padding: 0 14px; border: 1px solid rgba(85,201,255,.7); border-radius: 5px; background: rgba(9,54,78,.72); color: #dff5ff; font-size: .68rem; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.save-slots-trigger:hover { background: rgba(18,91,127,.9); }
.player-settings-trigger + .save-slots-trigger { margin-left: 10px; }
.debug-tools-trigger { min-height: 38px; margin-left: 8px; border: 1px solid rgba(240,184,92,.68); border-radius: 5px; padding: 0 12px; background: rgba(66,43,12,.78); color: #ffe1a6; font-size: .65rem; font-weight: 850; letter-spacing: .08em; cursor: pointer; }
.debug-tools-trigger:hover { background: rgba(112,70,15,.92); color: #fff4d7; }
.creator-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

@media (max-width: 780px) {
  .save-selector { width: min(94%, 620px); margin: 20px auto; padding: 24px; }
  .save-slot-grid { grid-template-columns: 1fr; }
  .save-slot { min-height: 235px; }
}

@media (max-width: 650px) {
  .save-slots-trigger { width: 38px; min-width: 38px; height: 38px; padding: 0; font-size: 0; }
  .player-settings-trigger + .save-slots-trigger { margin-left: 6px; }
  .save-slots-trigger::after { content: "III"; font-size: .65rem; letter-spacing: .08em; }
  .debug-tools-trigger { width: 38px; min-width: 38px; padding: 0; font-size: 0; }
  .debug-tools-trigger::after { content: "DEV"; font-size: .58rem; }
}

/* Búsqueda de Haru: tres decisiones reutilizan un único flujo convergente. */
.doctor-route-screen { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 92px clamp(18px, 4vw, 58px) 50px; color: #eaf4fb; background: radial-gradient(circle at 78% 18%, rgba(47,118,137,.18), transparent 28%), linear-gradient(rgba(2,9,17,.62), rgba(2,9,17,.92)), url("assets/locations/battle-dusk-pass.webp?v=0.20.1") center/cover; }
.doctor-route-screen > header { display: flex; flex: 0 0 auto; align-items: end; justify-content: space-between; gap: 28px; width: 100%; max-width: 1180px; margin: 0 auto 8px; }
.doctor-route-screen h2 { margin: 4px 0 7px; font-family: Cinzel, serif; color: #f4f0e8; }
.doctor-route-screen header p:not(.eyebrow), .route-log { color: #afc2cf; }
.route-metrics { display: grid; grid-template-columns: repeat(4, minmax(76px, 1fr)); gap: 7px; }
.route-metrics span { min-width: 76px; border: 1px solid rgba(85,201,255,.32); border-radius: 6px; padding: 8px 10px; background: rgba(3,18,32,.86); text-align: center; }
.route-metrics small, .route-metrics strong { display: block; }
.route-metrics small { color: #85cce9; font-size: .57rem; font-weight: 900; letter-spacing: .08em; }
.route-metrics strong { margin-top: 2px; color: #fff3db; font-size: 1.05rem; }
.route-log { flex: 0 0 auto; width: 100%; max-width: 1180px; margin: 0 auto; border-left: 3px solid #f0b85c; padding: 8px 14px; background: rgba(3,18,32,.82); font-size: 14px; line-height: 1.4; }
.route-workspace { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr); gap: 18px; width: 100%; min-height: 0; max-height: 510px; max-width: 1180px; margin: 14px auto; }
.route-workspace.has-event { grid-template-columns: minmax(0, 1fr) 270px; align-items: center; }
.route-atlas { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; height: 100%; padding: 16px 18px 14px; border: 1px solid rgba(166,192,190,.24); border-radius: 14px; background: radial-gradient(ellipse at 50% 50%, rgba(28,58,60,.36), transparent 75%), rgba(3,17,24,.82); box-shadow: inset 0 0 70px rgba(0,0,0,.25), 0 16px 44px rgba(0,0,0,.2); }
.route-map-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #c8b88e; font: 700 11px Cinzel, serif; letter-spacing: .16em; }
.route-map-heading small { color: #9ab2b7; font: 700 11px "Alegreya Sans", sans-serif; letter-spacing: .12em; }
.route-map { position: relative; min-height: 0; margin: 4px 0 26px; isolation: isolate; }
.route-map-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.route-edge { fill: none; stroke: #617b7e; stroke-width: 2; stroke-dasharray: 3 7; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.route-edge.available { stroke: #66e0ba; stroke-width: 2.5; stroke-dasharray: 5 6; }
.route-edge.travelled { stroke: #b89aff; stroke-width: 3; stroke-dasharray: none; filter: drop-shadow(0 0 4px rgba(173,132,255,.4)); }
.route-edge.bypassed { stroke: #3a4c51; opacity: .55; }
.route-node, .route-destination, .route-map-start { position: absolute; display: flex; flex-direction: column; align-items: center; width: 148px; transform: translate(-50%, -25px); }
.route-node { min-width: 0; border: 0; border-radius: 8px; padding: 0; background: transparent; color: #c0cece; cursor: pointer; font: inherit; }
.route-node i, .route-map-start i, .route-destination i { position: relative; display: grid; flex: 0 0 50px; width: 50px; height: 50px; place-items: center; color: #b1c2c5; font-style: normal; transition: transform .18s ease; }
.route-node i::before, .route-map-start i::before { content: ""; position: absolute; z-index: -1; inset: 5px; border: 2px solid #6b8184; border-radius: 5px; background: #0a2028; transform: rotate(45deg); transition: border-color .18s ease, box-shadow .18s ease; }
.route-node i svg, .route-map-start i svg { width: 24px; height: 24px; }
.route-node span, .route-node small { position: relative; max-width: 100%; padding: 1px 5px; background: #071b23; border-radius: 3px; }
.route-node span { margin-top: 9px; color: #cfdbdc; font: 700 12px Cinzel, serif; line-height: 1.4; }
.route-node small { color: #a1b9bd; font-size: 12px; line-height: 1.3; }
.route-node.available i { color: #9affdb; }
.route-node.available i::before { border-color: #67e7ba; background: #0e352e; box-shadow: 0 0 0 4px rgba(53,214,157,.07), 0 0 20px rgba(53,214,157,.16); }
.route-node.available span { color: #e1fff3; }
.route-node.available:hover i, .route-node.available:focus-visible i { transform: scale(1.14); }
.route-node.available:hover i::before, .route-node.available:focus-visible i::before { border-color: #b5ffe7; box-shadow: 0 0 25px rgba(53,214,157,.38); }
.route-node:focus-visible { outline: 2px solid #a6ffdf; outline-offset: 7px; }
.route-node.chosen i, .route-node.pending i { color: #dacaff; }
.route-node.chosen i::before, .route-node.pending i::before, .route-map-start i::before { border-color: #b18aef; background: #251e3a; }
.route-node.current i::before, .route-map-start.current i::before { box-shadow: 0 0 0 5px rgba(177,138,239,.13), 0 0 24px rgba(177,138,239,.3); }
.route-node.current span { color: #e5d5ff; }
.route-node em, .route-map-start em { margin-top: 5px; color: #c8a8ff; font: 800 10px "Alegreya Sans", sans-serif; letter-spacing: .1em; white-space: nowrap; }
.route-node.passed { opacity: .32; }
.route-node.locked { cursor: default; }
.route-node:disabled { cursor: default; }
.route-destination, .route-map-start { pointer-events: none; color: #d7c39a; font: 700 12px Cinzel, serif; }
.route-map-start i { color: #d8c3ff; }
.route-destination i { border: 2px solid #dfb773; border-radius: 50%; background: #29281e; color: #f3dba8; font-size: 25px; box-shadow: 0 0 25px rgba(223,183,115,.13); }
.route-destination strong, .route-map-start strong { margin-top: 9px; }
.route-destination small { margin-top: 2px; color: #afbbb6; font: 12px "Alegreya Sans", sans-serif; }
.route-map-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid rgba(129,161,165,.18); padding-top: 12px; }
.route-map-legend { display: flex; flex-wrap: wrap; gap: 16px; color: #afc1c4; font-size: 12px; }
.route-map-legend span { display: flex; align-items: center; gap: 6px; }
.route-map-legend span::before { content: ""; width: 7px; height: 7px; border: 1px solid currentColor; transform: rotate(45deg); }
.route-map-legend .legend-current { color: #c3a4f3; }
.route-map-legend .legend-available { color: #76e6bf; }
.route-map-help { margin: 0; color: #c0d4d4; font-size: 13px; }
.route-workspace .river-investigation { min-width: 0; margin: 0; padding: 20px; border-left-width: 3px; }
.route-workspace .river-investigation h3 { font: 700 19px Cinzel, serif; color: #f5e9d4; }
.route-workspace .river-investigation p:not(.eyebrow) { color: #bdcdd4; font-size: 15px; line-height: 1.5; }
.route-workspace .river-investigation > div { display: grid; }
.route-workspace .river-investigation button { font-size: 14px; }
.route-workspace.has-event .route-node { width: 132px; }
.route-workspace.has-event .route-node span { font-size: 11px; }
.route-workspace.has-event .route-node small { font-size: 11px; }
.river-investigation, .doctor-encounter { max-width: 900px; margin: 20px auto 0; border: 1px solid rgba(85,201,255,.58); border-left: 5px solid #42cfff; border-radius: 8px; padding: 22px; background: rgba(3,18,32,.96); }
.river-investigation > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.river-investigation button { flex: 1 1 180px; border: 1px solid rgba(85,201,255,.45); border-radius: 5px; padding: 11px; background: #0b3c59; color: #eff9ff; font-weight: 800; cursor: pointer; }
.doctor-encounter { display: grid; grid-template-columns: 120px 1fr; gap: 24px; align-items: center; }
.doctor-mark { display: grid; width: 110px; height: 110px; place-items: center; border: 2px solid #f0b85c; border-radius: 50%; color: #f0b85c; font: 700 3rem Cinzel, serif; box-shadow: 0 0 28px rgba(240,184,92,.2); }
.doctor-encounter .route-metrics { margin: 18px 0; }

.book-delivery, .hideout-intel { color: #eaf4fb; }
.entrance-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.entrance-preview article, .hideout-intel, .bestiary-entry, .bestiary-empty { border: 1px solid rgba(85,201,255,.3); border-radius: 7px; padding: 14px; background: rgba(3,18,32,.86); }
.entrance-preview span, .bestiary-entry header span { color: #83d8ff; font-size: .6rem; font-weight: 900; letter-spacing: .1em; }
.entrance-preview strong { display: block; margin-top: 5px; color: #f3e7d2; }
.entrance-preview .secret-known { border-color: rgba(240,184,92,.65); }
.entrance-preview .secret-locked { opacity: .62; }
.hideout-intel { margin: 14px 0; border-left: 4px solid #f0b85c; }
.hideout-intel p { margin: 5px 0; }
.hideout-intel .known { color: #f0cb89; }
.hideout-intel .locked { color: #8c9ba6; }
.bestiary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.bestiary-entry header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.bestiary-identity { display: flex; align-items: center; gap: 10px; }
.bestiary-appearance { display: grid; place-items: center; width: 50px; height: 64px; flex: 0 0 auto; overflow: hidden; border: 1px solid rgba(101,196,235,.35); border-radius: 6px; background: radial-gradient(circle at 50% 70%, rgba(85,201,255,.13), transparent 64%), #071522; }
.bestiary-appearance img { width: 68px; height: 68px; object-fit: contain; transform: translateY(7px); }
.bestiary-entry h3 { margin: 3px 0; color: #f4f0e8; font-family: Cinzel, serif; font-size: .95rem; }
.bestiary-entry > p { color: #aebfcc; }
.bestiary-entry dl { display: grid; gap: 6px; margin: 10px 0 0; }
.bestiary-entry dl div { display: grid; grid-template-columns: 145px 1fr; gap: 9px; border-top: 1px solid rgba(105,174,211,.14); padding-top: 6px; }
.bestiary-entry dt { color: #83d8ff; font-size: .66rem; font-weight: 850; }
.bestiary-entry dd { margin: 0; color: #d7e2e9; font-size: .72rem; }
.bestiary-entry.boss { border-color: rgba(240,184,92,.48); }
.chronicle-details { margin-top: 14px; color: #d5e1e8; }
.chronicle-details summary { cursor: pointer; color: #83d8ff; font-weight: 800; }
.mission-decision-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; background: rgba(1,7,14,.78); backdrop-filter: blur(3px); }
.mission-decision-panel { width: min(720px, 96vw); border: 1px solid rgba(85,201,255,.7); border-left: 5px solid #42cfff; border-radius: 8px; padding: 24px; background: rgba(3,18,32,.98); color: #eaf4fb; box-shadow: 0 25px 80px rgba(0,0,0,.6); }
.mission-decision-panel h2 { margin: 5px 0 8px; font-family: Cinzel, serif; color: #f4f0e8; }
.mission-decision-panel > p:not(.eyebrow) { color: #afc1cd; }
.mission-decision-panel > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mission-decision-panel button { border: 1px solid rgba(85,201,255,.38); border-radius: 6px; padding: 15px; background: rgba(9,49,72,.72); color: #eaf4fb; cursor: pointer; text-align: left; }
.mission-decision-panel button.primary { border-color: #f0b85c; }
.mission-decision-panel button strong, .mission-decision-panel button small { display: block; }
.mission-decision-panel button small { margin-top: 6px; color: #aabcc8; line-height: 1.35; }

@media (max-width: 820px) {
  .doctor-route-screen > header { display: grid; }
  .bestiary-grid { grid-template-columns: 1fr; }
  .route-workspace.has-event { grid-template-columns: minmax(0, 1fr); }
  .route-map { min-height: 300px; }
  .route-atlas { padding-inline: 8px; }
  .route-node { width: 120px; }
  .route-node span, .route-node small { font-size: 11px; }
  .entrance-preview { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .route-metrics { grid-template-columns: repeat(2, 1fr); }
  .doctor-encounter { grid-template-columns: 1fr; }
  .doctor-mark { width: 76px; height: 76px; font-size: 2rem; }
  .bestiary-entry dl div { grid-template-columns: 1fr; gap: 2px; }
}
.element-dot { width: 8px; height: 8px; border-radius: 50%; }
.element-dot.fire { background: #ff783d; }.element-dot.wind { background: #67e8c3; }.element-dot.lightning { background: #68a8ff; }
.dojo-message { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.loadout-card > .primary-button { width: 100%; }
.village-shell { position: relative; display: block; }
.village-topbar {
  position: absolute;
  z-index: 40;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto;
  max-width: calc(100% - 130px);
  gap: 14px;
  border-color: rgba(255,255,255,.2);
  padding: 8px 10px;
  background: rgba(8,12,20,.86);
  box-shadow: 0 10px 34px rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
}
.village-topbar .avatar-swatch { width: 38px; height: 38px; border-width: 3px; }
.village-topbar .eyebrow { font-size: .58rem; }
.village-topbar h2 { font-size: .98rem; }
.campaign-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.campaign-summary > * { padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,0.07); color: #b8c2d1; font-size: 0.68rem; }
.campaign-summary strong { color: #f5a357; }
.village-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.village-nav button { border: 1px solid #344154; border-radius: 8px; padding: 10px; background: #111925; color: #aeb9c8; font-weight: 750; cursor: pointer; }
.village-nav button.active { border-color: #f5a357; background: #29212a; color: #fff; }
.village-return { position: absolute; z-index: 42; top: 70px; left: 12px; min-height: 38px; color: #9eabba; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; }
.village-return span { display: none; }
.village-return button { border-color: rgba(255,255,255,.2); padding: 8px 10px; background: rgba(8,12,20,.82); box-shadow: 0 8px 24px rgba(0,0,0,.34); backdrop-filter: blur(9px); }
.village-return button:hover { border-color: #f5a357; color: #fff; }
.village-map-card { overflow: hidden; border: 1px solid rgba(255,255,255,0.13); border-radius: 14px; background: #080b12; box-shadow: 0 24px 80px rgba(0,0,0,0.42); }
.map-heading { position: relative; z-index: 30; display: flex; align-items: end; justify-content: space-between; gap: 20px; min-height: 84px; padding: 16px 112px 16px 500px; border-bottom: 1px solid rgba(255,255,255,0.11); background: linear-gradient(90deg, #151e2d, #0c111b); }
.map-heading > div { display: none; }
.map-heading p:last-child { margin: 0; color: #aab4c4; font-size: 0.78rem; }
kbd { border: 1px solid #4e5b70; border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: #0a0f18; color: #f4c17c; font: inherit; }
.village-map { position: relative; width: 100%; margin: 0; isolation: isolate; background: #070a11; }
.village-map::after { content: ""; position: absolute; z-index: 1; inset: 0; pointer-events: none; box-shadow: inset 0 0 60px rgba(0,0,0,0.45); }
.village-map > img { display: block; width: 100%; height: auto; user-select: none; }
.village-hotspots { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; overflow: visible; }
.village-hotspot { cursor: pointer; outline: none; }
.hotspot-shape { fill: rgba(255,158,82,0); stroke: rgba(255,188,112,0); stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: all; transition: fill .16s ease, stroke .16s ease, filter .16s ease; }
.village-hotspot:hover .hotspot-shape { fill: rgba(255,142,55,0.22); stroke: rgba(255,192,115,0.96); filter: drop-shadow(0 0 5px rgba(255,132,50,0.95)) drop-shadow(0 0 13px rgba(250,72,38,0.7)); }
.village-hotspot:focus-visible .hotspot-shape { fill: rgba(103,232,195,0.2); stroke: #a6f6df; filter: drop-shadow(0 0 5px #67e8c3) drop-shadow(0 0 13px rgba(103,232,195,0.65)); }
.village-hotspot.coming-soon .hotspot-shape { fill: transparent; stroke: transparent; }
.village-hotspot:not(:hover):not(:focus-visible) .hotspot-shape { fill: transparent; stroke: transparent; filter: none; }
.village-hotspot.coming-soon:hover .hotspot-shape { fill: rgba(127,116,255,0.22); stroke: rgba(176,167,255,0.98); filter: drop-shadow(0 0 5px rgba(139,128,255,0.95)) drop-shadow(0 0 14px rgba(101,91,220,0.72)); }
.village-hotspot.coming-soon:focus-visible .hotspot-shape { fill: rgba(127,116,255,0.22); stroke: #c0b9ff; filter: drop-shadow(0 0 5px #8f83ff) drop-shadow(0 0 14px rgba(127,116,255,0.72)); }
.map-label.coming-soon .map-label-box { border-color: rgba(157,148,255,0.9); }
.map-label.coming-soon .map-label-box strong { color: #dedaff; }
.map-label.coming-soon .map-label-box small { color: #aca5ff; font-weight: 800; }
.map-label { position: absolute; z-index: 6; left: var(--label-x); top: var(--label-y); width: max-content; max-width: 240px; pointer-events: none; opacity: 0; transform: translate(-50%, 9px); transition: opacity .16s ease, transform .16s ease; }
.map-label-box { display: grid; gap: 2px; padding: 7px 10px; border: 1px solid rgba(255,181,102,0.78); border-radius: 7px; background: rgba(6,9,15,0.94); box-shadow: 0 8px 28px rgba(0,0,0,0.72); color: #fff; text-align: center; }
.map-label-box strong { color: #fff4df; font-size: 0.78rem; white-space: nowrap; }
.map-label-box small { color: #c1c9d4; font-size: 0.63rem; white-space: nowrap; }
.map-label.visible { opacity: 1; transform: translate(-50%, 0); }
.village-map-card > .notice-card { margin: 12px; }
.village-service { min-height: 430px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); align-items: center; gap: 22px; }
.village-service .lead { max-width: 720px; }
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.service-grid article { display: grid; min-height: 110px; align-content: end; gap: 7px; border: 1px solid #344154; border-radius: 10px; padding: 16px; background: linear-gradient(145deg, rgba(38,48,65,0.88), rgba(13,19,29,0.92)); }
.service-grid article span { color: #f5a357; font-size: 0.72rem; font-weight: 850; letter-spacing: 0.12em; }
.service-grid article strong { font-size: 0.88rem; }
.service-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.secondary-button { border: 0; border-radius: 9px; padding: 14px 22px; background-color: #111925; background-image: url("assets/ui/nav-button-frame.webp?v=0.20.0"); background-position: center; background-size: 100% 100%; color: #e5eaf2; font-weight: 800; text-shadow: 0 2px 3px #000; cursor: pointer; }
.secondary-button:hover { color: #ffd697; filter: drop-shadow(0 0 6px rgba(245,163,87,.35)); }
.development-note { border-left: 3px solid #f5a357; padding: 12px 14px; background: rgba(245,163,87,0.08); color: #bec7d4; font-size: 0.82rem; }
.npc-guide-strip { overflow: hidden; border: 1px solid #344154; border-radius: 14px; background: linear-gradient(145deg, rgba(28,38,55,.98), rgba(9,14,22,.98)); box-shadow: 0 18px 50px rgba(0,0,0,.28); }
.npc-guide-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.09); }
.npc-guide-heading p { margin: 0; }.npc-guide-heading strong { color: #9da9ba; font-size: .72rem; }
.npc-card-grid { display: grid; grid-template-columns: 1fr; }
.npc-card-grid.multiple { grid-template-columns: repeat(2, 1fr); }
.npc-card { position: relative; display: grid; grid-template-columns: minmax(120px, 42%) 1fr; align-items: end; min-height: 230px; overflow: hidden; background: radial-gradient(circle at 22% 34%, rgba(245,163,87,.13), transparent 52%); }
.npc-card + .npc-card { border-left: 1px solid rgba(255,255,255,.09); }
.npc-portrait { height: 230px; align-self: stretch; overflow: hidden; }
.npc-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 10px 14px rgba(0,0,0,.55)); }
.npc-card-copy { position: relative; z-index: 2; padding: 18px 14px 18px 4px; }
.npc-card-copy h3 { display: block; margin: 2px 0 18px; color: #fff; font-size: 1rem; letter-spacing: 0; text-transform: none; }
.npc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.npc-actions button { border: 1px solid #657187; border-radius: 7px; padding: 8px 10px; background: rgba(8,12,19,.78); color: #dfe5ef; font-size: .68rem; font-weight: 850; cursor: pointer; }
.npc-actions button:first-child { border-color: #f5a357; color: #f7bd7d; }.npc-actions button:hover { background: #252e3d; color: #fff; }
.location-stage {
  position: relative;
  min-height: 690px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  background-image: var(--location-bg);
  background-position: center;
  background-size: cover;
  box-shadow: 0 28px 90px rgba(0,0,0,.55);
}
.location-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4,7,13,.16) 0%, rgba(4,7,13,.05) 34%, rgba(4,7,13,.48) 58%, rgba(4,7,13,.76) 100%),
    linear-gradient(0deg, rgba(4,7,13,.72), transparent 46%);
}
.stage-characters { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.stage-character {
  position: absolute;
  bottom: -2%;
  left: 1.5%;
  width: 38%;
  height: 88%;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 1;
  opacity: 1;
  filter: none;
  transform: translateY(0) scale(1);
  transform-origin: center bottom;
  transition: opacity .2s ease, filter .2s ease, transform .2s ease;
  pointer-events: auto;
}
.stage-character img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 18px 18px rgba(0,0,0,.72)); transition: filter .2s ease; }
.stage-character span { position: absolute; bottom: 18px; left: 50%; min-width: max-content; padding: 6px 11px; border: 1px solid rgba(245,163,87,.45); border-radius: 999px; background: rgba(7,10,17,.82); color: #dfe5ef; font-size: .68rem; font-weight: 800; letter-spacing: .05em; opacity: 0; transform: translate(-50%, 6px); transition: .2s ease; }
.stage-character:hover, .stage-character:focus-visible { opacity: 1; filter: none; transform: translateY(0) scale(1); outline: none; }
.stage-character.active { z-index: 3; opacity: 1; filter: none; transform: translateY(0) scale(1.01); outline: none; }
.stage-character.active img { filter: drop-shadow(0 18px 18px rgba(0,0,0,.8)) drop-shadow(0 0 5px rgba(255,166,81,.22)); }
.stage-character:hover span, .stage-character:focus-visible span, .stage-character.active span { opacity: 1; transform: translate(-50%, 0); }
.stage-character.active span { border-color: #d89554; background: rgba(62,31,24,.92); color: #fff7e8; box-shadow: 0 0 8px rgba(245,163,87,.18); }
.location-stage.has-cast .stage-character:first-child { left: -3%; width: 36%; }
.location-stage.has-cast .stage-character:nth-child(2) { left: 10%; width: 36%; }
.stage-speech, .stage-ambient {
  position: absolute;
  z-index: 6;
  left: 31%;
  top: 15%;
  width: min(61%, 590px);
  border: 1px solid rgba(245,186,119,.88);
  border-radius: 18px;
  padding: 18px 20px;
  background: rgba(247,239,221,.97);
  box-shadow: 0 20px 55px rgba(0,0,0,.55);
  color: #1c1a1d;
  animation: stage-bubble-in .24s ease both;
}
.stage-speech::before, .stage-ambient::before { content: ""; position: absolute; left: -22px; bottom: 25px; width: 35px; height: 28px; background: inherit; clip-path: polygon(100% 0, 100% 100%, 0 80%); }
.stage-speaker, .stage-ambient strong { display: block; margin: -4px -5px 10px; border-bottom: 1px solid rgba(129,62,44,.22); padding: 4px 5px 8px; color: #813e2c; font-size: .72rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.stage-speech > p:not(.stage-speaker) { min-height: 54px; margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.55; }
.stage-speech > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.stage-speech small { color: #716b67; font-weight: 750; }
.stage-speech .primary-button { padding: 10px 14px; }
.stage-speech { border: 1px solid rgba(94,205,255,.72); border-left: 4px solid #3fcaff; border-radius: 7px; background: rgba(3,18,32,.94); color: #eef7ff; box-shadow: 0 18px 55px rgba(0,0,0,.48); }
.stage-speech::before { display: none; content: none; }
.stage-speech .stage-speaker { border-bottom-color: rgba(132,196,224,.3); color: #83d8ff; }
.stage-speech > p:not(.stage-speaker) { color: #f4f0e8; }
.stage-speech small { color: #aac1d2; }
.stage-speech.leaving, .stage-ambient.leaving { animation: stage-bubble-out .18s ease both; }
.stage-ambient { top: auto; bottom: 24%; left: 3.2%; width: 29%; padding: 14px 16px; font-size: .82rem; line-height: 1.45; pointer-events: none; }
.stage-ambient strong, .stage-ambient span { display: block; }
.stage-ambient::before { top: -22px; bottom: auto; left: 62%; transform: rotate(90deg); }
.location-stage.speaker-right .stage-ambient { right: 3.2%; left: auto; }
.location-stage.speaker-right .stage-ambient::before { right: auto; left: 38%; transform: rotate(90deg); }
.location-stage.speaker-right .stage-speech::before { right: -22px; left: auto; transform: scaleX(-1); }
.stage-options {
  position: relative;
  z-index: 4;
  width: 62%;
  max-height: 548px;
  margin: 112px 2.4% 30px auto;
  overflow: auto;
  opacity: 0;
  transform: translateX(24px);
}
.stage-options.ready { animation: stage-options-in .34s ease forwards; }
.stage-panel {
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 13px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(20,28,42,.94), rgba(7,11,18,.96));
  box-shadow: 0 18px 60px rgba(0,0,0,.46);
  backdrop-filter: blur(8px);
}
.stage-panel + .stage-panel { margin-top: 12px; }
.stage-options .dojo-layout { grid-template-columns: 1fr; }
.stage-options .village-service { min-height: 0; display: block; }
.stage-options .service-grid { grid-template-columns: 1fr; margin-block: 18px; }
.stage-options .service-grid article { min-height: 72px; }
.stage-options .mission-list { max-height: 490px; }
.stage-options .customizer { grid-template-columns: 140px 1fr; }
.stage-options .character-preview { width: 140px; }
.stage-options .cosmetic-grid { grid-template-columns: repeat(2, 1fr); }
.stage-options .equipment-grid { grid-template-columns: repeat(3, 1fr); }
.location-stage.location-dojo .stage-character:first-child { right: -4%; left: auto; width: 32%; }
.location-stage.location-dojo .stage-character:nth-child(2) { right: auto; left: -4%; width: 32%; }
.location-dojo .stage-speech { left: 26%; width: 48%; }
.location-dojo .stage-options { width: 48%; margin-right: auto; margin-left: auto; }
.location-dojo .stage-options .customizer { grid-template-columns: 110px 1fr; }
.location-dojo .stage-options .character-preview { width: 110px; }
.location-dojo .stage-ambient { bottom: 22%; width: 23%; }
.location-kagemori::before {
  background: linear-gradient(0deg, rgba(3,8,15,.58), rgba(3,8,15,.04) 58%, rgba(3,8,15,.2));
}
.location-stage.location-kagemori .stage-character:first-child { left: -7%; width: 29%; height: 82%; }
.location-stage.location-kagemori .stage-character:nth-child(2) { right: -8%; left: auto; width: 31%; height: 82%; }
.location-kagemori .stage-options {
  position: absolute;
  inset: 0;
  width: auto;
  max-height: none;
  margin: 0;
  overflow: visible;
  pointer-events: none;
}
.kagemori-investigation { position: absolute; inset: 0; pointer-events: none; }
.kagemori-investigation header {
  position: absolute;
  top: 3%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(58%, 720px);
  border: 1px solid rgba(94,205,255,.72);
  border-left: 4px solid #3fcaff;
  border-radius: 7px;
  padding: 13px 18px;
  background: rgba(3,18,32,.92);
  box-shadow: 0 18px 55px rgba(0,0,0,.48);
  transform: translateX(-50%);
}
.kagemori-investigation header h2 { margin: 2px 0 0; font-size: 1.05rem; }
.kagemori-investigation header strong { color: #f0b85c; white-space: nowrap; }
.investigation-log {
  position: absolute;
  bottom: 4%;
  left: 50%;
  width: min(52%, 650px);
  margin: 0;
  border: 1px solid rgba(94,205,255,.45);
  border-radius: 5px;
  padding: 10px 16px;
  background: rgba(3,18,32,.9);
  color: #eaf4fb;
  font-weight: 650;
  text-align: center;
  transform: translateX(-50%);
}
.clue-hotspots { position: absolute; z-index: 8; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.clue-hotspot { cursor: pointer; outline: none; }
.clue-shape { fill: rgba(255,158,82,0); stroke: rgba(255,188,112,0); stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: all; transition: fill .12s ease, stroke .12s ease, stroke-width .12s ease; }
.clue-hotspot:hover .clue-shape { fill: rgba(255,142,55,.24); stroke: rgba(255,205,143,1); stroke-width: 5; }
.clue-hotspot:focus-visible .clue-shape { fill: rgba(103,232,195,.22); stroke: #c8ffef; stroke-width: 5; }
.clue-hotspot.found:hover .clue-shape,
.clue-hotspot.found:focus-visible .clue-shape { fill: rgba(72,216,164,.22); stroke: #b8ffdc; stroke-width: 5; }
.clue-label { position: absolute; z-index: 9; left: var(--clue-label-x); top: var(--clue-label-y); pointer-events: none; opacity: 0; transform: translate(-50%, 8px); transition: opacity .16s ease, transform .16s ease; }
.clue-label strong { display: block; border: 1px solid rgba(255,181,102,.78); border-radius: 7px; padding: 6px 10px; background: rgba(6,9,15,.94); box-shadow: 0 8px 28px rgba(0,0,0,.72); color: #fff4df; font-size: .72rem; white-space: nowrap; }
.clue-label.visible { opacity: 1; transform: translate(-50%, 0); }
.kagemori-complete {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(48%, 590px);
  border: 1px solid rgba(94,205,255,.72);
  border-left: 4px solid #3fcaff;
  border-radius: 8px;
  padding: 24px;
  background: rgba(3,18,32,.95);
  box-shadow: 0 24px 70px rgba(0,0,0,.62);
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}
.kagemori-complete h2 { margin: 4px 0 12px; }
.kagemori-complete p:not(.eyebrow) { color: #c6d5df; line-height: 1.5; }
.kagemori-complete .primary-button { margin-top: 10px; }
.notice-card.story-objective { border-color: #3fcaff; background: rgba(5,34,53,.86); }
.notice-card.story-objective .notice-icon, .notice-card.story-objective strong { color: #8edcff; }
@keyframes stage-bubble-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes stage-bubble-out { to { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes stage-options-in { to { opacity: 1; transform: translateX(0); } }
.notice-card { display: flex; justify-content: space-between; gap: 12px; border-left: 3px solid #56647a; padding: 11px 14px; background: rgba(0,0,0,0.25); color: #9da9ba; font-size: 0.8rem; }
.notice-card.ally { border-color: #67e8c3; }.notice-card strong { color: #e9edf4; }
.dialogue-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: end center; padding: 28px; background: rgba(3,5,9,0.72); backdrop-filter: blur(3px); }
.dialogue-box { position: relative; width: min(820px, 100%); min-height: 170px; border: 1px solid #56647a; border-radius: 12px; padding: 24px; background: #101722; box-shadow: 0 25px 100px #000; }
.dialogue-box.with-portrait { display: grid; grid-template-columns: 230px 1fr; gap: 12px; min-height: 290px; padding: 0 24px 0 0; overflow: hidden; background: radial-gradient(circle at 14% 35%, rgba(245,163,87,.16), transparent 35%), #101722; }
.dialogue-story { display: block; padding: 0; background: transparent; backdrop-filter: none; overflow: hidden; }
.location-stage.story-dialogue-active .stage-characters,
.location-stage.story-dialogue-active .stage-speech,
.location-stage.story-dialogue-active .stage-ambient,
.location-stage.story-dialogue-active .stage-options { visibility: hidden; opacity: 0; pointer-events: none; }
.story-character { position: absolute; z-index: 1; bottom: -2%; width: 34%; height: 88%; pointer-events: none; }
.story-character-left { left: 1.5%; }
.story-character-right { right: 1.5%; }
.story-character-left.story-entering { animation: story-enter-left .56s cubic-bezier(.2,.76,.24,1) both; }
.story-character-right.story-entering { animation: story-enter-right .56s cubic-bezier(.2,.76,.24,1) both; }
.story-character.story-speaking { animation: story-settle .24s ease both; }
.story-character img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 16px 18px rgba(0,0,0,.65)); }
.story-character img.story-character-mirrored { transform: scaleX(-1); }
.story-character span { position: absolute; bottom: 1.5%; left: 50%; transform: translateX(-50%); border: 1px solid rgba(94,205,255,.8); border-radius: 999px; padding: 5px 14px; background: rgba(3,18,32,.94); color: #eaf7ff; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.story-dialogue-panel { position: absolute; top: 14%; right: 27%; z-index: 2; width: min(42%, 640px); min-height: 180px; border: 1px solid rgba(94,205,255,.72); border-left: 4px solid #3fcaff; border-radius: 7px; padding: 18px 22px; background: rgba(3,18,32,.94); color: #eef7ff; box-shadow: 0 18px 55px rgba(0,0,0,.48); animation: stage-bubble-in .24s ease both; }
.story-dialogue-panel header { border-bottom: 1px solid rgba(132,196,224,.3); padding: 0 0 10px; color: #83d8ff; font-family: "Cinzel", Georgia, serif; font-size: .76rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.story-dialogue-panel > p { min-height: 62px; margin: 14px 0; color: #f4f0e8; font-size: 1rem; font-weight: 650; line-height: 1.55; }
.story-dialogue-panel footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.story-dialogue-panel small { color: #aac1d2; font-weight: 750; }
.story-dialogue-panel .primary-button { min-width: 126px; border: 1px solid #55c9ff; border-radius: 4px; padding: 11px 18px; background: linear-gradient(180deg, #164d70, #073653); color: #f4f8fb; box-shadow: none; }
.dialogue-story.story-speaker-right .story-dialogue-panel { right: auto; left: 27%; }

@keyframes story-enter-left { from { opacity: 0; transform: translateX(-105%); } to { opacity: 1; transform: translateX(0); } }
@keyframes story-enter-right { from { opacity: 0; transform: translateX(105%); } to { opacity: 1; transform: translateX(0); } }
@keyframes story-settle { from { opacity: .82; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1050px), (max-height: 650px) {
  .story-character { left: 0; width: 38%; height: 82%; }
  .story-dialogue-panel { top: 12%; right: 3%; width: 55%; min-height: 160px; padding: 15px 18px; }
  .story-character-right { right: 0; left: auto; }
  .dialogue-story.story-speaker-right .story-dialogue-panel { right: auto; left: 3%; }
  .story-dialogue-panel > p { min-height: 48px; margin: 11px 0; font-size: .9rem; }
  .story-dialogue-panel .primary-button { padding: 9px 15px; }
  .location-stage.location-kagemori .stage-character { opacity: .72; }
  .kagemori-investigation header { width: 66%; padding: 9px 13px; }
  .kagemori-investigation header h2 { font-size: .88rem; }
  .investigation-log { bottom: 2%; width: 62%; font-size: .82rem; }
}
.dialogue-portrait { position: relative; align-self: stretch; min-height: 290px; overflow: hidden; }
.dialogue-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 12px 18px rgba(0,0,0,.6)); }
.dialogue-portrait span { position: absolute; right: 8px; bottom: 8px; left: 8px; padding: 5px 8px; border-radius: 5px; background: rgba(5,8,13,.82); color: #c4ccd8; font-size: .64rem; text-align: center; }
.dialogue-copy { position: relative; align-self: center; min-height: 170px; padding: 24px 0 54px; }
.dialogue-copy > p:not(.eyebrow) { min-height: 52px; font-size: 1.05rem; line-height: 1.55; }.dialogue-copy button { position: absolute; right: 0; bottom: 16px; }.dialogue-copy small { position: absolute; left: 0; bottom: 24px; color: #758197; }
.mission-board { padding: 20px; }.mission-list { display: grid; gap: 8px; max-height: 520px; margin-top: 18px; overflow-y: auto; padding-right: 5px; }
.saga-selector .lead { margin-bottom: 18px; }
.saga-grid { display: grid; gap: 12px; }
.saga-card { display: grid; gap: 7px; width: 100%; border: 1px solid #3b4960; border-radius: 12px; padding: 16px; background: linear-gradient(145deg, rgba(26,36,53,.96), rgba(11,17,27,.98)); color: #eef3fa; text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.saga-card:hover:not(:disabled) { transform: translateY(-2px); border-color: #f5a357; background: linear-gradient(145deg, rgba(42,52,69,.98), rgba(16,23,34,.98)); }
.saga-card.completed { border-color: rgba(103,232,195,.52); }
.saga-card.locked { opacity: .45; cursor: not-allowed; }
.saga-number { color: #f5a357; font-size: .68rem; font-weight: 900; letter-spacing: .13em; }
.saga-card strong { font-size: 1.05rem; }
.saga-card small { color: #aeb8c7; font-size: .76rem; }
.saga-progress { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; color: #8592a6; font-size: .68rem; }
.saga-action { margin-top: 3px; color: #f3c080; font-size: .7rem; font-weight: 850; letter-spacing: .06em; }
.saga-card.completed .saga-action { color: #67e8c3; }
.saga-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-bottom: 16px; }
.saga-header h2 { margin: 1px 0 3px; }
.saga-header p { margin: 0; color: #9ca8b9; font-size: .75rem; }
.saga-header > strong { color: #f5c96b; font-size: .82rem; }
.saga-back { padding: 9px 11px; }
.saga-next-note { margin: 12px 0 0; color: #8f9bad; font-size: .72rem; }
.saga-next-note strong { color: #d6deea; }
.mission-card { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 14px; border: 1px solid #303d50; border-radius: 9px; padding: 12px; background: #111925; }
.mission-card.completed { border-color: rgba(103,232,195,0.45); }.mission-card.locked { opacity: 0.48; }
.mission-number { color: #56647a; font-size: 1.5rem; font-weight: 850; }.mission-card.completed .mission-number { color: #67e8c3; }
.mission-card h3 { display: block; margin: 1px 0 5px; color: #f4f7fb; font-size: 1rem; letter-spacing: 0; text-transform: none; }.mission-card p { margin: 0; color: #909daf; font-size: 0.74rem; }
.mission-card button { border: 1px solid #f5a357; border-radius: 7px; padding: 9px 11px; background: transparent; color: #f5a357; font-size: 0.72rem; font-weight: 800; cursor: pointer; }.mission-card button:disabled { border-color: #647086; color: #647086; cursor: not-allowed; }
.archive-card ol { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; padding: 0; list-style: none; }
.archive-card li { display: flex; gap: 10px; padding: 11px; border: 1px solid #303d50; border-radius: 8px; color: #758197; }.archive-card li.done { color: #67e8c3; }.archive-card li div { display: grid; }.archive-card li strong { color: #d9dee7; font-size: 0.82rem; }.archive-card li small { color: inherit; }
.ending-card { margin-top: 18px; padding: 20px; border: 1px solid #f5a357; border-radius: 10px; background: rgba(245,163,87,0.08); }

@media (max-width: 650px) {
  main { width: 100%; padding-top: 0; }
  .game-heading { top: 8px; left: 50%; right: auto; transform: translateX(-50%); padding: 0; }
  .game-settings summary { width: 42px; height: 42px; justify-content: center; padding: 0; font-size: 0; }
  .game-settings summary span { font-size: 1rem; }
  .game-settings-panel { width: min(340px, calc(100vw - 18px)); }
  .option-row { grid-template-columns: 1fr 1fr; }
  .game-options .hint { display: block; }
  .mode-switch { font-size: 0.76rem; }
  .volume-control { display: flex; }
  #game { border-inline: 0; border-radius: 0; }
  .dojo-layout { grid-template-columns: 1fr; }
  .dojo-card { border-inline: 0; border-radius: 0; padding: 18px 14px; }
  .creator-card { margin: 12px auto; }
  .creator-form, .equipment-grid, .cosmetic-grid, .jutsu-grid { grid-template-columns: 1fr; }
  .customizer { grid-template-columns: 1fr; }
  .character-preview { width: min(220px, 100%); margin-inline: auto; }
  .creator-form label { grid-column: 1; }
  .village-topbar { top: 8px; left: 8px; align-items: center; max-width: calc(100% - 62px); gap: 7px; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 7px 8px; }
  .village-topbar .avatar-swatch { width: 32px; height: 32px; }
  .village-topbar .profile-heading { gap: 7px; }.village-topbar h2 { font-size: .86rem; }
  .campaign-summary { display: flex; flex-wrap: nowrap; gap: 4px; }.campaign-summary span:nth-child(2), .campaign-summary span:nth-child(3) { display: none; }
  .campaign-summary > * { padding: 4px 6px; font-size: .61rem; }
  .village-nav { display: flex; }.village-return { top: 60px; left: 8px; }.village-return span { display: none; }
  .map-heading { min-height: 74px; align-items: end; justify-content: flex-end; padding: 48px 62px 8px 8px; }.map-heading p:last-child { max-width: 200px; text-align: right; font-size: .64rem; }
  .map-label-box { padding: 5px 7px; }.map-label-box small { display: none; }.map-label-box strong { font-size: 12px; }
  .village-service { grid-template-columns: 1fr; }.service-grid { grid-template-columns: 1fr; }.service-grid article { min-height: 80px; }
  .npc-card-grid.multiple { grid-template-columns: 1fr; }.npc-card + .npc-card { border-top: 1px solid rgba(255,255,255,.09); border-left: 0; }
  .npc-card { min-height: 205px; }.npc-portrait { height: 205px; }.npc-guide-heading strong { display: none; }
  .location-stage { min-height: 880px; border-inline: 0; border-radius: 0; background-position: center top; }
  .location-stage::before { background: linear-gradient(0deg, rgba(4,7,13,.9) 0%, rgba(4,7,13,.44) 62%, rgba(4,7,13,.08) 100%); }
  .stage-character { top: 205px; bottom: auto; left: -3%; width: 58%; height: 350px; }
  .location-stage.has-cast .stage-character:first-child { left: -10%; width: 54%; }.location-stage.has-cast .stage-character:nth-child(2) { left: 12%; width: 52%; }
  .stage-speech { top: 105px; left: 8%; width: 84%; padding: 15px; }
  .stage-speech::before { left: 30px; bottom: -22px; transform: rotate(-90deg); }
  .stage-speech > p:not(.stage-speaker) { min-height: 45px; font-size: .9rem; }
  .stage-ambient { top: auto; right: auto; bottom: 41%; left: 4%; width: 56%; }
  .location-stage.speaker-right .stage-ambient { right: 4%; left: auto; }
  .stage-options { width: calc(100% - 24px); max-height: none; margin: 500px 12px 18px; overflow: visible; }
  .location-stage.location-dojo .stage-character:first-child { right: -18%; left: auto; width: 62%; }.location-stage.location-dojo .stage-character:nth-child(2) { right: auto; left: -18%; width: 62%; }
  .location-dojo .stage-speech { left: 8%; width: 84%; }
  .location-dojo .stage-options { width: calc(100% - 24px); margin: 500px 12px 18px; }
  .location-dojo .stage-ambient { bottom: 43%; width: 48%; }
  .stage-panel { padding: 16px 13px; }
  .stage-options .customizer { grid-template-columns: 1fr; }.stage-options .character-preview { width: min(180px, 100%); }
  .stage-options .cosmetic-grid { grid-template-columns: 1fr; }
  .stage-options .equipment-grid, .technique-slots { grid-template-columns: repeat(2, 1fr); }
  .equipment-modal { padding: 12px; }
  .equipment-modal-options { grid-template-columns: 1fr; }
  .affinity-slots { grid-template-columns: 1fr; }
  .affinity-options { grid-template-columns: repeat(2, 1fr); }
  .skill-tree-heading { align-items: start; flex-direction: column; }
  .skill-branch { grid-template-columns: 88px minmax(0, 1fr); }
  .skill-branch > header { align-content: center; display: grid; justify-items: center; text-align: center; }
  .skill-branch > header img { width: 30px; height: 30px; }
  .dialogue-box.with-portrait { grid-template-columns: 125px 1fr; min-height: 230px; padding-right: 14px; }.dialogue-portrait { min-height: 230px; }.dialogue-copy { padding-top: 18px; }.dialogue-copy > p:not(.eyebrow) { font-size: .92rem; }
  .mission-card { grid-template-columns: 42px 1fr; }.mission-card button { grid-column: 1 / -1; }
  .archive-card ol { grid-template-columns: 1fr; }.dialogue-overlay { padding: 12px; }
}

/* Village HUD refresh based on the supplied visual reference */
body:has(#meta:not([hidden])) main {
  width: min(100% - 20px, 1440px);
  padding-top: 10px;
}
body:has(#meta:not([hidden])) .game-heading {
  top: 28px;
  right: 34px;
  left: auto;
  transform: none;
}
body:has(#meta:not([hidden])) .game-settings summary {
  width: 168px;
  min-height: 58px;
  border: 1px solid rgba(67,147,255,.72);
  border-radius: 18px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(9,22,40,.96), rgba(7,15,28,.94));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 12px 32px rgba(0,0,0,.38);
  font-size: .98rem;
}
body:has(#meta:not([hidden])) .game-settings summary span {
  font-size: 1.45rem;
}
body:has(#meta:not([hidden])) .game-settings-panel {
  right: 0;
  margin-top: 4px;
}

.village-map-card {
  position: relative;
  border-color: rgba(66,139,232,.45);
  border-radius: 22px;
  background: #06101e;
  box-shadow: 0 28px 90px rgba(0,0,0,.52), inset 0 0 0 1px rgba(255,255,255,.02);
}
.village-map-card::before,
.village-map-card::after {
  content: "";
  position: absolute;
  z-index: 35;
  width: 32px;
  height: 32px;
  pointer-events: none;
}
.village-map-card::before {
  top: 8px;
  left: 8px;
  border-top: 3px solid #f5a357;
  border-left: 3px solid #f5a357;
}
.village-map-card::after {
  right: 8px;
  bottom: 8px;
  border-right: 3px solid #f5a357;
  border-bottom: 3px solid #f5a357;
}
.map-heading {
  display: none;
}
.village-map {
  overflow: hidden;
  border-radius: 21px 21px 0 0;
}
.village-map::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5,12,24,.42) 0%, transparent 22%, transparent 74%, rgba(5,12,24,.22) 100%),
    linear-gradient(90deg, rgba(4,10,20,.18), transparent 16%, transparent 84%, rgba(4,10,20,.18));
}
.village-map::after {
  box-shadow: inset 0 0 75px rgba(0,0,0,.36);
}

.village-topbar {
  top: 22px;
  left: 28px;
  width: min(860px, calc(100% - 300px));
  max-width: none;
  min-height: 88px;
  gap: 0;
  border: 0;
  border-radius: 22px;
  padding: 15px 24px;
  background-color: rgba(7,15,29,.96);
  background-image: url("assets/ui/hud-frame.webp?v=0.20.0"), linear-gradient(180deg, rgba(8,21,38,.95), rgba(7,15,29,.94));
  background-position: center;
  background-size: 100% 100%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 14px 38px rgba(0,0,0,.38);
}
.village-topbar .profile-heading {
  min-width: 355px;
  padding-right: 18px;
}
.village-topbar .avatar-swatch {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 5px solid #1d4d86;
  box-shadow: inset 0 -15px rgba(0,0,0,.18), 0 0 0 2px rgba(90,164,255,.25);
}
.profile-copy {
  min-width: 120px;
}
.village-topbar .profile-copy .eyebrow {
  margin-bottom: 2px;
  color: #ffae62;
  font-size: .66rem;
  letter-spacing: .22em;
}
.village-topbar .profile-copy h2 {
  font-size: 1.45rem;
  line-height: 1;
}
.level-chip {
  margin-left: auto;
  min-width: 112px;
  border: 1px solid rgba(245,163,87,.82);
  border-radius: 16px;
  padding: 10px 18px;
  background: rgba(95,55,20,.26);
  box-shadow: inset 0 0 18px rgba(245,163,87,.08);
  color: #f7b45d;
  font-size: .9rem;
  text-align: center;
}
.campaign-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  flex: 1;
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  border-left: 1px solid rgba(132,155,188,.34);
}
.campaign-summary > * {
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.summary-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  padding: 8px 18px !important;
  border-right: 1px solid rgba(132,155,188,.2);
}
.summary-item:last-child { border-right: 0; }
.summary-item b {
  grid-row: 1 / 3;
  color: #4e98ff;
  font-size: 1.45rem;
  line-height: 1;
}
.summary-item:nth-child(3) b { color: #ffc53f; }
.summary-item strong {
  align-self: end;
  color: #f7f9fc;
  font-size: .92rem;
  line-height: 1.1;
}
.summary-item small {
  align-self: start;
  color: #b2bccb;
  font-size: .7rem;
}

.village-map-card > .notice-card {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(170px, .95fr) 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  margin: 0;
  border: 1px solid rgba(64,139,235,.54);
  border-top-color: rgba(64,139,235,.75);
  border-left: 1px solid rgba(64,139,235,.54);
  border-radius: 0 0 21px 21px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(8,22,41,.96), rgba(6,16,30,.98));
  color: #c5cfdd;
}
.village-map-card > .notice-card::before {
  content: "";
  position: absolute;
  left: 43%;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: rgba(146,166,193,.32);
}
.notice-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #2e8fff;
  border-radius: 11px;
  background: rgba(24,91,166,.28);
  color: #6bb7ff;
  font-size: 1.1rem;
}
.village-map-card > .notice-card strong {
  color: #f2f5fa;
  font-size: .94rem;
}
.notice-detail {
  justify-self: end;
  padding-left: 22px;
  color: #63a9ff;
  font-size: .88rem;
}
.notice-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #2e8fff;
  border-radius: 15px;
  color: #f0f6ff;
  font-size: 2rem;
  line-height: 1;
}
.notice-card.ally .notice-icon {
  border-color: rgba(103,232,195,.75);
  background: rgba(40,140,116,.2);
  color: #67e8c3;
}
.notice-card.ally .notice-detail { color: #74e7c7; }

@media (max-width: 980px) {
  body:has(#meta:not([hidden])) .game-heading {
    top: 18px;
    right: 18px;
  }
  body:has(#meta:not([hidden])) .game-settings summary {
    width: 52px;
    min-height: 52px;
    padding: 0;
    font-size: 0;
  }
  body:has(#meta:not([hidden])) .game-settings summary span { font-size: 1.25rem; }
  .village-topbar {
    top: 14px;
    left: 14px;
    width: calc(100% - 88px);
    min-height: 70px;
    border-radius: 16px;
    padding: 7px 9px;
  }
  .village-topbar .profile-heading { min-width: 240px; padding-right: 10px; }
  .village-topbar .avatar-swatch { width: 48px; height: 48px; flex-basis: 48px; }
  .village-topbar .profile-copy h2 { font-size: 1.05rem; }
  .level-chip { min-width: 78px; padding: 7px 10px; font-size: .72rem; }
  .summary-item { padding: 7px 10px !important; }
  .summary-item b { font-size: 1rem; }
  .summary-item strong { font-size: .75rem; }
  .summary-item small { font-size: .6rem; }
}
@media (max-width: 650px) {
  body:has(#meta:not([hidden])) main { width: 100%; }
  .village-map-card { border-radius: 0; border-inline: 0; }
  .village-map { border-radius: 0; }
  .village-topbar {
    top: 8px;
    left: 8px;
    width: calc(100% - 62px);
    min-height: 58px;
    padding: 5px 7px;
    border-radius: 12px;
  }
  .village-topbar .profile-heading { min-width: 0; flex: 1; }
  .village-topbar .avatar-swatch { width: 36px; height: 36px; flex-basis: 36px; border-width: 3px; }
  .profile-copy { min-width: 0; }
  .village-topbar .profile-copy .eyebrow { font-size: .46rem; }
  .village-topbar .profile-copy h2 { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
  .level-chip { min-width: 58px; margin-left: 6px; padding: 5px 7px; border-radius: 9px; font-size: .58rem; }
  .campaign-summary { display: none; }
  .village-map-card > .notice-card {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    min-height: 62px;
    border-radius: 0;
    padding: 9px 11px;
  }
  .village-map-card > .notice-card::before { display: none; }
  .notice-icon { width: 36px; height: 36px; }
  .notice-detail { grid-column: 2; justify-self: start; padding-left: 0; font-size: .68rem; }
  .notice-arrow { grid-column: 3; grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 12px; }
}

/* Integrate village HUD directly over the map artwork */
.village-map-card > .map-heading {
  display: none !important;
}
.village-map-card .village-map {
  margin-top: 0 !important;
}
.village-map-card .village-map > img {
  display: block;
  margin: 0;
}
body:has(#meta:not([hidden])) .village-shell {
  padding-top: 0 !important;
}
body:has(#meta:not([hidden])) .village-topbar {
  position: absolute;
  z-index: 50;
  top: 18px;
  left: 26px;
}
body:has(#meta:not([hidden])) .game-heading {
  position: absolute;
  z-index: 55;
  top: 18px;
  right: 26px;
  left: auto;
  transform: none;
}
body:has(#meta:not([hidden])) .village-map-card {
  margin-top: 0;
}

/* Settings live inside the player HUD; back navigation owns the top-right slot */
body:has(#meta:not([hidden])) .game-heading {
  position: absolute;
  z-index: 65;
  top: 112px;
  right: 26px;
  left: auto;
  width: 340px;
  transform: none;
  pointer-events: none;
}
body:has(#meta:not([hidden])) .game-settings {
  pointer-events: none;
}
body:has(#meta:not([hidden])) .game-settings > summary {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  overflow: hidden;
  clip-path: inset(50%);
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
body:has(#meta:not([hidden])) .game-settings-panel {
  top: 0;
  right: 0;
  width: min(390px, calc(100vw - 30px));
  pointer-events: auto;
}
body:has(#game:not([hidden])) .game-heading {
  display: none !important;
}

.village-topbar {
  padding-right: 8px;
}
.player-settings-trigger {
  display: grid;
  place-items: center;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  margin-left: 6px;
  border: 0;
  border-radius: 15px;
  padding: 0;
  background-color: #0d1826;
  background-image: url("assets/ui/action-button-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  color: #dcecff;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.player-settings-trigger svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
}
.player-settings-trigger:hover,
.player-settings-trigger[aria-expanded="true"] {
  background-color: #1f1b1c;
  color: #ffd39b;
  filter: drop-shadow(0 0 6px rgba(245,163,87,.42));
  transform: rotate(5deg);
}
.player-settings-trigger:focus-visible {
  outline: 2px solid #8fc7ff;
  outline-offset: 2px;
}

.village-return {
  top: 18px !important;
  right: 26px !important;
  left: auto !important;
  z-index: 60;
}
.village-return button {
  min-width: 168px;
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  padding: 0 20px;
  background-color: #0d1623;
  background-image: url("assets/ui/nav-button-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 12px 32px rgba(0,0,0,.38);
  color: #f1f5fb;
  font-size: .86rem;
  font-weight: 850;
}
.village-return button:hover {
  color: #ffd697;
  filter: drop-shadow(0 0 7px rgba(245,163,87,.45));
}

@media (max-width: 980px) {
  .player-settings-trigger {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
  .player-settings-trigger svg { width: 24px; height: 24px; }
  .village-return {
    top: 14px !important;
    right: 14px !important;
  }
  .village-return button {
    min-width: 52px;
    min-height: 52px;
    width: 52px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }
  .village-return button::before {
    content: "←";
    font-size: 1.35rem;
  }
  body:has(#meta:not([hidden])) .game-heading {
    top: 78px;
    right: 14px;
  }
}
@media (max-width: 650px) {
  .player-settings-trigger {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    margin-left: 2px;
    border-radius: 10px;
  }
  .player-settings-trigger svg { width: 21px; height: 21px; }
  .village-return {
    top: 8px !important;
    right: 8px !important;
  }
  .village-return button {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    height: 42px;
    border-radius: 12px;
  }
  body:has(#meta:not([hidden])) .game-heading {
    top: 58px;
    right: 8px;
    width: min(340px, calc(100vw - 16px));
  }
}

/* Unified desktop stage: every game screen fills the viewport while preserving 16:9. */
@media (min-width: 981px) {
  body {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    overflow: hidden;
  }

  main,
  body:has(#meta:not([hidden])) main {
    width: min(100vw, calc(100dvh * 1.7777778));
    height: auto;
    max-height: 100dvh;
    aspect-ratio: 16 / 9;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(70, 145, 238, .42);
    border-radius: 22px;
    background: #06101e;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
  }

  #meta,
  #game {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  #meta { overflow: hidden; }

  #meta:has(.creator-card) {
    display: grid;
    place-items: center;
    padding: 24px;
  }

  .creator-card {
    margin: 0 auto;
  }

  .village-shell,
  .village-map-card,
  .location-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .village-map-card,
  .location-stage,
  #game {
    border: 0;
    border-radius: 21px;
    box-shadow: none;
  }

  .village-map-card .village-map {
    position: absolute;
    inset: 0;
    height: 100%;
    border-radius: 21px;
  }

  .village-map-card .village-map > img {
    width: 100%;
    height: 100%;
    object-fit: fill;
  }

  .village-map-card > .notice-card {
    position: absolute;
    right: 18px;
    bottom: 18px;
    left: 18px;
    width: auto;
    min-height: 72px;
    border-radius: 18px;
    box-shadow: 0 14px 42px rgba(0, 0, 0, .5);
  }

  .location-stage {
    background-position: center;
    background-size: cover;
  }

  .location-dojo .stage-options {
    width: 78%;
    max-height: calc(100% - 142px);
  }

  .location-dojo .stage-options .dojo-layout {
    grid-template-columns: minmax(340px, .88fr) minmax(480px, 1.32fr);
    align-items: start;
  }

  .dialogue-overlay {
    position: absolute;
    border-radius: inherit;
  }

  #game canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
  }
}

/* Keep the illustrated skin last so legacy blue panels cannot bleed through. */
:root {
  --ui-ink: #171310;
  --ui-paper: #27211c;
  --ui-paper-deep: #15110f;
  --ui-wood: #5b3825;
  --ui-rope: #b49568;
  --ui-crimson: #9b4038;
  --ui-gold: #dda052;
  --ui-text: #f1e6d3;
  --ui-muted: #b9aa96;
}

body {
  background: radial-gradient(circle at 20% 0%, rgba(126,54,36,.24), transparent 34rem), #100d0b;
}

.village-topbar {
  width: min(640px, calc(100% - 120px));
  min-height: 68px;
  padding: 9px 16px 10px 96px;
  border: 0;
  background-color: transparent;
  background-image: url("assets/ui/panel-frame.webp?v=0.20.0");
  background-repeat: no-repeat;
  box-shadow: none;
  backdrop-filter: none;
}

@media (min-width: 651px) {
  .village-topbar .profile-heading {
    min-width: 215px;
    gap: 10px;
    padding-right: 6px;
  }

  .village-topbar .avatar-swatch {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-width: 3px;
  }

  .village-topbar .profile-copy { min-width: 72px; }
  .village-topbar .profile-copy .eyebrow { font-size: .52rem; }
  .village-topbar .profile-copy h2 { font-size: 1.05rem; }

  .level-chip {
    margin-left: 6px;
    min-width: 72px;
    border-radius: 11px;
    padding: 6px 10px;
    font-size: .7rem;
  }

  .campaign-summary {
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

  .summary-item {
    column-gap: 7px;
    padding: 5px 7px !important;
  }

  .summary-item b { font-size: 1.05rem; }
  .summary-item strong { font-size: .75rem; }
  .summary-item small { font-size: .56rem; }

  .player-settings-trigger {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    margin-left: auto;
  }
}

@media (max-width: 650px) {
  .village-topbar {
    width: calc(100% - 62px);
    min-height: 58px;
    padding: 5px 7px 5px 50px;
  }
}

/* The settings sign drops from behind the illustrated HUD and retracts the same way. */
body:has(#meta:not([hidden])) .game-heading {
  z-index: 45;
  top: 76px;
  right: auto;
  left: 26px;
  width: min(640px, calc(100% - 120px));
}

body:has(#meta:not([hidden])) .game-settings-panel {
  top: 12px;
  right: 18px;
  left: auto;
  width: min(420px, calc(100vw - 52px));
  visibility: hidden;
  opacity: 0;
  transform: translateY(-88%);
  transform-origin: left top;
  pointer-events: none;
  will-change: transform, opacity;
}

body:has(#meta:not([hidden])) .game-settings[open]:not(.is-closing) .game-settings-panel {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  animation: settings-sign-in 320ms cubic-bezier(.2, .8, .2, 1) both;
  pointer-events: auto;
}

body:has(#meta:not([hidden])) .game-settings.is-closing .game-settings-panel {
  visibility: visible;
  animation: settings-sign-out 280ms cubic-bezier(.4, 0, .8, .2) both;
  pointer-events: none;
}

@keyframes settings-sign-in {
  from { opacity: 0; transform: translateY(-88%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes settings-sign-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-88%); }
}

@media (max-width: 650px) {
  body:has(#meta:not([hidden])) .game-heading {
    top: 58px;
    left: 8px;
    width: calc(100% - 62px);
  }

  body:has(#meta:not([hidden])) .game-settings-panel {
    right: 0;
    left: auto;
    width: min(360px, calc(100vw - 16px));
  }
}

@media (prefers-reduced-motion: reduce) {
  body:has(#meta:not([hidden])) .game-settings-panel {
    animation-duration: 1ms !important;
  }
}

.player-settings-trigger,
.notice-icon,
.notice-arrow,
.equipment-modal-heading button {
  border: 0;
  background-color: transparent;
  background-image: url("assets/ui/action-button-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  filter: none;
  transform: none;
  color: #ead9bf;
}

.primary-button,
.secondary-button,
.village-return button,
.mission-card button,
.npc-actions button,
.saga-back,
.attribute-list button {
  min-height: 46px;
  border: 0;
  border-radius: 5px;
  padding: 13px 28px;
  background-color: transparent;
  background-image: url("assets/ui/nav-button-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  filter: none;
  transform: none;
  color: #f0dfc6;
  text-shadow: 0 2px 3px #000;
}

.village-return button {
  min-width: 184px;
  min-height: 62px;
  padding: 13px 34px;
}

.gear-slot {
  border: 0;
  padding: 24% 20% 20% !important;
  background-color: transparent;
  background-image: url("assets/ui/equipment-slot-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  filter: none;
  transform: none;
}

.creator-card,
.dojo-card,
.stage-panel,
.dialogue-box,
.equipment-modal-card,
.game-settings-panel {
  border: 0;
  border-radius: 4px;
  padding: 34px 38px;
  background-color: transparent;
  background-image: url("assets/ui/panel-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  backdrop-filter: none;
  filter: none;
  color: var(--ui-text);
}

.dialogue-box.with-portrait {
  padding: 28px 38px 28px 0;
  background-color: transparent;
  background-image: url("assets/ui/panel-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  backdrop-filter: none;
}

.dojo-section,
.skill-tree,
.appearance-panel,
.affinity-selector {
  border-color: rgba(139,95,59,.5);
  background: rgba(24,19,16,.88);
}

.saga-card,
.mission-card,
.service-grid article,
.npc-guide-strip,
.village-map-card > .notice-card {
  border: 0;
  border-radius: 4px;
  background-color: transparent;
  background-image: url("assets/ui/card-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  color: var(--ui-text);
  box-shadow: none;
  backdrop-filter: none;
  filter: none;
}

.saga-card,
.saga-card:hover:not(:disabled) {
  min-height: 146px;
  padding: 28px 42px;
  background-color: transparent;
  background-image: url("assets/ui/card-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-color: transparent;
  box-shadow: none;
  filter: none;
  transform: none;
}

.player-settings-trigger:hover,
.player-settings-trigger[aria-expanded="true"],
.primary-button:hover,
.secondary-button:hover,
.village-return button:hover,
.mission-card button:hover,
.npc-actions button:hover,
.saga-back:hover,
.attribute-list button:hover,
.gear-slot:hover:not(:disabled),
.gear-slot:focus-visible {
  background-color: transparent;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: none;
  filter: none;
  transform: none;
}

.mission-card { min-height: 92px; padding: 20px 32px; }
.service-grid article, .npc-guide-strip { padding: 26px 34px; }
.village-map-card > .notice-card { padding: 18px 34px; }
.stage-panel.saga-selector { padding: 48px 48px 40px; }

.summary-item b,
.notice-detail,
.notice-card.ally .notice-detail {
  color: var(--ui-gold);
}

.player-settings-trigger:focus-visible,
button:focus-visible {
  outline-color: #d59a55;
}

.attribute-list button {
  display: grid;
  min-height: 56px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 11px 30px;
  text-align: center;
}

.attribute-list button small {
  display: block;
  line-height: 1.15;
}

.equipment-option,
.jutsu-card,
.affinity-slot,
.affinity-option,
.technique-slot,
.skill-node,
.archive-card li,
.stat-grid span,
.creator-form input,
.creator-form select,
.cosmetic-grid select,
.equipment-grid select {
  border-color: rgba(129,91,61,.56);
  background: rgba(29,24,20,.94);
  color: var(--ui-text);
}

.equipment-option,
.affinity-option,
.skill-node { padding: 13px 15px; }

.equipment-option:hover,
.equipment-option.selected,
.skill-node.selected,
.jutsu-card.selected {
  border-color: #bc7844;
  background: rgba(95,48,30,.55);
}

.affinity-slot.selected,
.technique-slot {
  border-color: rgba(156,119,72,.6);
  background: rgba(45,35,27,.9);
}

.equipment-modal { background: rgba(14,10,8,.84); }
.stage-options { scrollbar-color: #8d6041 #1a1512; }

@media (min-width: 981px) {
  main,
  body:has(#meta:not([hidden])) main {
    border-color: rgba(111,70,43,.72);
    background: #130f0c;
  }
}

@media (max-width: 650px) {
  .creator-card,
  .dojo-card,
  .stage-panel,
  .equipment-modal-card,
  .game-settings-panel { padding: 26px 22px; }
  .saga-card { padding: 24px 28px; }
  .mission-card { padding: 18px 24px; }
  .master-options { grid-template-columns: 1fr; }
}

.village-topbar .summary-item b,
.village-map-card .notice-detail,
.village-map-card .notice-card.ally .notice-detail {
  color: #dda052 !important;
}

/* Keep the HUD artwork and its content above the generic dojo-card skin. */
.village-topbar {
  padding: 9px 16px 10px 96px;
  background-color: transparent;
  background-image: url("assets/ui/panel-frame.webp?v=0.20.0");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

@media (max-width: 650px) {
  .village-topbar {
    padding: 5px 7px 5px 50px;
  }
}

/* Diario de misiones del HUD. */
.village-topbar .campaign-summary {
  grid-template-columns: repeat(2, minmax(72px, 1fr));
}

.mission-menu {
  position: relative;
  z-index: 72;
  flex: 0 0 auto;
}

.mission-menu-trigger {
  display: grid;
  grid-template-columns: 27px auto;
  align-items: center;
  gap: 7px;
  min-width: 98px;
  min-height: 40px;
  border: 1px solid rgba(221, 160, 82, .5);
  border-radius: 5px;
  padding: 5px 10px 5px 7px;
  background: rgba(26, 20, 15, .9);
  color: #f2e6d4;
  font-family: var(--font-display, "Cinzel", Georgia, serif);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.mission-menu-trigger:hover,
.mission-menu-trigger[aria-expanded="true"] {
  border-color: #f1aa55;
  background: rgba(57, 35, 18, .96);
  color: #fff4df;
}

.mission-menu-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: #e9963f;
}

.mission-menu-icon svg {
  width: 21px;
  height: 21px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mission-menu.has-unseen .mission-menu-icon {
  animation: mission-alert-pulse 1.05s ease-in-out infinite;
}

@keyframes mission-alert-pulse {
  0%, 100% { opacity: .58; filter: drop-shadow(0 0 0 rgba(242, 144, 43, 0)); transform: scale(.94); }
  50% { opacity: 1; filter: drop-shadow(0 0 7px rgba(255, 142, 38, .95)); transform: scale(1.08); }
}

.mission-menu-panel {
  position: absolute;
  z-index: 90;
  top: calc(100% + 11px);
  right: 0;
  width: min(390px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid rgba(221, 160, 82, .58);
  border-radius: 8px;
  background: linear-gradient(150deg, rgba(10, 18, 29, .99), rgba(4, 9, 17, .99));
  box-shadow: 0 24px 62px rgba(0, 0, 0, .72);
  color: #e7edf5;
}

.mission-menu-panel[hidden] { display: none; }

.mission-menu-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(221, 160, 82, .25);
  padding: 14px 16px;
  background: rgba(221, 160, 82, .07);
}

.mission-menu-panel > header div { display: grid; gap: 2px; }
.mission-menu-panel > header small { color: #e9963f; font-size: .6rem; font-weight: 800; letter-spacing: .16em; }
.mission-menu-panel > header strong { color: #fff4df; font-family: var(--font-display, "Cinzel", Georgia, serif); font-size: .94rem; }
.mission-menu-panel > header > span { display: grid; place-items: center; min-width: 28px; height: 28px; border: 1px solid rgba(221, 160, 82, .5); border-radius: 50%; color: #f0ae62; font-weight: 800; }

.mission-menu-list {
  display: grid;
  max-height: min(390px, calc(100dvh - 150px));
  overflow-y: auto;
  padding: 6px;
}

.mission-menu-item {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(126, 166, 200, .2);
  padding: 12px 13px;
  background: transparent;
  color: #dce7f1;
  text-align: left;
  cursor: pointer;
}

.mission-menu-item:hover,
.mission-menu-item:focus-visible { background: rgba(42, 91, 126, .24); outline: none; }
.mission-menu-item span { color: #e9963f; font-size: .58rem; font-weight: 800; letter-spacing: .12em; }
.mission-menu-item strong { color: #f5f8fb; font-family: var(--font-display, "Cinzel", Georgia, serif); font-size: .82rem; line-height: 1.25; }
.mission-menu-item small { color: #aebdce; font-size: .72rem; line-height: 1.35; }
.mission-menu-empty { margin: 0; padding: 20px 16px; color: #aebdce; font-size: .78rem; text-align: center; }

@media (max-width: 650px) {
  .mission-menu-trigger { min-width: 82px; padding-right: 7px; font-size: .57rem; }
  .mission-menu-panel { position: fixed; top: 72px; right: 8px; width: min(360px, calc(100vw - 16px)); }
}

@media (prefers-reduced-motion: reduce) {
  .mission-menu.has-unseen .mission-menu-icon { animation: none; filter: drop-shadow(0 0 6px rgba(255, 142, 38, .9)); }
}

/* Barra inferior: historia visible y encargos secundarios desplegables. */
.village-topbar .campaign-summary {
  grid-template-columns: repeat(3, minmax(72px, 1fr));
}

.mission-dock {
  position: absolute;
  z-index: 24;
  right: 18px;
  bottom: 14px;
  width: min(720px, calc(100% - 36px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: stretch;
  gap: 8px;
  min-height: 36px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #dce7f1;
}

.story-mission-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgba(91, 158, 204, .4);
  border-radius: 5px;
  padding: 4px 11px;
  background: rgba(3, 13, 25, .68);
  box-shadow: 0 9px 26px rgba(0, 0, 0, .36);
  backdrop-filter: blur(5px);
}

.story-mission-current strong {
  min-width: 0;
  overflow: hidden;
  color: #fff4df;
  font-family: var(--font-display, "Cinzel", Georgia, serif);
  font-size: .72rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-mission-current span {
  color: #f09a3e;
  font-size: .57rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.secondary-mission-menu {
  position: relative;
  z-index: 2;
  display: grid;
  padding: 0;
}

.secondary-mission-trigger {
  display: grid;
  grid-template-columns: 26px;
  justify-content: center;
  align-items: center;
  width: 38px;
  min-width: 38px;
  border: 1px solid rgba(105, 183, 225, .48);
  border-radius: 5px;
  padding: 3px 5px;
  background: rgba(7, 27, 45, .72);
  color: #e6f1f8;
  box-shadow: 0 9px 26px rgba(0, 0, 0, .36);
  backdrop-filter: blur(5px);
  cursor: pointer;
}

.secondary-mission-trigger:hover,
.secondary-mission-trigger[aria-expanded="true"] {
  border-color: #91d6f8;
  background: rgba(17, 61, 91, .98);
}

.mission-target-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #dbeaf3;
}

.mission-target-icon svg {
  width: 23px;
  height: 23px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.secondary-mission-menu.has-unseen .mission-target-icon {
  color: #f09a3e;
  animation: mission-target-pulse 1.05s ease-in-out infinite;
}

@keyframes mission-target-pulse {
  0%, 100% { opacity: .58; filter: drop-shadow(0 0 0 rgba(242, 144, 43, 0)); transform: scale(.94); }
  50% { opacity: 1; filter: drop-shadow(0 0 8px rgba(255, 142, 38, .98)); transform: scale(1.08); }
}

.secondary-mission-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(390px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid rgba(221, 160, 82, .58);
  border-radius: 8px;
  background: linear-gradient(150deg, rgba(10, 18, 29, .99), rgba(4, 9, 17, .99));
  box-shadow: 0 24px 62px rgba(0, 0, 0, .72);
  color: #e7edf5;
}

.secondary-mission-panel[hidden] { display: none; }
.secondary-mission-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(221, 160, 82, .25); padding: 14px 16px; background: rgba(221, 160, 82, .07); }
.secondary-mission-panel > header div { display: grid; gap: 2px; }
.secondary-mission-panel > header small { color: #e9963f; font-size: .6rem; font-weight: 800; letter-spacing: .16em; }
.secondary-mission-panel > header strong { color: #fff4df; font-family: var(--font-display, "Cinzel", Georgia, serif); font-size: .94rem; }
.secondary-mission-panel > header > span { display: grid; place-items: center; min-width: 28px; height: 28px; border: 1px solid rgba(221, 160, 82, .5); border-radius: 50%; color: #f0ae62; font-weight: 800; }

.secondary-mission-list { display: grid; max-height: min(390px, calc(100dvh - 190px)); overflow-y: auto; padding: 6px; }
.secondary-mission-item { display: grid; gap: 3px; width: 100%; border: 0; border-bottom: 1px solid rgba(126, 166, 200, .2); padding: 12px 13px; background: transparent; color: #dce7f1; text-align: left; cursor: pointer; }
.secondary-mission-item:hover,
.secondary-mission-item:focus-visible { background: rgba(42, 91, 126, .24); outline: none; }
.secondary-mission-item span { color: #e9963f; font-size: .58rem; font-weight: 800; letter-spacing: .12em; }
.secondary-mission-item strong { color: #f5f8fb; font-family: var(--font-display, "Cinzel", Georgia, serif); font-size: .82rem; line-height: 1.25; }
.secondary-mission-item small { color: #aebdce; font-size: .72rem; line-height: 1.35; }
.secondary-mission-item .mission-destination { color: #f09a3e; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.secondary-mission-empty { margin: 0; padding: 20px 16px; color: #aebdce; font-size: .78rem; text-align: center; }

@media (max-width: 650px) {
  .mission-dock { right: 8px; bottom: 8px; width: calc(100% - 16px); min-height: 34px; grid-template-columns: minmax(0, 1fr) 36px; gap: 5px; }
  .story-mission-current { padding: 4px 9px; }
  .story-mission-current strong { font-size: .68rem; }
  .story-mission-current span { font-size: .52rem; }
  .secondary-mission-trigger { width: 36px; min-width: 36px; padding: 3px 5px; }
  .secondary-mission-panel { position: fixed; right: 8px; bottom: 50px; width: min(360px, calc(100vw - 16px)); }
}

@media (prefers-reduced-motion: reduce) {
  .secondary-mission-menu.has-unseen .mission-target-icon { animation: none; filter: drop-shadow(0 0 6px rgba(255, 142, 38, .9)); }
}

#meta:has(.debug-screen) {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(94,205,255,.62) rgba(3,13,25,.86);
  scrollbar-gutter: stable;
}
.village-shell:has(.debug-screen) { display: flow-root; min-height: 100%; }
.debug-screen { width: calc(100% - 44px); max-width: 1396px; margin: 126px auto 28px; border: 1px solid rgba(94,205,255,.4); border-radius: 10px; padding: clamp(14px, 1.6vw, 20px); background: rgba(3,13,25,.96); box-shadow: 0 22px 70px rgba(0,0,0,.52); color: #eaf4fb; }
.debug-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; border-bottom: 1px solid rgba(94,205,255,.2); padding-bottom: 16px; }
.debug-heading h2, .debug-section h3 { margin: 3px 0 6px; }
.debug-heading p:not(.eyebrow), .debug-section > p { margin: 0; color: #a9bdca; }
.debug-release-warning { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; border: 1px solid rgba(255,174,83,.58); border-radius: 7px; padding: 10px 13px; background: rgba(73,38,8,.72); color: #ffe5b3; }
.debug-release-warning strong { color: #ffbe70; font-size: .66rem; letter-spacing: .1em; white-space: nowrap; }
.debug-release-warning span { font-size: .72rem; line-height: 1.35; }
.debug-status { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.debug-flag, .debug-choice { border: 1px solid rgba(137,157,174,.28); border-radius: 999px; padding: 5px 9px; background: rgba(13,27,41,.88); color: #8fa5b4; font-size: .67rem; font-weight: 800; }
.debug-flag.enabled { border-color: rgba(103,232,195,.5); color: #a9f5db; }
.debug-choice { border-color: rgba(240,184,92,.5); color: #f4cc88; }
.debug-section { margin-top: 14px; border: 1px solid rgba(115,178,219,.2); border-radius: 8px; padding: 15px; background: rgba(7,20,34,.72); }
.debug-checkpoints { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.debug-checkpoint, .debug-location-grid button, .debug-decision-grid button { border: 1px solid rgba(85,201,255,.42); border-radius: 6px; padding: 11px; background: rgba(9,54,78,.55); color: #e8f7ff; cursor: pointer; text-align: left; }
.debug-checkpoint:hover, .debug-location-grid button:hover, .debug-decision-grid button:hover { border-color: #7ed8ff; background: rgba(18,91,127,.7); }
.debug-checkpoint strong, .debug-checkpoint small { display: block; }
.debug-checkpoint small { margin-top: 5px; color: #a9bdca; line-height: 1.35; }
.debug-location-grid, .debug-decision-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.debug-location-grid button, .debug-decision-grid button { min-width: 120px; text-align: center; font-size: .68rem; font-weight: 850; letter-spacing: .05em; }
.debug-mission-list { display: grid; gap: 7px; margin-top: 13px; }
.debug-mission { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid rgba(115,178,219,.18); border-radius: 7px; padding: 9px 11px; background: rgba(2,12,22,.72); }
.debug-mission > span { color: #f0b85c; font-family: Cinzel, serif; font-weight: 800; }
.debug-mission strong, .debug-mission small { display: block; }
.debug-mission small { margin-top: 3px; color: #8fa5b4; }
.debug-mission.completed { border-left: 3px solid #67e8c3; }
.debug-mission button { border: 1px solid rgba(85,201,255,.55); border-radius: 5px; padding: 8px 11px; background: rgba(9,54,78,.68); color: #dcf4ff; font-size: .64rem; font-weight: 850; cursor: pointer; }
.debug-mission button:disabled { cursor: not-allowed; opacity: .45; }

@media (max-width: 900px) {
  .debug-checkpoints { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .debug-heading { display: grid; }
  .debug-release-warning { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (max-width: 620px) {
  .debug-screen { width: calc(100% - 24px); margin: 112px auto 12px; padding: 13px; }
  .debug-checkpoints { grid-template-columns: 1fr; }
  .debug-mission { grid-template-columns: 32px 1fr; }
  .debug-mission button { grid-column: 1 / -1; }
}

/* Estadísticas de combate: una sola lectura visual para personaje y balance. */
.attribute-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.attribute-heading span { color: var(--ui-gold, #f5a357); font-size: .72rem; white-space: nowrap; }
.stat-radar-wrap { display: grid; gap: 12px; }
.stat-radar { width: min(100%, 300px); margin: 0 auto; }
.stat-radar svg { display: block; width: 100%; height: auto; overflow: visible; }
.radar-grid polygon { fill: rgba(46, 98, 129, .055); stroke: rgba(115, 184, 222, .29); stroke-width: 1; vector-effect: non-scaling-stroke; }
.radar-grid polygon:last-of-type { fill: rgba(8, 21, 34, .5); stroke: rgba(111, 203, 244, .52); }
.radar-grid line { stroke: rgba(115, 184, 222, .24); stroke-width: 1; vector-effect: non-scaling-stroke; }
.radar-area { fill: rgba(66, 211, 183, .27); stroke: #6fe5c8; stroke-width: 2.2; filter: drop-shadow(0 0 5px rgba(74, 222, 192, .3)); vector-effect: non-scaling-stroke; transition: points .2s ease; }
.radar-dot { fill: #d9fff5; stroke: #42d3b7; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.radar-axis-label { fill: #b8c9d6; font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.stat-readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.stat-readout { display: grid; grid-template-columns: 1fr auto; align-items: center; min-width: 0; border: 1px solid rgba(105, 174, 211, .24); border-radius: 6px; padding: 8px 10px; background: rgba(5, 17, 29, .78); }
.stat-readout small { color: #aebdca; font-size: .66rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.stat-readout strong { grid-row: 1 / span 2; grid-column: 2; margin-left: 8px; color: #fff7e8; font-size: 1.15rem; line-height: 1; }
.stat-readout em { color: #8194a3; font-size: .59rem; font-style: normal; }
.stat-readout.positive em { color: #6fe5c8; }
.stat-readout.negative em { color: #ff9b8d; }
.attribute-list.radar-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.attribute-list.radar-controls button { min-height: 49px; align-content: center; justify-items: stretch; padding: 8px 12px; text-align: left; }
.attribute-list.radar-controls button > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.attribute-list.radar-controls strong { color: #f0dfc6; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
.attribute-list.radar-controls b { display: grid; min-width: 21px; height: 21px; place-items: center; border: 1px solid rgba(104, 205, 243, .45); border-radius: 50%; color: #8bdcff; font-size: .66rem; }
.attribute-list.radar-controls small { color: #99aabc; font-size: .57rem; }

@media (max-width: 650px) {
  .stat-radar { width: min(100%, 280px); }
  .stat-readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-readout:last-child { grid-column: 1 / -1; }
  .attribute-list.radar-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attribute-list.radar-controls button:last-child { grid-column: 1 / -1; }
}

/* Dojo: vista de configuración con técnicas, detalle y puntos siempre visibles. */
.location-dojo .stage-character,
.location-dojo .stage-speech,
.location-dojo .stage-ambient { display: none !important; }
.location-dojo .stage-options {
  width: min(calc(100% - 36px), 1280px);
  max-height: calc(100% - 28px);
  margin: 14px auto;
  border: 1px solid rgba(95, 162, 197, .48);
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(3, 16, 30, .97), rgba(4, 12, 23, .96));
  box-shadow: 0 22px 70px rgba(0, 0, 0, .58), inset 0 0 32px rgba(37, 119, 164, .08);
}
.dojo-layout.dojo-rework { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.dojo-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; }
.dojo-title { display: flex; min-width: 0; align-items: center; gap: 13px; }
.dojo-title-mark { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(240, 184, 92, .58); border-radius: 50%; color: #f0b85c; font-size: 1.8rem; text-shadow: 0 0 14px rgba(240, 184, 92, .6); }
.dojo-title .eyebrow { margin: 0 0 3px; color: #f0d6a3; font: 700 clamp(1rem, 2.1vw, 1.65rem) "Cinzel", Georgia, serif; letter-spacing: .025em; }
.dojo-title h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.dojo-title small { color: #92a8ba; font-size: .72rem; }
.dojo-level { display: grid; min-width: 110px; gap: 4px; color: #f1c476; font-size: .65rem; text-align: right; }
.dojo-level span { color: #9db1c2; }
.dojo-level i { height: 5px; overflow: hidden; border-radius: 99px; background: #142337; }
.dojo-level i b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #43cce8, #f0b85c); }
.dojo-tabs { display: flex; align-self: stretch; gap: 4px; border-bottom: 1px solid rgba(89, 139, 166, .32); }
.dojo-tabs [role="tab"] { display: inline-flex; min-width: 104px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 9px 13px; background: transparent; color: #9db0c2; font-size: .76rem; font-weight: 800; cursor: pointer; }
.dojo-tabs [role="tab"][aria-selected="true"] { border-color: rgba(65, 202, 231, .52); background: linear-gradient(180deg, rgba(22, 103, 131, .24), rgba(7, 29, 47, .22)); color: #d8f9ff; box-shadow: 0 0 15px rgba(43, 197, 230, .14), inset 0 -2px #39c5e1; }
.dojo-main-panel { min-width: 0; min-height: 340px; border: 1px solid rgba(73, 130, 162, .38); border-radius: 9px; padding: 13px; background: rgba(3, 13, 24, .64); }
.dojo-tab-panel[hidden] { display: none; }
.location-dojo .equipment-columns { display: grid; height: 100%; min-height: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 12px; }
.location-dojo .equipment-column { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; align-content: stretch; gap: 0; margin-top: 0; padding: 12px; }
.location-dojo .equipment-column .dojo-section-heading { min-height: 62px; align-items: flex-start; }
.location-dojo .equipment-column .dojo-section-heading > span { flex: 0 0 auto; }
.location-dojo .equipment-columns .affinity-slots,
.location-dojo .equipment-columns .equipment-grid { display: grid; grid-template-columns: 1fr; align-content: start; gap: 8px; }
.location-dojo .equipment-columns .affinity-slot { grid-template-columns: 24px 34px minmax(0, 1fr) auto; min-height: 82px; border: 1px solid rgba(87, 139, 174, .34); border-radius: 7px; padding: 10px; background: rgba(6, 19, 32, .72); }
.location-dojo .equipment-columns .affinity-slot:first-child { border-left: 1px solid rgba(87, 139, 174, .34); }
.location-dojo .equipment-columns .affinity-slot.empty,
.location-dojo .equipment-columns .affinity-slot.locked { grid-template-columns: 24px minmax(0, 1fr) auto; }
.location-dojo .equipment-columns .affinity-slot.selected { border-color: rgba(103, 232, 195, .46); background: linear-gradient(90deg, rgba(30, 108, 111, .2), rgba(6, 19, 32, .72)); }
.location-dojo .equipment-columns .affinity-change-note { margin-top: 10px; }
.location-dojo .equipment-columns .gear-slot { grid-template-columns: 46px minmax(0, 1fr); min-height: 82px; aspect-ratio: auto; align-content: center; justify-items: start; gap: 10px !important; border: 1px solid rgba(87, 139, 174, .34); border-radius: 7px; padding: 10px 34px 10px 10px !important; background: rgba(6, 19, 32, .72); background-image: none; color: #e9eef5; text-align: left; box-shadow: none; filter: none; }
.location-dojo .equipment-columns .gear-slot:hover:not(:disabled),
.location-dojo .equipment-columns .gear-slot:focus-visible { border-color: #70cdec; background: linear-gradient(90deg, rgba(25, 83, 117, .34), rgba(6, 19, 32, .78)); filter: none; transform: none; }
.location-dojo .equipment-columns .gear-icon { width: 42px; height: 42px; }
.location-dojo .equipment-columns .gear-copy { text-align: left; }
.location-dojo .equipment-columns .companion-slot { border-style: dashed; opacity: .58; }
.location-dojo .equipment-columns .companion-slot .gear-icon { color: #7891a3; }
.master-summary-card { position: relative; display: block; isolation: isolate; overflow: hidden; height: 100%; min-width: 0; min-height: 280px; border: 1px solid rgba(89, 164, 200, .48); border-radius: 10px; padding: 0; background: radial-gradient(circle at 50% 27%, rgba(38, 119, 155, .28), transparent 58%), rgba(6, 19, 32, .9); color: #e7eef3; text-align: left; cursor: pointer; }
.master-summary-card:hover, .master-summary-card:focus-visible { outline: none; border-color: #70d1ee; box-shadow: 0 0 0 1px rgba(112, 209, 238, .18), inset 0 0 34px rgba(47, 172, 211, .14); }
.master-summary-card img { position: absolute; z-index: 0; top: -2%; left: 50%; width: 128%; height: 152%; max-width: none; object-fit: contain; object-position: center top; transform: translateX(-50%); filter: drop-shadow(0 14px 20px rgba(0, 0, 0, .34)); transition: transform 240ms ease, filter 240ms ease; }
.master-summary-card:hover img, .master-summary-card:focus-visible img { transform: translateX(-50%) scale(1.025); filter: drop-shadow(0 17px 24px rgba(0, 0, 0, .42)) saturate(1.06); }
.master-summary-card > span { position: absolute; z-index: 2; inset: auto 0 0; display: grid; min-width: 0; align-content: end; gap: 5px; padding: 68px 18px 40px; background: linear-gradient(180deg, rgba(3, 13, 24, 0) 0%, rgba(3, 13, 24, .42) 34%, rgba(3, 13, 24, .88) 70%, rgba(3, 13, 24, .98) 100%); text-shadow: 0 2px 7px rgba(0, 0, 0, .78); }
.master-summary-card > span::before { content: ""; position: absolute; z-index: -1; inset: 30% 0 0; background: rgba(5, 17, 29, .08); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-mask-image: linear-gradient(180deg, transparent, #000 46%); mask-image: linear-gradient(180deg, transparent, #000 46%); pointer-events: none; }
.master-summary-card small { color: #8de1fa; font-size: .68rem; font-weight: 900; letter-spacing: .1em; }
.master-summary-card strong { color: #fff3df; font: 700 1.18rem "Cinzel", Georgia, serif; line-height: 1.1; }
.master-summary-card .master-role { color: #c3d3dd; font-size: .74rem; font-weight: 700; }
.master-summary-card em { color: #91e3f6; font-size: .72rem; font-style: normal; font-weight: 850; text-transform: uppercase; }
.master-summary-card p { max-width: 34ch; margin: 3px 0 0; color: #bdcbd4; font-size: .72rem; line-height: 1.4; }
.master-summary-card > b { position: absolute; z-index: 3; right: 14px; bottom: 12px; color: #f4c878; font-size: .62rem; letter-spacing: .07em; text-shadow: 0 2px 6px rgba(0, 0, 0, .92); }
.master-modal-card { width: min(820px, 100%); }
.master-modal-note { margin: -2px 0 14px; color: #91a6b7; font-size: .65rem; }
.master-modal-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.master-modal-options .master-option { min-height: 120px; }
.master-modal-options .master-option img { width: 70px; height: 94px; }
.statistics-layout { display: grid; height: 100%; min-height: 0; grid-template-columns: minmax(300px, .72fr) minmax(520px, 1.28fr); align-items: stretch; gap: 14px; }
.statistics-character-preview { width: 100%; min-height: 0; height: 100%; aspect-ratio: auto; overflow: hidden; border-color: rgba(88, 195, 230, .38); border-radius: 7px; background: radial-gradient(circle at 50% 38%, rgba(55, 164, 204, .18), transparent 52%), linear-gradient(180deg, rgba(9, 34, 53, .88), rgba(3, 12, 22, .92)); }
.statistics-character-preview .puppet-preview-rig { width: auto; height: min(calc(100% - 28px), 520px); }
.statistics-content { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr); align-content: stretch; gap: 10px; }
.statistics-layout .attribute-distribution { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.statistics-layout .attribute-card:last-child { grid-column: 1 / -1; }
.statistics-radar-card { display: grid; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid rgba(82, 151, 187, .32); border-radius: 9px; background: radial-gradient(circle at 25% 50%, rgba(36, 113, 145, .18), transparent 44%), rgba(5, 18, 30, .82); }
.statistics-layout .stat-radar-wrap { grid-template-columns: minmax(260px, .9fr) minmax(280px, 1.1fr); align-items: center; gap: 0; }
.statistics-layout .stat-radar { width: min(100%, 230px); padding: 2px 8px 3px; }
.statistics-layout .stat-readouts { align-content: center; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; border-left: 1px solid rgba(82, 151, 187, .18); padding: 5px; }
.statistics-layout .stat-readout { padding: 5px 7px; }
.statistics-layout .stat-readout:last-child { grid-column: 1 / -1; }
.xenoverse-appearance { display: grid; height: 100%; min-height: 0; grid-template-rows: auto minmax(0, 1fr); margin-top: 0; overflow: hidden; background: radial-gradient(circle at 22% 48%, rgba(36, 132, 174, .2), transparent 36%), linear-gradient(135deg, rgba(5, 20, 35, .96), rgba(7, 14, 25, .94)); }
.appearance-customizer { display: grid; min-height: 0; grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr); align-items: stretch; gap: 18px; padding: 4px 14px 14px; }
.xenoverse-appearance .character-preview { width: 100%; min-height: 0; height: 100%; aspect-ratio: auto; overflow: hidden; border-color: rgba(88, 195, 230, .38); background: radial-gradient(circle at 50% 38%, rgba(55, 164, 204, .18), transparent 52%), linear-gradient(180deg, rgba(9, 34, 53, .88), rgba(3, 12, 22, .92)); }
.raster-character-stage { position: absolute; inset: 0; overflow: hidden; }
.raster-character-stage::before { content: ""; position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(81, 182, 218, .2) 1px, transparent 1px), linear-gradient(90deg, rgba(81, 182, 218, .2) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, black, transparent 80%); }
.raster-character-aura { position: absolute; top: 42%; left: 50%; width: 78%; aspect-ratio: 1; border: 1px solid rgba(95, 213, 242, .3); border-radius: 50%; background: radial-gradient(circle, rgba(61, 194, 229, .16), transparent 67%); box-shadow: 0 0 42px rgba(38, 161, 207, .2), inset 0 0 32px rgba(77, 202, 235, .12); transform: translate(-50%, -50%); }
.puppet-preview-rig { position: absolute; top: 50%; left: 50%; width: auto; height: min(calc(100% - 28px), 500px); aspect-ratio: 11 / 16; transform: translate(-50%, -50%); }
.puppet-preview-layer { position: absolute; z-index: var(--puppet-z); top: var(--puppet-y); left: var(--puppet-x); display: block; width: var(--puppet-w); height: var(--puppet-h); object-fit: contain; transform: translate(-50%, -50%) rotate(var(--puppet-rotation, 0deg)); pointer-events: none; user-select: none; }
.cosmetic-menu { display: grid; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; padding: 3px 6px 3px 3px; }
.cosmetic-control { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(160px, 1.2fr); align-items: center; gap: 4px 12px; border: 1px solid rgba(78, 137, 170, .36); border-radius: 7px; padding: 10px 11px; background: linear-gradient(90deg, rgba(10, 35, 54, .92), rgba(8, 19, 32, .88)); transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.cosmetic-control:hover, .cosmetic-control:focus-within { border-color: rgba(93, 211, 242, .7); background: linear-gradient(90deg, rgba(14, 61, 84, .94), rgba(8, 23, 39, .92)); transform: translateX(-3px); }
.cosmetic-control.unavailable { border-style: dashed; opacity: .58; }
.cosmetic-control.unavailable:hover, .cosmetic-control.unavailable:focus-within { border-color: rgba(78, 137, 170, .36); background: linear-gradient(90deg, rgba(10, 35, 54, .92), rgba(8, 19, 32, .88)); transform: none; }
.cosmetic-label { color: #e7edf1; font-size: .72rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.cosmetic-outfit-control { width: 100%; min-height: 68px; color: inherit; text-align: left; cursor: not-allowed; }
.cosmetic-lock-state { display: flex; min-height: 32px; align-items: center; justify-content: center; gap: 7px; color: #8ba0ae; font: 800 .68rem "Cinzel", Georgia, serif; letter-spacing: .06em; }
.cosmetic-lock-state b { color: #67808e; font-size: .9rem; }
.cosmetic-stepper { display: grid; grid-template-columns: 34px minmax(92px, 1fr) 34px; align-items: center; gap: 5px; }
.cosmetic-stepper button { display: grid; width: 34px; height: 32px; place-items: center; border: 1px solid rgba(91, 194, 226, .42); border-radius: 5px; background: rgba(8, 45, 66, .84); color: #bceeff; font-size: 1.25rem; cursor: pointer; }
.cosmetic-stepper button:hover, .cosmetic-stepper button:focus-visible { outline: none; border-color: #70dcfa; background: rgba(17, 93, 125, .9); color: #fff; }
.cosmetic-stepper button:disabled { border-color: rgba(87, 116, 132, .28); background: rgba(8, 22, 32, .62); color: #607888; cursor: not-allowed; }
.cosmetic-stepper output { min-width: 0; color: #f4c676; font: 800 .76rem "Cinzel", Georgia, serif; letter-spacing: .08em; text-align: center; white-space: nowrap; }
.cosmetic-stepper output:has(.teleport-object-preview) { display: flex; align-items: center; justify-content: center; gap: 6px; letter-spacing: 0; }
.teleport-object-preview { width: 30px; height: 30px; object-fit: contain; }
.cosmetic-control > small { grid-column: 2; color: #83a8bc; font-size: .58rem; text-align: center; }
.dojo-technique-layout { display: grid; height: 100%; min-height: 0; grid-template-columns: minmax(240px, .76fr) minmax(0, 1.42fr); align-items: stretch; gap: 13px; }
.technique-detail-wrap { height: 100%; min-height: 0; }
.technique-detail { display: grid; height: 100%; min-height: 0; align-content: stretch; gap: 9px; border: 1px solid color-mix(in srgb, var(--technique-color, #55c9ff) 42%, #27394b); border-radius: 10px; padding: 13px; background: linear-gradient(150deg, rgba(14, 27, 40, .96), rgba(5, 12, 21, .96)); }
.technique-detail:not(.empty) { grid-template-rows: auto auto auto minmax(120px, 1fr) auto auto auto auto auto; }
.technique-detail .eyebrow { margin: 0; color: var(--technique-color, #83d8ff); font-size: .57rem; letter-spacing: .12em; }
.technique-detail h3 { margin: 0; color: #f2e7d2; font: 700 1.12rem "Cinzel", Georgia, serif; text-transform: uppercase; }
.technique-affinity { display: flex; gap: 7px; }
.technique-affinity span { border: 1px solid color-mix(in srgb, var(--technique-color, #55c9ff) 44%, transparent); border-radius: 5px; padding: 3px 7px; background: color-mix(in srgb, var(--technique-color, #55c9ff) 12%, transparent); color: #d8e5ec; font-size: .57rem; font-weight: 800; }
.technique-art-placeholder { display: grid; min-height: 120px; place-items: center; align-content: center; gap: 7px; border: 1px solid color-mix(in srgb, var(--technique-color, #55c9ff) 54%, #293746); border-radius: 7px; background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--technique-color, #55c9ff) 48%, transparent), transparent 55%), linear-gradient(135deg, color-mix(in srgb, var(--technique-color, #55c9ff) 43%, #07101b), color-mix(in srgb, var(--technique-color, #55c9ff) 14%, #101725)); color: #fff; }
.technique-art-placeholder span { font: 700 3rem "Cinzel", Georgia, serif; text-shadow: 0 2px 16px #000; }
.technique-art-placeholder small { color: rgba(255, 255, 255, .78); font-size: .58rem; font-weight: 900; letter-spacing: .14em; }
.technique-description { margin: 0; color: #aebdca; font-size: .66rem; line-height: 1.4; }
.technique-description strong { color: #d9eaf2; }
.technique-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.technique-metrics div { display: grid; gap: 2px; border: 1px solid rgba(83, 126, 154, .32); border-radius: 6px; padding: 7px; background: rgba(9, 23, 36, .72); }
.technique-metrics strong { color: #e9f3f6; font-size: .78rem; }
.technique-metrics small { color: #8ca2b2; font-size: .49rem; font-weight: 850; letter-spacing: .08em; }
.technique-accuracy { margin: 0; color: #91a9bb; font-size: .57rem; }
.technique-equip-button, .technique-upgrade-button { display: grid; width: 100%; gap: 3px; border: 1px solid rgba(240, 184, 92, .5); border-radius: 6px; padding: 9px; background: linear-gradient(120deg, rgba(143, 85, 28, .35), rgba(56, 39, 26, .42)); color: #f7d496; font-size: .62rem; font-weight: 900; letter-spacing: .04em; cursor: pointer; }
.technique-equip-button:disabled, .technique-upgrade-button:disabled { border-color: rgba(102, 123, 143, .28); background: rgba(19, 29, 40, .72); color: #718296; cursor: not-allowed; }
.technique-upgrade-button { border-color: rgba(102, 123, 143, .28); background: rgba(11, 21, 32, .65); color: #8695a6; }
.technique-upgrade-button small { font-size: .49rem; font-weight: 600; text-transform: none; }
.skill-tree { min-width: 0; margin: 0; border-color: rgba(70, 120, 150, .4); padding: 12px; }
.skill-tree-heading { align-items: center; }
.skill-tree-heading h3 { color: #e7d5b7; font: 700 .9rem "Cinzel", Georgia, serif; letter-spacing: .04em; }
.tree-status { display: grid; justify-items: end; gap: 5px; }
.dojo-equipped-count { color: #f0c476; font-size: .59rem; white-space: nowrap; }
.tree-legend { font-size: .52rem; }
.tree-legend i:nth-of-type(2) { background: #f39b58; }
.tree-legend i:nth-of-type(3) { background: #4a5668; }
.skill-branches { gap: 12px; }
.skill-branch { grid-template-columns: 92px minmax(0, 1fr); gap: 7px; }
.skill-branch > header { display: grid; justify-items: center; align-content: center; text-align: center; }
.skill-branch > header img { width: 29px; height: 29px; }
.skill-branch > header strong { font-size: .57rem; }
.skill-path { grid-auto-columns: minmax(102px, 1fr); gap: 9px; align-items: center; }
.skill-node { grid-template-columns: 23px minmax(0, 1fr); min-width: 102px; min-height: 70px; color: #e3ebf0; text-align: left; }
.skill-node:hover:not(.locked), .skill-node:focus-visible { outline: none; border-color: color-mix(in srgb, var(--branch-color) 75%, white); }
.skill-node.focused { border-color: var(--branch-color); box-shadow: 0 0 14px color-mix(in srgb, var(--branch-color) 28%, transparent); }
.skill-node.equipped .skill-step { background: color-mix(in srgb, var(--branch-color) 24%, #0b1420); color: #e9faff; }
.skill-node.locked { opacity: .52; }
.dojo-attributes { border: 1px solid rgba(73, 130, 162, .38); border-radius: 9px; padding: 11px 13px; background: rgba(3, 13, 24, .78); }
.dojo-attributes > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.dojo-attributes .eyebrow { margin: 0 0 3px; color: #f0c476; font: 700 .77rem "Cinzel", Georgia, serif; }
.dojo-attributes > header small { color: #8da1b4; font-size: .58rem; }
.dojo-attribute-actions { display: flex; align-items: center; gap: 8px; }
.dojo-attribute-actions > strong { border: 1px solid rgba(240, 184, 92, .44); border-radius: 6px; padding: 7px 10px; color: #f3c476; font-size: .6rem; white-space: nowrap; }
.dojo-attribute-actions > strong b { font-size: .95rem; }
.attribute-distribution { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.attribute-card { --attribute-color: #56cce7; display: grid; min-width: 0; gap: 7px; border: 1px solid color-mix(in srgb, var(--attribute-color) 30%, #25364a); border-radius: 7px; padding: 8px; background: linear-gradient(145deg, rgba(10, 25, 39, .9), rgba(5, 14, 24, .9)); }
.attribute-card.strength { --attribute-color: #ff9654; }
.attribute-card.speed { --attribute-color: #57cce4; }
.attribute-card.chakra { --attribute-color: #b77aea; }
.attribute-card.luck { --attribute-color: #65dc9a; }
.attribute-card header { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.attribute-icon { color: var(--attribute-color); font-size: 1rem; text-align: center; }
.attribute-card header > span:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.attribute-card header strong { color: #dce8ef; font-size: .61rem; text-transform: uppercase; }
.attribute-card header small { overflow: hidden; color: #8a9daf; font-size: .47rem; text-overflow: ellipsis; white-space: nowrap; }
.attribute-card.positive header small { color: #7ce0b2; }
.attribute-card.negative header small { color: #ff9d8d; }
.attribute-card header > b { color: #f2f4f5; font-size: .95rem; }
.attribute-meter { height: 9px; overflow: hidden; border: 1px solid rgba(129, 164, 187, .2); border-radius: 4px; background: repeating-linear-gradient(90deg, #142538 0 12px, #0b1725 12px 15px); }
.attribute-meter span { display: block; width: var(--attribute-fill); height: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--attribute-color) 68%, #164b6b), var(--attribute-color)); box-shadow: 0 0 9px color-mix(in srgb, var(--attribute-color) 35%, transparent); }
.attribute-card footer { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 4px; }
.attribute-card footer small { overflow: hidden; color: #8295a8; font-size: .46rem; text-overflow: ellipsis; white-space: nowrap; }
.attribute-card footer button { display: grid; flex: 0 0 24px; width: 24px; height: 24px; place-items: center; border: 1px solid color-mix(in srgb, var(--attribute-color) 45%, #2b3b4e); border-radius: 5px; background: rgba(11, 27, 41, .9); color: var(--attribute-color); font-size: .9rem; cursor: pointer; }
.attribute-card footer button:disabled { opacity: .4; cursor: not-allowed; }

/* El marco exterior es el único contenedor visual del Dojo. Los paneles
   internos organizan contenido sin acumular cajas y bordes concéntricos. */
.location-dojo .dojo-main-panel {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.location-dojo .dojo-section,
.location-dojo .dojo-attributes,
.location-dojo .appearance-panel,
.location-dojo .master-selection,
.location-dojo .skill-tree {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.location-dojo .character-preview {
  border: 0;
  box-shadow: none;
}
@media (min-width: 681px) {
  .location-dojo .dojo-main-panel {
    height: auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }
  .location-dojo .dojo-tab-panel { height: 100%; min-height: 0; }
  .location-dojo #dojo-panel-statistics { height: 100%; }
  .location-dojo #dojo-panel-statistics .dojo-attributes {
    display: grid;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
  }
}
@media (max-width: 980px) {
  .location-dojo .stage-options { width: calc(100% - 22px); max-height: calc(100% - 18px); margin: 9px auto; padding: 12px; }
  .dojo-topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .dojo-level { display: none; }
  .dojo-tabs [role="tab"] { min-width: 82px; padding-inline: 8px; }
  .dojo-technique-layout { grid-template-columns: minmax(210px, .75fr) minmax(0, 1.25fr); }
  .skill-branch { grid-template-columns: 72px minmax(0, 1fr); }
  .skill-path { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attribute-distribution { grid-template-columns: repeat(5, minmax(115px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .statistics-layout { grid-template-columns: minmax(230px, .68fr) minmax(450px, 1.32fr); }
  .statistics-character-preview { min-height: 0; }
  .statistics-character-preview .puppet-preview-rig { width: auto; }
  .statistics-layout .attribute-distribution { grid-template-columns: 1fr; overflow: visible; }
  .statistics-layout .attribute-card:last-child { grid-column: auto; }
  .statistics-layout .stat-radar-wrap { grid-template-columns: minmax(220px, .9fr) minmax(230px, 1.1fr); }
  .appearance-customizer { grid-template-columns: minmax(240px, .8fr) minmax(290px, 1.2fr); }
  .xenoverse-appearance .character-preview { min-height: 0; }
}
@media (max-width: 680px) {
  .location-dojo .stage-options { width: calc(100% - 12px); max-height: calc(100% - 10px); margin: 5px auto; padding: 9px; }
  .dojo-layout.dojo-rework { gap: 8px; }
  .dojo-topbar { grid-template-columns: 1fr; gap: 7px; }
  .dojo-title-mark { width: 36px; height: 36px; font-size: 1.3rem; }
  .dojo-title .eyebrow { font-size: 1rem; }
  .dojo-title small { font-size: .61rem; }
  .dojo-tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
  .dojo-tabs [role="tab"] { min-width: 0; padding: 8px 4px; font-size: .66rem; }
  .location-dojo .dojo-main-panel { height: auto; min-height: 0; padding: 0; }
  .location-dojo .equipment-columns { grid-template-columns: 1fr; }
  .location-dojo .equipment-column .dojo-section-heading { min-height: 0; }
  .dojo-technique-layout { grid-template-columns: 1fr; }
  .technique-detail { min-height: auto; }
  .technique-art-placeholder { min-height: 78px; }
  .skill-tree { padding: 8px; }
  .skill-tree-heading { align-items: start; flex-direction: column; }
  .tree-status { justify-items: start; }
  .skill-branch { grid-template-columns: 1fr; }
  .skill-branch > header { display: flex; justify-items: initial; text-align: left; }
  .skill-path { grid-template-columns: 1fr; }
  .dojo-attributes { padding: 9px; }
  .dojo-attributes > header { align-items: flex-start; }
  .dojo-attribute-actions { align-items: stretch; flex-direction: column; gap: 4px; }
  .dojo-attribute-actions > strong { padding: 6px; font-size: .5rem; }
  .attribute-distribution { grid-template-columns: 1fr; overflow: visible; }
  .attribute-card { grid-template-columns: 1fr; }
  .attribute-card header { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .attribute-card footer small { font-size: .56rem; }
  .statistics-layout, .appearance-customizer { grid-template-columns: 1fr; }
  .statistics-character-preview { min-height: 420px; }
  .statistics-layout .stat-radar-wrap { grid-template-columns: 1fr; }
  .statistics-layout .stat-readouts { border-top: 1px solid rgba(82, 151, 187, .18); border-left: 0; }
  .statistics-layout .stat-readouts { grid-template-columns: 1fr; }
  .statistics-layout .stat-readout:last-child { grid-column: auto; }
  .xenoverse-appearance .character-preview { min-height: 360px; }
  .cosmetic-control { grid-template-columns: minmax(92px, .72fr) minmax(150px, 1.28fr); }
}

/* HUD de metajuego: iconografía raster coherente con el arte ilustrado. */
.hud-stat-icon {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .62));
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.player-settings-trigger img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .72));
}
