:root {
  --bg: #0b1020;
  --bg-soft: #121a33;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #eef2ff;
  --text-muted: #9aa6c7;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --accent: #22d3ee;
  --success: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2552 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Decorative background orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
.orb-1 {
  width: 480px;
  height: 480px;
  background: var(--primary);
  top: -120px;
  left: -120px;
}
.orb-2 {
  width: 420px;
  height: 420px;
  background: var(--accent);
  bottom: -160px;
  right: -120px;
}

/* Header */
.site-header {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.3rem;
}
.logo-mark {
  font-size: 1.5rem;
}
.logo-text {
  background: linear-gradient(90deg, var(--accent), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav {
  display: flex;
  gap: 24px;
}
.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav a:hover {
  color: var(--text);
}

/* Hero */
.hero {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 20px 40px;
  text-align: center;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle {
  margin: 18px auto 0;
  max-width: 560px;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Shorten card */
.shorten-card {
  margin-top: 36px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.input-row {
  display: flex;
  gap: 12px;
}
.url-input {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.url-input::placeholder {
  color: #6b769b;
}
.url-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}
.btn-shorten {
  position: relative;
  padding: 0 28px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 130px;
}
.btn-shorten:hover {
  transform: translateY(-1px);
}
.btn-shorten:active {
  transform: translateY(0);
}
.btn-shorten:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.form-message {
  margin-top: 12px;
  font-size: 0.9rem;
  text-align: left;
  min-height: 1.2em;
  color: var(--danger);
}
.form-message.success {
  color: var(--success);
}

/* Result card */
.result-card {
  margin: 20px auto 0;
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: pop 0.25s ease;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.result-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  min-width: 0;
}
.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.result-link {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.result-link:hover {
  text-decoration: underline;
}
.result-actions {
  display: flex;
  gap: 10px;
}
.btn-copy,
.btn-open {
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--card-border);
  transition: background 0.2s, transform 0.15s;
}
.btn-copy {
  background: var(--success);
  color: #04241a;
  border: none;
}
.btn-copy:hover {
  transform: translateY(-1px);
}
.btn-open {
  background: transparent;
  color: var(--text);
}
.btn-open:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Sections */
.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
}
.how {
  position: relative;
  z-index: 2;
  max-width: 1000px;
  margin: 40px auto 0;
  padding: 40px 20px;
}
.steps {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.step {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.step-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}
.step h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.step p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* History */
.history-section {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 20px auto 0;
  padding: 20px;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.btn-clear {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.2s, border-color 0.2s;
}
.btn-clear:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.history-item .links {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-item .short {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}
.history-item .short:hover {
  text-decoration: underline;
}
.history-item .long {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.history-item .mini-copy {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.history-item .mini-copy:hover {
  background: rgba(255, 255, 255, 0.16);
}
.history-empty {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.95rem;
  padding: 10px 0;
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 40px 20px 30px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2942;
  color: var(--text);
  border: 1px solid var(--card-border);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 10;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 560px) {
  .input-row {
    flex-direction: column;
  }
  .btn-shorten {
    width: 100%;
    padding: 14px;
  }
  .nav {
    display: none;
  }
  .result-card {
    flex-direction: column;
    align-items: stretch;
  }
  .result-actions {
    justify-content: stretch;
  }
  .btn-copy,
  .btn-open {
    flex: 1;
    text-align: center;
  }
}
