@font-face {
  font-family: "Cinzel";
  src: url("assets/fonts/cinzel-latin-600.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 600;
}

/* Mantiene legible el aviso de companero sobre el mapa. */
@media (min-width: 651px) {
  .village-map-card > .notice-card {
    grid-template-columns: auto minmax(0, .95fr) minmax(0, 1fr) auto;
    column-gap: clamp(10px, 1.5vw, 18px);
  }

  .village-map-card > .notice-card strong,
  .village-map-card > .notice-card .notice-detail {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }
}

@font-face {
  font-family: "Cinzel";
  src: url("assets/fonts/cinzel-latin-700.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-latin-400.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-latin-500.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 500;
}

@font-face {
  font-family: "Alegreya Sans";
  src: url("assets/fonts/alegreya-sans-latin-700.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

/* Corrección visual de escritorio. La composición móvil se mantiene congelada. */
@media (min-width: 651px) {
  :root {
    --font-display: "Cinzel", Georgia, serif;
    --font-copy: "Alegreya Sans", "Segoe UI", sans-serif;
    --surface: rgba(27, 22, 18, .96);
    --surface-raised: rgba(39, 31, 24, .96);
    --line: rgba(190, 132, 78, .52);
    --text-strong: #fff4df;
    --text-copy: #e7dac8;
    --text-muted: #bcae9c;
    --text-disabled: #978b7d;
    font-family: var(--font-copy);
  }

  main,
  body:has(#meta:not([hidden])) main { border-color: rgba(102, 160, 205, .46); }

  .app-loading {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 14px;
    color: #c9d9e8;
    font-family: var(--font-display);
    letter-spacing: .08em;
  }
  .app-loading span {
    width: 42px;
    height: 42px;
    border: 2px solid rgba(121, 181, 221, .2);
    border-top-color: #79c9f2;
    border-radius: 50%;
    animation: loading-seal .8s linear infinite;
  }
  @keyframes loading-seal { to { transform: rotate(1turn); } }

  body,
  input,
  select,
  button {
    font-family: var(--font-copy);
  }

  h1,
  h2,
  h3,
  .eyebrow,
  .saga-number,
  .saga-action,
  .stage-speaker,
  .stage-ambient strong,
  .map-label-box strong,
  .primary-button,
  .secondary-button,
  .village-return button,
  .mission-card button,
  .npc-actions button,
  .attribute-list button,
  .game-settings summary {
    font-family: var(--font-display);
  }

  h1,
  h2,
  h3 {
    color: var(--text-strong);
    letter-spacing: .015em;
  }

  h2 { font-size: clamp(1.42rem, 2.2vw, 1.9rem); line-height: 1.15; }
  h3 { line-height: 1.25; }
  p { text-wrap: pretty; }
  .lead { color: var(--text-copy); font-size: 1rem; line-height: 1.48; }
  .eyebrow { color: #efad61; font-size: .72rem; font-weight: 700; letter-spacing: .13em; }

  /* Los paneles conservan postes y esquinas mediante nine-slice. */
  .creator-card,
  .stage-panel,
  .equipment-modal-card,
  .game-settings-panel {
    position: relative;
    isolation: isolate;
    border: 0;
    border-radius: 5px;
    background: var(--surface);
    background-image: none;
    box-shadow: 0 20px 58px rgba(0, 0, 0, .48);
    color: var(--text-copy);
  }

  .creator-card::before,
  .stage-panel::before,
  .equipment-modal-card::before,
  .game-settings-panel::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    border: 38px solid transparent;
    border-width: 38px 48px;
    border-image: url("assets/ui/panel-frame.webp?v=0.20.0") 72 96 76 96 fill / 38px 48px stretch;
    pointer-events: none;
  }

  .creator-card > *,
  .stage-panel > *,
  .equipment-modal-card > *,
  .game-settings-panel > * {
    position: relative;
    z-index: 1;
  }

  .creator-card {
    width: min(760px, calc(100% - 32px));
    padding: 46px 56px;
  }

  .stage-panel { padding: 38px 48px; }
  .stage-panel.saga-selector { padding: 38px 48px; }
  .equipment-modal-card { padding: 40px 48px; }

  .dialogue-box,
  .dialogue-box.with-portrait {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(43, 33, 25, .98), rgba(20, 16, 14, .98));
    background-image: none;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .7);
  }

  .game-settings-panel {
    padding: 40px 42px 36px;
  }

  .game-settings-panel .mode-switch {
    border-color: rgba(197, 146, 92, .38);
    background: rgba(27, 21, 18, .9);
    color: var(--text-copy);
    font-size: .88rem;
  }

  .game-settings-panel .hint {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: .78rem;
    line-height: 1.35;
  }

  /* El HUD conserva la interfaz compacta y nítida en escritorio. */
  .village-topbar {
    position: absolute;
    isolation: isolate;
    width: min(670px, calc(100% - 210px));
    min-height: 72px;
    padding: 10px 14px 10px 46px;
    background: rgba(16, 13, 11, .92);
    background-image: none;
  }

  .village-topbar::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    border: 13px solid transparent;
    border-width: 13px 36px;
    border-image: url("assets/ui/hud-frame.webp?v=0.20.0") 90 125 90 125 fill / 13px 36px stretch;
    pointer-events: none;
  }

  .village-topbar .profile-heading { min-width: 220px; }
  .village-topbar .profile-copy .eyebrow { font-size: .6rem; }
  .village-topbar .profile-copy h2 { font-size: 1.08rem; }
  .summary-item small { color: #c3b6a6; font-size: .64rem; }
  .summary-item strong { color: var(--text-copy); font-size: .8rem; }
  .summary-item b { font-size: 1.1rem; }

  .village-return {
    top: 16px !important;
    right: 20px !important;
  }

  .village-return button {
    width: auto;
    min-width: 176px;
    min-height: 56px;
    height: auto;
    padding: 12px 28px;
    font-size: .78rem;
    letter-spacing: .035em;
  }

  /* Una sola zona de desplazamiento y márgenes seguros frente a personajes/HUD. */
  .stage-options {
    width: 64%;
    max-height: calc(100% - 128px);
    margin: 102px 2.2% 24px auto;
    padding: 4px 8px 18px;
    scrollbar-gutter: stable;
  }

  .stage-options .mission-list {
    max-height: none;
    overflow: visible;
  }

  .stage-options::-webkit-scrollbar { width: 10px; }
  .stage-options::-webkit-scrollbar-track { border-radius: 10px; background: rgba(20, 16, 13, .8); }
  .stage-options::-webkit-scrollbar-thumb { border: 2px solid rgba(20, 16, 13, .8); border-radius: 10px; background: #8d6041; }

  .location-stage:not(.location-dojo) .stage-character {
    left: 1%;
    width: 32%;
    height: 84%;
  }

  .location-stage.has-cast:not(.location-dojo) .stage-character:first-child { left: -2%; width: 31%; }
  .location-stage.has-cast:not(.location-dojo) .stage-character:nth-child(2) { left: 7%; width: 31%; }

  /* Las tarjetas densas dejan de estirar el pergamino a proporciones extremas. */
  .saga-card,
  .mission-card,
  .service-grid article,
  .npc-guide-strip,
  .village-map-card > .notice-card {
    border: 1px solid rgba(153, 105, 65, .58);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(46, 36, 28, .97), rgba(23, 19, 16, .98));
    background-image: none;
    box-shadow: inset 0 1px rgba(255, 237, 206, .035), 0 8px 22px rgba(0, 0, 0, .24);
    color: var(--text-copy);
  }

  .saga-card,
  .saga-card:hover:not(:disabled) {
    min-height: 112px;
    padding: 15px 20px;
    background-image: none;
    transform: none;
  }

  .saga-card:hover:not(:disabled) {
    border-color: #d69450;
    background: linear-gradient(135deg, rgba(67, 45, 29, .98), rgba(30, 23, 18, .98));
  }

  .saga-grid { gap: 10px; }
  .saga-card strong { color: var(--text-strong); font-size: 1.08rem; }
  .saga-card small { color: #c8bcad; font-size: .82rem; }
  .saga-progress { color: #afa291; font-size: .75rem; }
  .saga-action { color: #f2bd78; font-size: .7rem; }

  .saga-card.locked,
  .mission-card.locked,
  .gear-slot.locked,
  .jutsu-card.locked,
  .affinity-slot.locked,
  .affinity-option:disabled,
  .technique-slot.locked,
  .skill-node.locked,
  .attribute-list button:disabled {
    opacity: 1;
  }

  .saga-card.locked,
  .mission-card.locked {
    border-color: rgba(132, 115, 96, .42);
    background: linear-gradient(135deg, rgba(31, 27, 23, .97), rgba(19, 17, 15, .98));
  }

  .saga-card.locked strong,
  .mission-card.locked h3 { color: #c1b6a8; }
  .saga-card.locked small,
  .saga-card.locked .saga-progress,
  .mission-card.locked p { color: var(--text-disabled); }
  .saga-card.locked .saga-action { color: #ad9d8a; }

  .section-heading { align-items: flex-start; gap: 24px; }
  .section-heading > strong { flex: 0 0 auto; color: #efb66d; font-size: .84rem; white-space: nowrap; }
  .saga-selector .lead { margin: 14px 0 16px; }

  .mission-card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    min-height: 88px;
    padding: 12px 16px;
  }

  .mission-card h3 { color: var(--text-strong); font-size: 1.02rem; }
  .mission-card p { color: #b9ad9e; font-size: .8rem; line-height: 1.35; }
  .mission-card button { min-width: 128px; min-height: 42px; padding: 9px 18px; font-size: .66rem; }
  .saga-header { gap: 18px; }
  .saga-header p { color: #bcae9e; font-size: .82rem; }
  .saga-next-note { color: #b0a392; font-size: .78rem; }

  .service-grid article,
  .npc-guide-strip { padding: 17px 20px; }
  .village-map-card > .notice-card { padding: 14px 22px; }

  .archive-card li {
    border-color: rgba(151, 108, 69, .48);
    background: rgba(36, 29, 23, .92);
    color: #a99d8e;
  }

  .archive-card li strong { color: #e6dac8; font-size: .88rem; }
  .archive-card li.done { color: #80d5bd; }

  /* El Dojo prioriza información y lectura sobre decoración repetida. */
  .location-dojo .stage-options {
    width: 76%;
    max-height: calc(100% - 124px);
    margin: 98px auto 24px;
  }

  .location-dojo .stage-options .dojo-layout {
    grid-template-columns: minmax(260px, .58fr) minmax(0, 1.42fr);
    gap: 14px;
  }

  .location-dojo .stage-panel {
    border: 1px solid rgba(161, 112, 70, .54);
    border-radius: 9px;
    padding: 17px;
    background: rgba(25, 21, 18, .96);
  }

  .location-dojo .stage-panel::before { display: none; }
  .location-stage.location-dojo .stage-character:first-child { right: -5%; width: 28%; }
  .location-stage.location-dojo .stage-character:nth-child(2) { left: -5%; width: 28%; }
  .location-dojo .stage-options .customizer { grid-template-columns: 118px minmax(0, 1fr); }
  .location-dojo .stage-options .character-preview { width: 118px; }

  .dojo-section,
  .skill-tree,
  .appearance-panel,
  .master-selection,
  .affinity-selector {
    border-color: rgba(151, 109, 72, .5);
    background: rgba(35, 28, 23, .9);
  }

  .dojo-section { padding: 12px; }
  .attribute-list button { min-height: 64px; padding-block: 10px; line-height: 1.12; }
  .attribute-list button small { line-height: 1.2; }
  .stat-grid small { font-size: .66rem; }
  .dojo-section-heading h3,
  .skill-tree-heading h3 { font-size: .84rem; }
  .dojo-section-heading p,
  .skill-tree-heading p { color: #b0a494; font-size: .72rem; line-height: 1.35; }
  .dojo-section-heading > span { font-size: .68rem; }
  .tree-legend { color: #a99d8e; font-size: .66rem; }

  .gear-slot.locked,
  .jutsu-card.locked,
  .affinity-slot.locked,
  .affinity-option:disabled,
  .technique-slot.locked,
  .skill-node.locked {
    filter: saturate(.55);
  }

  .gear-copy small { color: #b0a494; font-size: .66rem; }
  .gear-copy strong { color: #eee3d3; font-size: .76rem; }
  .gear-copy em { color: #9f9385; font-size: .66rem; }
  .equipment-option strong { font-size: .82rem; }
  .equipment-option small { color: #b0a493; font-size: .7rem; }
  .equipment-option em { font-size: .65rem; }

  .affinity-slot strong { font-size: .75rem; }
  .affinity-slot small { color: #aea292; font-size: .65rem; }
  .slot-index { font-size: .65rem; }
  .slot-edit { font-size: .64rem; }
  .affinity-change-note { color: #aaa092; font-size: .66rem; }
  .affinity-selector > div:first-child strong { font-size: .8rem; }
  .affinity-selector > div:first-child small { color: #aaa092; font-size: .66rem; }
  .affinity-option strong { font-size: .72rem; }
  .affinity-option small { color: #ada191; font-size: .63rem; }
  .affinity-close { color: #b4a898; font-size: .68rem; }

  .technique-slot { min-height: 56px; padding-left: 31px; }
  .technique-slot > span { width: 18px; height: 18px; font-size: .65rem; }
  .technique-slot strong { color: #eee4d6; font-size: .7rem; }
  .technique-slot small { color: #aaa092; font-size: .65rem; }
  .skill-branch { grid-template-columns: 112px minmax(0, 1fr); }
  .skill-branch > header strong { font-size: .74rem; }
  .skill-branch > header small { color: #aa9e8f; font-size: .65rem; }
  .skill-node { min-width: 124px; padding: 8px; }
  .skill-step { font-size: .65rem; }
  .skill-copy strong { font-size: .72rem; }
  .skill-copy small { color: #aa9e8f; font-size: .65rem; }
  .skill-state { color: #9f9486; font-size: .65rem; }
  .appearance-panel summary { color: #c2b6a6; font-size: .72rem; }
  .appearance-panel summary span { color: #9d9284; font-size: .64rem; }

  .creator-form label,
  .equipment-grid label,
  .cosmetic-grid label {
    color: #d2c5b4;
    font-size: .82rem;
  }

  .creator-form input,
  .creator-form select,
  .cosmetic-grid select,
  .equipment-grid select {
    border-color: rgba(159, 113, 73, .65);
    background: rgba(27, 22, 18, .96);
    color: var(--text-strong);
    font-size: .98rem;
  }

  .affinity-choice small { color: #afa393; font-size: .7rem; }
  .affinity-choice { border-color: rgba(153, 108, 70, .58); background: rgba(31, 25, 21, .96); }

  .stage-speech,
  .stage-ambient { font-family: var(--font-copy); }
  .stage-speech > p:not(.stage-speaker) { font-size: 1.08rem; }
  .stage-ambient { width: min(28%, 360px); font-size: .92rem; }

  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  summary:focus-visible {
    outline: 2px solid #efad61;
    outline-offset: 3px;
  }
}

@media (min-width: 651px) and (max-width: 980px) {
  body { min-height: 100dvh; overflow: hidden; }

  main,
  body:has(#meta:not([hidden])) main {
    width: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

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

  .village-map-card .village-map { position: absolute; inset: 0; height: 100%; }
  .village-map-card .village-map > img { width: 100%; height: 100%; object-fit: fill; }
  .creator-card { padding: 40px 48px; }
  .stage-options { width: 69%; max-height: calc(100% - 112px); margin-top: 88px; }
  .stage-panel,
  .stage-panel.saga-selector { padding: 34px 40px; }
  .stage-options:has(.saga-selector) { padding-bottom: 4px; }
  .saga-selector .lead { margin: 8px 0 10px; }
  .saga-selector .saga-grid { gap: 8px; }
  .saga-selector .saga-card { min-height: 0; gap: 4px; padding: 9px 14px; }
  .saga-selector .saga-progress,
  .saga-selector .saga-action { margin-top: 0; }
  .location-dojo .stage-options { width: 94%; max-height: calc(100% - 108px); margin-top: 84px; }
  .location-dojo .stage-options .dojo-layout { grid-template-columns: minmax(230px, .55fr) minmax(0, 1.45fr); }
  .location-stage.location-dojo .stage-character { opacity: .62; }
  .location-dojo .gear-copy strong {
    display: -webkit-box;
    min-height: 1.7em;
    overflow: hidden;
    line-height: 1.05;
    text-overflow: clip;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .mission-card button { min-width: 112px; }
}

@media (prefers-reduced-motion: reduce) and (min-width: 651px) {
  .stage-options.ready,
  .stage-speech,
  .stage-ambient { animation-duration: 1ms !important; }
}

/* v0.22 · Superficies de tinta: sin cajas marrones ni marcos repetidos. */
@media (min-width: 651px) {
  :root {
    --surface: rgba(5, 10, 19, .86);
    --surface-raised: rgba(9, 17, 30, .88);
    --line: rgba(130, 166, 202, .3);
    --text-copy: #e2e8f0;
    --text-muted: #aebdce;
    --text-disabled: #91a0b2;
    font-size: clamp(15px, 1.111vw, 16px);
  }

  .village-topbar,
  .creator-card,
  .stage-panel,
  .equipment-modal-card,
  .game-settings-panel {
    background: linear-gradient(150deg, rgba(7, 13, 24, .9), rgba(3, 8, 16, .82));
  }

  .primary-button,
  .secondary-button,
  .village-return button,
  .mission-card button,
  .npc-actions button,
  .saga-back,
  .attribute-list button {
    border: 0;
    border-bottom: 2px solid rgba(239, 173, 97, .76);
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(20, 39, 61, .88), rgba(10, 20, 35, .88));
    background-image: none;
    box-shadow: 0 9px 22px rgba(0, 0, 0, .24);
    color: #f5f7fb;
    font-family: var(--font-copy);
    font-size: max(.82rem, 13px);
    font-weight: 700;
    letter-spacing: .035em;
    text-shadow: none;
  }

  .primary-button:hover,
  .secondary-button:hover,
  .village-return button:hover,
  .mission-card button:hover:not(:disabled),
  .npc-actions button:hover,
  .saga-back:hover {
    background: linear-gradient(90deg, rgba(29, 60, 91, .96), rgba(13, 31, 53, .96));
    background-image: none;
    box-shadow: 0 0 0 1px rgba(112, 190, 243, .2), 0 10px 26px rgba(0, 0, 0, .28);
  }

  .mission-card button { font-size: max(.82rem, 13px); }
  .saga-action { color: #80c7f3; font-family: var(--font-copy); font-size: max(.82rem, 13px); }

  .saga-card,
  .mission-card,
  .service-grid article,
  .npc-guide-strip,
  .village-map-card > .notice-card {
    position: relative;
    border: 0;
    border-bottom: 1px solid rgba(135, 169, 204, .25);
    border-radius: 0;
    background: linear-gradient(90deg, rgba(18, 34, 54, .38), rgba(7, 15, 27, .08));
    background-image: none;
    box-shadow: none;
  }

  .saga-card::before,
  .mission-card::before,
  .service-grid article::before,
  .archive-card li::before {
    content: "";
    position: absolute;
    top: 16%;
    bottom: 16%;
    left: 0;
    width: 2px;
    border-radius: 2px;
    background: rgba(111, 180, 226, .6);
  }

  .saga-card:hover:not(:disabled) {
    border-color: rgba(126, 193, 235, .52);
    background: linear-gradient(90deg, rgba(24, 57, 86, .58), rgba(8, 18, 31, .12));
  }

  .saga-card.locked,
  .mission-card.locked {
    border-color: rgba(127, 147, 170, .18);
    background: linear-gradient(90deg, rgba(13, 24, 39, .28), transparent);
  }

  .saga-card.locked::before,
  .mission-card.locked::before { background: rgba(117, 136, 157, .38); }

  .archive-card ol { gap: 0 20px; }
  .archive-card li {
    position: relative;
    min-height: 58px;
    align-items: center;
    border: 0;
    border-bottom: 1px solid rgba(133, 163, 194, .22);
    border-radius: 0;
    padding: 10px 14px 10px 18px;
    background: transparent;
  }
  .archive-card li.done::before { background: #67d4b4; }

  .village-map-card > .notice-card {
    position: absolute;
    right: 18px;
    bottom: 18px;
    left: 18px;
  }

  .location-dojo .stage-panel {
    border: 0;
    border-left: 1px solid rgba(124, 166, 207, .38);
    border-radius: 0;
    background: linear-gradient(105deg, rgba(4, 10, 19, .9), rgba(5, 12, 23, .7));
    box-shadow: 0 20px 48px rgba(0, 0, 0, .34);
    backdrop-filter: blur(8px);
  }

  .dojo-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 2px 0 14px;
    border-bottom: 1px solid rgba(128, 165, 201, .26);
  }

  .dojo-tabs button {
    min-height: 42px;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    background: transparent;
    color: #9eafc1;
    font-weight: 700;
    cursor: pointer;
  }

  .dojo-tabs button[aria-selected="true"] {
    border-bottom-color: #72c8f2;
    color: #f2f7fb;
    background: linear-gradient(0deg, rgba(41, 111, 153, .2), transparent 70%);
  }

  .dojo-tab-panel[hidden] { display: none; }
  .dojo-tab-panel { animation: dojo-tab-in .18s ease both; }
  @keyframes dojo-tab-in { from { opacity: 0; } }

  .dojo-section,
  .skill-tree,
  .appearance-panel,
  .affinity-selector {
    border: 0;
    border-top: 1px solid rgba(123, 161, 198, .24);
    border-radius: 0;
    padding: 14px 0;
    background: transparent;
    box-shadow: none;
  }

  .dojo-tab-panel > :first-child { border-top: 0; padding-top: 2px; }
  .appearance-panel .customizer { padding: 8px 0 0; }

  .attribute-list { gap: 0; }
  .attribute-list button {
    grid-template-columns: 1fr auto;
    justify-items: start;
    min-height: 58px;
    border-bottom: 1px solid rgba(127, 163, 199, .2);
    padding: 10px 8px;
    background: transparent;
    box-shadow: none;
    text-align: left;
  }
  .attribute-list button small { justify-self: end; color: #9fb1c5; }
  .stat-grid span {
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .stat-grid span + span { border-left: 1px solid rgba(126, 163, 200, .2); }

  .level-chip {
    border-color: rgba(108, 180, 225, .52);
    background: rgba(16, 52, 78, .34);
    color: #d9f1ff;
  }

  .affinity-slots { gap: 0; }
  .affinity-slot {
    border: 0;
    border-left: 1px solid rgba(118, 158, 198, .28);
    border-radius: 0;
    padding: 9px 12px;
    background: transparent;
  }
  .affinity-slot:first-child { border-left: 0; }
  .affinity-slot.selected { border-color: rgba(103, 232, 195, .42); background: linear-gradient(90deg, rgba(30, 108, 111, .18), transparent); }

  .gear-slot {
    aspect-ratio: auto;
    min-height: 112px;
    border: 0;
    border-right: 1px solid rgba(125, 164, 202, .22);
    border-radius: 0;
    padding: 12px 10px !important;
    background: transparent;
    background-image: none;
    box-shadow: none;
    filter: none;
  }
  .gear-slot:last-child { border-right: 0; }
  .gear-slot:hover:not(:disabled),
  .gear-slot:focus-visible { background: linear-gradient(180deg, rgba(40, 100, 143, .2), transparent); filter: none; transform: none; }
  .gear-icon { border-color: rgba(106, 180, 225, .45); border-radius: 50%; background: rgba(27, 85, 122, .2); color: #86d1f5; }

  .technique-slot,
  .skill-node,
  .affinity-option {
    border-color: rgba(118, 158, 198, .34);
    background: rgba(7, 18, 32, .56);
  }
  .skill-node.selected { border-color: #73c7ef; background: rgba(24, 78, 113, .38); box-shadow: inset 0 0 18px rgba(68, 170, 224, .12); }
  .equipment-option,
  .equipment-option:hover,
  .equipment-option.selected {
    border: 0;
    border-bottom: 1px solid rgba(127, 164, 201, .25);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .equipment-option:hover { background: rgba(32, 87, 126, .2); }
  .equipment-option.selected { border-left: 2px solid #efad61; background: linear-gradient(90deg, rgba(38, 94, 132, .26), transparent); }

  .game-settings-panel .option-row { gap: 0 18px; }
  .game-settings-panel .mode-switch {
    min-height: 42px;
    border: 0;
    border-bottom: 1px solid rgba(128, 164, 199, .24);
    border-radius: 0;
    padding: 8px 4px;
    background: transparent;
  }
  .game-settings-panel .volume-control,
  .game-settings-panel .theme-control { min-height: 44px; border-bottom: 1px solid rgba(128, 164, 199, .24); }

  .creator-form input,
  .creator-form select,
  .cosmetic-grid select,
  .equipment-grid select {
    border-color: rgba(123, 164, 203, .42);
    background: rgba(5, 13, 24, .82);
  }
  .affinity-choice {
    border-color: rgba(122, 164, 204, .32);
    background: rgba(7, 17, 30, .62);
  }
  .affinity-choice:has(input:checked) { border-color: #73c8f0; background: rgba(23, 72, 104, .34); }

  .affinity-option small,
  .slot-edit,
  .skill-state,
  .technique-slot small,
  .skill-copy small,
  .equipment-option em,
  .gear-copy small,
  .stat-grid small,
  .tree-legend,
  .affinity-slot small,
  .affinity-change-note,
  .skill-branch > header small {
    font-size: max(.75rem, 12px);
  }

  .affinity-close {
    min-height: 32px;
    padding: 7px 10px;
    color: #b8c8d8;
    font-size: max(.75rem, 12px);
  }

  .map-label {
    opacity: .82;
    transform: translate(-50%, 0);
  }
  .map-label-box {
    border: 0;
    border-radius: 0;
    padding: 5px 10px;
    background: linear-gradient(90deg, transparent, rgba(2, 9, 18, .84) 18%, rgba(2, 9, 18, .84) 82%, transparent);
    box-shadow: none;
    text-shadow: 0 2px 5px #000;
  }
  .map-label-box small { display: none; }
  .map-label.visible { z-index: 8; opacity: 1; }
  .map-label.visible .map-label-box small,
  .map-label.recommended .map-label-box small { display: block; }
  .map-label.recommended .map-label-box strong { color: #8ed8ff; }
  .map-label.recommended { animation: recommended-pulse 2.2s ease-in-out infinite; }
  @keyframes recommended-pulse { 50% { filter: drop-shadow(0 0 7px rgba(81, 180, 235, .72)); } }

  .stage-character:focus-visible {
    outline: 2px solid #efad61;
    outline-offset: 3px;
  }

  .lead,
  .dialogue-copy,
  .stage-speech,
  .archive-card,
  .mission-card,
  .saga-card { user-select: text; }
}

@media (min-width: 651px) and (max-width: 980px) {
  .affinity-close,
  .dojo-tabs button { min-height: 44px; }
  .location-dojo .stage-options { max-height: calc(100% - 98px); }
  .location-dojo .stage-panel { padding: 13px; }
  .location-dojo .dojo-heading { margin-bottom: 7px; }
  .location-dojo .dojo-tabs { margin-bottom: 8px; }
  .location-dojo .dojo-section { padding: 8px 0; }
  .location-dojo .gear-slot {
    min-height: 80px;
    padding: 8px !important;
  }
  .map-label { max-width: 150px; }
  .map-label-box strong { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) and (min-width: 651px) {
  .dojo-tab-panel,
  .map-label.recommended { animation: none !important; }
}

/* v0.23 · Contraste completo y retirada de las últimas superficies marrones. */
@media (min-width: 651px) {
  body,
  main,
  body:has(#meta:not([hidden])) main {
    background-color: #030813;
    background-image: none;
  }

  .creator-card,
  .stage-panel,
  .equipment-modal-card,
  .game-settings-panel {
    border: 1px solid rgba(117, 169, 210, .32);
    background-color: rgba(3, 9, 18, .96);
    background-image: linear-gradient(145deg, rgba(5, 13, 25, .96), rgba(2, 8, 17, .92));
    box-shadow: 0 22px 60px rgba(0, 0, 0, .5), inset 0 1px rgba(185, 220, 244, .035);
  }

  .village-topbar::before,
  .creator-card::before,
  .stage-panel::before,
  .equipment-modal-card::before,
  .game-settings-panel::before {
    display: none;
  }

  .village-topbar {
    padding: 10px 16px 10px 18px;
    border-left: 3px solid #65bce9;
    border-radius: 4px;
    backdrop-filter: blur(10px);
  }

  .primary-button,
  .secondary-button,
  .village-return button,
  .mission-card button,
  .npc-actions button,
  .saga-back {
    min-height: 44px;
    border: 1px solid rgba(112, 192, 237, .62);
    border-bottom: 2px solid #69c6f2;
    border-radius: 4px;
    background-color: rgba(9, 35, 59, .98);
    background-image: linear-gradient(180deg, rgba(24, 76, 111, .98), rgba(9, 35, 59, .98));
    box-shadow: 0 8px 20px rgba(0, 0, 0, .32), inset 0 1px rgba(221, 244, 255, .12);
    color: #f7fbff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
  }

  .primary-button:hover,
  .secondary-button:hover,
  .village-return button:hover,
  .mission-card button:hover:not(:disabled),
  .npc-actions button:hover,
  .saga-back:hover {
    border-color: #9cddff;
    background: linear-gradient(180deg, rgba(38, 106, 148, 1), rgba(12, 49, 79, 1));
    box-shadow: 0 0 0 2px rgba(110, 202, 247, .16), 0 10px 26px rgba(0, 0, 0, .38);
    color: #fff;
  }

  .primary-button:active,
  .secondary-button:active,
  .village-return button:active,
  .mission-card button:active:not(:disabled),
  .npc-actions button:active,
  .saga-back:active {
    transform: translateY(1px);
    background: #0d3556;
  }

  .primary-button:disabled,
  .secondary-button:disabled,
  .mission-card button:disabled {
    border-color: rgba(119, 139, 160, .42);
    background: rgba(16, 28, 43, .76);
    color: #8797a9;
    opacity: 1;
  }

  .stage-speech,
  .stage-ambient {
    border: 1px solid rgba(117, 187, 226, .55);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(7, 20, 36, .98), rgba(3, 10, 21, .98));
    color: #edf5fb;
    box-shadow: 0 24px 62px rgba(0, 0, 0, .64), inset 3px 0 #65bce9;
    backdrop-filter: blur(8px);
  }

  .stage-speech::before { display: none; content: none; }
  .stage-ambient::before { background: #071426; }
  .stage-speaker,
  .stage-ambient strong {
    border-bottom-color: rgba(130, 180, 217, .28);
    color: #82d3f7;
  }
  .stage-speech small { color: #a9bbcc; }
  .stage-speech .primary-button {
    min-width: 126px;
    color: #fff;
  }

  .dialogue-box,
  .dialogue-box.with-portrait {
    border: 1px solid rgba(117, 169, 210, .38);
    background-color: rgba(3, 10, 20, .98);
    background-image: linear-gradient(145deg, rgba(7, 20, 36, .98), rgba(3, 10, 20, .98));
    color: #edf5fb;
    box-shadow: 0 26px 76px rgba(0, 0, 0, .7), inset 3px 0 #65bce9;
  }

  .stage-character span,
  .stage-character.active span {
    border-color: rgba(108, 190, 233, .58);
    background: rgba(3, 15, 28, .92);
    color: #eaf6fc;
    box-shadow: 0 0 10px rgba(73, 171, 224, .16);
  }

  .equipment-modal {
    background: radial-gradient(circle at 50% 42%, rgba(14, 42, 67, .34), transparent 42%), rgba(1, 5, 12, .86);
    backdrop-filter: blur(7px) saturate(.8);
  }
  .equipment-modal-card {
    border-left: 3px solid #65bce9;
    border-radius: 5px;
  }
  .equipment-modal-heading {
    border-bottom: 1px solid rgba(127, 173, 211, .26);
    padding-bottom: 12px;
  }
  .equipment-modal-heading button,
  .player-settings-trigger,
  .notice-icon,
  .notice-arrow {
    border: 1px solid rgba(115, 178, 219, .46);
    background: rgba(7, 24, 41, .94);
    background-image: none;
    box-shadow: none;
    color: #d9effb;
  }
  .equipment-modal-heading button:hover,
  .player-settings-trigger:hover,
  .player-settings-trigger[aria-expanded="true"] {
    border-color: #84d3f6;
    background: #103a5b;
    color: #fff;
  }

  .equipment-option.selected {
    border-left-color: #72cdf5;
    background: linear-gradient(90deg, rgba(24, 84, 121, .38), transparent);
  }

  .game-settings-panel .mode-switch,
  .game-settings-panel .volume-control,
  .game-settings-panel .theme-control {
    border-color: rgba(124, 166, 204, .25);
    background: transparent;
  }

  .stage-options,
  .equipment-modal-card { scrollbar-color: #4d8fb8 #07111f; }
  .stage-options::-webkit-scrollbar-track,
  .equipment-modal-card::-webkit-scrollbar-track { background: #07111f; }
  .stage-options::-webkit-scrollbar-thumb,
  .equipment-modal-card::-webkit-scrollbar-thumb {
    border-color: #07111f;
    background: #4d8fb8;
  }
}

/* Kagemori: el reparto acompaña el diálogo sin cubrir las pistas. */
.location-stage.location-kagemori.has-cast [data-stage-npc="iori"].stage-character:first-child {
  right: auto;
  left: -5%;
  width: 30%;
}

.location-stage.location-kagemori.has-cast [data-stage-npc="nami"].stage-character:nth-child(2) {
  right: 0;
  left: auto;
  width: 31%;
}

.location-stage.location-kagemori:not(.investigation-ready) .stage-character {
  opacity: .42;
  pointer-events: none;
}

.location-stage.location-kagemori:not(.investigation-ready) .stage-character.active {
  z-index: 3;
  opacity: 1;
}

.location-stage.location-kagemori .stage-characters {
  transition: opacity .32s ease;
}

/* Evita promover dos retratos grandes a capas filtradas en esta escena. */
.location-stage.location-kagemori .stage-character img,
.location-stage.location-kagemori .stage-character.active img {
  filter: none;
}

.location-stage.location-kagemori.investigation-ready .stage-characters {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.location-stage.location-kagemori.investigation-ready .stage-character {
  pointer-events: none;
}

@media (min-width: 651px) {
  .location-stage.location-kagemori .stage-speech {
    left: 23%;
    width: 54%;
    max-width: 650px;
  }
}

/* Dojo rework: estas reglas deben quedar después de la piel de escritorio.
   La maqueta anterior dividía .dojo-layout en dos columnas y comprimía el
   encabezado, el árbol y los atributos del panel nuevo. */
@media (min-width: 651px) {
  .location-dojo .stage-options {
    display: grid;
    width: min(calc(100% - 48px), 1280px);
    height: calc(100% - 172px);
    max-height: none;
    margin: 100px auto auto;
    overflow: hidden;
    border: 1px solid rgba(95, 162, 197, .48);
    border-radius: 12px;
    padding: 14px;
    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);
  }

  .location-dojo .stage-options .dojo-layout.dojo-rework {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  .location-dojo .dojo-topbar {
    grid-template-columns: minmax(300px, 1fr) auto auto;
    gap: 16px;
  }

  .location-dojo .dojo-tabs {
    display: flex;
    grid-template-columns: none;
    gap: 4px;
    margin: 0;
  }

  .location-dojo .dojo-tabs [role="tab"] {
    min-width: 104px;
    min-height: 0;
    border: 1px solid transparent;
    border-bottom: 0;
    padding: 9px 13px;
  }

  .location-dojo .dojo-tabs [role="tab"][aria-selected="true"] {
    border-color: rgba(65, 202, 231, .52);
    border-bottom-color: transparent;
  }

  .location-dojo .xenoverse-appearance .character-preview {
    width: 100%;
  }

  .location-dojo .stage-options .statistics-character-preview {
    width: 100%;
  }

  .location-dojo .technique-detail {
    min-height: 0;
    gap: 7px;
    padding: 10px;
  }

  .location-dojo .technique-art-placeholder { min-height: 120px; }
  .location-dojo .technique-metrics div { padding: 6px; }
  .location-dojo .technique-equip-button,
  .location-dojo .technique-upgrade-button { padding: 7px; }
  .location-dojo .skill-path {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 9px 12px;
    overflow: visible;
    padding: 1px 2px;
  }
  .location-dojo .skill-node { min-width: 0; min-height: 66px; }
  .location-dojo .attribute-card { gap: 5px; padding: 6px; }
  .location-dojo .attribute-meter { height: 7px; }
  .location-dojo .attribute-card footer button { width: 22px; height: 22px; flex-basis: 22px; }
}

@media (min-width: 651px) and (max-width: 1100px) {
  .location-dojo .stage-options {
    width: calc(100% - 28px);
    height: calc(100% - 148px);
    max-height: none;
    margin: 92px auto auto;
    padding: 12px;
  }

  .location-dojo .dojo-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
  }

  .location-dojo .dojo-level { display: none; }
  .location-dojo .dojo-tabs { grid-column: 1 / -1; }
  .location-dojo .skill-path { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* v0.68 · Escala tipográfica accesible para escritorio y tablet horizontal. */
@media (min-width: 651px) {
  :root {
    --text-caption: max(.8125rem, 13px);
    --text-control: max(.875rem, 14px);
    --text-body: max(1rem, 16px);
    font-size: clamp(16px, 1.25vw, 18px);
  }

  body { font-size: var(--text-body); }

  main small,
  main .eyebrow,
  main .hint,
  main .compact,
  main .summary-item small,
  main .campaign-summary > *,
  main .map-label-box small,
  main .saga-number,
  main .saga-progress,
  main .saga-next-note,
  main .mission-card p,
  main .archive-card small,
  main .tree-legend,
  main .skill-tree-heading p,
  main .dojo-level,
  main .dojo-equipped-count,
  main .technique-affinity span,
  main .technique-description,
  main .technique-accuracy,
  main .skill-branch > header strong,
  main .skill-state,
  main .stat-readout em,
  main .mission-menu-item span,
  main .secondary-mission-item span,
  main .secondary-mission-item .mission-destination {
    font-size: var(--text-caption) !important;
    line-height: 1.35;
  }

  main button,
  main input,
  main select,
  main textarea,
  main label,
  main .level-chip,
  main .summary-item strong,
  main .map-label-box strong,
  main .stage-speaker,
  main .stage-ambient strong,
  main .saga-action,
  main .dojo-tabs [role="tab"],
  main .technique-metrics strong,
  main .skill-step,
  main .skill-copy strong,
  main .dojo-attribute-actions > strong,
  main .attribute-card header strong,
  main .attribute-list.radar-controls strong,
  main .mission-menu-item strong,
  main .secondary-mission-item strong {
    font-size: var(--text-control) !important;
    line-height: 1.3;
  }

  .village-topbar {
    width: min(720px, calc(100% - 210px));
  }

  .location-dojo .stage-options { overflow: hidden; }

  .location-dojo .technique-detail,
  .location-dojo .skill-node,
  .location-dojo .attribute-card {
    overflow-wrap: anywhere;
  }
}

/* v0.83 · El HUD comparte una sola retícula, textura e iconografía de juego. */
@media (min-width: 651px) {
  body:has(#meta:not([hidden])) .village-topbar {
    top: 14px;
    left: 18px;
    display: grid;
    grid-template-columns: minmax(176px, .9fr) minmax(160px, .78fr) auto;
    align-items: center;
    width: min(680px, calc(100% - 36px));
    max-width: calc(100% - 36px);
    min-height: 74px;
    gap: 0;
    padding: 10px 18px 10px 30px;
    background: linear-gradient(180deg, rgba(11, 20, 31, .96), rgba(7, 13, 22, .98));
    box-shadow: 0 12px 30px rgba(0, 0, 0, .44);
  }

  body:has(#meta:not([hidden])) .village-topbar::before {
    border-width: 14px 34px;
    filter: saturate(.78) brightness(.84);
  }

  .village-topbar .profile-heading {
    display: grid;
    grid-template-columns: 48px minmax(76px, 1fr) auto;
    align-items: center;
    min-width: 0;
    height: 52px;
    gap: 10px;
    padding-right: 14px;
  }

  .village-topbar .avatar-swatch {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border: 3px solid #315c86;
    box-shadow: inset 0 -12px rgba(0, 0, 0, .2), 0 0 0 2px rgba(210, 157, 86, .2);
  }

  .village-topbar .profile-copy {
    display: grid;
    align-content: center;
    min-width: 0;
    gap: 1px;
  }

  .village-topbar .profile-copy .eyebrow {
    margin: 0;
    overflow: hidden;
    color: #dba05b;
    font-size: var(--text-caption) !important;
    line-height: 1.15;
    letter-spacing: .16em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .village-topbar .profile-copy h2 {
    margin: 0;
    overflow: hidden;
    color: #f4eadb;
    font-size: 1.06rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .village-topbar .level-chip {
    display: grid;
    grid-template-columns: auto auto;
    align-self: center;
    align-items: baseline;
    min-width: 0;
    margin: 0;
    gap: 5px;
    border: 0;
    border-left: 1px solid rgba(116, 139, 160, .28);
    border-radius: 0;
    padding: 2px 0 2px 10px;
    background: transparent;
    box-shadow: none;
    text-align: left;
    white-space: nowrap;
  }

  .village-topbar .level-chip small {
    color: #968a7c;
    font-family: var(--font-display);
    font-size: var(--text-caption) !important;
    font-weight: 600;
    letter-spacing: .11em;
  }

  .village-topbar .level-chip strong {
    color: #e7b166;
    font-family: var(--font-display);
    font-size: .92rem !important;
    font-variant-numeric: tabular-nums;
  }

  .village-topbar .campaign-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(86px, 1fr));
    align-items: stretch;
    height: 50px;
    min-width: 0;
    border-right: 1px solid rgba(116, 139, 160, .22);
    border-left: 1px solid rgba(116, 139, 160, .3);
  }

  .village-topbar .summary-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    align-items: center;
    min-width: 0;
    column-gap: 7px;
    padding: 4px 10px !important;
    border-right: 1px solid rgba(116, 139, 160, .18);
  }

  .village-topbar .summary-item:last-child { border-right: 0; }
  .village-topbar .hud-stat-icon {
    grid-row: 1 / 3;
    align-self: center;
    width: 36px;
    height: 36px;
    margin-left: -3px;
  }

  .village-topbar .summary-item strong,
  .village-topbar .summary-item small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .village-topbar .summary-item strong {
    align-self: end;
    color: #f6eee2;
    font-variant-numeric: tabular-nums;
  }

  .village-topbar .summary-item small {
    align-self: start;
    color: #b9ad9d;
  }

  .village-topbar .topbar-actions {
    height: 50px;
    margin-left: 10px;
    gap: 7px;
  }

  .village-topbar .player-settings-trigger {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    margin: 0;
    border: 0;
    border-radius: 4px;
    padding: 0;
    background: radial-gradient(circle, rgba(69, 111, 141, .18), transparent 67%);
    box-shadow: none;
    color: inherit;
  }

  .village-topbar .player-settings-trigger img {
    width: 44px;
    height: 44px;
    transition: filter .18s ease, transform .18s ease;
  }

  .village-topbar .player-settings-trigger:hover,
  .village-topbar .player-settings-trigger[aria-expanded="true"] {
    background: radial-gradient(circle, rgba(221, 160, 82, .2), transparent 67%);
    filter: drop-shadow(0 0 7px rgba(221, 160, 82, .42));
    transform: none;
  }

  .village-topbar .player-settings-trigger:hover img,
  .village-topbar .player-settings-trigger[aria-expanded="true"] img {
    filter: drop-shadow(0 0 6px rgba(237, 176, 91, .72));
    transform: rotate(13deg) scale(1.04);
  }

  .game-settings-panel .settings-save-slots {
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 12px;
    border: 0;
    border-top: 1px solid rgba(128, 164, 199, .28);
    border-radius: 0;
    padding: 13px 4px 3px;
    background: transparent;
    color: #e7dac8;
    text-align: left;
    cursor: pointer;
  }

  .game-settings-panel .settings-save-slots span { display: grid; gap: 1px; }
  .game-settings-panel .settings-save-slots small {
    color: #a79a8b;
    font-size: .58rem !important;
    font-weight: 700;
    letter-spacing: .12em;
  }
  .game-settings-panel .settings-save-slots strong {
    color: #f1e6d3;
    font-family: var(--font-display);
    font-size: .82rem;
    letter-spacing: .08em;
  }
  .game-settings-panel .settings-save-slots b {
    color: #dca15a;
    font-size: 1.05rem;
    transition: transform .16s ease;
  }
  .game-settings-panel .settings-save-slots:hover,
  .game-settings-panel .settings-save-slots:focus-visible {
    background: transparent;
    color: #fff4df;
  }
  .game-settings-panel .settings-save-slots:hover b,
  .game-settings-panel .settings-save-slots:focus-visible b { transform: translateX(3px); }

  body:has(#meta:not([hidden])) .village-shell > .debug-tools-trigger {
    position: absolute;
    z-index: 48;
    left: 18px;
    bottom: 14px;
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 7px;
    margin: 0;
    border: 1px dashed rgba(221, 160, 82, .46);
    border-radius: 4px;
    padding: 5px 10px;
    background: rgba(16, 12, 10, .76);
    color: #b9aa96;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
    font-size: var(--text-caption) !important;
    letter-spacing: .06em;
    opacity: .62;
  }

  body:has(#meta:not([hidden])) .village-shell > .debug-tools-trigger span {
    border-radius: 3px;
    padding: 2px 4px;
    background: rgba(221, 160, 82, .16);
    color: #e2ad68;
    font-size: var(--text-caption);
    font-weight: 800;
    letter-spacing: .08em;
  }

  body:has(#meta:not([hidden])) .village-shell > .debug-tools-trigger:hover,
  body:has(#meta:not([hidden])) .village-shell > .debug-tools-trigger:focus-visible {
    border-color: rgba(221, 160, 82, .78);
    background: rgba(41, 29, 19, .94);
    color: #f0d8b7;
    opacity: 1;
  }

  #meta:has(.debug-screen) .village-shell > .debug-tools-trigger {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: max-content;
    margin: 96px 22px 0 auto;
  }

  #meta:has(.debug-screen) .debug-screen { margin-top: 12px; }
}

@media (min-width: 1100px) {
  body:has(#meta:not([hidden])) .village-topbar {
    grid-template-columns: 250px minmax(230px, 1fr) auto;
  }

  .village-topbar .summary-item { padding-inline: 13px !important; }
}

@media (min-width: 651px) and (max-width: 980px) {
  body:has(#meta:not([hidden])) .village-topbar {
    left: 14px;
    grid-template-columns: 184px minmax(190px, 1fr) auto;
    width: min(620px, calc(100% - 28px));
    max-width: calc(100% - 28px);
    padding-right: 13px;
    padding-left: 24px;
  }

  .village-topbar .profile-heading {
    grid-template-columns: 40px minmax(48px, 1fr) 62px;
    gap: 7px;
    padding-right: 8px;
  }
  .village-topbar .avatar-swatch { width: 40px; height: 40px; flex-basis: 40px; }
  .village-topbar .profile-copy .eyebrow { font-size: var(--text-caption) !important; letter-spacing: .1em; }
  .village-topbar .level-chip { min-width: 0; padding-left: 7px; }
  .village-topbar .summary-item { grid-template-columns: 26px minmax(0, 1fr); column-gap: 5px; padding-inline: 6px !important; }
  .village-topbar .hud-stat-icon { width: 32px; height: 32px; margin-left: -3px; }
  .village-topbar .topbar-actions { margin-left: 7px; gap: 5px; }
}

@media (min-width: 651px) and (max-width: 780px) {
  body:has(#meta:not([hidden])) .village-topbar {
    grid-template-columns: 178px minmax(160px, 1fr) auto;
  }

  .village-topbar .summary-item small { display: none; }
  .village-topbar .summary-item strong { grid-row: 1 / 3; align-self: center; }
}
