:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;

  --bg-0: #070a12;
  --bg-1: #0b1022;

  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --surface-solid: #0e142b;

  --text: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.70);
  --text-dim: rgba(255, 255, 255, 0.55);

  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.20);

  --success: #10b981;
  --error: #fb7185;

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.35);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;

  --ring: 0 0 0 4px rgba(79, 70, 229, 0.35);

  --maxw: 920px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 700px at 10% 10%, rgba(79, 70, 229, 0.35), transparent 60%),
              radial-gradient(900px 600px at 90% 20%, rgba(236, 72, 153, 0.22), transparent 55%),
              linear-gradient(180deg, var(--bg-0), var(--bg-1));
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Background décor */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.blob {
  position: absolute;
  width: 560px;
  height: 560px;
  filter: blur(60px);
  opacity: 0.65;
  border-radius: 999px;
}

.blob-1 {
  top: -180px;
  left: -160px;
  background: radial-gradient(circle at 30% 30%, rgba(79,70,229,0.75), rgba(79,70,229,0));
}

.blob-2 {
  bottom: -220px;
  right: -180px;
  background: radial-gradient(circle at 30% 30%, rgba(236,72,153,0.55), rgba(236,72,153,0));
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 20%, rgba(0,0,0,1), rgba(0,0,0,0));
  opacity: 0.35;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 18px 40px;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.20);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

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

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, rgba(79,70,229,1), rgba(236,72,153,0.95));
  box-shadow: 0 12px 24px rgba(79,70,229,0.25);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2px;
}

.top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  color: var(--text-muted);
}

.status-badge.connected {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: rgba(255,255,255,0.92);
}

/* Hero */
.hero {
  padding: 22px 10px 14px;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  margin-top: 18px;
}

.hero-subtitle {
  margin: 10px auto 14px;
  max-width: 740px;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.chips {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  border-radius: 9999px;
  font-size: 0.9rem;
  color: var(--text);
}

/* Cards */
.card {
  margin: 16px auto 0;
  padding: 22px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: rise 420ms ease both;
}

@keyframes rise {
  from { transform: translateY(10px); opacity: 0.0; }
  to   { transform: translateY(0); opacity: 1; }
}

.card-header h3 {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Inputs */
.input-section {
  margin-top: 14px;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 10px 0 8px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input[type="url"] {
  width: 100%;
  padding: 14px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
  transition: box-shadow 180ms ease, border-color 180ms ease, transform 180ms ease;
}

input[type="url"]::placeholder {
  color: rgba(255,255,255,0.45);
}

input[type="url"]:focus {
  border-color: rgba(79, 70, 229, 0.55);
  box-shadow: var(--ring);
  transform: translateY(-1px);
}

/* Buttons */
.primary-btn,
.secondary-btn,
.ghost-btn {
  border: none;
  cursor: pointer;
  font-weight: 650;
  transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.primary-btn {
  width: 100%;
  padding: 14px 14px;
  border-radius: var(--radius-md);
  color: white;
  background: linear-gradient(135deg, rgba(79,70,229,1), rgba(67,56,202,1));
  box-shadow: 0 14px 28px rgba(79,70,229,0.22);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(79,70,229,0.28);
}

.primary-btn:active {
  transform: translateY(0px) scale(0.99);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-btn--inline {
  width: auto;
  padding: 14px 18px;
  white-space: nowrap;
}

.secondary-btn {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.10);
  border: 1px solid var(--border);
  color: var(--text);
}

.secondary-btn:hover {
  background: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.ghost-btn {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text);
}

.ghost-btn:hover {
  background: rgba(255,255,255,0.11);
  transform: translateY(-1px);
}

/* Spinner */
.spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  border-radius: 14px;
  color: var(--text-muted);
}

.spinner .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  animation: bounce 900ms infinite ease-in-out;
}
.spinner .dot:nth-child(2) { animation-delay: 120ms; opacity: 0.75; }
.spinner .dot:nth-child(3) { animation-delay: 240ms; opacity: 0.60; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.spinner-text {
  margin-left: 4px;
}

/* Result */
.result-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.18);
}

.result-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.copy-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

#display-short-url {
  flex: 1;
  color: rgba(167, 139, 250, 0.95);
  text-decoration: none;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
}

#display-short-url:hover {
  background: rgba(255,255,255,0.08);
}

.hint {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* Error */
.error-text {
  color: var(--error);
  font-size: 0.95rem;
  margin-top: 12px;
  text-align: center;
}

/* Footer */
.footer {
  margin-top: 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* Utilities */
.hidden { display: none !important; }


.user-email {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  padding-left: 2px; /* small alignment nudge */
}
