/* Ironwheel Convoy Deck — Inked Parchment Roguelite Commercial Desktop UI (100% Offline, 0 Blur, 60 FPS WebView2) */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --iw-bg: #141210;
  --iw-slate: #1C1A19;
  --iw-slate-2: #262220;
  --iw-parchment: #EBD5AC;
  --iw-parchment-hi: #F6E8CA;
  --iw-ink: #1C1917;
  --iw-ink-soft: #433930;
  --iw-bronze: #C59B5F;
  --iw-bronze-hi: #F0CA82;
  --iw-amber: #E59835;
  --iw-crimson: #9E2E2E;
  --iw-crimson-hi: #D94A4A;
  --iw-teal: #2E857D;
  --iw-cyan: #58DCE8;
  --iw-light: #F3EAD8;
  --iw-muted: #B6A892;
  --iw-font-display: 'Cinzel', 'Marcellus', 'Palatino Linotype', 'Georgia', serif;
  --iw-font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--iw-bg);
  color: var(--iw-light);
  font-family: var(--iw-font-body);
  user-select: none;
  -webkit-user-select: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: var(--iw-font-body);
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  overflow: visible !important;
  position: relative;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.hidden {
  display: none !important;
}

.btn-label {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ===== CANVAS STACK (100vw x 100vh Full-Bleed Playfield) ===== */
#stage-root {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--iw-bg);
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
}

#vfx3d-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 6;
}

#cutin-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 80;
  display: none;
}

/* ===== HEROIC NO-BOX TITLE SCREEN ===== */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: #141210;
  background-image: url('../assets/art/title_bg.jpg');
  background-size: cover;
  background-position: center center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 28px 28px;
}

#title-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 65% 44%, rgba(20, 16, 14, 0.16) 0%, rgba(12, 10, 9, 0.72) 82%);
  pointer-events: none;
  z-index: 0;
}

.title-top-bar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.title-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(24, 21, 19, 0.86);
  border: 1px solid rgba(197, 155, 95, 0.55);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--iw-bronze-hi);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.title-util-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.title-hero-stage {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  pointer-events: none;
}

.title-hero-portrait-wrap {
  position: relative;
  width: clamp(250px, 28vw, 410px);
  height: clamp(340px, 60vh, 560px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

#title-hero-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.72));
}

.title-emblem-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
  gap: 14px;
  max-width: 680px;
  padding-right: 1vw;
  pointer-events: auto;
}

.title-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--iw-bronze-hi);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.92);
}

.title-main-emblem {
  font-family: var(--iw-font-display);
  font-size: clamp(38px, 4.6vw, 72px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0.05em;
  color: #FDE6A8;
  text-shadow: 0 4px 0 #1B120C, 0 8px 22px rgba(0, 0, 0, 0.92);
  margin: 0;
}

.title-cta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 8px;
}

.title-play-btn {
  min-width: 230px;
  min-height: 62px;
  padding: 0 28px;
  font-family: var(--iw-font-display);
  font-size: clamp(20px, 1.8vw, 26px);
  letter-spacing: 0.08em;
  color: #FFF8E6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.65));
}

.title-sec-btn {
  min-width: 148px;
  min-height: 54px;
  padding: 0 18px;
  font-family: var(--iw-font-display);
  font-size: clamp(14px, 1.15vw, 17px);
  color: #F6EFE2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.title-loader-wrap {
  width: min(440px, 80vw);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.title-loader-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--iw-parchment);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.title-loader-track {
  width: 100%;
  height: 22px;
  padding: 3px;
  display: flex;
  align-items: center;
}

.title-loader-fill {
  height: 100%;
  width: 0%;
  min-width: 14px;
  transition: width 120ms ease;
}

/* ===== FLOATING GAMEPLAY HUD (Full-Bleed Playfield >= 72% Clear) ===== */
#hud-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.hud-top-bar {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  pointer-events: none;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  pointer-events: auto;
}

.hud-pill-box {
  height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-width: 8px 14px 8px 14px !important;
  border-image-width: 8px 14px 8px 14px !important;
  font-family: var(--iw-font-body);
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 800;
  color: var(--iw-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-pill-box img.chip-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.hud-pill-district {
  max-width: 245px;
  color: var(--iw-bronze-hi);
}

.hud-pill-day {
  color: var(--iw-parchment);
}

.hud-btn {
  height: 42px;
  padding: 0 10px;
  border-width: 8px 10px 8px 10px !important;
  border-image-width: 8px 10px 8px 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: clamp(12.5px, 0.95vw, 14px);
  font-weight: 800;
  color: #FAF3E3;
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-btn img.btn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.hud-btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
}

.hud-btn.is-active {
  filter: brightness(1.18) saturate(1.2);
  outline: 2px solid var(--iw-bronze-hi);
  outline-offset: 1px;
}

/* Red-Dot Notification Badge (NEVER clipped — parent overflow: visible!) */
.notify-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #DC2626;
  border: 2px solid #FFF5E4;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  z-index: 35;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Top-Center Combat / Boss Header Strip */
.encounter-hud {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 46vw);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.encounter-header-bar {
  width: 100%;
  padding: 6px 14px 8px;
  background: rgba(24, 20, 18, 0.90);
  border: 2px solid var(--iw-bronze);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}

.encounter-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.encounter-name {
  font-family: var(--iw-font-display);
  color: var(--iw-bronze-hi);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.encounter-intent-badge {
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--iw-crimson);
  border: 1px solid #F6B29E;
  color: #FFF5F0;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.encounter-intent-badge.dazed {
  background: var(--iw-teal);
  border-color: var(--iw-cyan);
}

.hp-bar-outer {
  width: 100%;
  height: 14px;
  background: #120F0E;
  border: 1px solid #594A39;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9E2E2E 0%, #D94E3B 100%);
  transition: width 120ms ease;
}

.hp-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.tough-bar-outer {
  width: 100%;
  height: 8px;
  background: #10161B;
  border: 1px solid #3A5564;
  border-radius: 2px;
  overflow: hidden;
}

.tough-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2E857D 0%, #5CE1FF 100%);
  transition: width 120ms ease;
}

/* Floating Road Hover Preview Chip */
#road-hover-banner {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  background: rgba(28, 24, 21, 0.94);
  border: 2px solid var(--iw-bronze-hi);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--iw-parchment-hi);
  white-space: nowrap;
  pointer-events: none;
  z-index: 25;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
}

/* Compact Floating Squad + Relic Strip (Left/Right edge — <= 178px wide, never blocks playfield!) */
.squad-floating-strip {
  position: absolute;
  top: 66px;
  left: 12px;
  width: 176px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.squad-unit-chip {
  padding: 5px 8px;
  background: rgba(24, 21, 19, 0.86);
  border: 1px solid rgba(197, 155, 95, 0.52);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.squad-unit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 800;
}

.squad-unit-name {
  color: var(--iw-parchment);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.squad-unit-role {
  font-size: 11px;
  font-weight: 800;
  color: var(--iw-bronze-hi);
}

.squad-mini-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.squad-mini-hp {
  height: 7px;
  background: #141110;
  border-radius: 2px;
  overflow: hidden;
}

.squad-mini-hp > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2E857D, #4ADE80);
}

.squad-mini-shd {
  height: 4px;
  background: #11151B;
  border-radius: 2px;
  overflow: hidden;
}

.squad-mini-shd > i {
  display: block;
  height: 100%;
  background: #58DCE8;
}

.relic-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.relic-chip {
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(46, 36, 26, 0.9);
  border: 1px solid var(--iw-bronze);
  font-size: 11px;
  font-weight: 700;
  color: var(--iw-bronze-hi);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right-side Objective / Synergy Micro Pill */
.objective-floating-pill {
  position: absolute;
  top: 66px;
  right: 12px;
  width: 178px;
  padding: 7px 9px;
  background: rgba(24, 21, 19, 0.86);
  border: 1px solid rgba(197, 155, 95, 0.52);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.obj-title {
  font-family: var(--iw-font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--iw-bronze-hi);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.obj-line {
  font-size: 12px;
  font-weight: 700;
  color: var(--iw-parchment);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.obj-line.done {
  color: #6EE7B7;
}

/* ===== BOTTOM DECK & TACTICAL ORDERS DOCK ===== */
.hud-bottom-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

/* Hand of 4-5 Inked Parchment Road Cards */
#card-hand {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 4px 6px 2px;
  pointer-events: none;
}

.convoy-card {
  position: relative;
  width: clamp(136px, 11.4vw, 166px);
  height: clamp(162px, 21.5vh, 198px);
  padding: 4px 6px 4px;
  gap: 2px;
  border-width: 10px 10px 10px 10px !important;
  border-image-width: 10px 10px 10px 10px !important;
  background-color: var(--iw-parchment) !important;
  color: var(--iw-ink) !important;
  text-shadow: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  pointer-events: auto;
  overflow: visible !important;
  transition: transform 130ms cubic-bezier(0.22, 1.4, 0.36, 1), filter 120ms ease;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.62));
}

.convoy-card:hover {
  transform: translateY(-16px) scale(1.04);
  z-index: 12;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.78)) brightness(1.04);
}

.convoy-card:active {
  transform: translateY(-6px) scale(0.97);
}

.convoy-card .card-hop {
  position: absolute;
  top: -12px;
  left: -10px;
  min-width: 34px;
  height: 34px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--iw-crimson);
  border: 2px solid var(--iw-bronze-hi);
  color: #FFF6E6;
  font-family: var(--iw-font-display);
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
  z-index: 5;
  pointer-events: none;
}

.convoy-card .card-cost {
  position: absolute;
  top: -10px;
  right: -8px;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--iw-slate);
  border: 1.5px solid var(--iw-bronze);
  color: var(--iw-bronze-hi);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

.convoy-card .card-art-frame {
  width: 96px;
  height: 92px;
  border-radius: 6px;
  background: radial-gradient(circle, rgba(28, 25, 23, 0.20) 0%, rgba(28, 25, 23, 0.04) 76%);
  border: 1.5px solid rgba(118, 95, 68, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  flex-shrink: 0;
}

.convoy-card .card-art-frame img {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.convoy-card .card-title {
  font-family: var(--iw-font-display);
  font-size: clamp(12px, 0.86vw, 12.5px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--iw-ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.convoy-card .card-fx {
  font-family: var(--iw-font-body);
  font-size: clamp(10.5px, 0.82vw, 11.5px);
  font-weight: 700;
  line-height: 1.12;
  color: var(--iw-ink-soft);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.convoy-card .card-step-pill {
  font-size: 10.5px;
  font-weight: 800;
  color: #6B211E;
  background: rgba(158, 46, 46, 0.12);
  border: 1px solid rgba(158, 46, 46, 0.35);
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* Compact 68-80px Tactical Order Buttons ([Q] [W] [E] [R]) — Round 5 Golden Ratios! */
#orders-dock {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
  flex-shrink: 0;
}

.order-btn {
  width: 76px;
  height: 76px;
  border-width: 5px 8px 5px 10px !important;
  border-image-width: 5px 8px 5px 10px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px;
  background-color: rgba(28, 25, 23, 0.92) !important;
  overflow: visible !important;
}

.order-btn img.order-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  pointer-events: none;
}

.order-btn .order-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--iw-parchment);
  max-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.order-btn .order-key {
  position: absolute;
  top: -8px;
  left: -6px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--iw-bronze);
  border: 1.5px solid #1C1917;
  color: #1C1917;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
}

.order-btn .order-cd-mask {
  position: absolute;
  inset: 2px;
  background: rgba(12, 10, 9, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  color: #FDE6A8;
  border-radius: 2px;
  pointer-events: none;
  z-index: 4;
}

.order-btn.order-ready {
  outline: 2px solid var(--iw-amber);
  outline-offset: 1px;
}

.order-btn.order-ult-ready {
  outline: 2.5px solid #FDE68A;
  outline-offset: 1px;
  filter: brightness(1.15);
}

/* ===== MODALS (9-Slice Inked Parchment Roguelite · Anti-SaaS 60/25/15 · minmax(0,1fr)) ===== */
.modal-backdrop, .seasons-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 9, 8, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-frame, .seasons-frame {
  position: relative;
  width: min(980px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 14px 12px;
  background-color: #1B1814 !important;
  color: var(--iw-light);
  overflow: visible;
}

.seasons-frame {
  box-sizing: border-box;
  border-style: solid;
  border-color: transparent;
  border-width: 21.700px 22.050px 30.800px 22.050px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_modal.png') 62 63 88 63 fill / 21.700px 22.050px 30.800px 22.050px / 0 stretch;
  box-shadow: inset 0 1px 0 var(--uiv-bevel-hi), inset 0 -2px 0 var(--uiv-bevel-lo);
}

.modal-frame-compact {
  width: min(560px, 92vw);
}

.modal-header, .seasons-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 6px;
  border-bottom: 1px solid rgba(197, 155, 95, 0.35);
}

.modal-title, .seasons-title {
  font-family: var(--iw-font-display);
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 800;
  color: var(--iw-bronze-hi);
  letter-spacing: 0.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-close-btn, .seasons-close-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn img, .seasons-close-btn img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.modal-tabs, .seasons-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.modal-tab-btn, .seasons-tab-btn {
  height: 40px;
  padding: 0 14px;
  border-width: 8px 10px 5px 10px !important;
  border-image-width: 8px 10px 5px 10px !important;
  font-family: var(--iw-font-display);
  font-size: clamp(12.5px, 1vw, 14px);
  font-weight: 800;
  color: var(--iw-muted);
  background: rgba(34, 30, 26, 0.82);
  border: 1px solid rgba(163, 139, 103, 0.35);
  border-radius: 3px 3px 0 0;
  white-space: nowrap;
}

.modal-tab-btn.is-active, .seasons-tab-btn.is-active {
  color: #FFF6E2;
  background: transparent;
}

.modal-body, .seasons-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 2px 6px;
}

/* Strict Modal Grid Containment (minmax(0, 1fr)) */
.grid-2, .seasons-action-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.grid-3, .seasons-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grid-4, .seasons-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-5 > *, .seasons-grid-3 > *, .seasons-grid-4 > *, .seasons-action-pair > * {
  min-width: 0;
  max-width: 100%;
}

/* Visual-First 60/25/15 Shop & Meta Tiles (Zero Modal Art Starvation) */
.art-card, .vault-tile, .vault-card, .season-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 9px;
  background: linear-gradient(180deg, #27221E 0%, #1A1714 100%);
  border: 2px solid rgba(163, 139, 103, 0.55);
  border-radius: 4px;
  text-align: center;
  overflow: visible;
}

.vt-bevel {
  box-shadow: inset 0 1px 0 var(--uiv-bevel-hi), inset 0 -2px 0 var(--uiv-bevel-lo);
  transition: transform 110ms ease, filter 120ms ease;
}

.vt-bevel:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.art-card.parchment-face, .vault-tile.parchment-face, .vault-card.parchment-face, .season-card.parchment-face {
  background: linear-gradient(180deg, #F2E2BE 0%, #E1C592 100%);
  border-color: #8C6A3B;
  color: var(--iw-ink);
}

.art-card-img-box, .vt-art {
  width: 100%;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(201, 138, 50, 0.16) 0%, rgba(16, 14, 12, 0.4) 76%);
  border-radius: 3px;
  padding: 6px;
  overflow: hidden;
}

.art-card-img-box img, .vt-art img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.art-card-title, .vt-head {
  font-family: var(--iw-font-display);
  font-size: clamp(13px, 1.05vw, 15px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--iw-bronze-hi);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-card.parchment-face .art-card-title,
.vault-tile.parchment-face .vt-head,
.vault-card.parchment-face .vt-head,
.season-card.parchment-face .vt-head {
  color: var(--iw-ink);
}

.art-card-sub, .vt-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--iw-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-card.parchment-face .art-card-sub,
.vault-tile.parchment-face .vt-meta,
.vault-card.parchment-face .vt-meta,
.season-card.parchment-face .vt-meta {
  color: var(--iw-ink-soft);
}

.art-card-badge, .vt-badge {
  position: absolute;
  top: -9px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--iw-crimson);
  border: 1px solid var(--iw-bronze-hi);
  color: #FFF7E8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  z-index: 6;
}

.art-card-badge.badge-best, .vt-badge.badge-best {
  background: #B45309;
}

.art-card-badge.badge-popular, .vt-badge.badge-popular {
  background: var(--iw-teal);
}

.vt-chips {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(16, 14, 12, 0.72);
  border: 1px solid rgba(197, 155, 95, 0.45);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--iw-parchment-hi);
}

.currency-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.card-cta-btn, .vt-cta {
  width: 100%;
  min-height: 40px;
  padding: 4px 10px;
  border-width: 8px 10px 8px 10px !important;
  border-image-width: 8px 10px 8px 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.card-cta-btn img, .vt-cta img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.stg-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Operation Pass Horizontal Milestone Track */
.pass-hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #2B2119 0%, #1B1814 100%);
  border: 2px solid var(--iw-bronze);
  border-radius: 4px;
  margin-bottom: 10px;
}

.pass-track-scroll {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.pass-tier-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  background: #231E1A;
  border: 1.5px solid rgba(163, 139, 103, 0.4);
  border-radius: 4px;
}

.pass-tier-node.unlocked {
  border-color: var(--iw-bronze-hi);
  background: #2D251C;
}

.pass-tier-pill {
  font-size: 12px;
  font-weight: 800;
  color: var(--iw-bronze-hi);
}

.pass-slot {
  width: 100%;
  padding: 5px 4px;
  border-radius: 3px;
  background: rgba(16, 14, 12, 0.65);
  border: 1px solid rgba(163, 139, 103, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 800;
}

.pass-slot.claimed {
  opacity: 0.55;
  border-color: #2E857D;
}

.pass-slot.prem {
  border-color: rgba(232, 168, 73, 0.65);
}

.pass-slot img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Settings & Sliders */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vt-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(34, 29, 25, 0.85);
  border: 1px solid rgba(163, 139, 103, 0.4);
  border-radius: 4px;
}

.setting-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--iw-parchment);
}

.setting-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-controls input[type="range"] {
  width: 140px;
  accent-color: var(--iw-amber);
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.lang-chip-btn {
  padding: 7px 8px;
  border-radius: 4px;
  background: #25201C;
  border: 1.5px solid rgba(163, 139, 103, 0.4);
  color: var(--iw-parchment);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.lang-chip-btn.is-active {
  background: #4C3419;
  border-color: var(--iw-bronze-hi);
  color: #FFF8E6;
}

.gift-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.gift-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1.5px solid var(--iw-bronze);
  background: #141210;
  color: var(--iw-parchment-hi);
  font-family: var(--iw-font-body);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ===== FTUE SPOTLIGHT & 3-ICON GUIDE ===== */
#tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
}

.tut-spotlight {
  position: fixed;
  border: 3px solid #F5B951;
  border-radius: 6px;
  box-shadow: 0 0 0 9999px rgba(8, 7, 6, 0.45);
  pointer-events: none;
  z-index: 111;
  animation: uivSpotlightPulse 1.3s ease-in-out infinite;
}

.tut-pill {
  position: fixed;
  padding: 8px 16px;
  background: #1F1B17;
  border: 2px solid var(--iw-bronze-hi);
  border-radius: 4px;
  color: var(--iw-parchment-hi);
  font-family: var(--iw-font-display);
  font-size: 15px;
  font-weight: 800;
  z-index: 113;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
}

.tut-hand {
  position: fixed;
  width: 44px;
  height: 44px;
  z-index: 114;
  pointer-events: none;
  animation: uivTutHandTap 1.0s ease-in-out infinite;
}

#btn-skip-tut {
  position: fixed;
  top: 194px;
  right: 16px;
  z-index: 115;
  pointer-events: auto;
  padding: 6px 14px;
  background: rgba(28, 25, 23, 0.92);
  border: 1.5px solid var(--iw-bronze);
  border-radius: 4px;
  color: var(--iw-parchment);
  font-size: 13px;
  font-weight: 800;
}

.guide-flow-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 0 14px;
}

.guide-step-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  background: #25201B;
  border: 1.5px solid var(--iw-bronze);
  border-radius: 4px;
  text-align: center;
}

.guide-step-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.guide-step-card span {
  font-family: var(--iw-font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--iw-parchment-hi);
}

/* ===== TOAST FEEDBACK ===== */
#toast-stack {
  position: fixed;
  top: 118px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 160;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast-item {
  padding: 7px 16px;
  background: rgba(24, 20, 17, 0.95);
  border: 2px solid var(--iw-bronze-hi);
  border-radius: 4px;
  color: #FFF7E4;
  font-family: var(--iw-font-display);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.65);
}

/* ===== VICTORY / DEFEAT / DRAFT OVERLAYS ===== */
.result-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0;
}

.result-stars img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.draft-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

/* ===== PREVIEW-ONLY [DEV F2] PANEL ===== */
#dev-f2-pill {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 180;
  padding: 4px 9px;
  background: rgba(20, 18, 16, 0.88);
  border: 1px solid #C59B5F;
  border-radius: 3px;
  color: #FDE6A8;
  font-size: 11px;
  font-weight: 800;
}

#debug-panel {
  position: fixed;
  left: 10px;
  bottom: 42px;
  width: 286px;
  z-index: 181;
  padding: 10px;
  background: rgba(18, 16, 14, 0.96);
  border: 2px solid #C59B5F;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#debug-panel .dev-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

#debug-panel button {
  padding: 5px 6px;
  background: #2C241D;
  border: 1px solid #8A6F46;
  border-radius: 3px;
  color: #F5E9D3;
  font-size: 11px;
  font-weight: 700;
}

/* ===== 720p & COMPACT DESKTOP TUNING (9-Language Zero Overflow) ===== */
@media (max-width: 1366px), (max-height: 768px) {
  .hud-top-bar { top: 6px; left: 6px; right: 6px; height: 42px; gap: 3px; }
  .hud-group { gap: 3px; }
  .hud-pill-box { height: 35px; padding: 0 4px; font-size: 12px; gap: 3px; border-width: 6px 8px 6px 8px !important; border-image-width: 6px 8px 6px 8px !important; }
  .hud-pill-district { max-width: 245px; }
  .hud-pill-box img.chip-icon { width: 16px; height: 16px; }
  .hud-btn { height: 35px; padding: 0 5px; font-size: 12px; gap: 3px; border-width: 6px 7px 6px 7px !important; border-image-width: 6px 7px 6px 7px !important; }
  .hud-btn img.btn-icon { width: 15px; height: 15px; }
  .hud-btn-icon-only { width: 34px; height: 35px; padding: 0; }
  .convoy-card {
    width: 136px;
    height: 162px;
    padding: 3px 5px 3px;
    border-width: 8px 8px 8px 8px !important;
    border-image-width: 8px 8px 8px 8px !important;
  }
  .convoy-card .card-art-frame { width: 78px; height: 74px; }
  .convoy-card .card-art-frame img { width: 72px; height: 72px; }
  .convoy-card .card-title { font-size: 12px; }
  .convoy-card .card-fx { font-size: 10.5px; }
  .convoy-card .card-step-pill { font-size: 10px; padding: 0 5px; }
  .order-btn { width: 68px; height: 68px; }
  .order-btn img.order-icon { width: 38px; height: 38px; }
  .squad-floating-strip { width: 162px; top: 56px; }
  .objective-floating-pill { width: 164px; top: 56px; }
  .encounter-hud { top: 54px; }
  .art-card-img-box, .vt-art { height: 92px; }
  .art-card-img-box img, .vt-art img { width: 78px; height: 78px; }
}

@media (max-width: 900px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-hero-portrait-wrap { display: none; }
  .title-emblem-col { align-items: center; text-align: center; }
  .squad-floating-strip, .objective-floating-pill { display: none; }
}
