/* ==========================================================================
   Emberveil Grimoire — Inked Parchment & Dark Obsidian Roguelite Deckbuilder
   UI Vault Style: inked_parchment_roguelite (Contract v2.2)
   Strict Compliance:
   - 25+ Genuine UI Vault 9-Slice Regions (assets/ui/vault_inked_parchment_roguelite/)
   - STRICT COLOR BAN: ZERO neon cyan glows! bronze_gold (#E2B362) & wax_crimson (#D9534F) ONLY!
   - Lesson #11 Thin 10-12px Card Borders + Lesson #12 Dark Ink (#1A120E) on Light Parchment (#EBD5AC)
   - Pillar 1 Heroic No-Box Title (0 BOXED_LOGIN_TITLE_SCREEN)
   - Pillar 2 Full-Bleed Arena >= 70-78% Viewport + 0 Permanent Glossary Sidebar + HUD >= 13px + nowrap
   - Pillar 3 Spotlight Ring + Animated Pointer Hand (tut-hand) + 3-Icon Flow Strip
   - Pillar 5 & 6 Anti-SaaS 60/25/15 Visual Modals + Victory Sunburst + Tactile Icon Settings
   ========================================================================== */

:root {
  --bg-obsidian: #12100F;
  --bg-deep: #0B0A09;
  --bg-slate: #1C1917;
  --surface-hearth: #241E1B;
  --surface-plum: #3D312B;
  --jade-deep: #294A45;
  --jade-glow: #64998D;
  --bronze-gilded: #A38B67;
  --gold-antique: #C98A32;
  --ember-crimson: #9E2E2E;
  --gold-title: #F5DEB3;
  --parchment-paper: #EBD5AC;
  --text-light: #F2EAE0;
  --text-num: #FFF9EE;
  --ink-dark: #1A120E;

  --font-display: 'Cinzel', 'Marcellus', Palatino, 'Palatino Linotype', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;

  /* UI Vault inked_parchment_roguelite Contract v2.2 (slot_radius_px: 2, slot_daylight: 1, NO CYAN!) */
  --tb-slot-style: inked_parchment_roguelite;
  --tb-slot-shape: rect;
  --tb-slot-radius: 2px;
  --tb-slot-chamfer: 0px;
  --tb-slot-inset: 3px 3px 3px 3px;
  --tb-slot-palette: bronze_gold;
  --tb-slot-mode: chaser_slot;
  --tb-slot-daylight: 1;
  --tb-slot-z: 3;
}

*, *::before, *::after {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

[hidden], .is-hidden-unlock {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-obsidian);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.3;
}

/* Typography Utilities */
.font-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold-title);
  text-shadow: 0 2px 0 #120B08, 0 0 12px rgba(201, 138, 50, 0.32);
}

.tabular-nums {
  font-family: var(--font-body);
  font-weight: 800;
  color: var(--text-num);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.92);
}

/* ==========================================================================
   Genuine UI Vault 9-Slice Chrome (assets/ui/vault_inked_parchment_roguelite/)
   ========================================================================== */
.panel-9slice {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 22px 22px 28px 22px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_modal.png') 62 63 88 63 fill / 22px 22px 28px 22px / 0 stretch;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.82);
}

.subpanel-9slice,
.rail-card {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 13px 15px 11px 15px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_subpanel.png') 78 92 55 92 fill / 13px 15px 11px 15px / 0 stretch;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pill-9slice,
.stat-chip {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 8px 14px 8px 14px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/hud_pill.png') 41 80 42 79 fill / 8px 14px 8px 14px / 0 stretch;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 13.5px;
  white-space: nowrap;
  position: relative;
  overflow: visible !important;
}

.popout-chip {
  margin-left: 6px;
  padding-left: 6px;
}

.chip-pop-ico {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin: -8px 2px -8px -14px;
  flex-shrink: 0;
  pointer-events: none;
}

.ribbon-9slice {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 12px 28px 12px 20px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/ribbon_header.png') 58 237 60 106 fill / 12px 28px 12px 20px / 0 stretch;
}

/* Sculpted 4-State UI Vault Buttons (overflow: visible for pop-outs & .notify-badge!) */
button {
  font-family: var(--font-body);
  cursor: pointer;
  position: relative;
  overflow: visible !important;
  outline: none;
  transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.14s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1.5px);
  filter: brightness(1.09);
}

button:active:not(:disabled) {
  transform: translateY(1.5px);
}

button:disabled {
  cursor: not-allowed;
}

button > .btn-label {
  display: inline-block;
  max-width: 100%;
  overflow: visible;
  white-space: nowrap;
  font-size: 13.5px;
  line-height: 1.18;
  vertical-align: middle;
}

/* Button State 1: Primary Gilded Bronze Plate (btn_primary.png) */
.btn-gold,
.btn-primary {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 10px 15px 10px 15px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/btn_primary.png') 82 70 73 83 fill / 10px 15px 10px 15px / 0 stretch;
  color: #FFFDF5;
  padding: 2px 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 3px rgba(18, 9, 4, 0.96), 0 0 6px rgba(18, 9, 4, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Button State 2: Secondary Arcane Jade Plate (btn_secondary.png) */
.btn-jade,
.btn-secondary {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 10px 15px 10px 15px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/btn_secondary.png') 61 71 61 75 fill / 10px 15px 10px 15px / 0 stretch;
  color: #F8F4EC;
  padding: 2px 8px;
  font-weight: 800;
  text-shadow: 0 2px 3px rgba(8, 16, 16, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Button State 3: Wax Crimson Combat Plate (btn_danger.png) */
.btn-ember,
.btn-danger {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 10px 16px 10px 16px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/btn_danger.png') 62 76 61 76 fill / 10px 16px 10px 16px / 0 stretch;
  color: #FFF8EB;
  padding: 3px 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 3px rgba(16, 6, 6, 0.96);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Obsidian & Tarnished Bronze Utility Plate (hud_pill.png) */
.btn-bronze {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 8px 13px 8px 13px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/hud_pill.png') 41 80 42 79 fill / 8px 13px 8px 13px / 0 stretch;
  color: #F6E7CE;
  padding: 2px 7px;
  font-weight: 700;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Button State 4: Disabled Weathered Slate Plate (btn_disabled.png) */
.btn-gold:disabled,
.btn-jade:disabled,
.btn-ember:disabled,
.btn-bronze:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-overdrive.is-uncharged {
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/btn_disabled.png') 63 76 62 76 fill / 9px 14px 9px 14px / 0 stretch;
  color: #CFC8BE;
  opacity: 0.78;
  filter: grayscale(0.2);
}

.btn-overdrive.is-uncharged {
  cursor: help;
}

/* Active Modal Tab State (tab_active.png) */
.tab-is-active {
  background: transparent !important;
  border-style: solid !important;
  border-color: transparent !important;
  border-width: 11px 14px 6px 14px !important;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/tab_active.png') 50 48 23 49 fill / 11px 14px 6px 14px / 0 stretch !important;
  color: #FDE68A !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95) !important;
}

/* Compact Square Tier-3 Utility Icon Buttons */
.icon-utility-btn {
  width: 38px;
  height: 38px;
  padding: 4px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 6px 8px 6px 8px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/slot_tile.png') 15 42 14 70 fill / 6px 8px 6px 8px / 0 stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.utility-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
}

.lexicon-qmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
  color: #FDE68A;
  line-height: 1;
}

.hotkey-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 4px;
  background: rgba(14, 11, 10, 0.88);
  border: 1px solid rgba(226, 179, 98, 0.55);
  color: #FDE68A;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

/* Red-Dot Notification Badge (Never Clipped!) */
.notify-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #C92A2A;
  border: 2px solid #FFF8EB;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.78);
}

.icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   Screen Router
   ========================================================================== */
.screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: none;
}

.screen.active {
  display: flex;
}

/* ==========================================================================
   1. Heroic No-Box Title Screen (#screen-title) — 0 BOXED_LOGIN_TITLE_SCREEN!
   ========================================================================== */
#screen-title {
  background: #0C0A09 url('../assets/art/title_bg.jpg') center center / cover no-repeat;
  align-items: center;
  justify-content: space-between;
  padding: 4vh 6.5vw;
}

#screen-title::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 48%, rgba(28, 22, 18, 0.14) 0%, rgba(11, 9, 8, 0.84) 76%),
    linear-gradient(90deg, rgba(10, 8, 7, 0.88) 0%, rgba(10, 8, 7, 0.48) 48%, rgba(10, 8, 7, 0.18) 100%);
  pointer-events: none;
}

.title-top-bar {
  position: absolute;
  top: 18px;
  right: 26px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-pill-select {
  background: #1B1714;
  color: #F5DEB3;
  border: 2px solid #A38B67;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* STRICTLY NO background or border on .title-left-column (0 BOXED_LOGIN_TITLE_SCREEN!) */
.title-left-column {
  position: relative;
  z-index: 10;
  max-width: 590px;
  width: 50%;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-crest-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-left: 8px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 8px 16px 8px 16px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/hud_pill.png') 41 80 42 79 fill / 8px 16px 8px 16px / 0 stretch;
  color: #F5DEB3;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: visible;
}

.popout-ico {
  width: 34px;
  height: 34px;
  object-fit: contain;
  margin: -10px 2px -10px -18px;
}

.title-main-heading {
  margin: 0;
  font-size: clamp(44px, 4.6vw, 68px);
  line-height: 1.03;
  letter-spacing: 0.04em;
  color: #FCE9BD;
  text-shadow:
    0 3px 0 #1A0F0A,
    0 6px 14px rgba(0, 0, 0, 0.92),
    0 0 24px rgba(201, 138, 50, 0.42);
}

.title-sub-copy {
  margin: 0;
  color: #E7DDD0;
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
}

/* Real 0-100% Preload Bar with UI Vault 9-Slice Track & Fill */
#title-loading-box {
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loading-meta-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #F5DEB3;
}

.loading-track,
.uiv-bar-track {
  width: 100%;
  height: 22px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 6px 12px 6px 12px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/bar_track.png') 39 70 42 69 fill / 6px 12px 6px 12px / 0 stretch;
  overflow: hidden;
  display: flex;
  align-items: center;
}

#title-loading-fill,
.uiv-bar-fill {
  height: 100%;
  width: 0%;
  min-width: 10px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 3px 6px 3px 6px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/bar_fill_primary.png') 25 30 28 28 fill / 3px 6px 3px 6px / 0 stretch;
  transition: width 0.16s ease-out;
}

.loading-detail-line {
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(242, 234, 224, 0.78);
  letter-spacing: 0.02em;
  min-height: 16px;
}

.title-primary-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: nowrap;
}

.title-primary-row > #btn-title-play {
  flex: 1 1 auto;
}

.title-continue-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  margin-left: 4px;
  border-radius: 4px;
  background: rgba(16, 12, 10, 0.72);
  border: 1px solid rgba(245, 222, 179, 0.55);
  color: #FDE68A;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#btn-title-new-run {
  flex: 0 0 auto;
  min-height: 62px;
  padding: 4px 12px;
  white-space: nowrap;
}

.title-cta-stack {
  display: none;
  flex-direction: column;
  gap: 12px;
  max-width: 440px;
}

.title-cta-stack.ready {
  display: flex;
}

#btn-title-play {
  min-width: 260px;
  min-height: 62px;
  border-width: 13px 22px 13px 22px;
  border-image-width: 13px 22px 13px 22px;
  font-family: var(--font-display);
}

#btn-title-play > .btn-label {
  font-size: clamp(17px, 1.45vw, 22px);
  letter-spacing: 0.05em;
}

.cta-pop-ico {
  width: 42px;
  height: 42px;
  object-fit: contain;
  margin: -8px 4px -8px -6px;
  flex-shrink: 0;
}

.title-secondary-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.title-secondary-row > button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
}

.title-portrait-stage {
  position: relative;
  z-index: 8;
  width: 44%;
  height: 84vh;
  max-width: 580px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

#title-hero-portrait {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  transform-origin: 50% 94%;
}

/* ==========================================================================
   2. Full-Bleed 16:9 Tactical Battle Screen (#screen-battle)
      Playfield >= 70-78% Viewport, ZERO Permanent Keyword Sidebar, HUD >= 13px
   ========================================================================== */
#screen-battle {
  flex-direction: column;
  background: var(--bg-obsidian);
}

#hud-top-ribbon {
  height: 52px;
  width: 100%;
  background: linear-gradient(180deg, #1E1916 0%, #12100F 100%);
  border-bottom: 2px solid #7D6445;
  padding: 0 12px;
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 30;
  flex-shrink: 0;
}

#hud-top-ribbon .hud-cluster {
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#hud-top-ribbon button:not(.icon-utility-btn) {
  height: 36px;
  max-height: 38px;
  padding: 2px 8px;
  border-width: 7px 11px 7px 11px;
  border-image-width: 7px 11px 7px 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

#hud-top-ribbon button > .btn-label {
  font-size: 13px;
  overflow: visible;
}

#hud-top-ribbon .icon-img {
  width: 18px;
  height: 18px;
}

.hud-act-badge {
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.relic-shelf {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  overflow: visible;
}

.relic-slot-icon {
  width: 30px;
  height: 30px;
  padding: 3px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 4px 6px 4px 6px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/slot_tile.png') 15 42 14 70 fill / 4px 6px 4px 6px / 0 stretch;
  position: relative;
  cursor: pointer;
  transition: transform 0.16s ease;
}

.relic-slot-icon.proc-flash {
  transform: scale(1.24);
  filter: brightness(1.3);
}

/* TurnTimeline AV Strip inside Top Center */
#timeline-av-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 6px 12px 6px 12px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/hud_pill.png') 41 80 42 79 fill / 6px 12px 6px 12px / 0 stretch;
  padding: 2px 6px;
}

.av-header-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: rgba(201, 138, 50, 0.24);
  border: 1px solid rgba(245, 222, 179, 0.52);
  color: #FDE68A;
  white-space: nowrap;
  cursor: help;
}

.av-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 800;
  background: #222B29;
  border: 1px solid #64998D;
  color: #FFF9EE;
  white-space: nowrap;
  cursor: help;
}

.av-token.enemy {
  background: #381A18;
  border-color: #C95B4B;
}

.av-token.active-now {
  border-color: #F5DEB3;
  background: #523618;
  color: #FFF6D6;
}

.av-shift-up {
  color: #6EE7B7;
  font-size: 12px;
}

/* Full-Bleed Battle Workspace (>= 77% @ 1080p, >= 69% @ 720p!) */
#battle-main-grid {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
}

#arena-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #100E0D;
}

#battle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.arena-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
}

#vfx3d-canvas { z-index: 14; }
#diegetic-canvas { z-index: 15; }
#cutin-canvas { z-index: 65; }

/* Floating Corner HUD Clusters (pointer-events: none wrapper, 0 Sidebar Bloat!) */
.hud-floating-cluster {
  position: absolute;
  top: 10px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

#hud-corner-left {
  left: 12px;
  width: 244px;
}

#hud-corner-right {
  right: 12px;
  width: 236px;
}

.hud-floating-cluster > * {
  pointer-events: auto;
}

.compact-hud-card {
  padding: 5px 8px;
  gap: 5px;
}

.rail-card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #F5DEB3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pyre-num {
  color: #F5DEB3;
  font-size: 13px;
}

/* Exhaust-Pyre 9-Slice Gauge & Overdrive Ultimates */
.pyre-bar-outer {
  width: 100%;
  height: 18px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 5px 10px 5px 10px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/bar_track.png') 39 70 42 69 fill / 5px 10px 5px 10px / 0 stretch;
  overflow: hidden;
  display: flex;
  align-items: center;
}

#pyre-bar-fill {
  height: 100%;
  width: 0%;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 3px 5px 3px 5px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/bar_fill_primary.png') 25 30 28 28 fill / 3px 5px 3px 5px / 0 stretch;
  transition: width 0.2s ease;
}

.overdrive-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.btn-overdrive {
  padding: 2px 6px;
  border-width: 7px 11px 7px 11px;
  border-image-width: 7px 11px 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.btn-overdrive > .btn-label {
  font-size: 12.5px;
  line-height: 1.15;
  text-align: left;
  white-space: normal;
  overflow: visible;
  flex: 1;
  min-width: 0;
}

/* Round 5 Tactile Potion Belt (Compact Square Slots, Icon >= 58%!) */
.potion-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.potion-btn {
  width: 64px;
  height: 68px;
  padding: 3px 2px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 6px 8px 6px 8px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/slot_tile.png') 15 42 14 70 fill / 6px 8px 6px 8px / 0 stretch;
  color: #F2EAE0;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}

.potion-btn:disabled {
  opacity: 0.55;
}

.potion-btn .icon-img {
  width: 38px;
  height: 38px;
}

/* Top-Right Objective & Target Intent Pill */
.objective-list {
  font-size: 13px;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-intent-pill {
  padding-top: 4px;
  border-top: 1px solid rgba(163, 139, 103, 0.35);
  font-size: 13px;
  font-weight: 700;
  color: #F5DEB3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: help;
}

/* Unobstructed Flying Bonus Creature */
#flying-bonus-btn {
  position: absolute;
  top: 30%;
  left: 24%;
  z-index: 45;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 8px 14px 8px 14px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/btn_primary.png') 82 70 73 83 fill / 8px 14px 8px 14px / 0 stretch;
  color: #FFFDF5;
  font-weight: 800;
  font-size: 13px;
}

/* Bottom Wide Parchment Card Fan Dock */
#hand-bar {
  height: 194px;
  width: 100%;
  background: linear-gradient(180deg, rgba(22, 18, 16, 0.94) 0%, #0D0B0A 100%);
  border-top: 2px solid #8A6F4D;
  padding: 6px 14px 8px;
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr) 204px;
  align-items: center;
  gap: 10px;
  z-index: 28;
  flex-shrink: 0;
}

.mana-orb-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mana-orb {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #A8DFD1 0%, #397569 48%, #1C3C38 82%, #0F1E1D 100%);
  border: 3px solid #E2B362;
  box-shadow: inset 0 2px 8px rgba(255, 248, 220, 0.42), 0 4px 14px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: help;
}

#mana-orb-text {
  font-size: 22px;
  line-height: 1;
}

.mana-sub-lbl {
  font-size: 12px;
  font-weight: 800;
  color: #F5DEB3;
}

.pile-pill-btn {
  width: 100%;
  justify-content: space-between;
  padding: 2px 7px;
  border-width: 7px 11px 7px 11px;
  border-image-width: 7px 11px 7px 11px;
}

.pile-pair-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.blessing-pill-btn {
  padding: 2px 8px;
  border-width: 8px 12px 8px 12px;
  border-image-width: 8px 12px 8px 12px;
}

#hand-fan-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  min-width: 0;
  overflow: visible;
}

/* ==========================================================================
   Playable Parchment Rarity Cards (Lessons #11 & #12: Thin 10-12px 9-Slice + Dark Ink!)
   ========================================================================== */
.grimoire-card {
  width: 146px;
  height: 180px;
  padding: 4px 5px 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  cursor: pointer;
  flex-shrink: 1;
  min-width: 112px;
  border-style: solid;
  border-color: transparent;
  background: transparent;
  color: #1A120E;
  text-shadow: none;
  overflow: visible;
  transition: transform 0.14s cubic-bezier(0.2, 0.85, 0.25, 1), filter 0.14s ease;
}

.grimoire-card.rarity-common {
  border-width: 10px 11px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/card_common.png') 48 56 46 63 fill / 10px 11px / 0 stretch;
}

.grimoire-card.rarity-rare {
  border-width: 11px 12px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/card_rare.png') 75 85 75 85 fill / 11px 12px / 0 stretch;
}

.grimoire-card.rarity-epic {
  border-width: 11px 12px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/card_epic.png') 80 94 79 94 fill / 11px 12px / 0 stretch;
}

.grimoire-card.rarity-legendary {
  border-width: 12px 12px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/card_legendary.png') 107 96 105 95 fill / 12px 12px / 0 stretch;
}

.grimoire-card:hover:not(.unplayable) {
  transform: translateY(-14px) scale(1.06);
  z-index: 40;
}

.grimoire-card.selected {
  transform: translateY(-18px) scale(1.08);
  outline: 2px solid #E2B362;
  z-index: 42;
}

.grimoire-card.combo-synergy-ready {
  box-shadow: 0 0 14px rgba(226, 179, 98, 0.68);
}

.grimoire-card.unplayable {
  opacity: 0.62;
  filter: sepia(0.35) saturate(0.65);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 2px;
}

/* Lesson #11 Corner Pop-Out Cost Gem frees 100% of card title width! */
.card-cost-gem {
  position: absolute;
  top: -13px;
  left: -13px;
  z-index: 6;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4E341A 0%, #1F140B 85%);
  border: 2px solid #E2B362;
  color: #FFF9EE;
  font-weight: 900;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* Lesson #12 Crisp Dark Ink on All 4 Antique Parchment Rarity Cards! */
.card-title-txt {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 12.5px;
  line-height: 1.12;
  color: #1A120E;
  text-shadow: none;
  text-align: center;
  white-space: normal;
  overflow: visible;
  word-break: normal;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.card-art-window {
  width: 100%;
  height: 68px;
  border-radius: 4px;
  overflow: hidden;
  background: #1A1512;
  border: 1.5px solid #4A3828;
  position: relative;
  background-repeat: no-repeat;
}

.card-hotkey-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  margin: 0;
  z-index: 2;
}

.card-type-pill {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 2px 3px;
  border-radius: 3px;
  background: #231C18;
  color: #F6E7CE;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.card-desc-txt {
  font-size: 12px;
  line-height: 1.14;
  font-weight: 700;
  color: #231812;
  text-shadow: none;
  text-align: center;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-desc-txt strong {
  color: #5C2214;
}

.live-dmg-num {
  color: #8E1B16;
  font-weight: 900;
  text-shadow: none;
}

.end-turn-column {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

#btn-end-turn {
  min-height: 50px;
  border-width: 11px 18px 11px 18px;
  border-image-width: 11px 18px 11px 18px;
  font-family: var(--font-display);
}

#btn-end-turn > .btn-label {
  font-size: 15px;
}

/* ==========================================================================
   3. Modals (UI Vault frame_modal.png + ribbon_header.png + btn_close.png!)
      ZERO backdrop-filter: blur()!
   ========================================================================== */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(9, 8, 7, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-scrim.open {
  display: flex;
}

#modal-coach {
  z-index: 125;
}

.modal-dialog {
  width: min(1080px, 94vw);
  max-height: 91vh;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 20px 22px 26px 22px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_modal.png') 62 63 88 63 fill / 20px 22px 26px 22px / 0 stretch;
  will-change: transform, opacity;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog.compact {
  width: min(650px, 92vw);
}

.modal-header {
  padding: 8px 16px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 10px 24px 10px 18px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/ribbon_header.png') 58 237 60 106 fill / 10px 24px 10px 18px / 0 stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: clamp(18px, 1.55vw, 23px);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Lesson #15: Diamond Asset Close Button (btn_close.png) */
.modal-close-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  background: url('../assets/ui/vault_inked_parchment_roguelite/btn_close.png') center / contain no-repeat;
  border: none;
  border-image: none;
  font-size: 0;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-help-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 6px 8px 6px 8px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/slot_tile.png') 15 42 14 70 fill / 6px 8px 6px 8px / 0 stretch;
  color: #F5DEB3;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Strict Grid Containment Law */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.grid-1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.grid-3 > *, .grid-2 > *, .grid-4 > *, .grid-1 > * {
  min-width: 0;
  max-width: 100%;
}

/* ==========================================================================
   Anti-SaaS 60/25/15 Visual Cards (Seasons, Shop, Quest Passes, Mastery)
   ========================================================================== */
.sm-grid-3x2 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sm-grid-3x2 > * {
  min-width: 0;
  max-width: 100%;
}

.season-card,
.shop-pack-card {
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 13px 15px 11px 15px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_subpanel.png') 78 92 55 92 fill / 13px 15px 11px 15px / 0 stretch;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  position: relative;
  overflow: visible;
}

.season-card {
  height: 236px;
}

.sm-art-frame,
.shop-art-stage {
  position: relative;
  width: 100%;
  height: 128px;
  border-radius: 5px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 44%, #352920 0%, #171412 86%);
  border: 1px solid rgba(226, 179, 98, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sm-art-frame {
  height: 136px;
}

.sm-art-img {
  width: 100%;
  height: 100%;
  display: block;
}

.shop-art-img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  display: block;
}

.sm-VisualChip {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 13, 11, 0.92);
  border: 1.5px solid #E2B362;
  font-size: 12.5px;
  font-weight: 800;
  color: #FFF9EE;
}

.sm-meta-strip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.sm-title-txt,
.shop-title-txt {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-title-txt {
  text-align: center;
}

.sm-tag-txt {
  font-size: 12.5px;
  font-weight: 700;
  color: #9ED5C8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-cta-btn {
  width: 100%;
  height: 36px;
}

.shop-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 4;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: #9E2E2E;
  border: 1px solid #F5DEB3;
  color: #FFF8EB;
}

.shop-badge.best {
  background: #C98A32;
  color: #1A120E;
}

.shop-chips-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.rwd-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(18, 14, 12, 0.9);
  border: 1px solid rgba(226, 179, 98, 0.48);
  font-size: 12.5px;
  font-weight: 800;
  color: #FFF9EE;
  white-space: nowrap;
}

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

/* ==========================================================================
   Pillar 6: Victory 3-Star + Sunburst + Loot Counter & Tactile Icon Settings
   ========================================================================== */
.victory-sunburst-stage {
  position: relative;
  width: 100%;
  min-height: 112px;
  border-radius: 8px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 48%, rgba(226, 165, 64, 0.34) 0%, rgba(18, 14, 12, 0.90) 76%);
  border: 1px solid rgba(236, 188, 102, 0.52);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  pointer-events: none !important;
}

.victory-sunburst-stage > *,
.victory-sunburst-stage canvas {
  pointer-events: none !important;
}

.victory-sunburst-spin {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -210px;
  margin-top: -210px;
  width: 420px;
  height: 420px;
  background: url('../js/ui_motion/textures/tex_sunburst_rays.png') center / contain no-repeat;
  opacity: 0.32;
  pointer-events: none !important;
  animation: tbSunburstSpin 22s linear infinite;
}

@keyframes tbSunburstSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#reward-stars-canvas,
.victory-stars-canvas {
  position: relative;
  z-index: 2;
  width: 280px;
  height: 84px;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  align-self: center;
  flex-shrink: 0;
  pointer-events: none !important;
}

.victory-draft-kicker {
  position: relative;
  z-index: 2;
  font-size: 14px;
  font-weight: 800;
  color: #F5DEB3;
  text-align: center;
  margin: 0 auto;
  pointer-events: none !important;
}

.reward-draft-strip {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.reward-footer-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding-top: 4px;
}

.victory-next-cta {
  min-width: 240px;
  min-height: 48px;
}

.grid-3 .victory-next-cta,
.grid-2 .victory-next-cta {
  min-width: 0;
  width: 100%;
}

/* Tactile Settings Controls */
.settings-block {
  gap: 10px;
}

.settings-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  cursor: pointer;
}

.settings-lbl-grp {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-ico {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.settings-lbl {
  font-weight: 800;
  font-size: 14px;
  color: #F2EAE0;
}

.settings-slider-grp {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mute-pill-btn {
  min-width: 68px;
}

.arcane-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #9E2E2E 0%, #C98A32 100%);
  border: 1.5px solid #A38B67;
  outline: none;
  cursor: pointer;
}

.arcane-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFF8EB 0%, #E2B362 65%, #784814 100%);
  border: 2px solid #1C1714;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.75);
}

.arcane-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.arcane-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.arcane-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #2B2420;
  border: 2px solid #8A6F4D;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.arcane-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #CFC8BE;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  transition: transform 0.18s cubic-bezier(0.2, 0.85, 0.25, 1), background 0.18s ease;
}

.arcane-switch input:checked + .arcane-switch-track {
  background: #2E6F65;
  border-color: #E2B362;
}

.arcane-switch input:checked + .arcane-switch-track::after {
  transform: translateX(22px);
  background: #FFF6D6;
}

.sanctuary-embark-bar {
  padding-top: 8px;
  border-top: 1px solid rgba(163, 139, 103, 0.35);
}

/* Branching Dungeon Map Nodes */
.map-floors-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-floor-row {
  display: grid;
  grid-template-columns: 82px repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(28, 23, 20, 0.84);
  border: 1px solid #5C4934;
}

.map-node-btn {
  padding: 6px 10px;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 6px 10px 6px 12px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/slot_tile.png') 15 42 14 70 fill / 6px 10px 6px 12px / 0 stretch;
  color: #F2EAE0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
}

.map-node-btn.available {
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/btn_secondary.png') 61 71 61 75 fill / 8px 12px 8px 12px / 0 stretch;
}

.map-node-btn.cleared {
  opacity: 0.56;
}

/* ==========================================================================
   Pillar 3: Spotlight Ring + Animated Pointer Hand (`tut-hand`) & 3-Icon Strip
   ========================================================================== */
#tutorial-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  display: none;
}

#tutorial-layer.active {
  display: block;
}

.tut-spotlight {
  position: fixed;
  left: 50%;
  top: 76%;
  width: 158px;
  height: 190px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  border: 3px solid #E2B362;
  outline: 3px solid rgba(158, 46, 46, 0.55);
  will-change: transform, opacity;
  pointer-events: none !important;
  animation: tutRingPulse 1.35s ease-in-out infinite;
}

@keyframes tutRingPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.95; }
  50% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
}

.tut-hand {
  position: fixed;
  left: 50%;
  top: 76%;
  width: 54px;
  height: 54px;
  will-change: transform;
  pointer-events: none !important;
  z-index: 97;
  animation: tutHandArc 1.5s cubic-bezier(0.25, 0.8, 0.25, 1) infinite;
}

@keyframes tutHandArc {
  0% { transform: translate(-8px, 6px) scale(1); }
  45% { transform: translate(18px, -34px) scale(0.94); }
  100% { transform: translate(-8px, 6px) scale(1); }
}

#tutorial-card {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 12px 16px 10px 16px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_subpanel.png') 78 92 55 92 fill / 12px 16px 10px 16px / 0 stretch;
  padding: 4px 12px;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.tut-cue-label {
  font-size: 15px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* 3-Icon Visual Flow Strip inside Feature Coach Modal */
.guide-flow-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}

.guide-step-tile {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 12px 14px 10px 14px;
  border-image: url('../assets/ui/vault_inked_parchment_roguelite/frame_subpanel.png') 78 92 55 92 fill / 12px 14px 10px 14px / 0 stretch;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.guide-step-tile img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.guide-step-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  color: #F5DEB3;
  line-height: 1.2;
}

.guide-flow-arrow {
  font-size: 22px;
  font-weight: 900;
  color: #E2B362;
  flex-shrink: 0;
}

/* Toast & Preview-Only [DEV F2] */
#toast-stack {
  position: fixed;
  bottom: 204px;
  right: 20px;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: rgba(24, 20, 18, 0.96);
  border: 1.5px solid #A38B67;
  border-left: 4px solid #E2B362;
  color: #FFF9EE;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.82);
}

#dev-f2-pill {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 150;
  padding: 4px 9px;
  border-radius: 5px;
  background: rgba(20, 16, 14, 0.92);
  border: 1px solid #E2B362;
  color: #F5DEB3;
  font-size: 12px;
  font-weight: 800;
}

#debug-panel {
  position: fixed;
  top: 60px;
  left: 16px;
  width: min(440px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  z-index: 155;
  background: #1A1614;
  border: 2px solid #E2B362;
  border-radius: 10px;
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.88);
}

#debug-panel.open {
  display: flex;
}

/* ==========================================================================
   Responsive 1280x720 Lock (Lesson #14: flex-wrap: nowrap + >= 13px HUD!)
   ========================================================================== */
@media (max-width: 1440px) {
  #hud-top-ribbon {
    height: 48px;
    padding: 0 6px;
    gap: 4px;
  }
  #hud-top-ribbon .hud-cluster {
    gap: 4px;
  }
  #hud-top-ribbon .hotkey-tag {
    display: none;
  }
  #hud-top-ribbon button:not(.icon-utility-btn) {
    height: 34px;
    padding: 1px 5px;
    border-width: 6px 8px 6px 8px;
    border-image-width: 6px 8px 6px 8px;
    gap: 4px;
  }
  .icon-utility-btn {
    width: 32px;
    height: 32px;
  }
  .stat-chip {
    padding: 1px 6px;
    border-width: 6px 10px 6px 10px;
    border-image-width: 6px 10px 6px 10px;
    font-size: 13px;
  }
  .chip-pop-ico {
    width: 24px;
    height: 24px;
    margin: -6px 1px -6px -11px;
  }
  .av-token {
    padding: 2px 5px;
    font-size: 13px;
  }
  #hud-corner-left {
    width: 232px;
  }
  #hud-corner-right {
    width: 214px;
  }
  .potion-btn {
    width: 58px;
    height: 62px;
  }
  .potion-btn .icon-img {
    width: 34px;
    height: 34px;
  }
  #hand-bar {
    height: 174px;
    grid-template-columns: 146px minmax(0, 1fr) 188px;
    padding: 4px 10px 6px;
  }
  .mana-orb {
    width: 66px;
    height: 66px;
  }
  #mana-orb-text {
    font-size: 19px;
  }
  .grimoire-card {
    width: 132px;
    height: 164px;
    min-width: 104px;
  }
  .card-art-window {
    height: 54px;
  }
}

@media (max-width: 900px) {
  #screen-title {
    flex-direction: column;
    justify-content: center;
    padding: 16px;
  }
  .title-left-column {
    width: 100%;
    max-width: 100%;
  }
  .title-portrait-stage {
    height: 32vh;
    width: 100%;
  }
  .hud-floating-cluster {
    display: none;
  }
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   v1.0.1.0-rc1: High-Contrast Floating Combat Numbers & Multi-Line Tooltips
   ========================================================================== */
.combat-dmg-layer {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  overflow: hidden;
}

.floating-dmg-pop {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) scale(0.72);
  padding: 3px 10px;
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #FFFDF7;
  text-shadow: 0 2px 0 #120B08, 0 -1px 0 #120B08, 2px 0 0 #120B08, -2px 0 0 #120B08, 0 4px 10px rgba(0, 0, 0, 0.85);
  background: rgba(16, 12, 10, 0.72);
  border: 1.5px solid rgba(245, 222, 179, 0.55);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  animation: floatingDmgRise 1.08s cubic-bezier(0.18, 0.88, 0.32, 1) forwards;
}

.floating-dmg-pop.kind-crit {
  font-size: 28px;
  color: #FDE047;
  background: rgba(127, 29, 29, 0.90);
  border-color: #FDE047;
}

.floating-dmg-pop.kind-followup {
  font-size: 19px;
  color: #7DD3FC;
  background: rgba(12, 74, 110, 0.90);
  border-color: #38BDF8;
}

.floating-dmg-pop.kind-dot {
  font-size: 19px;
  color: #FDBA74;
  background: rgba(67, 20, 7, 0.88);
  border-color: #F97316;
}

.floating-dmg-pop.kind-poison {
  font-size: 19px;
  color: #86EFAC;
  background: rgba(20, 83, 45, 0.88);
  border-color: #4ADE80;
}

.floating-dmg-pop.kind-break {
  font-size: 18px;
  color: #FEF08A;
  background: rgba(153, 27, 27, 0.94);
  border-color: #FDE047;
}

.floating-dmg-pop.kind-block {
  font-size: 18px;
  color: #BAE6FD;
  background: rgba(15, 23, 42, 0.88);
  border-color: #67E8F9;
}

.floating-dmg-pop.kind-heal {
  font-size: 19px;
  color: #86EFAC;
  background: rgba(15, 42, 28, 0.88);
  border-color: #4ADE80;
}

.floating-dmg-pop.kind-enemy-hit {
  font-size: 22px;
  color: #FCA5A5;
  background: rgba(69, 10, 10, 0.88);
  border-color: #EF4444;
}

@keyframes floatingDmgRise {
  0% {
    opacity: 0;
    transform: translate(-50%, -35%) scale(0.72);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -62%) scale(1.14);
  }
  32% {
    opacity: 1;
    transform: translate(-50%, -74%) scale(1.0);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -106%) scale(0.98);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -132%) scale(0.94);
  }
}

.tb-tooltip-portal {
  white-space: pre-line !important;
  max-width: min(380px, calc(100vw - 20px)) !important;
  line-height: 1.42 !important;
}

.guide-step-tile .rwd-chip {
  white-space: normal;
  text-align: center;
  line-height: 1.28;
  font-size: 11.5px;
  padding: 4px 7px;
}
