:root {
  --bg: #080c14;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.4);
  --text: #f0f4ff;
  --text-muted: #6b7a99;
  --accent: #6366f1;
  --accent-2: #a78bfa;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: rgba(0, 0, 0, 0.04);
  --surface-hover: rgba(0, 0, 0, 0.07);
  --border: rgba(0, 0, 0, 0.09);
  --border-accent: rgba(99, 102, 241, 0.5);
  --text: #0f172a;
  --text-muted: #64748b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition:
    background var(--transition),
    color var(--transition);
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: #6366f1;
  top: -200px;
  left: -100px;
  animation-duration: 20s;
}
.orb-2 {
  width: 400px;
  height: 400px;
  background: #a78bfa;
  bottom: -100px;
  right: -80px;
  animation-duration: 15s;
  animation-delay: -5s;
}
.orb-3 {
  width: 300px;
  height: 300px;
  background: #38bdf8;
  top: 50%;
  left: 50%;
  animation-duration: 25s;
  animation-delay: -10s;
}

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

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 12, 20, 0.6);
  transition: background var(--transition);
}

[data-theme="light"] nav {
  background: rgba(244, 246, 251, 0.6);
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}

.logo em {
  font-style: normal;
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pill-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}

.pill-tab {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.pill-tab.active {
  background: var(--accent);
  color: #fff;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-accent);
}

section.panel {
  display: none;
  padding: 4rem 0;
}
section.panel.active {
  display: block;
}

.hero-text {
  max-width: 680px;
  padding: 5rem 0 4rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 1.25rem;
}

.grad {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 2.5rem;
  max-width: 500px;
}

.btn-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 48px var(--accent-glow);
}

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

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-accent);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: all var(--transition);
  opacity: 0;
  transform: translateY(24px);
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  background: var(--surface-hover);
  border-color: var(--border-accent);
  transform: translateY(-4px);
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.section-label {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.section-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.demo-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.counter-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  min-width: 200px;
}

.counter-display {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--accent);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.counter-display.pop {
  transform: scale(1.35);
}

.counter-controls {
  display: flex;
  gap: 0.5rem;
}

.count-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  display: grid;
  place-items: center;
}

.count-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.storage-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  flex: 2;
  min-width: 280px;
}

.storage-block h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-field {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.input-field:focus {
  border-color: var(--border-accent);
}
.input-field::placeholder {
  color: var(--text-muted);
}

.note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 160px;
  overflow-y: auto;
}

.note-list li {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.2s ease-out;
}

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

.note-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}

.note-del:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  border-radius: 12px;
  padding: 0.9rem 1.4rem;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 320px;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast.removing {
  animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast.info .toast-dot {
  background: var(--accent);
}
.toast.success .toast-dot {
  background: var(--success);
}
.toast.warn .toast-dot {
  background: var(--warn);
}
.toast.error .toast-dot {
  background: var(--danger);
}

.toast-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 3rem;
}

.fetch-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 3rem;
}

.fetch-block h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.fetch-result {
  margin-top: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  min-height: 60px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Courier New", monospace;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.form-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.form-block h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-group label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.field-group.full {
  grid-column: 1 / -1;
}

.field-error {
  font-size: 0.75rem;
  color: var(--danger);
  min-height: 1rem;
}

.input-field.invalid {
  border-color: var(--danger);
}
.input-field.valid {
  border-color: var(--success);
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}
