:root {
  --bg-dark: #07040e;
  --bg-deep: #0e071c;
  --panel-bg: rgba(17, 9, 32, 0.75);
  --panel-border: rgba(168, 85, 247, 0.22);
  --panel-border-hover: rgba(192, 132, 252, 0.45);
  
  --primary-purple: #9d4edd;
  --primary-glow: #c77dff;
  --neon-violet: #a855f7;
  --neon-magenta: #e879f9;
  --cyber-cyan: #38bdf8;
  --cyber-emerald: #10b981;
  --cyber-rose: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --code-bg: #090414;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: auto;
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Cyber Header */
.cyber-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--neon-magenta);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--neon-magenta);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--neon-violet);
  text-transform: uppercase;
}

.glow-title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 10px;
  text-shadow: 0 0 25px rgba(168, 85, 247, 0.45);
}

.gradient-text {
  background: linear-gradient(135deg, #c77dff 0%, #a855f7 50%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 400;
  max-width: 620px;
  margin: 0 auto 12px;
}

.creator-tag {
  font-size: 0.88rem;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.creator-tag .author-name {
  color: var(--neon-magenta);
  background: rgba(232, 121, 249, 0.1);
  border: 1px solid rgba(232, 121, 249, 0.25);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Grid Layout */
.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  width: 100%;
  flex: 1;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: var(--transition);
  min-width: 0;
  width: 100%;
}

.glass-panel:hover {
  border-color: var(--panel-border-hover);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 25px rgba(168, 85, 247, 0.15);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-chip {
  font-size: 1.25rem;
  background: rgba(168, 85, 247, 0.15);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.panel-title-group h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.counter-badge, .tag-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.tag-pill.tag-accent {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.35);
  color: var(--primary-glow);
}

/* Input Area */
.textarea-wrapper {
  position: relative;
  flex: 1;
  min-height: 360px;
  margin-bottom: 16px;
  display: flex;
  min-width: 0;
  width: 100%;
}

textarea#sourceInput {
  width: 100%;
  height: 100%;
  min-height: 360px;
  background: var(--code-bg);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  color: #e2e8f0;
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: var(--transition);
  min-width: 0;
}

textarea#sourceInput:focus {
  border-color: var(--neon-violet);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.25), inset 0 0 10px rgba(168, 85, 247, 0.08);
}

textarea#sourceInput::placeholder {
  color: #475569;
}

/* Security Card */
.security-card {
  background: rgba(10, 5, 22, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.security-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.security-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

.security-status.status-ready {
  color: var(--cyber-emerald);
}

.security-status.status-locked {
  color: var(--neon-magenta);
}

.security-status.status-blocked {
  color: var(--cyber-rose);
}

.auth-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bypass-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(168, 85, 247, 0.25);
}

.bypass-control label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  align-items: center;
  position: relative;
  max-width: 250px;
  width: 100%;
}

.input-with-action input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--neon-magenta);
  font-family: var(--font-code);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 36px 6px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  letter-spacing: 1px;
}

.input-with-action input:focus {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 10px rgba(232, 121, 249, 0.3);
}

.btn-sm.btn-ghost {
  position: absolute;
  right: 4px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.9rem;
  transition: var(--transition);
}

.btn-sm.btn-ghost:hover {
  color: var(--text-main);
}

/* YAML Output Area */
.yaml-output-wrapper {
  flex: 1;
  background: var(--code-bg);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  overflow-y: auto;
  min-height: 360px;
  max-height: 560px;
  margin-bottom: 16px;
  position: relative;
  min-width: 0;
  width: 100%;
}

.yaml-code {
  font-family: var(--font-code);
  font-size: 0.82rem;
  line-height: 1.65;
  color: #cbd5e1;
  white-space: pre;
  tab-size: 2;
  min-width: 0;
  display: block;
}

/* Custom Scrollbars */
.yaml-output-wrapper::-webkit-scrollbar,
textarea#sourceInput::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.yaml-output-wrapper::-webkit-scrollbar-track,
textarea#sourceInput::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.yaml-output-wrapper::-webkit-scrollbar-thumb,
textarea#sourceInput::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 4px;
}

.yaml-output-wrapper::-webkit-scrollbar-thumb:hover,
textarea#sourceInput::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.6);
}

/* Buttons & Action Bars */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.output-actions {
  margin-bottom: 14px;
}

.btn {
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  border: none;
  outline: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-primary.glow-btn {
  flex: 1;
  background: linear-gradient(135deg, #9d4edd 0%, #7b2cbf 100%);
  color: #ffffff;
  border: 1px solid rgba(199, 125, 255, 0.4);
  box-shadow: 0 4px 16px rgba(157, 78, 221, 0.35);
  position: relative;
  overflow: hidden;
}

.btn-primary.glow-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #b05cf3 0%, #8e32dd 100%);
  box-shadow: 0 6px 24px rgba(157, 78, 221, 0.6);
  transform: translateY(-1px);
}

.btn-primary.glow-btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn-action {
  flex: 1;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: var(--text-main);
}

.btn-action:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.28);
  border-color: var(--primary-glow);
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.25);
  transform: translateY(-1px);
}

.btn-action.btn-accent {
  background: linear-gradient(135deg, rgba(232, 121, 249, 0.2) 0%, rgba(168, 85, 247, 0.25) 100%);
  border-color: rgba(232, 121, 249, 0.45);
  color: #ffffff;
}

.btn-action.btn-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(232, 121, 249, 0.35) 0%, rgba(168, 85, 247, 0.45) 100%);
  box-shadow: 0 4px 20px rgba(232, 121, 249, 0.35);
}

/* Footer */
.cyber-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.cyber-footer strong {
  color: var(--neon-magenta);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(18, 9, 36, 0.95);
  border: 1px solid var(--neon-violet);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 15px rgba(168, 85, 247, 0.3);
  backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  opacity: 0;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 380px;
}

.toast.toast-error {
  border-color: var(--cyber-rose);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 15px rgba(244, 63, 94, 0.3);
}

.toast.toast-success {
  border-color: var(--cyber-emerald);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.3);
}

@keyframes toast-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  to {
    transform: translateY(20px);
    opacity: 0;
  }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .app-container {
    padding: 16px 12px;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .bypass-control {
    flex-direction: column;
    align-items: flex-start;
  }
  .input-with-action {
    max-width: 100%;
  }
  .panel-actions {
    flex-direction: column;
  }
  .panel-actions button {
    width: 100%;
  }
}
