/* Saurian Works: Tech Tycoon — UI Vault Steampunk Brass Rail Commercial Stylesheet
 * 100% Offline WebView2 Safe: ZERO external fonts, ZERO GPU blur filters, 720p/1080p 0-scroll, 9-lang safe
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1A1614;
  color: #FAF0D7;
  font-family: var(--uiv-font-body, 'Segoe UI', system-ui, sans-serif);
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

/* ==================== TITLE SCREEN ==================== */
.screen-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#screen-title {
  background: #1A1614 url('../assets/art/title_bg.jpg') center center / cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 28px 36px 36px;
}

.title-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 14, 10, 0.56) 0%, rgba(20, 14, 10, 0.18) 45%, rgba(20, 14, 10, 0.72) 100%);
  pointer-events: none;
}

.title-top-row {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.title-center-stage {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 780px;
}

.title-logo-ribbon {
  padding: 12px 44px;
  text-align: center;
}

.title-logo-main {
  font-family: var(--uiv-font-display, 'Trebuchet MS', sans-serif);
  font-size: clamp(34px, 4.2vw, 62px);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #FFE14D;
  -webkit-text-stroke: 2px #1E1510;
  text-shadow: 0 4px 0 #1E1510, 0 8px 18px rgba(0, 0, 0, 0.55);
  line-height: 1.06;
}

.title-logo-sub {
  font-size: clamp(16px, 1.5vw, 24px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #FAF0D7;
  text-shadow: 0 2px 0 #1E1510;
  margin-top: 4px;
}

.title-hero-frame {
  position: relative;
  width: clamp(220px, 26vh, 330px);
  height: clamp(240px, 32vh, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#title-hero-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.55));
}

.title-cta-wrap {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#btn-play-main {
  min-width: 240px;
  height: 64px;
  padding: 0 32px;
  border-width: 12px 32px 12px 32px;
  border-image-width: 12px 32px 12px 32px;
  font-size: clamp(20px, 1.8vw, 26px);
  font-weight: 900;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#btn-title-settings {
  height: 44px;
  padding: 0 14px;
  border-width: 7px 14px 8px 14px;
  border-image-width: 7px 14px 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

#btn-title-settings img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* ==================== GAMEPLAY FULL-BLEED CANVAS ==================== */
#foundry-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

#vfx3d-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 12;
}

#cutin-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 65;
}

/* ==================== FLOATING TOP HUD (720p/1080p NOWRAP) ==================== */
.top-hud-bar {
  position: fixed;
  top: 10px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.hud-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  min-width: 0;
}

.hud-pill {
  height: 42px;
  padding: 0 8px;
  border-width: 6px 14px 6px 10px;
  border-image-width: 6px 14px 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(13px, 0.98vw, 15px);
  font-weight: 800;
  color: #FAF0D7;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hud-sep {
  opacity: 0.65;
}

.hud-pill img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

#hud-grid-label.is-surge {
  color: #FFE14D;
}

.hud-obj-float {
  position: fixed;
  top: 58px;
  left: 14px;
  z-index: 19;
  height: 36px;
  max-width: 260px;
  pointer-events: none;
}

.hud-nav-btn {
  position: relative;
  overflow: visible !important;
  height: 42px;
  padding: 0 8px;
  border-width: 6px 12px 7px 12px;
  border-image-width: 6px 12px 7px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: clamp(12.5px, 0.94vw, 14px);
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-nav-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.hud-icon-only {
  width: 42px;
  padding: 0;
  border-width: 6px;
  border-image-width: 6px;
}

.notify-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #D93829;
  border: 2px solid #FAF0D7;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 12;
}

/* ==================== BOTTOM COMPACT ACTION DOCK (ROUND 5 RATIOS) ==================== */
.bottom-dock-wrap {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  border-width: 6px 18px 8px 18px;
  border-image-width: 6px 18px 8px 18px;
}

/* CRITICAL ANT_ICON_IN_GIANT_BOX LAW:
 * Main booster icon MUST be direct first <img> child (.booster-btn > img.booster-icon) at 44x44px (40x40px @ 720p)
 * and cost/status badge chip placed AFTER it at 14x14px with overflow: visible !important!
 */
.booster-btn {
  position: relative;
  overflow: visible !important;
  width: 78px;
  height: 78px;
  padding: 2px;
  border-width: 8px;
  border-image-width: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.booster-btn > img.booster-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  pointer-events: none;
  flex-shrink: 0;
}

.booster-lbl {
  font-size: 12px;
  font-weight: 800;
  color: #FAF0D7;
  line-height: 1.05;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.booster-cost-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #2A221E;
  border: 2px solid #E69B24;
  color: #FFE89B;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  z-index: 8;
}

.booster-cost-badge img.booster-chip {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.booster-cost-badge.is-vip-free {
  background: #1B3B2F;
  border-color: #34D399;
  color: #D1FAE5;
}

.booster-cost-badge.is-at-cap {
  background: #223029;
  border-color: #4ADE80;
  color: #BBF7D0;
}

.booster-key-tag {
  position: absolute;
  top: -8px;
  left: -6px;
  min-width: 22px;
  height: 20px;
  padding: 0 4px;
  border-radius: 6px;
  background: #1E1713;
  border: 1.5px solid #B87333;
  color: #FAF0D7;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.booster-btn.is-ready {
  filter: brightness(1.14);
  box-shadow: 0 0 0 3px #FFE14D;
}

.booster-btn.is-active {
  box-shadow: 0 0 0 3px #34D399;
}

/* ==================== BOTTOM FIXED STATUS & FTUE BAR ==================== */
.status-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: rgba(24, 18, 14, 0.90);
  border-top: 2px solid #B87333;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 700;
  color: #FAF0D7;
}

#tut-guide-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #FFE14D;
}

#btn-tut-skip {
  height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  background: #3E2E24;
  border: 1.5px solid #E69B24;
  color: #FAF0D7;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* ==================== STAGE-1 SPOTLIGHT FTUE ==================== */
#tut-spotlight-ring {
  position: fixed;
  pointer-events: none;
  z-index: 45;
}

#tut-pointer-hand {
  position: fixed;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 46;
}

/* ==================== TOAST BANNER ==================== */
#toast-banner {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  padding: 8px 22px;
  font-size: 15px;
  font-weight: 800;
  color: #FAF0D7;
  pointer-events: none;
}

/* ==================== ANTI-SAAS VISUAL-FIRST MODALS ==================== */
#dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(16, 11, 8, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

#active-modal-card {
  position: relative;
  width: min(960px, 94vw);
  max-height: min(690px, 88vh);
  display: flex;
  flex-direction: column;
  padding: 8px 14px 14px;
  color: #FAF0D7;
}

.dlg-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.dlg-ribbon-title {
  flex: 1;
  padding: 4px 18px;
  border-width: 8px 24px 12px 24px;
  border-image-width: 8px 24px 12px 24px;
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 900;
  text-align: center;
  color: #FAF0D7;
}

.dlg-close-x {
  width: 42px;
  height: 42px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dlg-close-x img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

#dlg-body-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  flex: 1;
}

.vt-tabs-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.vt-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.vt-tabs-bar .vt-tabs {
  margin-bottom: 0;
}

.vt-tab {
  height: 40px;
  padding: 0 12px;
  border-width: 7px 14px 8px 14px;
  border-image-width: 7px 14px 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.vt-guild-pill {
  height: 38px;
  padding: 0 10px;
  border-width: 6px 14px 6px 10px;
  border-image-width: 6px 14px 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.vt-grid {
  display: grid;
  gap: 12px;
}

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

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

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

.sn-main-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
}

.sn-subbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sn-sub-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 2px solid #B87333;
  background: #2A221E;
  color: #FAF0D7;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.sn-sub-btn.is-active {
  background: #E69B24;
  border-color: #FFE14D;
  color: #1E1713;
}

.sn-medal-tile {
  min-height: 174px;
  padding: 4px 6px 6px;
}

.sn-medal-tile .vt-art-box {
  width: 64px;
  height: 64px;
}

.sn-medal-tile .vt-art {
  width: 60px;
  height: 60px;
}

.sn-spark-box {
  padding: 12px 16px;
  border-width: 6px 18px 8px 18px;
  border-image-width: 6px 18px 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sn-spark-hdr {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 800;
  color: #FAF0D7;
}

.sn-spark-hdr > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

#sn-analytics-canvas {
  width: 100%;
  height: 210px;
  border-radius: 8px;
  border: 2px solid #B87333;
  display: block;
}

.stg-ver-stamp {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #C9B98A;
  opacity: 0.85;
}

/* Preserve 9-slice border-image on Vault Tiles when TrackBVisualTier sets data-visual-tier / .uiv-tier-* */
.vault-tile.uiv-tier-0,
.vault-tile.uiv-tier-1,
.vault-tile.uiv-tier-2,
.vault-tile.uiv-tier-3,
.vault-tile.uiv-tier-4 {
  border-style: solid;
  border-color: transparent;
  border-width: 14px;
}

.vault-tile.uiv-steampunk_brass_rail-card-legendary.uiv-tier-3,
.vault-tile.uiv-steampunk_brass_rail-card-legendary.uiv-tier-4 {
  border-width: 18px 14px 18px 14px;
}

.vault-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px 8px;
  border-width: 14px;
  border-image-width: 14px;
  min-height: 192px;
  text-align: center;
  color: #1E1713;
}

.vault-tile.uiv-steampunk_brass_rail-card-legendary {
  border-width: 18px 14px 18px 14px;
  border-image-width: 18px 14px 18px 14px;
}

.vt-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2A221E;
  border: 2px solid #E69B24;
  color: #FFE89B;
  font-size: 12px;
  font-weight: 800;
}

.vt-art-box {
  width: 82px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vt-art {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.vt-title {
  font-size: 15px;
  font-weight: 900;
  color: #1E1713;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vt-stat {
  font-size: 13px;
  font-weight: 800;
  color: #3A2A1E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.15;
}

.vt-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #1E1713;
}

.vt-prem-line {
  background: rgba(230, 155, 36, 0.22);
  border-radius: 8px;
  padding: 2px 8px;
}

.vt-mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(30, 23, 19, 0.12);
  font-size: 12.5px;
  font-weight: 800;
}

.vt-mini-chip.is-ok { color: #166534; }
.vt-mini-chip.is-low { color: #991B1B; }

.vt-chip-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.vt-cta {
  width: 100%;
  min-height: 38px;
  padding: 2px 8px;
  border-width: 7px 14px 8px 14px;
  border-image-width: 7px 14px 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 900;
}

.vt-cta-pair {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.vt-cta-pair .vt-cta {
  flex: 1;
}

.vt-done-pill {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(46, 139, 139, 0.22);
  border: 1.5px solid #2E8B8B;
  color: #1E1713;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.vt-bar {
  width: 100%;
  height: 18px;
  border-width: 4px 8px;
  border-image-width: 4px 8px;
  position: relative;
  overflow: hidden;
  padding: 1px;
}

.vt-fill {
  height: 100%;
  background: linear-gradient(90deg, #E69B24 0%, #FFE14D 100%);
  border-radius: 4px;
}

.vt-prog-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 800;
  color: #1E1713;
  margin-bottom: 4px;
}

.vt-foot-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ==================== SETTINGS & EXIT MODALS ==================== */
.stg-group {
  padding: 10px 14px;
  border-width: 6px 18px 8px 18px;
  border-image-width: 6px 18px 8px 18px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stg-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14.5px;
  font-weight: 800;
  color: #FAF0D7;
}

.stg-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stg-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.stg-select, .stg-input {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 2px solid #B87333;
  background: #1E1713;
  color: #FAF0D7;
  font-size: 14px;
  font-weight: 700;
}

.exit-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px;
}

.exit-hero-art {
  width: 140px;
  height: 140px;
  object-fit: contain;
}

.exit-actions {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==================== PREVIEW-ONLY DEV PANEL ==================== */
#dev-panel {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 80;
  width: 240px;
  padding: 12px;
  background: rgba(24, 18, 14, 0.95);
  border: 2px solid #E69B24;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#dev-panel button {
  height: 32px;
  border-radius: 6px;
  border: 1px solid #B87333;
  background: #3A2C22;
  color: #FAF0D7;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== 720p RESPONSIVE TIGHTENING (1280x720) ==================== */
@media (max-width: 1366px), (max-height: 768px) {
  .top-hud-bar {
    top: 6px;
    left: 8px;
    right: 8px;
    gap: 4px;
  }
  .hud-left, .hud-right {
    gap: 4px;
  }
  .hud-pill {
    height: 36px;
    padding: 0 6px;
    font-size: 12px;
    gap: 4px;
    border-width: 5px 7px !important;
    border-image-width: 5px 7px !important;
  }
  .hud-pill img {
    width: 17px;
    height: 17px;
  }
  .hud-nav-btn {
    height: 36px;
    padding: 0 7px;
    font-size: 12px;
    gap: 4px;
    border-width: 5px 7px !important;
    border-image-width: 5px 7px !important;
  }
  .hud-nav-btn img {
    width: 17px;
    height: 17px;
  }
  .hud-icon-only {
    width: 36px;
    padding: 0 !important;
  }
  .hud-obj-float {
    top: 48px;
    left: 8px;
    max-width: 240px;
  }
  .bottom-dock-wrap {
    bottom: 30px;
    padding: 5px 10px;
    gap: 8px;
  }
  .booster-btn {
    width: 70px;
    height: 74px;
    padding: 3px 2px 5px;
  }
  .booster-btn > img.booster-icon {
    width: 38px;
    height: 38px;
  }
  .vault-tile {
    min-height: 172px;
  }
  .vt-art-box {
    width: 68px;
    height: 68px;
  }
  .vt-art {
    width: 64px;
    height: 64px;
  }
}
