:root {
  /* Stacklands Warm Wooden Tabletop & Cream Parchment Palette */
  --wood-dark: #4f3522;
  --wood-mid: #6d4b32;
  --wood-light: #876042;
  --wood-trim: #3b2618;

  --parchment: #fcf5e3;
  --parchment-warm: #f3e6c8;
  --parchment-deep: #e5d2aa;
  --ink: #2b1f17;
  --ink-soft: #5c4636;

  /* Card Type Header Colors */
  --type-tower: #70bd5e;
  --type-tower-dark: #4b8f3b;
  --type-upgrade: #f0b23a;
  --type-upgrade-dark: #c28318;
  --type-skill: #58a6e8;
  --type-skill-dark: #3577b3;
  --type-buff: #bd78de;
  --type-buff-dark: #8849a8;

  /* Accent Tokens */
  --hp-red: #eb6363;
  --energy-cyan: #ffd84d;
  --gold-amber: #f7be38;
  --star-violet: #9e7bf5;
  --mint-ok: #68c962;

  --font-ui: 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', 'Segoe UI', sans-serif;
  --font-num: 'Consolas', 'Courier New', ui-monospace, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--wood-dark);
  color: var(--ink);
  font-family: var(--font-ui);
  user-select: none;
  -webkit-user-select: none;
}

canvas, img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.px-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 236, 196, 0.12), rgba(35, 20, 10, 0.42)),
    repeating-linear-gradient(
      0deg,
      var(--wood-mid) 0px,
      var(--wood-mid) 46px,
      var(--wood-dark) 46px,
      var(--wood-dark) 49px,
      var(--wood-light) 49px,
      var(--wood-light) 94px,
      var(--wood-dark) 94px,
      var(--wood-dark) 97px
    );
}

.layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* =========================================================
   TOP MINIMALIST ICON + NUMBER BATTLE HUD
   ========================================================= */
#battle-hud {
  height: 56px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(59, 38, 24, 0.92), rgba(59, 38, 24, 0.72));
  border-bottom: 3px solid var(--ink);
  z-index: 20;
}

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  cursor: help;
  transition: transform 0.14s cubic-bezier(0.22, 1.4, 0.36, 1), background-color 0.15s;
}

.hud-pill.pulse {
  transform: scale(1.16);
}

.hud-pill.shake {
  animation: hudShake 0.28s ease;
  background: #ffd6d6;
}

.pill-hp .hud-icon { color: #d94343; font-size: 17px; }
.pill-energy .hud-icon { color: #e09600; font-size: 17px; }
.pill-gold .hud-icon { color: #d68b00; font-size: 16px; }
.pill-stage .hud-icon { font-size: 15px; }
.pill-wave .hud-icon { font-size: 15px; }

.hud-center-strip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hud-center-strip::-webkit-scrollbar {
  display: none;
}

.relic-strip, .buff-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.relic-chip, .buff-chip {
  position: relative;
  width: 38px;
  height: 38px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.buff-chip {
  background: #f5e9ff;
  border-radius: 50%;
}

.relic-chip:hover, .buff-chip:hover {
  transform: translateY(-3px) scale(1.08);
}

.relic-chip.glow {
  border-color: #f5a623;
  box-shadow: 0 0 10px rgba(255, 214, 74, 0.95), 0 3px 0 var(--ink);
}

.chip-counter {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--ink);
  color: var(--parchment);
  border-radius: 9px;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  min-width: 38px;
  padding: 0 8px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.12s ease;
}

.icon-btn.icon-only {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.icon-btn:hover {
  background: #fffaf0;
  transform: translateY(-2px);
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.icon-btn.active-toggle {
  background: #ffe17d;
}

.icon-btn.confirm-reset-armed {
  width: auto;
  min-width: 98px;
  padding: 0 10px;
  gap: 5px;
  background: linear-gradient(180deg, #ffcf70, #f07865);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 0 10px rgba(240, 120, 101, 0.65), 0 3px 0 var(--ink);
}

.icon-btn.confirm-reset-armed:hover {
  background: linear-gradient(180deg, #ffda8a, #f26852);
}

.icon-btn.reset-fresh-shake {
  animation: hudShake 0.28s ease;
}

.btn-mini-num {
  font-size: 13px;
}

/* =========================================================
   BATTLEFIELD STAGE & FLOATING IN-WORLD MICRO-WIDGETS
   ========================================================= */
#stage-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px 10px;
  position: relative;
  overflow: hidden;
}

#canvas-frame {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #47783b;
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 var(--ink), 0 12px 24px rgba(24, 14, 7, 0.45);
  overflow: visible;
}

#battle-canvas {
  display: block;
  border-radius: 10px;
  cursor: grab;
}

#battle-canvas:active {
  cursor: grabbing;
}

/* Tactile Bouncing Skip Waiting Bubble at Path Entrance */
.skip-bubble {
  position: absolute;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  padding: 0 12px 0 8px;
  background: linear-gradient(180deg, #ffe77a, #f5b935);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--ink), 0 6px 14px rgba(0, 0, 0, 0.32);
  color: var(--ink);
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  transform: translate(-50%, -50%);
  animation: skipBounce 1.1s ease-in-out infinite;
}

.skip-bubble:hover {
  filter: brightness(1.07);
  animation-play-state: paused;
  transform: translate(-50%, -54%) scale(1.08);
}

.skip-bubble:active {
  transform: translate(-50%, -46%) scale(0.96);
}

.skip-ring {
  width: 28px;
  height: 28px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(43, 31, 23, 0.2);
  stroke-width: 4.5;
}

.ring-fg {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-dasharray: 120;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear;
}

.skip-bubble.rush-warning {
  background: linear-gradient(180deg, #ffcf75, #f07b3f);
}

.skip-bubble.prep-paused {
  background: linear-gradient(180deg, #e8f8dd, #9ce07c);
  animation-duration: 1.9s;
}

.skip-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.skip-reward {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--parchment);
  padding: 2px 6px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 13px;
}

/* Crisp Native-DPI DOM Drag Preview Pill & Floating Board Event Toasts */
.canvas-drag-badge {
  position: absolute;
  z-index: 18;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: #ffe075;
  border: 2.5px solid var(--ink);
  border-radius: 11px;
  box-shadow: 0 3px 0 var(--ink), 0 5px 10px rgba(0, 0, 0, 0.28);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  transform: translate(-50%, -100%);
}

.canvas-drag-badge.badge-warn {
  background: #ffd166;
  color: #2b1f17;
}

.canvas-drag-badge.badge-overdrive {
  background: #9ef2ff;
  border-color: #163240;
  color: #102a36;
}

.canvas-drag-badge.badge-evolve {
  background: #ffe787;
  border-color: #3d260b;
  color: #3b2208;
}

.board-toast-layer {
  position: absolute;
  inset: 0;
  z-index: 17;
  pointer-events: none;
  overflow: visible;
}

.board-toast-pill {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #fff2a8;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: boardToastRise 0.92s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.board-toast-pill.toast-overdrive {
  background: #aaf4ff;
  color: #102a36;
}

.board-toast-pill.toast-hearth {
  background: #ffe185;
  color: #382008;
}

.board-toast-pill.toast-dismantle {
  background: #f8e8b8;
  border-color: var(--ink);
  color: var(--ink);
}

/* Dedicated Non-Overlapping Tabletop Battlefield Inspector Sidebar */
.inspector-sidebar {
  width: 252px;
  flex: 0 0 252px;
  height: 100%;
  max-height: 100%;
  background: var(--parchment);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 var(--ink), 0 12px 22px rgba(24, 14, 7, 0.38);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  z-index: 12;
}

.insp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 2.5px dashed var(--parchment-deep);
  flex-shrink: 0;
}

.insp-portrait-box {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: radial-gradient(circle at 50% 55%, #fffef8 15%, var(--parchment-warm) 100%);
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  box-shadow: 0 2px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.insp-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.insp-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.insp-name {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insp-subtag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  align-self: flex-start;
  padding: 1px 6px;
  background: var(--parchment-warm);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
}

.insp-subtag.tier-elite {
  background: #fff0b3;
  color: #5c3a00;
}

.insp-subtag.tier-boss {
  background: #ffd4cc;
  color: #6b1414;
}

.insp-subtag.tier-evolved {
  background: #ffe58f;
  color: #4f2d00;
}

.insp-pin-btn {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: var(--parchment-warm);
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 2px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.insp-pin-btn.pinned {
  background: #ffe380;
}

.insp-pin-btn:hover {
  filter: brightness(1.06);
}

.insp-evo-banner {
  padding: 5px 7px;
  background: linear-gradient(180deg, #fff6cf, #ffe699);
  border: 2px solid #b57614;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.32;
  font-weight: 800;
  color: #4f2d00;
}

.insp-evo-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 900;
  margin-bottom: 2px;
}

.insp-hp-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-bar-track {
  position: relative;
  height: 16px;
  background: #4a3525;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.insp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #63cf55, #8ee874);
  transition: width 0.08s linear;
}

.insp-bar-fill.boss {
  background: linear-gradient(90deg, #f0713a, #ffb347);
}

.insp-bar-fill.shield {
  background: linear-gradient(90deg, #48cae4, #90e0ef);
}

.insp-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 900;
  color: #fffef8;
  text-shadow: 0 1px 2px #1e140d, 1px 0 0 #1e140d, -1px 0 0 #1e140d;
}

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

.insp-stat-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 6px;
  background: var(--parchment-warm);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.insp-stat-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.insp-stat-val {
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}

.insp-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 900;
  color: var(--ink);
}

.insp-section-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.insp-upgrade-slots {
  display: flex;
  flex-direction: column;
  gap: 3.5px;
}

.insp-upgrade-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  background: #f0e3c6;
  border: 1.5px dashed #8c7256;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  color: #786048;
}

.insp-upgrade-slot.filled {
  background: #fff8dc;
  border: 2px solid var(--ink);
  color: var(--ink);
}

.insp-slot-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #6b533d;
  border: 1.5px solid var(--ink);
  flex-shrink: 0;
}

.insp-upgrade-slot.filled .insp-slot-dot {
  background: #ffd541;
}

.insp-aura-row,
.insp-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.insp-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: var(--parchment-warm);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink);
}

.insp-chip.chip-cyan {
  background: #d8f7ff;
  color: #103c4d;
}

.insp-chip.chip-flame {
  background: #ffe3cc;
  color: #662400;
}

.insp-chip.chip-star {
  background: #f2e0ff;
  color: #461766;
}

.insp-chip.chip-grove {
  background: #e1f7d8;
  color: #1d4716;
}

.insp-dismantle-btn {
  width: 100%;
  min-height: 30px;
  margin-top: auto;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #f5dfab;
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 2.5px 0 var(--ink);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.12s ease, transform 0.1s ease;
}

.insp-dismantle-btn:hover {
  background: #ffe69e;
  transform: translateY(-1px);
}

.insp-dismantle-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.insp-dismantle-btn.confirm-armed {
  background: #ff9f45;
  border-color: #2b1408;
  color: #2b1408;
  box-shadow: 0 0 0 2px #ffe07d, 0 2.5px 0 #2b1408;
}

.insp-dismantle-btn.confirm-armed:hover {
  background: #ffad5c;
}

.insp-dismantle-hint {
  margin-top: auto;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--parchment-warm);
  border: 1.5px dashed var(--ink-soft);
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.insp-trait-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-trait-item {
  padding: 4px 6px;
  background: var(--parchment-warm);
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.3;
}

.insp-trait-label {
  font-weight: 900;
  color: var(--ink);
}

.insp-trait-detail {
  font-weight: 700;
  color: var(--ink-soft);
}

.insp-prep-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  background: #eafadf;
  border: 2px solid #2f6623;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 900;
  color: #1d4214;
}

.insp-wave-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-wave-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 6px;
  background: var(--parchment-warm);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.insp-wave-entry.next-wave {
  background: #f5ebd4;
  border-style: dashed;
}

.insp-wave-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.insp-wave-name {
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insp-wave-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-num);
  font-size: 10.5px;
  color: var(--ink-soft);
}

.insp-wave-count {
  padding: 1px 6px;
  background: var(--ink);
  color: var(--parchment);
  border-radius: 8px;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 900;
}

.insp-harmony-box {
  margin-top: auto;
  padding: 6px 8px;
  background: linear-gradient(180deg, #f5edff, #eadbff);
  border: 2px solid var(--ink);
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-harmony-track {
  height: 8px;
  background: #cab8e6;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  overflow: hidden;
}

.insp-harmony-fill {
  height: 100%;
  background: linear-gradient(90deg, #9d7bf5, #ffd147);
  transition: width 0.25s ease;
}

.insp-harmony-desc {
  font-size: 10.5px;
  line-height: 1.28;
  font-weight: 800;
  color: #392359;
}

.insp-idle-hint {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
  text-align: center;
}

/* Legacy placed-tower micro-HUD stays hidden */
.tower-micro {
  display: none !important;
}

/* =========================================================
   STACKLANDS HAND DOCK & PHYSICAL CARDS
   ========================================================= */
#hand-dock {
  height: 186px;
  padding: 2px 20px 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  z-index: 22;
}

.pile-cluster {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
}

.pile-badge {
  position: relative;
  width: 54px;
  height: 68px;
  background: var(--parchment-warm);
  border: 3px solid var(--ink);
  border-radius: 9px;
  box-shadow: 0 4px 0 var(--ink), 3px 3px 0 var(--parchment-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-num);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  transition: transform 0.14s ease, background-color 0.14s ease, box-shadow 0.16s ease;
}

.pile-badge:hover {
  transform: translateY(-3px) scale(1.06);
  background: #fff9eb;
}

.pile-badge:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 0 var(--ink), 2px 2px 0 var(--parchment-deep);
}

.pile-badge.reshuffle-out {
  animation: pileReshuffleOut 0.5s cubic-bezier(0.22, 1.35, 0.36, 1);
}

.pile-badge.reshuffle-in {
  animation: pileReshuffleIn 0.6s cubic-bezier(0.22, 1.35, 0.36, 1);
}

.pile-reshuffle-float {
  position: absolute;
  left: 27px;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #ffe57f;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
  z-index: 35;
  animation: pileReshuffleFloat 0.9s ease-out forwards;
}

.pile-icon {
  font-size: 20px;
}

.pile-num {
  font-size: 15px;
}

.redraw-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--parchment);
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s;
}

.redraw-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.06);
  background: #fff9eb;
}

.redraw-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.redraw-btn.redraw-suggest:not(:disabled) {
  background: #fff2b8;
  animation: redrawSuggestPulse 1.15s ease-in-out infinite;
}

.redraw-btn.redraw-suggest.mulligan-ready:not(:disabled) {
  background: #ebffd9;
}

.redraw-ring {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  transform: rotate(-90deg);
}

#redraw-ring-fg {
  stroke: #e89b1e;
  stroke-dasharray: 138.2;
}

.redraw-glyph {
  font-size: 24px;
  font-weight: 900;
  color: var(--ink);
}

.redraw-cost {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: #ffe169;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 1px 5px;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 900;
}

.hand-fan {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  perspective: 800px;
}

.hand-fan[data-hand-count="6"],
.hand-fan[data-hand-count="7"] {
  gap: 6px;
}

/* Tactile Stacklands Physical Card */
.sl-card {
  position: relative;
  width: 142px;
  height: 172px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 11px;
  box-shadow: 0 5px 0 var(--ink), 0 8px 16px rgba(26, 15, 8, 0.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: grab;
  transform: translateY(calc(var(--fan-y, 0px) + var(--fan-sink, 0px))) rotate(var(--fan-rot, 0deg)) scale(var(--fan-scale, 1));
  transform-origin: 50% 110%;
  transition: transform 0.18s cubic-bezier(0.22, 1.35, 0.36, 1), box-shadow 0.18s ease, filter 0.15s ease, background-color 0.15s ease;
  flex-shrink: 0;
}

.sl-card[data-type="tower"] { --card-accent: var(--type-tower); --card-accent-dark: var(--type-tower-dark); }
.sl-card[data-type="upgrade"] { --card-accent: var(--type-upgrade); --card-accent-dark: var(--type-upgrade-dark); }
.sl-card[data-type="skill"] { --card-accent: var(--type-skill); --card-accent-dark: var(--type-skill-dark); }
.sl-card[data-type="buff"] { --card-accent: var(--type-buff); --card-accent-dark: var(--type-buff-dark); }

.sl-card.upgraded {
  border-color: #3d2808;
  box-shadow: 0 0 0 2px #ffd54f inset, 0 5px 0 var(--ink), 0 8px 16px rgba(26, 15, 8, 0.32);
}

/* High-Contrast Playable Hand Cards: Luminous Emerald/Mint Readiness Glow & Elevated Lift */
.hand-fan .sl-card.playable {
  --fan-sink: -4px;
  --fan-scale: 1;
  background: #fffdf5;
  border-color: #1f3b1b;
  box-shadow:
    0 0 0 2px #9ef08a,
    0 0 14px 3px rgba(108, 232, 118, 0.68),
    0 6px 0 var(--ink),
    0 10px 18px rgba(26, 15, 8, 0.34);
}

.hand-fan .sl-card.playable.upgraded {
  box-shadow:
    0 0 0 2px #ffd54f inset,
    0 0 0 2px #9ef08a,
    0 0 15px 3px rgba(108, 232, 118, 0.72),
    0 6px 0 var(--ink),
    0 10px 18px rgba(26, 15, 8, 0.34);
}

.hand-fan .sl-card.playable:hover {
  transform: translateY(-24px) rotate(0deg) scale(1.08);
  z-index: 30;
  box-shadow:
    0 0 0 2.5px #b7ff9e,
    0 0 20px 5px rgba(118, 242, 128, 0.86),
    0 10px 0 var(--ink),
    0 16px 26px rgba(26, 15, 8, 0.44);
}

.hand-fan .sl-card.playable.overdrive-ready {
  box-shadow:
    0 0 0 2px #86eeff,
    0 0 15px 3px rgba(102, 230, 255, 0.72),
    0 6px 0 var(--ink),
    0 10px 18px rgba(26, 15, 8, 0.34);
}

/* High-Contrast Unplayable Hand Cards: Sunk Lower, Dimmed & Desaturated, Crimson Cost Pill */
.sl-card.unplayable {
  background: #d2c6b2;
  border-color: #3d322a;
  filter: grayscale(0.45) brightness(0.84);
  cursor: not-allowed;
}

.hand-fan .sl-card.unplayable {
  --fan-sink: 14px;
  --fan-scale: 1;
  box-shadow: 0 3px 0 #241b15, 0 4px 8px rgba(15, 9, 5, 0.36);
}

.hand-fan .sl-card.unplayable:hover {
  transform: translateY(calc(var(--fan-y, 0px) + 10px)) rotate(var(--fan-rot, 0deg)) scale(1);
  z-index: 25;
  box-shadow: 0 4px 0 #241b15, 0 6px 12px rgba(15, 9, 5, 0.42);
}

.sl-card.unplayable .card-art-wrap,
.sl-card.unplayable .card-desc {
  filter: grayscale(0.68) brightness(0.85);
}

.sl-card.unplayable .card-header {
  background: #7d7063;
}

.sl-card.unplayable .card-title {
  color: #f4ece0;
}

.sl-card.unplayable .card-cost {
  background: #e03131;
  border-color: #2b1414;
  color: #fffdf8;
  filter: saturate(1.85) brightness(1.08);
}

.sl-card.unplayable[data-lock-kind="target"] .card-cost {
  background: #d95b26;
  border-color: #2b1810;
  color: #fffdf8;
  filter: saturate(1.75) brightness(1.06);
}

.card-lock-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: rgba(43, 31, 23, 0.82);
  border: 1.5px solid #ffd166;
  border-radius: 5px;
}

.sl-card.dragging-source {
  opacity: 0.18;
  pointer-events: none;
}

.card-header {
  height: 30px;
  padding: 0 6px 0 5px;
  gap: 5px;
  background: var(--card-accent, var(--type-tower));
  border-bottom: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
}

.card-cost {
  flex-shrink: 0;
  min-width: 24px;
  height: 21px;
  padding: 0 5px;
  gap: 2px;
  background: #ffe46b;
  border: 2px solid var(--ink);
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  color: var(--ink);
}

.card-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}

.card-art-wrap {
  height: 62px;
  margin: 4px 7px 3px;
  background:
    radial-gradient(circle at 50% 55%, #fffdf6 10%, var(--parchment-warm) 100%);
  border: 2px solid var(--ink);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.card-art-canvas {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.card-type-pip {
  position: absolute;
  right: 4px;
  bottom: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.94;
}

/* Upgrade Card Forge Durability Pips (Bottom-Left of Card Artwork) */
.card-forge-pips {
  position: absolute;
  left: 4px;
  bottom: 3px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  background: rgba(43, 31, 23, 0.82);
  border: 1.5px solid #e9c46a;
  border-radius: 6px;
}

.forge-pip {
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: #5c4636;
  border: 1px solid #24170f;
}

.forge-pip.filled {
  background: #ffe055;
  box-shadow: 0 0 4px rgba(255, 224, 85, 0.85);
}

/* Subtle Hover-Only Single-Card Quick-Cycle Button (Top-Right of Card Artwork) */
.card-quick-swap {
  position: absolute;
  right: 3px;
  top: 3px;
  z-index: 4;
  width: 22px;
  height: 22px;
  padding: 0;
  background: #fff8dc;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.14s ease, transform 0.14s ease, background-color 0.12s ease;
}

.hand-fan .sl-card:hover .card-quick-swap {
  opacity: 0.96;
  pointer-events: auto;
  transform: translateY(0);
}

.card-quick-swap:hover:not(:disabled) {
  background: #ffe375;
  transform: translateY(-1px);
}

.card-quick-swap.on-cooldown {
  background: #dfd3be;
  cursor: not-allowed;
}

.hand-fan .sl-card:hover .card-quick-swap.on-cooldown {
  opacity: 0.48;
}

.sl-card.quick-swapping {
  animation: cardQuickSwapIn 0.28s cubic-bezier(0.22, 1.35, 0.36, 1);
}

.sl-card.quick-swap-deny {
  animation: hudShake 0.25s ease;
}

.card-desc {
  flex: 1;
  padding: 3px 7px 5px;
  font-size: 12.5px;
  line-height: 1.32;
  color: var(--ink);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  white-space: pre-line;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: hidden;
}

/* Drag Ghost Layer */
.drag-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}

.drag-ghost-wrap {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  will-change: transform;
}

.drag-ghost-wrap.over-field .sl-card {
  transform: scale(0.76);
  opacity: 0.86;
}

/* =========================================================
   UNIVERSAL STACKLANDS PARCHMENT HOVER TOOLTIP
   ========================================================= */
.tooltip-card {
  position: fixed;
  z-index: 95;
  max-width: 286px;
  padding: 10px 12px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 11px;
  box-shadow: 0 5px 0 var(--ink), 0 10px 22px rgba(0, 0, 0, 0.36);
  pointer-events: none;
}

.tt-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.tt-title {
  flex: 1;
  font-weight: 900;
  font-size: 13.5px;
  color: var(--ink);
}

.tt-tag {
  padding: 1px 6px;
  background: var(--parchment-warm);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.tt-desc {
  font-size: 12px;
  line-height: 1.42;
  color: var(--ink-soft);
  font-weight: 700;
}

.tt-warn {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  padding: 4px 7px;
  background: #ffe3e3;
  border: 1.5px solid #c92a2a;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.3;
  font-weight: 900;
  color: #9c1919;
}

.tt-overdrive {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 6px;
  padding: 4px 7px;
  background: #dff8ff;
  border: 1.5px solid #1b7fa6;
  border-radius: 6px;
  font-size: 11.2px;
  line-height: 1.32;
  font-weight: 900;
  color: #104961;
}

.tt-meta {
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1.5px dashed var(--parchment-deep);
  font-size: 11.2px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--ink);
}

.tt-evo {
  margin-top: 5px;
  padding: 4px 6px;
  background: #fff3c4;
  border: 1.5px solid #c28318;
  border-radius: 6px;
  font-size: 11.2px;
  line-height: 1.35;
  font-weight: 800;
  color: #5c3808;
}

/* =========================================================
   TABLETOP SCREENS (TITLE / META, POST-STAGE SHOP, SUMMARY)
   ========================================================= */
#screen-layer {
  z-index: 40;
  overflow-y: auto;
  padding: 20px;
  align-items: center;
  justify-content: center;
}

.tabletop-board {
  width: min(1160px, 95vw);
  max-height: 94vh;
  overflow-y: auto;
  background: var(--parchment);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 8px 0 var(--ink), 0 18px 36px rgba(20, 11, 5, 0.5);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.board-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 3px dashed var(--parchment-deep);
  padding-bottom: 9px;
}

.game-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-logo h1 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.starlight-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #efe6ff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 16px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  background: linear-gradient(180deg, #86db6e, #5ab544);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--ink);
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s;
}

.cta-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.05);
}

.cta-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}

.cta-btn.secondary {
  background: var(--parchment-warm);
  font-size: 14px;
  padding: 8px 16px;
}

.cta-btn.confirm-leave {
  background: linear-gradient(180deg, #ffcf70, #f09436);
  font-size: 14px;
  padding: 9px 16px;
}

.shop-tray.free-loot-pulse {
  animation: freeLootPulse 0.72s ease-in-out 2;
}

.cta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Progress Bar */
.unlock-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--parchment-warm);
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 8px 14px;
}

.unlock-bar-track {
  flex: 1;
  height: 16px;
  background: #dcc8a0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.unlock-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9d7bf5, #f5b942);
  transition: width 0.3s ease;
}

/* Starter Perk Row & Meta Starlight Grid */
.perk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.keepsake-grid .perk-card {
  padding: 7px 9px;
  gap: 7px;
  align-items: flex-start;
}

.keepsake-grid .meta-node-title {
  font-size: 12.5px;
}

.keepsake-grid .meta-node-desc {
  font-size: 11px;
  line-height: 1.28;
}

.perk-card {
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--parchment-warm);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s;
}

.perk-card.selected {
  background: #ffe999;
  box-shadow: 0 0 0 2px #f09c1f inset, 0 4px 0 var(--ink);
  transform: translateY(-2px);
}

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

@media (max-width: 1020px) {
  .keepsake-grid,
  .meta-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.meta-node {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  background: var(--parchment-warm);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink);
}

.meta-node.unlocked {
  background: #e9f7df;
}

.meta-node-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-node-title {
  font-weight: 900;
  font-size: 13px;
}

.meta-node-desc {
  font-size: 11.2px;
  color: var(--ink-soft);
  font-weight: 700;
  line-height: 1.32;
}

/* Shop Layout */
.shop-sections {
  display: grid;
  grid-template-columns: 1.34fr 1fr;
  gap: 14px;
}

.shop-sections .card-row {
  flex-wrap: nowrap;
  gap: 10px;
}

.shop-sections .sl-card {
  width: 138px;
}

@media (max-width: 860px) {
  .shop-sections {
    grid-template-columns: 1fr;
  }
  .shop-sections .card-row {
    flex-wrap: wrap;
  }
}

.shop-tray {
  background: var(--parchment-warm);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 900;
  font-size: 15px;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.shop-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.shop-slot.sold {
  opacity: 0.38;
  pointer-events: none;
}

.price-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #ffe373;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
}

.price-btn:disabled {
  background: #ddd1ba;
  opacity: 0.6;
  cursor: not-allowed;
}

.service-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.service-tile {
  flex: 1 1 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  font-weight: 900;
  font-size: 13px;
}

.service-tile:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Modal Drawer (Deck Viewer / Card Upgrade / Remove Picker) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: rgba(25, 15, 8, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-board {
  width: min(920px, 94vw);
  max-height: 86vh;
  background: var(--parchment);
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-card-grid {
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 8px 4px 12px;
}

.modal-empty-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 24px;
  margin: 12px auto;
  background: var(--parchment-warm);
  border: 2.5px dashed #8a735b;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  color: #5c4632;
}

.card-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 2px 0 var(--ink);
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1.25;
}

.card-zone-badge.zone-deployed {
  background: #dff5d2;
  color: #1f3b18;
}

.card-zone-badge.zone-hand {
  background: #fff0b8;
  color: #3b2808;
}

.card-zone-badge.zone-draw {
  background: #dceeff;
  color: #162d42;
}

.card-zone-badge.zone-discard {
  background: #e8dfd1;
  color: #3d3126;
}

.card-zone-badge.zone-forged {
  background: #ffe0b5;
  color: #4a2308;
}

/* Summary Stat Chips */
.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.stat-box {
  min-width: 110px;
  padding: 10px 16px;
  background: var(--parchment-warm);
  border: 3px solid var(--ink);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 18px;
}

/* Animations */
@keyframes skipBounce {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, -58%); }
}

@keyframes hudShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes pileReshuffleOut {
  0% { transform: scale(1); background: var(--parchment-warm); }
  35% { transform: translateX(-8px) scale(0.86) rotate(-6deg); background: #ffe0a3; }
  100% { transform: scale(1); background: var(--parchment-warm); }
}

@keyframes pileReshuffleIn {
  0% { transform: scale(1); }
  35% {
    transform: translateY(-6px) scale(1.15) rotate(4deg);
    background: #ffe885;
    box-shadow: 0 0 14px rgba(255, 214, 74, 0.9), 0 5px 0 var(--ink);
  }
  100% { transform: scale(1); }
}

@keyframes pileReshuffleFloat {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.85); }
  22% { opacity: 1; transform: translate(-50%, -4px) scale(1.04); }
  75% { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(0.95); }
}

@keyframes redrawSuggestPulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 2px #ffe066, 0 0 12px rgba(255, 212, 59, 0.72), 0 4px 0 var(--ink);
  }
  50% {
    transform: translateY(-3px);
    box-shadow: 0 0 0 3px #ffd43b, 0 0 18px rgba(255, 200, 40, 0.95), 0 5px 0 var(--ink);
  }
}

@keyframes freeLootPulse {
  0%, 100% {
    box-shadow: none;
    border-color: var(--ink);
  }
  45% {
    background: #fff4cc;
    border-color: #d97706;
    box-shadow: 0 0 0 3px #ffd166, 0 0 18px rgba(255, 196, 54, 0.85);
  }
}

@keyframes boardToastRise {
  0% { opacity: 0; transform: translate(-50%, -15%) scale(0.86); }
  18% { opacity: 1; transform: translate(-50%, -65%) scale(1.04); }
  78% { opacity: 1; transform: translate(-50%, -135%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.95); }
}

@keyframes cardQuickSwapIn {
  0% { opacity: 0.35; transform: translateY(18px) rotateY(55deg) scale(0.88); }
  100% { opacity: 1; transform: translateY(calc(var(--fan-y, 0px) + var(--fan-sink, 0px))) rotate(var(--fan-rot, 0deg)) scale(var(--fan-scale, 1)); }
}

@media (max-width: 1320px) {
  .inspector-sidebar {
    width: 236px;
    flex: 0 0 236px;
    padding: 7px 8px;
    gap: 5px;
  }
  .hand-fan {
    gap: 6px;
  }
  .hand-fan .sl-card {
    width: 138px;
  }
}

/* Responsive 1280x720 & Compact Laptop Height Polish */
@media (max-height: 760px) {
  #battle-hud {
    height: 50px;
    padding: 4px 12px;
  }
  #stage-wrap {
    padding: 6px 14px 8px;
    gap: 10px;
  }
  #hand-dock {
    height: 176px;
    padding: 0 16px 8px;
  }
  .sl-card {
    width: 138px;
    height: 164px;
  }
  .card-header {
    height: 27px;
  }
  .card-art-wrap {
    height: 58px;
    margin: 2px 6px 1px;
  }
  .card-art-canvas {
    width: 56px;
    height: 56px;
  }
  .card-desc {
    padding: 2px 6px 3px;
    font-size: 11.5px;
    line-height: 1.26;
  }
  .inspector-sidebar {
    padding: 7px 8px;
    gap: 5px;
  }
  .insp-portrait-box {
    width: 38px;
    height: 38px;
  }
  .tabletop-board {
    max-height: 96vh;
    padding: 10px 18px;
    gap: 8px;
  }
  .board-top {
    padding-bottom: 6px;
  }
  .shop-tray {
    padding: 7px 11px;
    gap: 6px;
  }
  .tabletop-board .sl-card {
    height: 162px;
  }
  .shop-sections .sl-card {
    width: 136px;
  }
  .service-tile {
    padding: 7px 8px;
    gap: 4px;
  }
}
