/* HUD de mando de una plaza 3D: Construcción · Terreno · Señorío.
   Las imágenes son originales del proyecto y se procesan con
   scripts/process-scene-command-assets.cjs. */
:root {
  --sch-gold: #d8b25c;
  --sch-gold-hi: #f3d894;
  --sch-ink: #0c0a07;
  --sch-cream: #eadfc7;
  --sch-muted: #aa9a7a;
  --sch-green: #76a66b;
  --sch-red: #b86655;
  --sch-dock-h: 72px;
}

#scene-command-hud,
#scene-command-hud * {
  box-sizing: border-box;
}

#scene-command-hud {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  color: var(--sch-cream);
  font-family: "Crimson Text", Georgia, serif;
  -webkit-tap-highlight-color: transparent;
}

body.scene-command-ready #build-panel,
body.scene-command-ready #build-fab,
body.scene-command-ready #foso-panel,
body.scene-command-ready #foso-fab,
body.scene-command-ready #build-toast {
  display: none !important;
}

body.scene-command-ready #top,
body.scene-command-ready #sed-topbtn,
body.scene-command-ready #sed-camviews {
  display: none !important;
}

#scene-command-hud button {
  font: inherit;
}

#scene-command-hud .sch-clickable {
  pointer-events: auto;
}

.sch-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 58%, rgba(4, 3, 2, .17) 100%),
    linear-gradient(180deg, rgba(3, 2, 1, .12), transparent 15%, transparent 82%, rgba(3, 2, 1, .2));
  opacity: .65;
}

.sch-status {
  position: absolute;
  z-index: 4;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 50%;
  width: min(920px, calc(100vw - 28px));
  min-height: 62px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(216, 178, 92, .62);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(31, 24, 15, .94), rgba(12, 10, 7, .96)),
    url("/assets/ui/scene-command-surface.webp");
  background-size: auto, 360px 360px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .52), 0 1px 0 rgba(255, 233, 174, .13) inset;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.sch-status::before,
.sch-drawer::before,
.sch-dock::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(222, 190, 119, .16);
  border-radius: inherit;
  pointer-events: none;
}

.sch-back-button,
.sch-overview-button,
.sch-close,
.sch-icon-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(216, 178, 92, .42);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(67, 50, 26, .92), rgba(25, 19, 11, .96));
  color: var(--sch-gold-hi);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 239, 186, .1) inset;
}

.sch-back-button {
  position: relative;
  z-index: 1;
  text-decoration: none;
}

.sch-back-button span {
  margin-top: -3px;
  font: 34px/1 Georgia, serif;
}

.sch-place-crest {
  padding: 3px;
  overflow: hidden;
}

.sch-place-crest img {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .7));
}

.sch-back-button:active,
.sch-overview-button:active,
.sch-close:active,
.sch-icon-button:active {
  transform: scale(.96);
  filter: brightness(1.12);
}

.sch-status-copy {
  min-width: 0;
  flex: 1;
}

.sch-location-line {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sch-settlement {
  overflow: hidden;
  color: var(--sch-gold-hi);
  font-family: "MedievalSharp", Georgia, serif;
  font-size: clamp(14px, 2.2vw, 18px);
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.sch-year {
  flex: 0 0 auto;
  color: #c6a55c;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 11px;
  white-space: nowrap;
}

.sch-context {
  margin-top: 2px;
  overflow: hidden;
  color: var(--sch-muted);
  font-size: 12px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-control-badge {
  flex: 0 0 auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid rgba(118, 166, 107, .62);
  border-radius: 999px;
  background: rgba(34, 73, 37, .7);
  color: #d9f0d2;
  font-size: 12px;
  white-space: nowrap;
}

.sch-control-badge[data-tier="vassal"] {
  border-color: rgba(190, 153, 76, .7);
  background: rgba(87, 60, 22, .72);
  color: #f1dda6;
}

.sch-control-badge[data-tier="foreign"],
.sch-control-badge[data-tier="unavailable"] {
  border-color: rgba(184, 102, 85, .65);
  background: rgba(89, 36, 29, .72);
  color: #f0c4ba;
}

.sch-top-actions {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.sch-input-button,
.sch-view-button {
  min-width: 78px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(216, 178, 92, .44);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(69, 50, 26, .94), rgba(27, 20, 12, .98));
  color: #e8d5aa;
  cursor: pointer;
  font: 12px/1 "MedievalSharp", Georgia, serif;
  box-shadow: 0 1px 0 rgba(255, 239, 186, .09) inset;
}

.sch-input-button img,
.sch-view-button img {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .65));
}

.sch-input-button[aria-pressed="true"] {
  border-color: rgba(230, 193, 102, .82);
  background: linear-gradient(180deg, rgba(111, 76, 28, .96), rgba(54, 37, 17, .98));
  color: #ffe5a2;
  box-shadow: 0 0 0 1px rgba(244, 215, 143, .12) inset, 0 0 15px rgba(184, 130, 38, .16);
}

.sch-input-button.locked,
.sch-input-button:disabled {
  cursor: not-allowed;
  filter: grayscale(.8);
  opacity: .48;
}

.sch-view-button i {
  width: 7px;
  height: 7px;
  margin-left: 1px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s ease;
}

.sch-view-button[aria-expanded="true"] i {
  transform: translateY(2px) rotate(225deg);
}

.sch-input-button:active:not(:disabled),
.sch-view-button:active {
  transform: scale(.97);
  filter: brightness(1.1);
}

.sch-view-menu {
  position: absolute;
  z-index: 4;
  top: calc(100% + 7px);
  right: 7px;
  width: min(280px, calc(100vw - 24px));
  padding: 6px;
  border: 1px solid rgba(216, 178, 92, .62);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(39, 29, 16, .99), rgba(13, 10, 7, .99)),
    url("/assets/ui/scene-command-surface.webp");
  background-size: auto, 300px 300px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .7);
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}

.sch-view-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.sch-view-menu button {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d6c7a9;
  text-align: left;
  cursor: pointer;
}

.sch-view-menu button + button {
  margin-top: 3px;
}

.sch-view-menu button.active {
  border-color: rgba(221, 183, 92, .6);
  background: rgba(100, 69, 27, .42);
  color: #f3d894;
}

.sch-view-menu img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .7));
}

.sch-view-menu span {
  min-width: 0;
}

.sch-view-menu b,
.sch-view-menu small {
  display: block;
}

.sch-view-menu b {
  font: 14px/1.05 "MedievalSharp", Georgia, serif;
}

.sch-view-menu small {
  margin-top: 3px;
  color: #a99a7d;
  font-size: 10px;
}

.sch-scrim {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: rgba(4, 3, 2, .48);
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
  backdrop-filter: blur(1px);
}

.sch-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.sch-drawer {
  position: absolute;
  z-index: 2;
  left: max(16px, env(safe-area-inset-left, 0px));
  top: calc(84px + env(safe-area-inset-top, 0px));
  bottom: calc(94px + env(safe-area-inset-bottom, 0px));
  width: min(430px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(216, 178, 92, .68);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(26, 20, 13, .95), rgba(10, 8, 5, .98)),
    url("/assets/ui/scene-command-surface.webp");
  background-size: auto, 430px 430px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, .68), 0 1px 0 rgba(255, 234, 174, .13) inset;
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  pointer-events: none;
  transition: transform .24s cubic-bezier(.2, .74, .28, 1), opacity .18s ease;
  backdrop-filter: blur(10px);
}

.sch-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.sch-drawer-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px 9px 15px;
  border-bottom: 1px solid rgba(216, 178, 92, .3);
  background: linear-gradient(180deg, rgba(62, 44, 22, .5), rgba(18, 14, 9, .12));
}

.sch-drawer-title-wrap {
  min-width: 0;
  flex: 1;
}

.sch-eyebrow {
  color: var(--sch-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
  line-height: 1;
  text-transform: uppercase;
}

.sch-drawer-title {
  margin: 3px 0 0;
  color: var(--sch-gold-hi);
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.1;
}

.sch-drawer-body {
  flex: 1;
  min-height: 0;
  padding: 13px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  scrollbar-color: #6b5530 transparent;
  -webkit-overflow-scrolling: touch;
}

.sch-intro {
  margin: 0 2px 12px;
  color: #cabd9f;
  font-size: 14px;
  line-height: 1.35;
}

.sch-mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.sch-mode-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 15px;
  border: 1px solid rgba(216, 178, 92, .46);
  border-radius: 13px;
  background: #1b140c;
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(0, 0, 0, .38), 0 1px 0 rgba(255, 235, 180, .08) inset;
  isolation: isolate;
}

.sch-mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("/assets/ui/scene-command-modes.webp");
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-position: var(--sch-art-x, left) center;
  transition: transform .32s ease, filter .24s ease;
}

.sch-mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(8, 6, 4, .92) 0%, rgba(8, 6, 4, .67) 52%, rgba(8, 6, 4, .13) 100%);
}

.sch-mode-card[data-open-mode="terrain"] { --sch-art-x: center; }
.sch-mode-card[data-open-mode="lordship"] { --sch-art-x: right; }

.sch-mode-card:hover {
  border-color: var(--sch-gold-hi);
  box-shadow: 0 9px 26px rgba(0, 0, 0, .44), 0 0 0 1px rgba(239, 207, 131, .15) inset;
}

.sch-mode-card:hover::before {
  transform: scale(1.035);
  filter: brightness(1.08);
}

.sch-mode-card:active {
  transform: scale(.985);
}

.sch-mode-card[disabled] {
  cursor: not-allowed;
  filter: grayscale(.72);
  opacity: .65;
}

.sch-mode-card[disabled]::after {
  background: rgba(8, 7, 5, .72);
}

.sch-card-copy {
  max-width: 78%;
}

.sch-card-kicker {
  display: block;
  margin-bottom: 3px;
  color: #dec586;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.sch-card-title {
  display: block;
  color: #fff0c7;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 19px;
  line-height: 1.05;
  text-shadow: 0 2px 3px #000;
}

.sch-card-desc {
  display: block;
  margin-top: 4px;
  color: #d4c7ab;
  font-size: 12px;
  line-height: 1.2;
}

.sch-lock {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226, 193, 118, .48);
  border-radius: 999px;
  background: rgba(21, 15, 8, .86);
  font-size: 15px;
}

.sch-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 2px 8px;
  color: var(--sch-gold-hi);
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 15px;
  font-weight: 400;
}

.sch-section-title small {
  color: var(--sch-muted);
  font-family: "Crimson Text", Georgia, serif;
  font-size: 11px;
}

.sch-resources {
  display: flex;
  gap: 5px;
  margin-bottom: 11px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sch-resources::-webkit-scrollbar { display: none; }

.sch-resource {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 5px 8px;
  border: 1px solid rgba(130, 105, 60, .38);
  border-radius: 8px;
  background: rgba(18, 14, 9, .58);
  color: #ddd0b5;
  font-size: 12px;
  text-align: center;
}

.sch-resource b {
  color: #fff0c7;
  font-weight: 600;
}

.sch-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sch-tabs::-webkit-scrollbar { display: none; }

.sch-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid rgba(125, 99, 52, .56);
  border-radius: 999px;
  background: rgba(27, 20, 11, .82);
  color: #bcae8f;
  cursor: pointer;
  white-space: nowrap;
}

.sch-tab.active {
  border-color: var(--sch-gold);
  background: rgba(84, 60, 23, .72);
  color: #f6dda0;
  box-shadow: 0 0 0 1px rgba(234, 198, 109, .11) inset;
}

.sch-building-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.sch-modular-launch {
  position: relative;
  min-height: 56px;
  overflow: hidden;
  border-color: #c5a24e;
  background:
    linear-gradient(90deg, rgba(80, 53, 20, .94), rgba(45, 31, 15, .88)),
    url("/assets/ui/scene-command-modes.webp");
  background-size: auto, 300% 100%;
  background-position: center, left center;
  text-shadow: 0 2px 3px #000;
}

.sch-modular-studio {
  width: 100%;
  min-height: 38px;
  margin: -2px 0 4px;
  border-color: rgba(158, 129, 73, .62);
  color: #d9c598;
  background: linear-gradient(180deg, rgba(42, 33, 21, .92), rgba(24, 19, 13, .94));
}

.sch-modular-list {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.sch-modular-building {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: stretch;
  padding: 7px;
  border: 1px solid rgba(153, 122, 64, .52);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(45, 33, 18, .9), rgba(19, 14, 9, .94));
}

.sch-modular-select {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.sch-modular-emblem {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 178, 92, .42);
  border-radius: 9px;
  background: radial-gradient(circle at 35% 25%, #614b2b, #251a0e 74%);
  color: #efd286;
  font-size: 22px;
}

.sch-modular-edit {
  min-width: 74px;
  padding: 6px 8px;
  border: 1px solid rgba(121, 157, 104, .62);
  border-radius: 8px;
  background: linear-gradient(180deg, #385c37, #203b20);
  color: #dcefd6;
  cursor: pointer;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 11px;
}

.sch-modular-edit:disabled {
  border-color: rgba(126, 104, 65, .48);
  background: rgba(33, 25, 16, .84);
  color: #988b72;
  cursor: default;
}

.sch-building {
  padding: 10px;
  border: 1px solid rgba(126, 102, 61, .48);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(37, 28, 16, .88), rgba(18, 14, 9, .92));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

.sch-building.locked {
  opacity: .56;
}

.sch-building-main {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sch-building-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 178, 92, .35);
  border-radius: 9px;
  background: radial-gradient(circle at 35% 28%, #584223, #21180d 74%);
  font-size: 23px;
}

.sch-building-copy {
  min-width: 0;
  flex: 1;
}

.sch-building-name {
  overflow: hidden;
  color: #f2dfb3;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-building-meta {
  margin-top: 2px;
  color: var(--sch-muted);
  font-size: 11px;
  line-height: 1.2;
}

.sch-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sch-material {
  min-height: 40px;
  flex: 1 1 130px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(125, 99, 52, .58);
  border-radius: 8px;
  background: rgba(30, 22, 12, .95);
  color: #e9d9b5;
  cursor: pointer;
}

.sch-material:hover {
  border-color: var(--sch-gold);
}

.sch-material:disabled {
  cursor: not-allowed;
  opacity: .47;
}

.sch-material-cost {
  color: #b9d59d;
  font-size: 10px;
  white-space: nowrap;
}

.sch-material:disabled .sch-material-cost {
  color: #d99a8e;
}

.sch-callout {
  margin: 8px 0 11px;
  padding: 10px 11px;
  border: 1px solid rgba(196, 155, 73, .38);
  border-radius: 10px;
  background: rgba(79, 57, 23, .24);
  color: #d8c9aa;
  font-size: 13px;
  line-height: 1.35;
}

.sch-callout.locked {
  border-color: rgba(184, 102, 85, .5);
  background: rgba(94, 35, 28, .25);
  color: #e1b6ac;
}

.sch-primary,
.sch-secondary {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-family: "MedievalSharp", Georgia, serif !important;
  font-size: 14px !important;
}

.sch-primary {
  border: 1px solid #a78a48;
  background: linear-gradient(180deg, #725526, #3e2c14);
  color: #fff0c4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3), 0 1px 0 rgba(255, 239, 183, .15) inset;
}

.sch-secondary {
  border: 1px solid rgba(132, 108, 66, .72);
  background: linear-gradient(180deg, #302419, #1a140e);
  color: #d9caad;
}

.sch-primary:disabled,
.sch-secondary:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.sch-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sch-stat {
  min-height: 68px;
  padding: 9px 10px;
  border: 1px solid rgba(124, 99, 54, .42);
  border-radius: 9px;
  background: rgba(18, 14, 9, .62);
}

.sch-stat-label {
  color: var(--sch-muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sch-stat-value {
  margin-top: 3px;
  overflow: hidden;
  color: #f0ddaf;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-dock {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: min(660px, calc(100vw - 24px));
  min-height: var(--sch-dock-h);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(216, 178, 92, .62);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(32, 24, 14, .94), rgba(10, 8, 5, .97)),
    url("/assets/ui/scene-command-surface.webp");
  background-size: auto, 380px 380px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .65), 0 1px 0 rgba(255, 234, 178, .12) inset;
  transform: translateX(-50%);
  backdrop-filter: blur(9px);
  pointer-events: auto;
}

.sch-dock-button {
  position: relative;
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #c9bda4;
  cursor: pointer;
}

.sch-dock-button:hover {
  background: rgba(95, 68, 27, .28);
  color: #f2ddb0;
}

.sch-dock-button.active {
  border-color: rgba(216, 178, 92, .66);
  background: linear-gradient(180deg, rgba(103, 75, 30, .66), rgba(50, 35, 16, .76));
  color: #ffe6a8;
  box-shadow: 0 0 0 1px rgba(255, 225, 153, .08) inset, 0 4px 12px rgba(0, 0, 0, .24);
}

.sch-dock-button.locked {
  opacity: .5;
}

.sch-mode-art {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 1px solid rgba(222, 188, 113, .48);
  border-radius: 9px;
  background-image: url("/assets/ui/scene-command-modes.webp");
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-position: left center;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .4);
}

.sch-dock-button[data-mode="terrain"] .sch-mode-art { background-position: center center; }
.sch-dock-button[data-mode="lordship"] .sch-mode-art { background-position: right center; }

.sch-dock-label {
  min-width: 0;
  overflow: hidden;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: clamp(12px, 2vw, 15px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-placebar {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(var(--sch-dock-h) + 24px + env(safe-area-inset-bottom, 0px));
  width: min(540px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(216, 178, 92, .72);
  border-radius: 13px;
  background:
    linear-gradient(180deg, rgba(34, 26, 15, .96), rgba(12, 9, 6, .98)),
    url("/assets/ui/scene-command-surface.webp");
  background-size: auto, 360px 360px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .62);
  pointer-events: auto;
}

.sch-placebar.open { display: flex; }

.sch-place-copy {
  min-width: 0;
  flex: 1;
  padding: 0 5px;
}

.sch-place-title {
  overflow: hidden;
  color: #f1d99e;
  font-family: "MedievalSharp", Georgia, serif;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sch-place-hint {
  margin-top: 2px;
  color: var(--sch-muted);
  font-size: 10px;
}

.sch-placebar button {
  min-width: 46px;
  min-height: 46px;
  padding: 6px 10px;
  border: 1px solid rgba(139, 112, 63, .7);
  border-radius: 9px;
  background: linear-gradient(180deg, #342718, #1b150e);
  color: #eadabc;
  cursor: pointer;
}

.sch-placebar button:disabled {
  cursor: not-allowed;
  filter: grayscale(.65);
  opacity: .5;
}

.sch-placebar .confirm {
  border-color: #6c9d61;
  background: linear-gradient(180deg, #3f7540, #214522);
  color: #e6f5df;
}

.sch-placebar .cancel {
  border-color: #a55c4e;
  background: linear-gradient(180deg, #71392f, #3e201b);
  color: #f2d0ca;
}

.sch-toast {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(var(--sch-dock-h) + 92px + env(safe-area-inset-bottom, 0px));
  width: max-content;
  max-width: min(88vw, 520px);
  padding: 9px 14px;
  border: 1px solid rgba(216, 178, 92, .7);
  border-radius: 10px;
  background: rgba(14, 10, 6, .96);
  color: #f0dfba;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .58);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}

.sch-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.sch-lordship-panel #st-hud {
  z-index: 82;
}

@media (max-width: 720px) {
  :root { --sch-dock-h: 68px; }

  .sch-vignette { opacity: .42; }

  .sch-status {
    top: calc(5px + env(safe-area-inset-top, 0px));
    width: calc(100vw - 12px);
    min-height: 62px;
    gap: 4px;
    padding: 5px;
  }

  .sch-back-button,
  .sch-overview-button {
    min-width: 44px;
    min-height: 44px;
  }

  .sch-place-crest img {
    width: 32px;
    height: 32px;
  }

  .sch-location-line {
    display: block;
  }

  .sch-settlement {
    font-size: clamp(12px, 3.7vw, 15px);
  }

  .sch-year {
    display: block;
    margin-top: 1px;
    font-size: 9px;
  }

  .sch-context {
    margin-top: 1px;
    font-size: 9px;
  }

  .sch-context::after {
    content: " · " attr(data-control);
    color: #bda873;
  }

  .sch-control-badge {
    display: none;
  }

  .sch-top-actions {
    gap: 3px;
  }

  .sch-input-button,
  .sch-view-button {
    min-width: 48px;
    min-height: 48px;
    flex-direction: column;
    gap: 1px;
    padding: 2px 3px;
    font-size: 8px;
  }

  .sch-input-button img,
  .sch-view-button img {
    width: 25px;
    height: 25px;
  }

  .sch-view-button i {
    display: none;
  }

  .sch-view-menu {
    right: 4px;
  }

  .sch-scrim {
    bottom: calc(var(--sch-dock-h) + 13px + env(safe-area-inset-bottom, 0px));
  }

  .sch-drawer {
    top: auto;
    left: max(6px, env(safe-area-inset-left, 0px));
    right: max(6px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--sch-dock-h) + 17px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: min(69vh, 650px);
    border-radius: 16px 16px 12px 12px;
    transform: translateY(calc(100% + 100px));
  }

  .sch-drawer.open {
    transform: translateY(0);
  }

  .sch-drawer-head {
    min-height: 56px;
    padding: 8px 10px 7px 13px;
  }

  .sch-drawer-head::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    width: 42px;
    height: 3px;
    border-radius: 999px;
    background: rgba(219, 189, 122, .38);
    transform: translateX(-50%);
  }

  .sch-drawer-title { font-size: 17px; }
  .sch-drawer-body { padding: 11px 11px 14px; }
  .sch-intro { font-size: 13px; }

  .sch-mode-card {
    min-height: 116px;
    padding: 12px;
  }

  .sch-card-title { font-size: 17px; }
  .sch-card-desc { font-size: 11px; }

  .sch-dock {
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 12px);
    min-height: var(--sch-dock-h);
    gap: 2px;
    padding: 4px;
    border-radius: 14px;
  }

  .sch-dock-button {
    min-height: 58px;
    gap: 4px;
    padding: 4px;
  }

  .sch-mode-art {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .sch-dock-label {
    font-size: clamp(10px, 3vw, 12px);
  }

  .sch-placebar {
    bottom: calc(var(--sch-dock-h) + 16px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 12px);
    padding: 6px;
  }

  .sch-placebar button {
    min-width: 44px;
    min-height: 44px;
    padding: 4px 8px;
  }

  .sch-placebar button span { display: none; }

  .sch-modular-building {
    grid-template-columns: minmax(0, 1fr) 68px;
    padding: 6px;
  }

  .sch-modular-edit {
    min-width: 0;
    padding: 5px;
    font-size: 10px;
  }

  .sch-toast {
    bottom: calc(var(--sch-dock-h) + 76px + env(safe-area-inset-bottom, 0px));
  }

  body.sch-lordship-panel #st-hud {
    bottom: calc(var(--sch-dock-h) + 18px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100vh - var(--sch-dock-h) - 92px);
  }

  body.scene-terrain-open .sch-drawer,
  body.scene-terrain-open .sch-scrim {
    display: none;
  }
}

@media (max-width: 420px) {
  .sch-dock-button {
    flex-direction: column;
    gap: 1px;
  }

  .sch-mode-art {
    width: 34px;
    height: 34px;
  }

  .sch-dock-label {
    max-width: 92px;
    line-height: 1;
  }

  .sch-summary-grid { gap: 6px; }
}

@media (min-width: 721px) and (max-height: 700px) {
  .sch-drawer {
    top: calc(82px + env(safe-area-inset-top, 0px));
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sch-drawer,
  .sch-scrim,
  .sch-toast,
  .sch-mode-card::before {
    transition: none;
  }
}
