/* ============================================================================
 * Coria Campaign Skill Workshop — Arcane Sepia & Obsidian Design System
 * Visually aligned with the `altarion-aitusa` Foundry VTT module
 * ============================================================================ */

:root {
  --bg-deep: #0e0c11;
  --bg-panel: #16131a;
  --bg-panel-elev: #1e1923;
  --bg-sepia-dark: #251e18;
  --bg-sepia-mid: #3a2e23;
  --border-sepia: rgba(202, 169, 114, 0.34);
  --border-strong: rgba(218, 182, 120, 0.62);
  --text-main: #f3ece0;
  --text-muted: #b5a898;
  --accent-gold: #e5b869;
  --accent-arcane: #60a5fa;
  --accent-violet: #a855f7;
  --accent-success: #4ade80;
  --accent-danger: #f87171;
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.65);
  --radius-sm: 6px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ============================================================================
 * LOGIN SCREEN (2-Step Auth)
 * ============================================================================ */

.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 25% 20%, rgba(96, 165, 250, 0.14), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.14), transparent 48%),
    linear-gradient(160deg, #0c0a0f 0%, #191311 100%);
  z-index: 900;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(170deg, rgba(34, 28, 24, 0.96), rgba(18, 15, 22, 0.98));
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow-lg), 0 0 42px rgba(229, 184, 105, 0.12);
}

.auth-crest {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

.auth-crest-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: radial-gradient(circle, rgba(229, 184, 105, 0.25), rgba(20, 16, 26, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--accent-gold);
  margin-bottom: 10px;
  box-shadow: 0 0 22px rgba(229, 184, 105, 0.3);
}

.auth-crest h1 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0.4px;
  color: #f7e6c4;
}

.auth-crest p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  margin-bottom: 5px;
}

.auth-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-sepia);
  background: rgba(11, 10, 15, 0.88);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(229, 184, 105, 0.2);
}

.auth-account-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: rgba(229, 184, 105, 0.12);
  border: 1px solid rgba(229, 184, 105, 0.4);
}

.auth-account-pill strong {
  color: #fef08a;
  font-size: 0.96rem;
}

.auth-link-btn {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 0.78rem;
  text-decoration: underline;
  padding: 0;
}

.auth-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(127, 29, 29, 0.45);
  border: 1px solid rgba(248, 113, 113, 0.55);
  color: #fecaca;
  font-size: 0.82rem;
}

.auth-note {
  margin: 12px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* ============================================================================
 * BUTTONS
 * ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-sepia);
  background: var(--bg-sepia-dark);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: filter 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.14);
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: linear-gradient(135deg, #8a6434, #634621);
  border-color: var(--accent-gold);
  color: #fff9ec;
}

.btn-arcane {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-color: #93c5fd;
  color: #ffffff;
}

.btn-success {
  background: linear-gradient(135deg, #15803d, #166534);
  border-color: #4ade80;
  color: #ffffff;
}

.btn-danger {
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
  border-color: #f87171;
  color: #fee2e2;
}

.btn-sm {
  padding: 5px 9px;
  font-size: 0.76rem;
}

.btn-full {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
}

/* ============================================================================
 * 3-COLUMN WORKSPACE SHELL
 * ============================================================================ */

.workshop-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.topbar {
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: linear-gradient(180deg, #29211a 0%, #1c1613 100%);
  border-bottom: 1.5px solid var(--border-sepia);
  z-index: 20;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #f5dfba;
  letter-spacing: 0.3px;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold);
}

.world-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(12, 10, 14, 0.7);
  border: 1px solid var(--border-sepia);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.world-select-wrap select {
  background: transparent;
  border: none;
  color: #fde68a;
  font-weight: 700;
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
}

.world-select-wrap select option {
  background: #1a161d;
  color: #f8fafc;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(229, 184, 105, 0.14);
  border: 1px solid rgba(229, 184, 105, 0.42);
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8e4be;
}

.user-pill.is-gm {
  background: rgba(168, 85, 247, 0.22);
  border-color: rgba(192, 132, 252, 0.6);
  color: #f3e8ff;
}

/* Main 3-column grid: Left Sidebar | Center PixiJS Canvas | Right Inspector */
.workspace-columns {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  overflow: hidden;
}

/* --- Column 1: Left Navigation Menu --- */
.col-left {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #17141b 0%, #120f15 100%);
  border-right: 1.5px solid var(--border-sepia);
  overflow: hidden;
}

.char-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 10px 7px;
  border-bottom: 1px solid rgba(202, 169, 114, 0.18);
  background: rgba(34, 27, 22, 0.55);
}

.char-tab-btn {
  flex: 1;
  min-width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid rgba(202, 169, 114, 0.25);
  background: rgba(14, 12, 18, 0.72);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.char-tab-btn.is-active {
  background: linear-gradient(135deg, rgba(138, 100, 52, 0.55), rgba(66, 48, 28, 0.85));
  border-color: var(--accent-gold);
  color: #fff6e0;
}

.char-header-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-bottom: 1px solid rgba(202, 169, 114, 0.2);
  background: linear-gradient(135deg, rgba(42, 33, 25, 0.65), rgba(18, 15, 22, 0.8));
}

.char-portrait {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  object-position: top center;
  border: 1.5px solid var(--accent-gold);
  background: #0b0a0e;
  flex-shrink: 0;
}

.char-meta {
  min-width: 0;
}

.char-meta h2 {
  margin: 0;
  font-size: 0.94rem;
  color: #f9ebd2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-meta span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-filters {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(202, 169, 114, 0.18);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-search {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-sepia);
  background: rgba(9, 8, 13, 0.85);
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
}

.nav-search:focus {
  border-color: var(--accent-gold);
}

.cat-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.cat-pill {
  padding: 5px 4px;
  border-radius: 5px;
  border: 1px solid rgba(202, 169, 114, 0.22);
  background: rgba(20, 17, 25, 0.85);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.cat-pill.is-active {
  background: linear-gradient(135deg, #74542a, #4d371b);
  border-color: var(--accent-gold);
  color: #fff6e0;
}

.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: rgba(25, 21, 31, 0.65);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
  text-align: left;
  width: 100%;
  color: var(--text-main);
}

.item-row:hover {
  background: rgba(48, 39, 31, 0.75);
  border-color: rgba(202, 169, 114, 0.32);
}

.item-row.is-selected {
  background: linear-gradient(90deg, rgba(120, 86, 42, 0.48), rgba(34, 27, 42, 0.92));
  border-color: var(--accent-gold);
}

.item-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid rgba(202, 169, 114, 0.4);
  flex-shrink: 0;
  background: #0d0b12;
}

.item-row-info {
  flex: 1;
  min-width: 0;
}

.item-row-name {
  display: block;
  font-weight: 700;
  font-size: 0.81rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-row-sub {
  display: block;
  font-size: 0.69rem;
  color: var(--text-muted);
}

.item-row-badges {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.mini-dot {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
}

.mini-dot.auto {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.55);
  color: #86efac;
}

.mini-dot.anim {
  background: rgba(96, 165, 250, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.6);
  color: #93c5fd;
}

.mini-dot.req {
  background: rgba(250, 204, 21, 0.2);
  border: 1px solid rgba(250, 204, 21, 0.6);
  color: #fde047;
}

.mini-dot.fb {
  background: rgba(168, 85, 247, 0.24);
  border: 1px solid rgba(192, 132, 252, 0.65);
  color: #e9d5ff;
}

/* --- Column 2: Center PixiJS Tactical Grid --- */
.col-center {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: #100e13;
  position: relative;
  overflow: hidden;
}

.grid-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 10px;
  background: linear-gradient(180deg, rgba(35, 28, 22, 0.94), rgba(22, 18, 24, 0.96));
  border-bottom: 1px solid var(--border-sepia);
  z-index: 5;
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid rgba(202, 169, 114, 0.22);
}

.toolbar-group:last-child {
  border-right: none;
  margin-right: 0;
  padding-right: 0;
}

.toolbar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 2px;
}

.grid-stage-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.grid-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(30, 58, 138, 0.92);
  border: 1.5px solid #93c5fd;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
}

.grid-statusbar {
  height: 28px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(16, 13, 19, 0.96);
  border-top: 1px solid rgba(202, 169, 114, 0.18);
}

/* --- Column 3: Right Vertical Details & Editor Panel --- */
.col-right {
  width: 405px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #18141c 0%, #120f16 100%);
  border-left: 1.5px solid var(--border-sepia);
  overflow: hidden;
  transition: width 0.2s ease;
}

.col-right.is-collapsed {
  width: 0;
  border-left: none;
}

.inspector-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: linear-gradient(135deg, rgba(46, 36, 26, 0.85), rgba(22, 18, 28, 0.95));
  border-bottom: 1px solid var(--border-sepia);
}

.inspector-header img {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  border: 1.5px solid var(--accent-gold);
}

.inspector-title {
  flex: 1;
  min-width: 0;
}

.inspector-title h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #faecd4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-title span {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.inspector-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1d1714;
  border-bottom: 1.5px solid var(--border-sepia);
}

.inspector-tab {
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
}

.inspector-tab.is-active {
  color: #fef08a;
  background: rgba(138, 100, 52, 0.22);
  border-bottom-color: var(--accent-gold);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: rgba(24, 20, 30, 0.88);
  border: 1px solid rgba(202, 169, 114, 0.26);
}

.panel-card h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
}

.status-chip.yes {
  background: rgba(22, 163, 74, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.55);
  color: #bbf7d0;
}

.status-chip.no {
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

.status-chip.pending {
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fef08a;
}

.status-chip.progress {
  background: rgba(59, 130, 246, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.6);
  color: #bfdbfe;
}

.desc-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.48;
  color: #dfd5c7;
}

/* Editor Controls */
.editor-subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.editor-subtabs.has-4 {
  grid-template-columns: repeat(4, 1fr);
}

.editor-subtabs.has-4 .editor-subtab {
  padding: 7px 4px;
  font-size: 0.72rem;
}

.summon-lock-banner {
  padding: 7px 10px;
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.42);
  color: #bae6fd;
  font-size: 0.74rem;
  line-height: 1.38;
}

.aura-style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.aura-style-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid rgba(202, 169, 114, 0.28);
  background: rgba(14, 12, 20, 0.9);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.14s ease;
}

.aura-style-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(116, 84, 42, 0.22);
}

.aura-style-btn.is-selected {
  border-color: #fde68a;
  background: linear-gradient(135deg, rgba(138, 100, 52, 0.45), rgba(45, 34, 60, 0.85));
  box-shadow: 0 0 8px rgba(229, 184, 105, 0.25);
}

.aura-style-btn.is-none.is-selected {
  border-color: #f87171;
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.45), rgba(24, 18, 28, 0.9));
}

.aura-style-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fef3c7;
  display: flex;
  align-items: center;
  gap: 5px;
}

.aura-style-sub {
  font-size: 0.66rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.aura-swatch-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.aura-swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, border-color 0.12s;
}

.aura-swatch-btn:hover {
  transform: scale(1.14);
  border-color: #ffffff;
}

.aura-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(18, 15, 26, 0.92);
  border: 1px solid rgba(202, 169, 114, 0.3);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fef3c7;
}

.aura-toggle-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #eab308;
  cursor: pointer;
}

.editor-subtab {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-sepia);
  background: rgba(16, 13, 21, 0.85);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.editor-subtab.is-active {
  background: linear-gradient(135deg, rgba(138, 100, 52, 0.45), rgba(62, 43, 24, 0.8));
  border-color: var(--accent-gold);
  color: #fff6e0;
}

.variant-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.variant-row select {
  flex: 1;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-sepia);
  background: #0f0d14;
  color: #fef08a;
  font-weight: 700;
  font-size: 0.82rem;
}

.channel-box {
  padding: 10px 11px;
  border-radius: 9px;
  background: rgba(16, 14, 22, 0.9);
  border: 1px solid rgba(202, 169, 114, 0.26);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.channel-title {
  font-weight: 800;
  font-size: 0.82rem;
  color: #93c5fd;
  text-transform: uppercase;
}

.channel-title.area {
  color: #d8b4fe;
}

.selected-anim-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(34, 28, 42, 0.72);
  border: 1px dashed rgba(202, 169, 114, 0.35);
  font-size: 0.8rem;
}

.slider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ctrl-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ctrl-field.full {
  grid-column: 1 / -1;
}

.ctrl-field label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.ctrl-field label strong {
  color: var(--text-main);
}

.ctrl-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.tint-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tint-row input[type="color"] {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-sepia);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.loop-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f3e8d2;
  cursor: pointer;
}

/* Requirements & Chat-Style Feedback */
.req-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border-radius: 8px;
  background: rgba(16, 14, 22, 0.88);
  border: 1px solid rgba(202, 169, 114, 0.24);
}

.req-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.req-block-head label {
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--accent-gold);
}

.req-textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-sepia);
  background: rgba(9, 8, 13, 0.88);
  color: var(--text-main);
  font-size: 0.82rem;
  line-height: 1.42;
}

.req-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.feedback-thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.feedback-bubble {
  padding: 8px 10px;
  border-radius: 8px;
  border-top-left-radius: 2px;
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.38), rgba(24, 24, 44, 0.92));
  border: 1px solid rgba(129, 140, 248, 0.45);
  font-size: 0.8rem;
  line-height: 1.42;
}

.feedback-bubble-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #c7d2fe;
  margin-bottom: 3px;
  font-weight: 700;
}

.gm-feedback-composer {
  margin-top: 6px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(88, 28, 135, 0.2);
  border: 1px dashed rgba(192, 132, 252, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================================
 * CONTEXT MENU (RIGHT-CLICK ON TOKEN)
 * ============================================================================ */

.token-context-menu {
  position: fixed;
  display: none;
  min-width: 252px;
  background: #1b1620;
  border: 1.5px solid var(--border-strong);
  border-radius: 9px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 900;
}

.ctx-header {
  padding: 4px 8px 6px;
  font-weight: 800;
  font-size: 0.82rem;
  color: #fef08a;
  border-bottom: 1px solid rgba(202, 169, 114, 0.22);
  margin-bottom: 4px;
}

.ctx-section-title {
  padding: 3px 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-main);
  font-size: 0.79rem;
  cursor: pointer;
  text-align: left;
}

.ctx-item:hover {
  background: rgba(229, 184, 105, 0.18);
}

.ctx-item.is-active {
  background: rgba(229, 184, 105, 0.25);
  color: #fef08a;
  font-weight: 700;
}

.ctx-item.ctx-caster {
  color: #fde047;
  font-weight: 700;
}

.ctx-item.ctx-danger {
  color: #fca5a5;
}

.ctx-divider {
  height: 1px;
  background: rgba(202, 169, 114, 0.2);
  margin: 5px 0;
}

/* ============================================================================
 * MODALS (ANIMATION CATALOG & TARGET PICKER)
 * ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 8, 0.76);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 850;
}

.modal-window {
  width: 100%;
  max-width: 980px;
  height: 86vh;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, #201a24, #141118);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-window.compact {
  max-width: 440px;
  height: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, #2b221a, #1d1714);
  border-bottom: 1px solid var(--border-sepia);
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #fae8c8;
}

.modal-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(202, 169, 114, 0.2);
  background: rgba(15, 13, 20, 0.85);
  flex-shrink: 0;
}

.modal-filters input,
.modal-filters select {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-sepia);
  background: #0d0b11;
  color: var(--text-main);
  font-size: 0.82rem;
}

.modal-filters input {
  flex: 1;
  min-width: 210px;
}

.catalog-perpage-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e8d5b5;
  white-space: nowrap;
}

.catalog-perpage-wrap select {
  min-width: 64px;
  font-weight: 700;
  color: #fde68a;
}

.catalog-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  align-content: start;
  gap: 10px;
}

.catalog-grid::-webkit-scrollbar {
  width: 10px;
}

.catalog-grid::-webkit-scrollbar-track {
  background: rgba(10, 8, 14, 0.85);
  border-left: 1px solid rgba(202, 169, 114, 0.16);
}

.catalog-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(229, 184, 105, 0.65), rgba(168, 125, 62, 0.65));
  border-radius: 999px;
  border: 2px solid rgba(10, 8, 14, 0.85);
}

.catalog-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(253, 224, 71, 0.85), rgba(229, 184, 105, 0.85));
}

.catalog-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #1d1714, #141016);
  border-top: 1px solid rgba(202, 169, 114, 0.28);
  flex-shrink: 0;
}

.catalog-pg-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.catalog-pg-info strong {
  color: #fde68a;
}

.catalog-pg-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.pg-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid rgba(202, 169, 114, 0.34);
  background: rgba(28, 23, 34, 0.92);
  color: #f3e8d2;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.pg-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: rgba(116, 84, 42, 0.55);
  color: #fff9ec;
}

.pg-btn.is-active {
  background: linear-gradient(135deg, #9a6e34, #6b4b21);
  border-color: #fde68a;
  color: #fffbeb;
  box-shadow: 0 0 8px rgba(229, 184, 105, 0.4);
}

.pg-btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.pg-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  user-select: none;
}

.catalog-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(202, 169, 114, 0.25);
  background: rgba(17, 15, 23, 0.92);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  text-align: left;
  padding: 0;
  color: var(--text-main);
}

.catalog-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.catalog-thumb-wrap {
  width: 100%;
  height: 98px;
  background: #090b12;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.catalog-thumb-wrap canvas,
.catalog-thumb-wrap img,
.catalog-thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-card-meta {
  padding: 7px 8px;
}

.catalog-card-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: #f8ebd4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-card-cat {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.toast-container {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 950;
  pointer-events: none;
}

.toast-item {
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(24, 20, 30, 0.96);
  border: 1px solid var(--accent-gold);
  color: #fef3c7;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
}

.toast-item.error {
  border-color: #f87171;
  color: #fecaca;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 9, 14, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(202, 169, 114, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(229, 184, 105, 0.6);
}
