@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --dark: #000000;
  --darkLighter: #0a0a0a;
  --darkCard: #111111;
  --darkElevated: #1a1a1a;
  --darkElevated2: #242424;
  --darkElevated3: #2e2e2e;
  --gray900: #3d3d3d;
  --gray700: #6b6b6b;
  --gray400: #a0a0a0;
  --gray200: #d0d0d0;
  --text: #ffffff;
  --textSecondary: #a0a0a0;
  --textMuted: #6b6b6b;
  --border: rgba(255, 255, 255, 0.15);
  --borderStrong: rgba(255, 255, 255, 0.50);
  --success: #ffffff;
  --warning: #ffb020;
  --danger: #ff3b3b;
  --surface: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
  --primaryBtn: linear-gradient(135deg, #ffffff 0%, #d0d0d0 100%);
  --bgGradient: linear-gradient(135deg, #000000 0%, #0a0a0a 100%);
  --shadowXl: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadowGlow: 0 0 30px rgba(255, 255, 255, 0.15);
  --sp1: 0.5rem;
  --sp2: 0.75rem;
  --sp3: 1rem;
  --sp4: 1.5rem;
  --sp5: 2rem;
  --sp6: 3rem;
  --sp7: 4rem;
  --sp8: 6rem;
  --radiusSm: 6px;
  --radiusMd: 10px;
  --radiusLg: 16px;
  --radiusXl: 24px;
  --radiusPill: 999px;
  --ease: 250ms ease;
  --easeOut: 250ms ease-out;
  --easeBounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --zToast: 500;
  --zModalBackdrop: 600;
  --zModal: 610;
  --zSplash: 999;
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
}

.loading-screen {
  position: fixed; inset: 0; z-index: var(--zSplash);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--dark);
  transition: opacity 0.5s ease;
}
.loading-screen.fade-out { opacity: 0; pointer-events: none; }
.loading-logo-wrap { position: relative; margin-bottom: var(--sp4); }
.loading-logo img { width: 96px; height: 96px; border-radius: 50%; }
.loading-spinner {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.loading-sub { font-size: 0.85rem; color: var(--textSecondary); margin-bottom: var(--sp4); }
.loading-track { width: 200px; height: 3px; background: var(--darkCard); border-radius: var(--radiusPill); overflow: hidden; }
.loading-fill { height: 100%; width: 0; background: var(--text); border-radius: var(--radiusPill); animation: fillBar 1.8s ease forwards; }
@keyframes fillBar { to { width: 100%; } }

@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@keyframes heroPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.6; } }
@keyframes fabIn { from { opacity: 0; transform: translate(20px, 20px) scale(0.8); } to { opacity: 1; transform: translate(0, 0) scale(1); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.navbar {
  position: fixed; top: var(--sp3); left: 50%; transform: translateX(-50%);
  width: calc(100% - 2rem); max-width: 1200px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: var(--radiusLg);
  padding: 0.65rem 1.25rem; z-index: 100;
}
.navbar-brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; }
.brand-logo img { width: 32px; height: 32px; border-radius: var(--radiusSm); }
.brand-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.navbar-menu { display: flex; gap: 0.25rem; align-items: center; }
.nav-link {
  padding: 0.4rem 0.9rem; border-radius: var(--radiusSm);
  color: var(--textSecondary); text-decoration: none; font-size: 0.85rem; font-weight: 500;
  transition: var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--darkCard); }
.navbar-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 0.35rem; border-radius: var(--radiusSm); }

.hero {
  position: relative; padding: var(--sp8) var(--sp4) var(--sp5); overflow: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 48px 48px; opacity: 0.4; pointer-events: none;
}
.hero-content { position: relative; max-width: 640px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: var(--sp1);
  background: var(--darkCard); border: 1px solid var(--border);
  padding: 0.35rem 1rem; border-radius: var(--radiusPill); font-size: 0.8rem; color: var(--textSecondary);
  margin-bottom: var(--sp4);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.hero-title { font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 700; line-height: 1.15; margin-bottom: var(--sp3); }
.hero-accent {
  background: linear-gradient(135deg, var(--text) 0%, var(--gray200) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-desc { color: var(--textSecondary); font-size: 1rem; margin-bottom: var(--sp5); max-width: 480px; margin-inline: auto; }
.hero-actions { display: flex; gap: var(--sp2); justify-content: center; flex-wrap: wrap; }

.section { padding: var(--sp6) var(--sp4); }
.section-alt { background: var(--darkLighter); }
.app-container { max-width: 960px; margin: 0 auto; }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: var(--sp4); }
@media (max-width: 700px) { .content-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--darkCard); border: 1px solid var(--border);
  border-radius: var(--radiusLg); overflow: hidden;
  transition: var(--ease);
  box-shadow: var(--shadowXl);
}
.card:hover { border-color: var(--borderStrong); background: var(--darkElevated); }
.card-header {
  display: flex; align-items: center; gap: 0.6rem;
  padding: var(--sp3) 1.25rem; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.9rem;
  background: linear-gradient(to right, transparent, var(--darkElevated2) 50%, transparent);
}
.card-header svg { width: 18px; height: 18px; color: var(--text); flex-shrink: 0; }
.card-body { padding: 1.25rem; }

.input-group { margin-bottom: var(--sp3); }
.input-group:last-of-type { margin-bottom: 0; }
.label-help { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; }
.label-help label { font-size: 0.8rem; font-weight: 500; color: var(--textSecondary); text-transform: uppercase; letter-spacing: 0.03em; }
.help-icon {
  display: inline-flex; width: 16px; height: 16px; cursor: help;
  color: var(--textMuted); position: relative;
}
.help-icon svg { width: 16px; height: 16px; }
.help-icon:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--darkElevated3); color: var(--text);
  padding: var(--sp1) var(--sp2); border-radius: var(--radiusSm); font-size: 0.75rem;
  white-space: nowrap; border: 1px solid var(--border); z-index: 400;
  box-shadow: var(--shadowXl); pointer-events: none; line-height: 1.4;
}

input, select {
  width: 100%; padding: 0.55rem 0.85rem;
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radiusSm);
  font-size: 0.85rem; font-family: 'Space Grotesk', sans-serif; outline: none;
  transition: var(--ease);
}
input:focus, select:focus { border-color: var(--borderStrong); box-shadow: 0 0 0 2px rgba(255,255,255,0.08); }
input[type="file"] { padding: 0.45rem; cursor: pointer; }
input[type="file"]::file-selector-button {
  background: var(--darkElevated); border: 1px solid var(--border); color: var(--text);
  padding: 0.3rem 0.7rem; border-radius: 4px; font-size: 0.75rem; font-family: inherit; cursor: pointer; margin-right: var(--sp1);
}
input[type="number"] { font-family: 'DM Mono', monospace; }
input[type="number"]:focus { border-color: var(--borderStrong); box-shadow: 0 0 0 2px rgba(255,255,255,0.08); }

.btn {
  display: inline-flex; align-items: center; gap: var(--sp1);
  padding: 0.55rem 1.25rem; border-radius: var(--radiusSm);
  font-size: 0.85rem; font-weight: 600; font-family: 'Space Grotesk', sans-serif;
  border: none; cursor: pointer; transition: var(--ease);
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primaryBtn); color: var(--dark); }
.btn-primary:hover { box-shadow: var(--shadowGlow); }
.btn-ghost { background: transparent; color: var(--textSecondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--darkElevated); color: var(--text); border-color: var(--borderStrong); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.95rem; }

.section-output { margin-top: var(--sp4); }

.code-wrapper {
  background: rgba(0,0,0,0.5); border: 1px solid var(--border);
  border-radius: var(--radiusSm); padding: var(--sp3);
  max-height: 340px; overflow: auto; margin-bottom: 0.85rem;
}
.code-wrapper pre {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.78rem; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
  color: var(--gray200);
}
.output-actions { display: flex; gap: var(--sp1); }

.sound-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.75rem; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border); border-radius: var(--radiusSm);
  margin-bottom: 0.5rem; gap: var(--sp2);
}
.sound-item-info { flex: 1; min-width: 0; }
.sound-item-name { font-weight: 600; font-size: 0.85rem; }
.sound-item-detail { font-size: 0.75rem; color: var(--textSecondary); }
.sound-item-delete {
  background: none; border: none; color: var(--danger); cursor: pointer;
  padding: 0.25rem; border-radius: 4px; flex-shrink: 0;
  transition: var(--ease);
}
.sound-item-delete:hover { background: rgba(255, 59, 59, 0.15); }
.sound-item-delete svg { width: 16px; height: 16px; }

.empty-sounds {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp1);
  padding: var(--sp5) var(--sp3); color: var(--textSecondary); text-align: center;
}
.empty-sounds svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-sounds p { font-size: 0.85rem; }

.footer {
  border-top: 1px solid var(--border); padding: var(--sp6) var(--sp4) var(--sp4);
  text-align: center;
}
.footer-wrap { max-width: 600px; margin: 0 auto; }
.footer-logo img { width: 48px; height: 48px; border-radius: 50%; margin-bottom: var(--sp2); }
.footer-name { font-weight: 700; font-size: 1rem; margin-bottom: 0.35rem; }
.footer-desc { font-size: 0.8rem; color: var(--textSecondary); margin-bottom: 1.25rem; }
.footer-socials { display: flex; justify-content: center; gap: var(--sp2); margin-bottom: var(--sp4); }
.social-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--darkCard); border: 1px solid var(--border);
  color: var(--textSecondary); transition: var(--ease);
}
.social-btn:hover { color: var(--text); border-color: var(--borderStrong); background: var(--darkElevated); }
.social-btn svg { width: 18px; height: 18px; }

.modal-overlay {
  position: fixed; inset: 0; z-index: var(--zModalBackdrop);
  background: rgba(0,0,0,0.5); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp3);
  opacity: 0; visibility: hidden;
  transition: opacity var(--ease), visibility 0s linear var(--ease);
}
.modal-overlay.active { opacity: 1; visibility: visible; transition-delay: 0s; }
.modal {
  background: var(--darkElevated); border: 1px solid var(--border);
  border-radius: var(--radiusLg); width: 100%; max-width: 440px;
  padding: var(--sp4); position: relative; z-index: var(--zModal);
  box-shadow: var(--shadowXl);
  transform: scale(0.92) translateY(20px); opacity: 0;
  transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity var(--ease);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); opacity: 1; transition-delay: 50ms; }
.modal-close {
  position: absolute; top: var(--sp2); right: var(--sp2);
  background: none; border: none; color: var(--textSecondary); cursor: pointer;
  padding: 0.35rem; border-radius: var(--radiusSm); transition: var(--ease);
}
.modal-close:hover { color: var(--text); background: var(--darkElevated2); }
.modal-close svg { width: 20px; height: 20px; }
.modal-title {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 700; font-size: 1rem; margin-bottom: 1.25rem; padding-right: 2rem;
}
.modal-title svg { width: 20px; height: 20px; flex-shrink: 0; }
.modal-actions { display: flex; gap: var(--sp2); margin-top: 1.25rem; }
.modal-actions .btn { flex: 1; justify-content: center; }

.preview-container { text-align: center; margin: var(--sp3) 0; }
#icon-preview {
  max-width: 100px; max-height: 100px; border-radius: var(--radiusSm);
  background: rgba(0,0,0,0.4); border: 1px dashed var(--border);
  padding: 0.35rem; display: none; margin: 0 auto;
}
.preview-label { display: block; font-size: 0.75rem; color: var(--textSecondary); margin-top: 0.35rem; }

.toast-container {
  position: fixed; bottom: var(--sp4); right: var(--sp4); z-index: var(--zToast);
  display: flex; flex-direction: column; gap: var(--sp1);
}
.toast {
  background: var(--darkElevated3); border: 1px solid var(--border);
  border-left: 3px solid var(--text);
  padding: var(--sp2) var(--sp3); border-radius: var(--radiusMd);
  font-size: 0.85rem; font-family: 'Space Grotesk', sans-serif;
  box-shadow: var(--shadowXl);
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
.toast-success { border-left-color: var(--text); }
.toast-error { border-left-color: var(--danger); }
.toast.removing { animation: toastOut 0.3s ease-out forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }

.input-row { display: flex; gap: var(--sp2); }
.input-row .half { flex: 1; min-width: 0; }

.variants-section { margin-top: 1.25rem; padding-top: var(--sp3); border-top: 1px solid var(--border); }
.variants-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.25rem; font-size: 0.85rem; font-weight: 600; }
.variants-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--text); color: var(--dark); font-size: 0.7rem; border-radius: var(--radiusPill); padding: 0.1rem 0.5rem; margin-left: 0.35rem; vertical-align: middle; }
.variants-hint { font-size: 0.75rem; color: var(--textSecondary); margin-bottom: var(--sp2); }

.variants-header .variants-actions { display: flex; gap: var(--sp1); align-items: center; }
.variants-header .variants-actions .btn { flex-shrink: 0; }

.variant-card {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radiusMd); padding: 0.85rem; margin-bottom: 0.65rem;
  position: relative;
}
.variant-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem; font-size: 0.8rem; font-weight: 500; color: var(--textSecondary);
}
.variant-remove {
  background: none; border: none; color: var(--danger); cursor: pointer;
  padding: 0.2rem; border-radius: var(--radiusSm); display: flex; transition: var(--ease);
}
.variant-remove:hover { background: rgba(255, 59, 59, 0.15); }
.variant-remove svg { width: 16px; height: 16px; }

.variant-fields { display: flex; flex-direction: column; gap: var(--sp1); }
.variant-row { display: flex; gap: var(--sp1); align-items: flex-end; }
.variant-row .input-group { margin-bottom: 0; flex: 1; min-width: 0; }
.variant-row .input-group label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; }

.toggle-row { display: flex; gap: var(--sp2); flex-wrap: wrap; padding-top: 0.35rem; }

.toggle-wrap {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: var(--textSecondary); cursor: pointer; user-select: none;
}
.toggle-wrap input[type="checkbox"] {
  width: 34px; height: 20px; appearance: none; -webkit-appearance: none;
  background: var(--gray900); border-radius: var(--radiusPill); border: none; cursor: pointer; position: relative;
  transition: var(--ease); padding: 0; flex-shrink: 0;
}
.toggle-wrap input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--gray700);
  transition: var(--ease);
}
.toggle-wrap input[type="checkbox"]:checked { background: var(--text); }
.toggle-wrap input[type="checkbox"]:checked::after { left: 16px; background: var(--dark); }
.toggle-wrap.is3d-label input[type="checkbox"]:checked { background: var(--gray400); }
.toggle-wrap.is3d-label input[type="checkbox"]:checked::after { left: 16px; background: var(--dark); }

.variant-subtitle-input { margin-top: 0.35rem; }

@media (max-width: 700px) {
  .input-row { flex-direction: column; }
  .variant-row { flex-wrap: wrap; }
  .navbar-menu {
    position: absolute; top: calc(100% + 0.5rem); left: 0; right: 0;
    flex-direction: column; background: rgba(10,10,10,0.96); backdrop-filter: blur(18px);
    border: 1px solid var(--border); border-radius: var(--radiusMd);
    padding: var(--sp1); display: none;
  }
  .navbar-menu:not(.collapsed) { display: flex; }
  .navbar-toggle { display: block; }
  .modal { margin: var(--sp3); }
  .toast-container { left: var(--sp3); right: var(--sp3); bottom: var(--sp3); }
}

.hero-grid { animation: heroPulse 4s ease-in-out infinite; }

.toast { animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.fab {
  position: fixed; bottom: var(--sp5); right: var(--sp5); z-index: 400;
  width: 56px; height: 56px; border-radius: var(--radiusPill);
  background: var(--primaryBtn); color: var(--dark);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; box-shadow: var(--shadowXl);
  transition: transform var(--ease), box-shadow var(--ease);
  animation: fabIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
.fab:hover { transform: scale(1.1); box-shadow: var(--shadowXl), var(--shadowGlow); }
.fab:active { transform: scale(0.95); }
.fab svg { transition: transform var(--ease); }
.fab:hover svg { animation: pulse 1.5s ease infinite; }
@media (max-width: 700px) {
  .fab { bottom: var(--sp4); right: var(--sp4); width: 48px; height: 48px; }
}
