/* 
   LINKPACK ULTRA SONIC ENGINE v2.0
   Design: Cyber-tactile Glassmorphism, Deep Dark Void Palette, Fluid Transitions
*/

:root {
  --bg-void: #06080d;
  --bg-surface: rgba(16, 20, 31, 0.72);
  --bg-input: rgba(10, 13, 22, 0.85);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  --border-glass: rgba(255, 255, 255, 0.12);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --sonic-cyan: #06b6d4;
  --sonic-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-pink: #ec4899;
  
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  
  --radius-xl: 24px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Radial Mesh */
.ambient-glow {
  position: fixed;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  animation: floatAmbient 12s ease-in-out infinite alternate;
}

.glow-1 {
  top: -15%;
  left: -10%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.glow-2 {
  bottom: -20%;
  right: -10%;
  background: radial-gradient(circle, var(--sonic-cyan) 0%, transparent 70%);
  animation-delay: -6s;
}

@keyframes floatAmbient {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.15) translate(40px, 30px); }
}

/* Main Wrapper */
.wrapper {
  width: 100%;
  max-width: 580px;
  position: relative;
  z-index: 10;
}

/* Brand Navbar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-box {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--primary-glow);
}

.bolt-icon {
  width: 18px;
  height: 18px;
  stroke: var(--sonic-cyan);
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--sonic-cyan);
  letter-spacing: 0.05em;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Glass Card */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Typography & Headers */
.panel-header {
  margin-bottom: 2rem;
}

.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  margin-bottom: 1rem;
}

.launch-chip {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.mono-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.badge-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Form Styling */
.input-group {
  margin-bottom: 1.5rem;
}

label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.55rem;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: none;
  font-weight: 400;
  font-family: var(--font-mono);
}

.links-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}

.sub-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--sonic-cyan);
}

.input-wrapper input,
.link-row input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-wrapper input:focus,
.link-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(14, 18, 29, 0.95);
}

/* Link Row & Inputs Container */
.inputs-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom Minimal Scrollbar */
.inputs-container::-webkit-scrollbar {
  width: 5px;
}
.inputs-container::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.link-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  animation: slideInRow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRow {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.link-label-input {
  flex: 0 0 38%;
  font-size: 0.88rem !important;
}

.link-url-input {
  flex: 1;
  font-family: var(--font-mono) !important;
  font-size: 0.85rem !important;
}

.btn-trash {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-trash:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-trash svg {
  width: 17px;
  height: 17px;
}

/* Form Actions */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
}

.btn-ghost svg {
  width: 16px;
  height: 16px;
}

/* Sonic Glowing Primary Button */
.btn-sonic {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  box-shadow: 0 4px 20px var(--primary-glow);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-sonic::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-20deg);
  transition: 0.6s;
}

.btn-sonic:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(6, 182, 212, 0.45);
}

.btn-sonic:hover::after {
  left: 100%;
}

.btn-sonic:active {
  transform: translateY(0);
}

.arrow-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn-sonic:hover .arrow-icon {
  transform: translateX(4px);
}

/* Viewer View & Launch Mode */
.launch-hero-action {
  margin-bottom: 2rem;
}

.launch-btn {
  padding: 1.15rem 1.5rem;
  font-size: 1.05rem;
  background: linear-gradient(135deg, #059669 0%, #0284c7 100%);
  box-shadow: 0 6px 24px rgba(5, 150, 105, 0.4);
}

.launch-btn:hover {
  box-shadow: 0 10px 32px rgba(2, 132, 199, 0.55);
}

.rocket-icon {
  width: 20px;
  height: 20px;
}

.popup-note {
  font-size: 0.76rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
}

/* Manifest List in Viewer */
.manifest-container {
  background: rgba(8, 11, 19, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1.75rem;
}

.manifest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.75rem;
}

.btn-micro {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 2px 6px;
  cursor: pointer;
}

.btn-micro:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.sonic-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sonic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  text-decoration: none;
  transition: all 0.18s ease;
}

.sonic-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateX(4px);
}

.sonic-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

.item-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.item-url {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.item-ext {
  color: var(--text-dim);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: 0.75rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.sonic-item:hover .item-ext {
  color: var(--sonic-cyan);
  transform: translate(2px, -2px);
}

/* Viewer Return Action */
.viewer-footer {
  text-align: center;
}

.return-btn {
  width: auto;
  border-style: solid;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f9fafb;
  padding: 0.85rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.2);
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  pointer-events: none;
}

.toast-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--sonic-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--sonic-cyan);
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .glass-card {
    padding: 1.75rem 1.25rem;
  }
  .hero-title {
    font-size: 1.75rem;
  }
  .link-row {
    flex-direction: column;
    gap: 0.4rem;
  }
  .link-label-input {
    flex: 1 1 auto;
    width: 100%;
  }
  .btn-trash {
    width: 100%;
    height: 34px;
  }
}