/* PixelPig - 2D Flat Ink Sticker Game Styling (No Emoji, High Contrast) */
:root {
  --ink-border: 3px solid #111111;
  --ink-shadow: 4px 4px 0px #111111;
  --ink-shadow-sm: 2px 2px 0px #111111;
  --ink-shadow-lg: 6px 6px 0px #111111;
  
  --bg-primary: #f5f6fa;
  --panel-bg: #ffffff;
  --header-bg: #2f3640;
  --accent-gold: #f1c40f;
  --accent-diamond: #00d2d3;
  --accent-green: #2ecc71;
  --accent-red: #e74c3c;
  --accent-purple: #9b59b6;
  --accent-blue: #3498db;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background-color: #1e272e;
  color: #2f3640;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

#app-container {
  width: 100%;
  max-width: 720px;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  max-height: 100dvh;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: var(--ink-border);
  border-right: var(--ink-border);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
  margin: 0 auto;
}

/* TOP STATUS HUD */
#hud-header {
  background-color: #2c3e50;
  color: #ffffff;
  padding: max(6px, env(safe-area-inset-top)) 10px 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--ink-border);
  z-index: 25;
  flex-shrink: 0;
}

.hud-resource-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #1a252f;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 3px 8px;
  font-weight: 800;
  font-size: 13px;
}

.hud-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.hud-btn {
  background: #f1c40f;
  color: #111;
  border: 2px solid #000;
  border-radius: 6px;
  padding: 3px 8px;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  box-shadow: var(--ink-shadow-sm);
}

.hud-btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* SUB HEADER (ROOM & QUICK ACTIONS) */
#sub-header {
  background: #ecf0f1;
  padding: 5px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--ink-border);
  font-size: 11px;
  font-weight: bold;
  flex-shrink: 0;
  z-index: 24;
}

#room-tag {
  font-weight: 900;
  letter-spacing: 0.5px;
}

/* CANVAS WORKSPACE */
#canvas-container {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #74b9ff;
  touch-action: none;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* IN-GAME TOAST NOTIFICATION */
#game-toast {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #ffffff;
  border: var(--ink-border);
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 900;
  font-size: 13px;
  z-index: 9999;
  box-shadow: var(--ink-shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#game-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#game-toast.error {
  background: #ff7675;
  color: #fff;
}

#game-toast.success {
  background: #55efc4;
  color: #111;
}

/* OVERLAY VIEWS */
.view-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 246, 250, 0.98);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(72px + env(safe-area-inset-bottom)) 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.hidden {
  display: none !important;
}

.view-title-bar {
  text-align: center;
  margin-bottom: 12px;
}

.view-title {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  letter-spacing: 0.5px;
}

.view-subtitle {
  font-size: 11px;
  color: #7f8c8d;
  font-weight: 600;
}

/* BOTTOM NAVIGATION BAR */
#bottom-nav {
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #ffffff;
  border-top: var(--ink-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  box-shadow: 0 -3px 0px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 1px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-btn img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.nav-btn span {
  font-size: 10px;
  font-weight: 900;
  color: #7f8c8d;
  white-space: nowrap;
}

.nav-btn.active {
  background: #f1c40f;
  border: 2px solid #000;
  box-shadow: var(--ink-shadow-sm);
  transform: translateY(-2px);
}

.nav-btn.active span {
  color: #111;
}
}

.nav-btn.active span {
  color: #000;
}

/* GACHA VIEW STYLES */
.gacha-panel-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gacha-machine-card {
  background: #ffffff;
  border: var(--ink-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--ink-shadow);
}

.gacha-machine-card.premium {
  background: #fef9e7;
  border-color: #f39c12;
}

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

.machine-title {
  font-size: 16px;
  font-weight: 900;
}

.machine-probs {
  font-size: 11px;
  color: #7f8c8d;
  font-weight: bold;
}

.gacha-card-content {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0;
}

.gacha-machine-illustration {
  width: 90px;
  height: 90px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
  animation: floatMachine 3s ease-in-out infinite alternate;
}

@keyframes floatMachine {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

.gacha-machine-details {
  flex: 1;
}

.gacha-desc {
  font-size: 12px;
  color: #576574;
  margin-bottom: 8px;
  line-height: 1.4;
}

.gacha-parts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-part {
  background: #f1f2f6;
  border: 1.5px solid #2c3e50;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
  color: #2c3e50;
}

.gacha-machine-card.premium .chip-part {
  background: #fef5e7;
  border-color: #d35400;
  color: #d35400;
}

.gacha-btn-group {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.btn-gacha-action {
  flex: 1;
  padding: 10px;
  border: var(--ink-border);
  border-radius: 8px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--ink-shadow);
  background: #f1c40f;
}

.btn-gacha-action.ten {
  background: #e67e22;
  color: #fff;
}

.btn-gacha-action:active {
  transform: translate(2px, 2px);
  box-shadow: var(--ink-shadow-sm);
}

/* CS:GO REEL MODAL */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.82);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.csgo-reel-container {
  width: 100%;
  background: #1e272e;
  border: var(--ink-border);
  border-radius: 14px;
  padding: 20px 10px;
  position: relative;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
}

.reel-window {
  width: 100%;
  height: 160px;
  overflow: hidden;
  position: relative;
  background: #111;
  border: 2px solid #333;
  border-radius: 8px;
}

.reel-pointer-top, .reel-pointer-bottom {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  z-index: 50;
}

.reel-pointer-top {
  top: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #f1c40f;
}

.reel-pointer-bottom {
  bottom: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid #f1c40f;
}

.reel-center-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: rgba(241, 196, 15, 0.6);
  z-index: 40;
}

.reel-track {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  will-change: transform;
}

.gacha-card {
  width: 130px;
  height: 140px;
  flex-shrink: 0;
  background: #2f3640;
  border: 3px solid #718093;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
}

.gacha-card-name {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gacha-card-rarity {
  font-size: 9px;
  font-weight: 900;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

/* RESULT POPUP */
.result-card-popup {
  background: #fff;
  border: var(--ink-border);
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--ink-shadow-lg);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-card-title {
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 8px;
}

.result-card-stats {
  font-size: 12px;
  color: #576574;
  margin: 8px 0;
  font-weight: bold;
}

/* Component Drop Breakdown Badges */
.gacha-components-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
  text-align: left;
}

.comp-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border: 1.5px solid #bdc3c7;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
}

.comp-badge.body {
  border-color: #f1c40f;
  background: #fef9e7;
  font-weight: bold;
}

.comp-badge.obtained {
  border-color: #2ecc71;
  background: #eafaf1;
  font-weight: bold;
  color: #27ae60;
}

.comp-badge.none {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #94a3b8;
}

.comp-label {
  font-weight: 900;
}

.comp-val {
  font-size: 10px;
}

/* BREEDING VIEW */
.breed-parents-section {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #fff;
  border: var(--ink-border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--ink-shadow);
}

.parent-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.parent-label {
  font-size: 11px;
  font-weight: 900;
  background: #2c3e50;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.breed-icon-divider {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.breed-pickers-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.picker-scroll-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
}

.picker-pig-card {
  width: 86px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.picker-pig-name {
  font-size: 10px;
  font-weight: bold;
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.btn-primary-action {
  width: 100%;
  padding: 12px;
  background: #2ecc71;
  color: #fff;
  border: var(--ink-border);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--ink-shadow);
}

.btn-primary-action:active {
  transform: translate(2px, 2px);
  box-shadow: var(--ink-shadow-sm);
}

/* CURRENCY EXCHANGE CARD */
.exchange-card {
  background: #fff;
  border: var(--ink-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: var(--ink-shadow-sm);
}

.exchange-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.btn-exchange {
  background: #f1c40f;
  color: #111;
  border: 2px solid #000;
  border-radius: 6px;
  padding: 8px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

/* SHOP & INVENTORY VIEW */
.shop-section-title {
  font-size: 14px;
  font-weight: 900;
  margin: 10px 0 6px 0;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.shop-item-card {
  background: #fff;
  border: var(--ink-border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: var(--ink-shadow-sm);
}

.shop-item-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.shop-item-title {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.shop-item-price {
  font-size: 11px;
  font-weight: 900;
  color: #00cec9;
}

.btn-buy-shop {
  background: #00d2d3;
  color: #111;
  border: 2px solid #000;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

/* INVENTORY VIEW & BATCH ACTIONS */
.inventory-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;
}

.inventory-pig-card {
  background: #fff;
  border: var(--ink-border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  box-shadow: var(--ink-shadow-sm);
}

.inventory-card-canvas {
  width: 85px;
  height: 85px;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  animation: pigThumbnailBreathe 2.4s ease-in-out infinite;
  will-change: transform;
}

@keyframes pigThumbnailBreathe {
  0%, 100% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.05, 0.95) translateY(-2px);
  }
}

.inventory-checkbox {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  accent-color: #e74c3c;
  cursor: pointer;
}

.inventory-pig-name {
  font-size: 10px;
  font-weight: 800;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.inventory-pig-val {
  font-size: 9px;
  color: #7f8c8d;
  font-weight: bold;
}

/* BOSS TOWER STYLES */
.tower-list-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.tower-floor-card {
  background: #fff;
  border: var(--ink-border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--ink-shadow-sm);
  cursor: pointer;
}

.tower-floor-card.locked {
  background: #dfe6e9;
  opacity: 0.6;
  cursor: not-allowed;
}

.tower-floor-card.cleared {
  border-color: #27ae60;
  background: #f4fbf7;
}

.tower-floor-card.current {
  border-color: #e74c3c;
  border-width: 2.5px;
  background: #fffdfd;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.25);
}

.floor-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

.floor-badge.cleared {
  background: #27ae60;
  color: #fff;
}

.floor-badge.current {
  background: #e74c3c;
  color: #fff;
  animation: pulseFloorBadge 1.5s infinite;
}

.floor-badge.locked {
  background: #95a5a6;
  color: #fff;
}

@keyframes pulseFloorBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.floor-boss-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.floor-info-box {
  flex: 1;
  margin-left: 12px;
}

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

.floor-desc {
  font-size: 11px;
  color: #7f8c8d;
}

/* SQUAD SELECTOR MODAL */
.squad-pigs-scroll {
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  border: 2px solid #000;
  padding: 8px;
  border-radius: 8px;
  background: #f8f9fa;
  margin: 10px 0;
}

.squad-pig-card {
  background: #fff;
  border: 2px solid #2c3e50;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.squad-pig-card.selected {
  border: 3px solid #2ecc71;
  background: #e8f8f5;
}

/* CAROUSEL ARROWS IN DETAIL POPUP */
.detail-preview-carousel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 8px 0;
}

.arrow-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: transform 0.15s;
}

.arrow-nav-btn:hover {
  transform: scale(1.15);
}

.arrow-nav-btn:active {
  transform: scale(0.95);
}

.arrow-nav-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

/* DETAIL & ROOM INPUTS */
.modal-form-group {
  margin: 10px 0;
  text-align: left;
}

.modal-label {
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  display: block;
}

.modal-input {
  width: 100%;
  padding: 8px 10px;
  border: var(--ink-border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  background: #f8f9fa;
}

.btn-danger-action {
  width: 100%;
  padding: 10px;
  background: #e74c3c;
  color: #fff;
  border: var(--ink-border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--ink-shadow);
  margin-top: 6px;
}

/* COMBAT ARENA STYLING: When in battle, view-boss MUST be transparent so canvas is crystal clear */
#view-boss.in-combat {
  background: transparent !important;
  pointer-events: none;
  padding: 0;
}

#view-boss.in-combat .view-title-bar,
#view-boss.in-combat #boss-tower-panel {
  display: none !important;
}

#view-boss.in-combat #boss-combat-bar {
  pointer-events: auto;
}

#boss-combat-bar {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 60;
  background: rgba(26, 37, 47, 0.94);
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid #000;
  box-shadow: var(--ink-shadow);
}

/* LIVE COMBAT PILL (Floating indicator on other tabs when battle is active) */
.battle-live-pill {
  position: absolute;
  bottom: calc(66px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: #fff;
  border: 2px solid #000;
  border-radius: 20px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 70;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: pulseGlow 2s infinite;
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e74c3c;
  display: inline-block;
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.3; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.2); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* COMBAT BADGE ON BOTTOM NAV */
.nav-combat-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  background: #e74c3c;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1px solid #000;
  white-space: nowrap;
}

/* ==========================================================================
   FARM ROOM SWITCH ARROWS & ROOM PILL
   ========================================================================== */
.room-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.9);
  border: 2.5px solid #111;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--ink-shadow-sm);
  z-index: 15;
  transition: transform 0.1s, background-color 0.1s;
}

.room-nav-arrow:hover {
  background: #ffffff;
}

.room-nav-arrow:active {
  transform: translateY(-50%) scale(0.92);
}

.room-nav-arrow.left {
  left: 12px;
}

.room-nav-arrow.right {
  right: 12px;
}

.room-nav-arrow img {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.farm-room-pill {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(26, 37, 47, 0.94);
  color: #ffffff;
  border: 2px solid #111;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 15;
  box-shadow: var(--ink-shadow-sm);
  pointer-events: none;
}

/* ==========================================================================
   STAR FAVORITE BUTTONS
   ========================================================================== */
.btn-favorite-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #2c3e50;
  border: 2px solid #111;
  border-radius: 16px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--ink-shadow-sm);
  transition: transform 0.1s;
}

.btn-favorite-pill.is-active {
  background: #f1c40f;
  color: #111;
}

.btn-favorite-pill:active {
  transform: scale(0.95);
}

.pill-star-icon {
  width: 16px;
  height: 16px;
}

.inventory-star-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid #111;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
}

.inventory-star-btn.is-favorite {
  background: #f1c40f !important;
  border-color: #d35400 !important;
  box-shadow: 0 0 6px rgba(241, 196, 15, 0.9);
}

.inventory-star-btn:active {
  transform: scale(0.85);
}

.inventory-star-btn img {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   MAGIC CIRCLE FUSION (Laboratory)
   ========================================================================== */
.magic-circle-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  position: relative;
  min-height: 200px;
}

.magic-ring-wrapper {
  position: relative;
  width: 190px;
  height: 190px;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: floatRing 3.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

.magic-ring-wrapper.is-fusing {
  animation: magicRingSurge 0.4s ease-in-out infinite alternate !important;
}

@keyframes magicRingSurge {
  0% {
    transform: scale(1) translateY(0);
    filter: drop-shadow(0 0 12px rgba(155, 89, 182, 0.9)) brightness(1.1);
  }
  100% {
    transform: scale(1.15) translateY(-6px);
    filter: drop-shadow(0 0 35px rgba(241, 196, 15, 1)) brightness(1.4);
  }
}

@keyframes floatRing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.magic-ring-base {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: spinRing 30s linear infinite;
  pointer-events: none;
}

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

.magic-orbit-runes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  animation: spinCounterRing 18s linear infinite;
  pointer-events: none;
}

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

.rune-node {
  position: absolute;
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 4px rgba(241, 196, 15, 0.7));
}

.rune-top {
  top: -12px;
  left: calc(50% - 21px);
}

.rune-right {
  top: calc(50% - 21px);
  right: -12px;
}

.rune-bottom {
  bottom: -12px;
  left: calc(50% - 21px);
}

.rune-left {
  top: calc(50% - 21px);
  left: -12px;
}

.magic-pig-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

#fusion-preview-canvas {
  width: 140px;
  height: 140px;
}

.fusion-empty-text {
  font-size: 11px;
  font-weight: 900;
  color: #2c3e50;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #111;
  border-radius: 12px;
  padding: 3px 10px;
  box-shadow: var(--ink-shadow-sm);
  white-space: nowrap;
}

.fusion-slots-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0 12px 0;
}

.fusion-slot-box {
  background: #ffffff;
  border: 2.5px solid #111;
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--ink-shadow-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}

.fusion-slot-box:hover {
  background: #fdfefe;
}

.fusion-slot-box:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.slot-header {
  font-size: 11px;
  font-weight: 900;
  color: #2c3e50;
  margin-bottom: 4px;
}

.slot-content {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 1.5px dashed #7f8c8d;
  border-radius: 6px;
  padding: 2px;
}

.slot-empty-plus {
  font-size: 26px;
  font-weight: 900;
  color: #95a5a6;
  line-height: 1;
}

.slot-pig-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.slot-filled-badge {
  font-size: 9px;
  font-weight: 900;
  color: #ffffff;
  background: #2c3e50;
  padding: 1px 4px;
  border-radius: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fusion-actions-row {
  margin-top: 6px;
}

/* ==========================================================================
   GACHA 1-BY-1 STEP REVEAL & 10-SUMMARY GRID
   ========================================================================== */
.gacha-step-preview-box {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  background: radial-gradient(circle, #f9ca24 0%, #f0932b 100%);
  border: 3px solid #111;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--ink-shadow);
  position: relative;
}

.gacha-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
  margin-top: 6px;
}

.gacha-summary-item {
  background: #ffffff;
  border: 2px solid #111;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  box-shadow: var(--ink-shadow-sm);
  text-align: left;
}

.gacha-summary-item canvas {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.gacha-summary-info {
  flex-grow: 1;
  overflow: hidden;
}

.gacha-summary-name {
  font-size: 11px;
  font-weight: 900;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gacha-summary-star {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gacha-summary-star img {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   ROOM MANAGEMENT & BATCH ASSIGNMENT MODAL
   ========================================================================== */
.room-mgmt-tabs-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  border-bottom: 2px solid #ddd;
  margin-bottom: 8px;
}

.room-mgmt-tab-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 900;
  border-radius: 20px;
  border: 2px solid #111;
  background: #ffffff;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.15s;
}

.room-mgmt-tab-pill:hover {
  background: #ecf0f1;
}

.room-mgmt-tab-pill.active {
  background: #9b59b6;
  color: #ffffff;
  box-shadow: var(--ink-shadow-sm);
  transform: translateY(-1px);
}

.room-mgmt-control-bar {
  background: #f8f9fa;
  border: 1.5px solid #2c3e50;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.room-mgmt-pigs-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 8px;
}

.room-mgmt-pig-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #ffffff;
  border: 2px solid #2c3e50;
  border-radius: 8px;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.15);
  transition: background 0.15s;
}

.room-mgmt-pig-card.in-target-room {
  background: #f0fff4;
  border-color: #27ae60;
}

.room-mgmt-pig-card.dormant-pig {
  background: #f9f9f9;
  border-style: dashed;
}

.room-mgmt-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #27ae60;
}

.room-mgmt-pig-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  animation: pigThumbnailBreathe 2.5s ease-in-out infinite;
  will-change: transform;
}

.room-mgmt-pig-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.room-mgmt-pig-title {
  font-size: 12px;
  font-weight: 900;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-mgmt-pig-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.room-status-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
}

.room-status-badge.badge-current {
  background: #2ecc71;
  color: #ffffff;
}

.room-status-badge.badge-other {
  background: #e67e22;
  color: #ffffff;
}

.room-status-badge.badge-dormant {
  background: #95a5a6;
  color: #ffffff;
}

.btn-evict-single {
  background: #ecf0f1;
  border: 1.5px solid #bdc3c7;
  border-radius: 4px;
  color: #7f8c8d;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 6px;
  cursor: pointer;
}

.btn-evict-single:hover {
  background: #e74c3c;
  color: #ffffff;
  border-color: #c0392b;
}

/* ==========================================================================
   CASINO FORTUNE WHEEL MINI GAME
   ========================================================================== */
.gacha-machine-card.casino {
  background: #ffffff;
  border-color: #e67e22;
}

.casino-wheel-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 4px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.casino-controls-panel {
  width: 100%;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.casino-currency-tabs {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #2c3e50;
}

.casino-tab-btn {
  flex: 1;
  background: #ecf0f1;
  border: none;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 900;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.15s;
}

.casino-tab-btn.active {
  background: #e67e22;
  color: #ffffff;
}

.casino-chips-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.casino-chip-btn {
  flex: 1;
  padding: 4px 2px;
  background: #ffffff;
  border: 1.5px solid #bdc3c7;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.15s;
}

.casino-chip-btn:hover {
  border-color: #e67e22;
}

.casino-chip-btn.active {
  background: #f39c12;
  color: #ffffff;
  border-color: #d35400;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.casino-result-badge {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  margin-top: 6px;
}

.casino-result-badge.win {
  background: #d4edda;
  color: #155724;
  border: 1.5px solid #c3e6cb;
}

.casino-result-badge.loss {
  background: #f8d7da;
  color: #721c24;
  border: 1.5px solid #f5c6cb;
}

.casino-result-badge.even {
  background: #e2e3e5;
  color: #383d41;
  border: 1.5px solid #d6d8db;
}

/* ==========================================================================
   PIG HP HEALTH BARS & SQUAD HEAL BUTTONS
   ========================================================================== */
.squad-pig-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  box-sizing: border-box;
}

.squad-hp-bar-wrapper {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border: 1px solid #111;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}

.squad-hp-bar-fill {
  height: 100%;
  background: #2ecc71;
  transition: width 0.3s ease;
}

.squad-hp-bar-fill.danger {
  background: #e74c3c;
}

.squad-hp-bar-fill.warning {
  background: #f39c12;
}

.btn-card-heal {
  margin-top: 3px;
  padding: 1px 4px;
  font-size: 9px;
  font-weight: bold;
  background: #27ae60;
  color: #fff;
  border: 1px solid #111;
  border-radius: 3px;
  cursor: pointer;
}

.btn-card-heal:hover {
  background: #2ecc71;
}

/* ==========================================================================
   LAZY RENDERING, SEARCH PILLS, PVP FORMATION & ADMIN CONSOLE STYLES
   ========================================================================== */
.pig-canvas-placeholder {
  width: 85px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  color: #7f8c8d;
  font-size: 10px;
  font-weight: bold;
}

.search-input-pill {
  transition: all 0.2s ease;
}
.search-input-pill:focus-within {
  box-shadow: 0 0 0 2px #f1c40f;
  background: rgba(0, 0, 0, 0.45) !important;
}

/* PVP Formation Grid */
.pvp-row-title {
  font-size: 11px;
  font-weight: 800;
  color: #bdc3c7;
  margin-bottom: 2px;
}
.pvp-slots-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}
.pvp-slot-box {
  background: rgba(30, 39, 46, 0.9);
  border: 1.5px dashed #7f8c8d;
  border-radius: 6px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-sizing: border-box;
  position: relative;
  transition: border-color 0.2s;
}
.pvp-slot-box.has-pig {
  border-style: solid;
  border-color: #f1c40f;
  background: #2c3e50;
}
.pvp-slot-label {
  font-size: 9px;
  color: #95a5a6;
  font-weight: bold;
}
.pvp-pig-name-tag {
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
  text-align: center;
}
.chip-job-class {
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 900;
  color: #fff;
}

/* PVP Team Tabs & Defense Tag */
.pvp-team-tab.active {
  background: #f1c40f !important;
  color: #2c3e50 !important;
  font-weight: 900;
  border-color: #d4ac0d !important;
}
.pvp-team-tab.is-defense::after {
  content: ' 🛡️';
}

/* PVP Pick Pig Card in Modal */
.pvp-pick-card {
  background: #fdfefe;
  border: 1.5px solid #d5dbdb;
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.pvp-pick-card:hover {
  transform: translateY(-2px);
  border-color: #f39c12;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.pvp-pick-card.is-assigned {
  border-color: #27ae60;
  background: #f4fdf7;
}

/* Shop Category and Items enhancement */
.shop-cat-btn.active {
  background: #9b59b6 !important;
  color: #fff !important;
  font-weight: 900;
}
.shop-item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid #ddd;
}
.shop-skill-pill {
  font-size: 9px;
  background: #fcf3cf;
  color: #b7950b;
  border: 1px solid #f9e79f;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 900;
  cursor: pointer;
  margin-top: 3px;
  transition: transform 0.1s;
}
.shop-skill-pill:hover {
  transform: scale(1.05);
}


/* Daily Tasks & Streaks */
.streak-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
}
.streak-day-row.active-today {
  border-color: #f1c40f;
  background: #fff9e6;
}
.streak-day-row.claimed {
  opacity: 0.6;
  background: #e9ecef;
}
.quest-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.quest-info-title {
  font-size: 12px;
  font-weight: bold;
  color: #2c3e50;
}
.quest-info-desc {
  font-size: 10px;
  color: #7f8c8d;
}
.quest-reward-tag {
  font-size: 11px;
  font-weight: 900;
  color: #e67e22;
}

/* Admin Room Cards */
.admin-room-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

