:root {
  color-scheme: dark;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  --bg: #0a0a0b;
  --panel: #18181b;
  --panel-strong: #27272a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #6366F1;
  --accent-strong: #4f46e5;
  --border: #27272a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #1a2032 0%, #0d0f14 55%, #0a0b10 100%);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 24px;
  background: linear-gradient(180deg, rgba(21, 24, 35, 0.98), rgba(13, 15, 20, 0.98));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #7b68ff, #4b7bff, #2de2ff);
  color: #0b0d12;
  letter-spacing: 0.5px;
}

.title {
  font-weight: 700;
  font-size: 1.1rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.85rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

input,
textarea,
select {
  font-family: inherit;
  background: var(--panel-strong);
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(75, 123, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(75, 123, 255, 0.2);
}

.links-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-row {
  background: var(--panel-strong);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #262c3f;
  display: grid;
  gap: 8px;
}

.link-row .row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

.link-row button {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.btn {
  font-family: inherit;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: linear-gradient(135deg, #4b7bff, #2de2ff);
  color: #081018;
  box-shadow: 0 14px 30px rgba(46, 135, 255, 0.35);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(46, 135, 255, 0.45);
}

.btn.secondary {
  background: #22283a;
  color: var(--text);
  border: 1px solid #2e3550;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.actions .tip {
  font-size: 0.8rem;
  color: var(--muted);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 10px;
  background: #121520;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border 0.2s ease, transform 0.2s ease;
}

.theme-card.active {
  border-color: rgba(75, 123, 255, 0.9);
  transform: translateY(-1px);
}

.theme-swatch {
  height: 50px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-card span {
  font-size: 0.82rem;
  color: var(--muted);
}

.preview-area {
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-title {
  font-weight: 700;
  font-size: 1.4rem;
}

.preview-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-badge {
  border: 1px solid #2f3750;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
}

.device {
  flex: 1;
  display: grid;
  place-items: center;
}

.preview {
  width: min(420px, 90vw);
  min-height: 640px;
  border-radius: 32px;
  padding: 32px 24px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.profile {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile h1 {
  margin: 0;
  font-size: 1.6rem;
}

.profile p {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.8;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.link-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.link-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.link-icon svg {
  width: 16px;
  height: 16px;
}

.watermark {
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.6;
  margin-top: auto;
}

.theme-minimal {
  --theme-bg: #fdfdfd;
  --theme-text: #11131a;
  --theme-card: #ffffff;
  --theme-border: rgba(15, 18, 28, 0.08);
  --theme-button: #f3f5ff;
  --theme-accent: #11131a;
  color: var(--theme-text);
  background: var(--theme-bg);
}

.theme-dark {
  --theme-bg: #0f1118;
  --theme-text: #f2f4ff;
  --theme-card: #1a1e2b;
  --theme-border: rgba(255, 255, 255, 0.08);
  --theme-button: #20263a;
  --theme-accent: #8bb9ff;
  color: var(--theme-text);
  background: var(--theme-bg);
}

.theme-gradient {
  --theme-bg: linear-gradient(140deg, #f857a6 0%, #5b86e5 100%);
  --theme-text: #ffffff;
  --theme-card: rgba(255, 255, 255, 0.18);
  --theme-border: rgba(255, 255, 255, 0.4);
  --theme-button: rgba(255, 255, 255, 0.3);
  --theme-accent: #ffffff;
  color: var(--theme-text);
  background: var(--theme-bg);
}

.theme-glass {
  --theme-bg: radial-gradient(circle at top, rgba(103, 232, 249, 0.25), rgba(17, 24, 39, 0.95));
  --theme-text: #f0f6ff;
  --theme-card: rgba(255, 255, 255, 0.12);
  --theme-border: rgba(255, 255, 255, 0.25);
  --theme-button: rgba(15, 23, 42, 0.35);
  --theme-accent: #7dd3fc;
  color: var(--theme-text);
  background: var(--theme-bg);
}

.theme-neon {
  --theme-bg: #09050f;
  --theme-text: #fefcff;
  --theme-card: rgba(29, 17, 53, 0.95);
  --theme-border: rgba(224, 129, 255, 0.4);
  --theme-button: rgba(127, 57, 255, 0.35);
  --theme-accent: #e081ff;
  color: var(--theme-text);
  background: var(--theme-bg);
}

.theme-pastel {
  --theme-bg: linear-gradient(180deg, #fbe7ff 0%, #e7f5ff 100%);
  --theme-text: #3b2c54;
  --theme-card: rgba(255, 255, 255, 0.75);
  --theme-border: rgba(59, 44, 84, 0.15);
  --theme-button: rgba(255, 255, 255, 0.85);
  --theme-accent: #6f4cff;
  color: var(--theme-text);
  background: var(--theme-bg);
}

.theme-minimal .link-card,
.theme-dark .link-card,
.theme-gradient .link-card,
.theme-glass .link-card,
.theme-neon .link-card,
.theme-pastel .link-card {
  background: var(--theme-button);
  color: var(--theme-text);
  border-color: var(--theme-border);
}

.theme-minimal .link-icon,
.theme-dark .link-icon,
.theme-gradient .link-icon,
.theme-glass .link-icon,
.theme-neon .link-icon,
.theme-pastel .link-icon {
  background: var(--theme-card);
  color: var(--theme-accent);
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  .preview-area {
    padding: 24px;
  }

  .preview {
    min-height: 600px;
  }
}
