/* ==========================================================================
   CALIGO CARD & DECK STUDIO STYLES (css/card-studio.css)
   ========================================================================== */

.studio-section {
  position: relative;
  background: radial-gradient(circle at 50% 10%, rgba(20, 24, 38, 0.95), var(--bg, #07080f) 80%);
  padding: 80px 0 100px;
  overflow: visible;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.studio-wrap {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header & Presets */
.studio-head {
  text-align: center;
  margin-bottom: 36px;
}

.studio-head .eyebrow {
  color: var(--gold, #d4af37);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.studio-head h2 {
  font-family: 'Cinzel', serif;
  font-size: 2.6rem;
  color: #fff;
  margin-bottom: 12px;
  text-shadow: 0 0 25px rgba(212, 175, 55, 0.25);
}

.studio-head .sub {
  color: #a0aec0;
  max-width: 780px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Presets & Deck Action Bar */
.studio-top-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(14, 18, 28, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.studio-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-deck-gen-highlight {
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.35);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.studio-deck-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.deck-status-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.deck-active-card-pill {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #ffd700;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.deck-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Save Card Button */
.btn-save-card {
  background: linear-gradient(135deg, #d4af37, #f59e0b);
  color: #0b0f19;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.btn-save-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.6);
  color: #000;
}

.btn-save-card:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.studio-preset-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-preset-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #d4af37;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-chip:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.4);
  color: #fff;
}

.preset-chip.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.1));
  border-color: #d4af37;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.studio-deck-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deck-count-badge {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.deck-count-badge b {
  color: #d4af37;
}

/* Main Grid: Workbench & Inspector */
.studio-grid {
  display: grid;
  grid-template-columns: 500px 1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 1080px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Card Stage */
.studio-stage-col {
  position: sticky;
  top: calc(var(--top, 64px) + 14px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
  z-index: 10;
  transition: top 0.2s ease;
}

@media (max-width: 1080px) {
  .studio-stage-col {
    position: static;
  }
}

.studio-card-viewport {
  background: rgba(10, 13, 22, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

/* Canvas Viewport Toolbar */
.stage-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-format-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
}

.stage-format-select {
  flex: 1;
  background: #141824;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.stage-format-dims {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: monospace;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-toggles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

.stage-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.stage-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.stage-toggle-btn.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
  color: #ffd700;
  font-weight: 600;
}

/* Interactive Card Stage Container */
.card-preview-wrapper {
  position: relative;
  width: 340px;
  height: 524px;
  background: #0d111a;
  border-radius: 14px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.15);
  user-select: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

/* Card Layers inside wrapper */
.card-layer-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: grab;
}

.card-layer-bg:active {
  cursor: grabbing;
}

.card-layer-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  object-fit: fill;
}

/* Canvas Overlay for Live Dragging & Smart Guides */
.card-overlay-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: auto;
}

/* Draggable Text & Icon Badges */
.card-drag-elem {
  position: absolute;
  cursor: move;
  border: 1px dashed transparent;
  padding: 4px 8px;
  border-radius: 4px;
  user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.card-drag-elem:hover {
  border-color: rgba(212, 175, 55, 0.6);
  background: rgba(14, 18, 28, 0.4);
}

.card-drag-elem.selected {
  border-color: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  background: rgba(0, 240, 255, 0.08);
}

/* Element Typestyles */
.elem-title {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px #000, 0 0 10px rgba(0,0,0,0.8);
  white-space: nowrap;
}

.elem-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d4af37;
  text-shadow: 0 1px 4px #000;
  white-space: nowrap;
}

.elem-value {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 2px 8px #000, 0 0 12px rgba(255, 215, 0, 0.4);
  line-height: 1;
}

.elem-icon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.8));
  display: flex;
  align-items: center;
  justify-content: center;
}

.elem-rules {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #e2e8f0;
  text-shadow: 0 1px 4px #000;
  max-width: 260px;
  background: rgba(7, 9, 15, 0.65);
  backdrop-filter: blur(4px);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.elem-quote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.8rem;
  line-height: 1.25;
  color: #cbd5e1;
  text-shadow: 0 1px 3px #000;
  max-width: 250px;
  text-align: center;
}

/* Smart Guides (Magnetische Führungslinien) */
.smart-guide-line {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 10;
}

.smart-guide-line.active {
  opacity: 1;
}

.smart-guide-line.vertical {
  width: 1px;
  top: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 240, 255, 0.2), #00f0ff 50%, rgba(0, 240, 255, 0.2));
  box-shadow: 0 0 6px #00f0ff;
}

.smart-guide-line.horizontal {
  height: 1px;
  left: 0;
  right: 0;
  background: linear-gradient(to right, rgba(0, 240, 255, 0.2), #00f0ff 50%, rgba(0, 240, 255, 0.2));
  box-shadow: 0 0 6px #00f0ff;
}

.smart-guide-line.gold {
  background: #ffd700;
  box-shadow: 0 0 6px #ffd700;
}

/* Bleed & Trim Guidelines (Druckstandards) */
.print-bleed-box {
  position: absolute;
  inset: -1px;
  border: 2px dashed rgba(255, 75, 75, 0.85);
  border-radius: 14px;
  pointer-events: none;
  z-index: 9;
  display: none;
  box-shadow: 0 0 10px rgba(255, 75, 75, 0.35);
}

.print-bleed-box::after {
  content: "✂️ Schnittkante (59 × 91 mm) · +2 mm Bleed im Export";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.print-trim-box {
  display: none !important;
}

.print-safe-box {
  position: absolute;
  inset: 10px;
  border: 1.5px dashed rgba(255, 215, 0, 0.85);
  border-radius: 8px;
  pointer-events: none;
  z-index: 9;
  display: none;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25), inset 0 0 8px rgba(212, 175, 55, 0.05);
}

.print-safe-box::after {
  content: "🛡️ Safe-Zone (2.5 mm Druck-Sicherheitsabstand)";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #ffd700;
  border: 1px solid rgba(212, 175, 55, 0.6);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* Stage Bottom Controls */
.stage-img-controls {
  width: 100%;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-btn-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.stage-zoom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  font-size: 0.8rem;
  justify-content: center;
}

.stage-zoom-row input[type="range"] {
  flex: 1;
  max-width: 180px;
  accent-color: #d4af37;
}

.stage-tip {
  font-size: 0.75rem;
  color: #718096;
  text-align: center;
  margin-top: 4px;
}

/* Right Column: Tabbed Inspector */
.studio-inspector {
  background: rgba(14, 18, 28, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Inspector Tabs */
.inspector-nav {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 24px;
  gap: 8px;
  overflow-x: auto;
}

.inspector-tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.inspector-tab-btn:hover {
  color: #fff;
}

.inspector-tab-btn.active {
  color: #d4af37;
  border-bottom-color: #d4af37;
  font-weight: 600;
}

.inspector-pane {
  display: none;
}

.inspector-pane.active {
  display: block;
}

/* Frame Selector & Gallery */
.frame-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.frame-cat-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.frame-cat-btn.active, .frame-cat-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
  color: #fff;
}

.frame-thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}

.frame-thumb-item {
  aspect-ratio: 59 / 91;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #090c14;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: all 0.2s;
}

.frame-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.frame-thumb-item:hover {
  border-color: rgba(212, 175, 55, 0.6);
  transform: translateY(-2px);
}

.frame-thumb-item.active {
  border-color: #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

/* Background Keyer Card */
.keyer-box {
  background: rgba(10, 14, 24, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 18px;
  margin-top: 16px;
}

.keyer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.keyer-head h4 {
  font-size: 0.95rem;
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.keyer-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.keyer-mode-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.keyer-mode-btn.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: #00f0ff;
  color: #fff;
  font-weight: 600;
}

/* Sliders with detailed Explanations (Required by User!) */
.slider-param-block {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.slider-param-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: #e2e8f0;
}

.slider-param-val {
  font-weight: 700;
  color: #d4af37;
  font-family: monospace;
}

.slider-param-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-param-control input[type="range"] {
  flex: 1;
  accent-color: #d4af37;
}

.slider-guide-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #94a3b8;
}

.guide-badge-avg {
  color: #ffd700;
  font-weight: 600;
}

.guide-higher {
  color: #f87171;
}

.guide-lower {
  color: #60a5fa;
}

/* Character & Artwork Selection */
.art-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 16px;
}

.art-thumb-item {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #090c14;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s;
  position: relative;
}

.art-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art-thumb-item:hover {
  border-color: #d4af37;
  transform: scale(1.05);
}

.art-thumb-item.active {
  border-color: #d4af37;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.art-thumb-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.65rem;
  color: #fff;
  padding: 2px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Text Fields Inspector */
.form-field-group {
  margin-bottom: 14px;
}

.form-field-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 5px;
}

.form-field-group input,
.form-field-group textarea,
.form-field-group select {
  width: 100%;
  background: #0d111c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-field-group input:focus,
.form-field-group textarea:focus,
.form-field-group select:focus {
  border-color: #d4af37;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Quick Align & Layout Presets */
.layout-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Print & Export Tab */
.print-spec-card {
  background: rgba(10, 14, 24, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.print-spec-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.spec-item {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 2px solid #d4af37;
}

.spec-item span {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
}

.spec-item b {
  font-size: 0.85rem;
  color: #fff;
}

.export-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 600px) {
  .export-btn-grid {
    grid-template-columns: 1fr;
  }
}

.btn-export {
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

/* Deck Tray (Bottom Area) */
.studio-deck-tray {
  margin-top: 40px;
  background: rgba(14, 18, 28, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px;
  padding: 20px;
}

.tray-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.tray-head h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tray-cards-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 4px;
  min-height: 140px;
}

.tray-card-item {
  flex: 0 0 80px;
  height: 124px;
  border-radius: 6px;
  background: #090c14;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.tray-card-item:hover {
  transform: translateY(-4px);
  border-color: #d4af37;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.tray-card-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tray-card-del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.tray-card-item:hover .tray-card-del {
  display: flex;
}

.tray-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  font-size: 0.65rem;
  color: #ffd700;
  text-align: center;
  padding: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* --- Corner Badges Styling & Customization --- */
.card-corner-badge {
  position: absolute;
  cursor: move;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 5;
  transition: box-shadow 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.card-corner-badge:hover {
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.8) !important;
}

.card-corner-badge.selected {
  outline: 2px solid #00f0ff !important;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.9) !important;
}

.corner-badge-val {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.corner-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-top: 2px;
}

/* 4-Corners Inspector Controls */
.badge-styling-box {
  background: rgba(14, 18, 28, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.badge-styling-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge-styling-head h4 {
  font-size: 0.92rem;
  color: #d4af37;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-style-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.badge-preset-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.badge-preset-btn:hover, .badge-preset-btn.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
  color: #fff;
}

.corner-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .corner-config-grid {
    grid-template-columns: 1fr;
  }
}

.corner-card-block {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.2s;
}

.corner-card-block:hover {
  border-color: rgba(212, 175, 55, 0.4);
}

.corner-card-block.active-corner {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.05);
}

.corner-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.corner-card-header label {
  font-weight: 600;
  font-size: 0.82rem;
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}


/* Symmetrical Guide Lines & Snap to Default */
.smart-guide-line.snap-default {
  background: #ffd700 !important;
  box-shadow: 0 0 10px #ffd700, 0 0 18px rgba(255, 215, 0, 0.8) !important;
  opacity: 1 !important;
  z-index: 20;
}


/* --- Visual Icon Picker Modal & Grid --- */
.icon-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(8px);
}

.icon-picker-modal[hidden] {
  display: none !important;
}

.icon-picker-card {
  background: #0d121f;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.2);
  overflow: hidden;
  animation: pickerPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pickerPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.icon-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 26, 42, 0.6);
}

.icon-picker-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: #ffd700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-picker-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.icon-picker-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.icon-picker-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(14, 18, 30, 0.4);
}

.icon-picker-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.icon-cat-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-cat-btn:hover, .icon-cat-btn.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
  color: #fff;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  padding: 16px 20px;
  overflow-y: auto;
  max-height: 380px;
}

.icon-grid-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: #ffd700;
  text-align: center;
}

.icon-grid-item:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: #d4af37;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.icon-grid-item.active {
  background: rgba(212, 175, 55, 0.25);
  border-color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.icon-grid-svg {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-grid-label {
  font-size: 0.72rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.icon-picker-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(14, 18, 30, 0.6);
  flex-wrap: wrap;
  gap: 10px;
}

.custom-badge-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
}


/* ==========================================================================
   DECK GENERATOR MODAL & ACTIVE TRAY CARD STYLING
   ========================================================================== */

.deck-gen-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(10px);
}

.deck-gen-modal[hidden] {
  display: none !important;
}

.deck-gen-card {
  background: #0d121f;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 18px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(212, 175, 55, 0.25);
  overflow: hidden;
  animation: pickerPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.deck-gen-header {
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 24, 38, 0.8);
}

.deck-gen-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.deck-gen-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.deck-gen-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.deck-gen-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deck-gen-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Preset Chips */
.deck-gen-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.deck-gen-preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  transition: all 0.2s;
  text-align: left;
}

.deck-gen-preset-btn .preset-icon {
  font-size: 1.25rem;
}

.deck-gen-preset-btn b {
  font-size: 0.85rem;
  color: #f1f5f9;
}

.deck-gen-preset-btn small {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.2;
}

.deck-gen-preset-btn:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateY(-2px);
}

.deck-gen-preset-btn.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

.deck-gen-preset-btn.active b {
  color: #ffd700;
}

/* Suit Count Selector */
.suit-count-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #94a3b8;
}

.suit-count-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.suit-count-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.suit-count-btn.active {
  background: #d4af37;
  color: #0b0f19;
  font-weight: 700;
  border-color: #ffd700;
}

/* Suits Grid */
.deck-gen-suits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.suit-card-config {
  background: rgba(14, 20, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.suit-card-config:hover {
  border-color: rgba(212, 175, 55, 0.4);
}

.suit-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.suit-icon-preview {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.suit-name-inp {
  flex: 1;
  background: #060910;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 8px;
  font-weight: 600;
}

.suit-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.suit-card-row select {
  flex: 1;
  background: #060910;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.75rem;
  padding: 4px 6px;
}

.suit-color-picker {
  width: 32px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 1px;
  background: transparent;
}

/* Values Row */
.deck-gen-values-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(14, 20, 32, 0.5);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.val-choice-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #e2e8f0;
  cursor: pointer;
}

.val-choice-label input[type="radio"] {
  accent-color: #d4af37;
}

/* Options Grid */
.deck-gen-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: rgba(14, 20, 32, 0.5);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 680px) {
  .deck-gen-options-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal Footer */
.deck-gen-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 18, 30, 0.8);
  flex-wrap: wrap;
  gap: 12px;
}

.deck-gen-summary-text {
  font-size: 0.95rem;
}

/* Active Tray Card & Mini-Badge */
.tray-card-item.active-deck-card {
  border: 2px solid #ffd700 !important;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.6);
  transform: translateY(-4px) scale(1.03);
}

.tray-card-badge-preview {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  pointer-events: none;
}

.tray-card-active-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #d4af37;
  color: #0b0f19;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}


/* ==========================================================================
   AUTHENTIC CALIGO NAMEPLATE & CORNER BADGES
   ========================================================================== */

.caligo-nameplate {
  position: absolute;
  cursor: grab;
  user-select: none;
  z-index: 10;
  width: 76%;
  max-width: 310px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.1s ease;
}

.caligo-nameplate:active {
  cursor: grabbing;
}

.caligo-nameplate.selected {
  outline: 2px dashed #00f0ff;
  outline-offset: 4px;
}

.caligo-nameplate-inner {
  width: 100%;
  background: linear-gradient(180deg, rgba(16, 23, 38, 0.95) 0%, rgba(8, 12, 20, 0.98) 100%);
  border: 1.5px solid #d4af37;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.85), 0 0 10px rgba(212, 175, 55, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
}

.caligo-nameplate-inner::before, .caligo-nameplate-inner::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  background: #ffd700;
  transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 4px #ffd700;
}

.caligo-nameplate-inner::before {
  left: 6px;
}

.caligo-nameplate-inner::after {
  right: 6px;
}

.caligo-nameplate-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffd700;
  text-shadow: 0 2px 6px #000, 0 0 8px rgba(255, 215, 0, 0.4);
  line-height: 1.15;
  white-space: normal;
  text-transform: uppercase;
}

.caligo-nameplate-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #94a3b8;
  text-shadow: 0 1px 3px #000;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95%;
}

/* --- Card Layer Pop-Out & Frame Transform Extensions --- */
.card-layer-popout {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: none;
}

.card-overlay-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5 !important;
  pointer-events: auto;
}

.frame-transform-box {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
}

.transform-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.transform-box-head h4 {
  font-size: 0.95rem;
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.transform-key-pill {
  font-family: monospace;
  font-size: 0.75rem;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #fde047;
  padding: 2px 8px;
  border-radius: 10px;
}

.popout-box {
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
}

.popout-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.popout-box-head h4 {
  font-size: 0.95rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.popout-mode-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.popout-mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.popout-mode-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.tray-card-popout-badge {
  position: absolute;
  bottom: 20px;
  left: 4px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  z-index: 5;
  pointer-events: none;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
