/* ============================================================================
   MISAKA AI MULTIMODAL STUDIO + VIP TIER 2 IMAGE EDITOR (Liquid Glass Theme)
   Clean, crisp surfaces (zero grainy noise overlay) · Responsive & Perf-safe
   ============================================================================ */

/* ── Composer & Controls Bar ── */
.misaka-studio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(8, 12, 24, 0.48);
  flex-wrap: wrap;
}

.misaka-toolbar-left,
.misaka-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Thread Drawer & Bar ── */
.misaka-threads-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.misaka-threads-btn:hover {
  background: rgba(0, 242, 254, 0.14);
  border-color: rgba(0, 242, 254, 0.45);
  color: #fff;
}

.misaka-threads-drawer {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(9, 13, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 242, 254, 0.18);
  max-height: 240px;
  overflow-y: auto;
}
.misaka-threads-drawer.open {
  display: flex;
}
.misaka-threads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.misaka-thread-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.misaka-thread-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
}
.misaka-thread-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}
.misaka-thread-item.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: rgba(0, 242, 254, 0.4);
}
.misaka-thread-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
}
.misaka-thread-meta {
  font-size: 0.7rem;
  color: #64748b;
  flex-shrink: 0;
}
.misaka-thread-actions {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.misaka-icon-mini {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.misaka-icon-mini:hover {
  background: rgba(0, 242, 254, 0.18);
  border-color: rgba(0, 242, 254, 0.45);
  color: #fff;
}
.misaka-icon-mini.danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* ── Dynamic Liquid Glass Model Selector ── */
.misaka-model-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.misaka-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 260px;
}
.misaka-model-trigger:hover {
  background: rgba(0, 242, 254, 0.14);
  border-color: rgba(0, 242, 254, 0.6);
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.18);
}
.misaka-model-trigger-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.misaka-vram-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.misaka-vram-dot.loaded {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.misaka-model-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: 360px;
  overflow-y: auto;
  background: rgba(10, 15, 28, 0.96);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(0, 242, 254, 0.28);
  border-radius: 16px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 10px;
  z-index: 1200;
  display: none;
  flex-direction: column;
  gap: 6px;
}
.misaka-model-popover.open {
  display: flex;
}
.misaka-model-popover.drop-up {
  top: auto;
  bottom: calc(100% + 8px);
}
.misaka-model-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.74rem;
  font-weight: 700;
  color: #94a3b8;
}
.misaka-model-option {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  color: #f8fafc;
}
.misaka-model-option:hover {
  background: rgba(0, 242, 254, 0.1);
  border-color: rgba(0, 242, 254, 0.35);
}
.misaka-model-option.selected {
  background: rgba(0, 242, 254, 0.15);
  border-color: rgba(0, 242, 254, 0.55);
}
.misaka-model-opt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.misaka-model-opt-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 700;
}
.misaka-model-opt-size {
  font-size: 0.72rem;
  font-family: monospace;
  color: #94a3b8;
}
.misaka-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.misaka-cap-badge {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}
.misaka-cap-badge.vision {
  background: rgba(0, 242, 254, 0.18);
  border-color: rgba(0, 242, 254, 0.45);
  color: #67e8f9;
}
.misaka-cap-badge.reasoning {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.45);
  color: #c4b5fd;
}
.misaka-cap-badge.code {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}
.misaka-cap-badge.fast {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}
.misaka-cap-badge.vram {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.55);
  color: #34d399;
}

/* ── VIP Image Edit Button ── */
.misaka-vip-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fcd34d;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.misaka-vip-edit-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.28));
  border-color: #fbbf24;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25);
}
.misaka-vip-pill {
  font-size: 0.64rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.3);
  color: #fef3c7;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* ── Drag & Drop Overlay ── */
.ai-station-console {
  position: relative;
}
.misaka-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(6, 12, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px dashed rgba(0, 242, 254, 0.75);
  border-radius: inherit;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  text-align: center;
  padding: 24px;
}
.ai-station-console.drag-active .misaka-drop-overlay {
  display: flex;
}
.misaka-drop-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: rgba(0, 242, 254, 0.16);
  border: 1px solid rgba(0, 242, 254, 0.5);
  color: #00f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* ── Attachments Preview Strip & Vision Guard Banner ── */
.misaka-vision-guard {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 13px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.79rem;
  color: #fde68a;
}
.misaka-vision-guard.visible {
  display: flex;
}
.misaka-vision-guard-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.misaka-attach-strip {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 4px 10px;
}
.misaka-attach-strip.has-items {
  display: flex;
}
.misaka-attach-card {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 242, 254, 0.35);
  background: rgba(10, 14, 26, 0.85);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}
.misaka-attach-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}
.misaka-attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.misaka-attach-remove:hover {
  background: #ef4444;
  border-color: #ef4444;
}
.misaka-attach-edit {
  position: absolute;
  bottom: 4px;
  left: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.9);
  border: none;
  color: #090d16;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
}
.misaka-attach-size {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #cbd5e1;
  font-size: 0.6rem;
  font-family: monospace;
}

/* ── Unified Composer Input Bar ── */
.ai-station-input-wrap {
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  background: rgba(10, 15, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 8px 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ai-station-input-wrap:focus-within {
  border-color: rgba(0, 242, 254, 0.55);
  box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.14);
}
.misaka-attach-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.misaka-attach-btn:hover {
  background: rgba(0, 242, 254, 0.16);
  border-color: rgba(0, 242, 254, 0.5);
  color: #00f2fe;
}
#ai-station-input.ai-station-textarea {
  flex: 1;
  min-height: 40px;
  max-height: 160px;
  resize: none;
  overflow-y: auto;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 9px 6px !important;
  line-height: 1.45;
  color: #f8fafc;
}
.misaka-composer-stop-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.misaka-composer-stop-btn.visible {
  display: inline-flex;
}
.misaka-composer-stop-btn:hover {
  background: rgba(239, 68, 68, 0.32);
  color: #fff;
}

/* ── Smart Scroll Floating Pill ── */
.misaka-scroll-bottom-btn {
  position: absolute;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 25;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(12, 19, 36, 0.94);
  border: 1px solid rgba(0, 242, 254, 0.45);
  color: #67e8f9;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}
.misaka-scroll-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ── Sent Image Gallery inside User Bubbles ── */
.misaka-msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.misaka-msg-img-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  max-width: 220px;
  max-height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.misaka-msg-img-wrap img {
  display: block;
  max-width: 220px;
  max-height: 180px;
  object-fit: cover;
  cursor: zoom-in;
}
.misaka-msg-img-edit-pill {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fcd34d;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.misaka-msg-img-wrap:hover .misaka-msg-img-edit-pill {
  opacity: 1;
}

/* ── Message Footer: Telemetry + Quick Actions ── */
.misaka-msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: #64748b;
}
.misaka-msg-metrics {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: monospace;
  color: #94a3b8;
}
.misaka-msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.misaka-msg-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #cbd5e1;
  font-size: 0.71rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.misaka-msg-act-btn:hover {
  background: rgba(0, 242, 254, 0.14);
  border-color: rgba(0, 242, 254, 0.4);
  color: #fff;
}

/* ── Pro Markdown Styling ── */
.misaka-md h1, .misaka-md h2, .misaka-md h3 {
  margin: 12px 0 6px;
  color: #f8fafc;
  font-weight: 800;
  line-height: 1.3;
}
.misaka-md h1 { font-size: 1.15rem; }
.misaka-md h2 { font-size: 1.04rem; color: #67e8f9; }
.misaka-md h3 { font-size: 0.95rem; color: #c4b5fd; }
.misaka-md p { margin: 0 0 8px; line-height: 1.6; }
.misaka-md p:last-child { margin-bottom: 0; }
.misaka-md ul, .misaka-md ol {
  margin: 6px 0 10px 20px;
  padding: 0;
  line-height: 1.6;
}
.misaka-md li { margin-bottom: 4px; }
.misaka-md blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid #00f2fe;
  background: rgba(0, 242, 254, 0.06);
  border-radius: 0 8px 8px 0;
  color: #cbd5e1;
}
.misaka-md a {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.misaka-md code.misaka-inline-code {
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.22);
  padding: 1px 6px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86em;
  color: #7dd3fc;
}
.misaka-code-block {
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(4, 7, 16, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.misaka-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.72rem;
  font-family: monospace;
  color: #94a3b8;
}
.misaka-code-copy {
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: #67e8f9;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.misaka-code-copy:hover {
  background: rgba(0, 242, 254, 0.25);
  color: #fff;
}
.misaka-code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #e2e8f0;
}
/* Lightweight syntax highlighting tokens */
.tok-kw { color: #c084fc; font-weight: 600; }
.tok-str { color: #86efac; }
.tok-num { color: #fbbf24; }
.tok-com { color: #64748b; font-style: italic; }
.tok-fn { color: #38bdf8; }

.misaka-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.misaka-md table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.misaka-md th, .misaka-md td {
  padding: 7px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
}
.misaka-md th {
  background: rgba(0, 242, 254, 0.1);
  color: #67e8f9;
  font-weight: 700;
}

.misaka-think-block {
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.28);
  padding: 7px 11px;
  font-size: 0.8rem;
  color: #cbd5e1;
}
.misaka-think-block summary {
  cursor: pointer;
  font-weight: 700;
  color: #c4b5fd;
  user-select: none;
}
.misaka-think-content {
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #94a3b8;
  max-height: 220px;
  overflow-y: auto;
}

/* ── Floating Copilot Textarea Upgrade ── */
.ai-chat-footer textarea.ai-input {
  flex: 1;
  min-height: 38px;
  max-height: 110px;
  resize: none;
  padding: 9px 12px;
  line-height: 1.4;
}

/* ── Lightbox Modal ── */
.misaka-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 100060;
  background: rgba(4, 7, 15, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}
.misaka-lightbox-overlay.open {
  display: flex;
}
.misaka-lightbox-img {
  max-width: min(92vw, 1100px);
  max-height: 78vh;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
}
.misaka-lightbox-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── VIP Tier 2 Paywall & Image Editor Studio Modal ── */
.misaka-studio-modal {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(3, 6, 14, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.misaka-studio-modal.open {
  display: flex;
}
.misaka-studio-box {
  width: min(1040px, 100%);
  max-height: 92vh;
  background: rgba(11, 16, 30, 0.97);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.misaka-studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(0, 242, 254, 0.06));
}
.misaka-studio-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.misaka-studio-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Paywall Lock Card */
.misaka-paywall-card {
  max-width: 620px;
  margin: 10px auto;
  padding: 28px 26px;
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(245, 158, 11, 0.45);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.misaka-paywall-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #090d16;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.35);
}
.misaka-paywall-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 8px;
  text-align: left;
  font-size: 0.86rem;
  color: #cbd5e1;
  line-height: 1.8;
}
.misaka-paywall-list i {
  color: #fbbf24;
  margin-right: 8px;
}

/* Unlocked Editor Workspace */
.misaka-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 18px;
  align-items: start;
}
.misaka-editor-stage {
  position: relative;
  background: rgba(5, 8, 16, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}
.misaka-compare-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 460px;
  user-select: none;
}
.misaka-compare-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: 450px;
  border-radius: 10px;
}
.misaka-compare-before {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-right: 2px solid #00f2fe;
}
.misaka-compare-before canvas {
  width: 100%;
  height: 100%;
}
.misaka-compare-slider {
  width: 100%;
  margin-top: 10px;
  accent-color: #00f2fe;
}
.misaka-editor-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
}
.misaka-ai-edit-prompt-row {
  display: flex;
  gap: 8px;
}
.misaka-ai-edit-prompt-row input {
  flex: 1;
  background: rgba(5, 8, 18, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff;
  font-size: 0.84rem;
  outline: none;
}
.misaka-ai-edit-prompt-row input:focus {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.misaka-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.misaka-preset-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}
.misaka-preset-chip.active,
.misaka-preset-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fde68a;
}
.misaka-slider-row {
  display: grid;
  grid-template-columns: 82px 1fr 38px;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: #cbd5e1;
}
.misaka-slider-row input[type="range"] {
  accent-color: #00f2fe;
}
.misaka-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .misaka-editor-grid {
    grid-template-columns: 1fr;
  }
  .misaka-studio-toolbar {
    padding: 8px 10px;
  }
  .misaka-model-trigger {
    max-width: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .misaka-model-trigger,
  .misaka-vip-edit-btn,
  .misaka-scroll-bottom-btn {
    transition: none !important;
  }
}


/* ── Grupos de Modelos por Potencia y Tier ── */
.misaka-model-group {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.misaka-model-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.misaka-model-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}
.misaka-model-group-head.t0 { color: #34d399; }
.misaka-model-group-head.t2 { color: #fbbf24; }
.misaka-model-group-head.t3 { color: #67e8f9; }
.misaka-model-group-pill {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}
.misaka-model-group-pill.t0 { color: #34d399; border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.14); }
.misaka-model-group-pill.t2 { color: #fde68a; border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.16); }
.misaka-model-group-pill.t3 { color: #67e8f9; border-color: rgba(0, 242, 254, 0.45); background: rgba(0, 242, 254, 0.16); }
.misaka-model-option.is-locked { opacity: 0.72; }
.misaka-cap-badge.locked {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
}


/* ── Encuadre equilibrado y limpio de Misaka AI Station ── */
#page-ai .ai-station-layout,
#page-ai .ai-station-grid {
  align-items: stretch !important;
}
#page-ai .ai-chat-main,
#page-ai .ai-chat-panel {
  display: flex !important;
  flex-direction: column !important;
  min-height: 680px !important;
  height: 100% !important;
}
#page-ai #ai-station-messages {
  flex: 1 1 auto !important;
  min-height: 440px !important;
  max-height: 64vh !important;
}
#page-ai .ai-quick-prompts-bar,
#page-ai .ai-quick-actions-row {
  flex-wrap: wrap !important;
  overflow: visible !important;
  gap: 6px !important;
  row-gap: 6px !important;
}
#page-ai .ai-sidebar-card .spec-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 7px 0 !important;
}
#page-ai .ai-sidebar-card .spec-val {
  text-align: right !important;
  font-size: 0.78rem !important;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#page-ai .ai-quick-deck-buttons {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 6px !important;
}
#page-ai .ai-quick-deck-buttons .btn {
  justify-content: center !important;
}
