:root {
  --bg: #0F0A1A;
  --bg-panel: rgba(25, 18, 51, 0.4);
  --bg-input: #1a1233;
  --border: #3A2E60;
  --text: #F0F0FA;
  --text-sec: #A8A0C8;
  --text-muted: #6860A0;
  --purple: #8B5CF6;
  --purple-light: #A78BFA;
  --accent: #F59E0B;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, sans-serif;
  --transition: 200ms ease;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.08), transparent 25%),
                    radial-gradient(circle at 85% 30%, rgba(245, 158, 11, 0.05), transparent 25%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.header {
  background: rgba(15, 10, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo { display: flex; align-items: center; gap: 0.4rem; }
.logo-icon { font-size: 1.2rem; }
.logo-text { font-size: 1.1rem; font-weight: 800; color: var(--purple-light); letter-spacing: -0.02em; }

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost { background: transparent; color: var(--text-sec); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-input); color: #fff; }

.input {
  padding: 0.45rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  color: var(--text);
  transition: border-color var(--transition);
}
.input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2); }

.textarea { width: 100%; resize: vertical; line-height: 1.4; }

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(16px);
}

.panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  transition: color var(--transition);
}
.tab:hover { color: var(--text-sec); }
.tab.active { color: var(--purple-light); box-shadow: 0 2px 0 var(--purple-light); }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--text-sec); }
.hint { font-size: 0.68rem; color: var(--text-muted); line-height: 1.3; }

.actions { display: flex; gap: 0.4rem; }

.preview-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 300px;
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #fff;
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .header-actions { width: 100%; justify-content: space-between; }
}
