:root {
  --bg: #06060a;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(139, 92, 246, 0.5);
  --text: #f4f4f5;
  --text-dim: #71717a;
  --text-faint: #52525b;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --accent-glow: rgba(139, 92, 246, 0.3);
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Aurora background */
.aurora {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}
.aurora-1 {
  width: 600px; height: 600px;
  top: -200px; left: -100px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
}
.aurora-2 {
  width: 500px; height: 500px;
  bottom: -100px; right: -100px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
}
.aurora-3 {
  width: 400px; height: 400px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08), transparent 70%);
}

/* Shell */
.shell {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

@media (min-width: 768px) {
  .shell { padding: 64px 24px 100px; }
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  margin-bottom: 48px;
  text-decoration: none;
}
.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.2s;
}
.brand-name:hover {
  opacity: 0.9;
}

/* Hero */
.hero { margin-bottom: 36px; }
.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 440px;
  line-height: 1.7;
}

/* Input Card */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@media (min-width: 768px) {
  .input-card { padding: 28px; }
}

.url-row { margin-bottom: 18px; }

.url-field {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.url-field:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-icon {
  color: var(--text-faint);
  flex-shrink: 0;
}
.url-field input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  padding: 14px 12px;
  font-family: var(--font);
}
.url-field input::placeholder { color: var(--text-faint); }

.paste-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.2s, background 0.2s;
}
.paste-btn:hover { color: var(--text); background: var(--surface-hover); }

/* Options */
.options-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.option { flex: 1; }
.option label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.option select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.option select:focus { border-color: var(--border-focus); }

/* CTA Button */
.cta-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
}
.cta-btn:active { transform: translateY(0); }
.cta-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.cta-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Alert */
.alert {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
}
.alert-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--red);
}
.alert-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--green);
}

/* Result Card */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.result-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.result-author {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar-ring {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--accent);
}
.author-meta { display: flex; flex-direction: column; }
.author-name { font-weight: 600; font-size: 0.92rem; }
.author-status { font-size: 0.75rem; color: var(--green); }

.timer-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--amber);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
}

.result-video {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  margin-bottom: 14px;
}
.result-video video {
  width: 100%;
  max-height: 420px;
  display: block;
  object-fit: contain;
}

.result-caption {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 18px;
  line-height: 1.5;
  max-height: 100px;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}
.result-caption::-webkit-scrollbar {
  width: 5px;
}
.result-caption::-webkit-scrollbar-track {
  background: transparent;
}
.result-caption::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.25);
  border-radius: 4px;
}
.result-caption::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.45);
}

.result-link-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  scroll-margin: 24px;
}

.link-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.link-box-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.status-badge-active {
  display: inline-flex;
  align-items: center;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: uppercase;
}

.result-link-box input#short-url-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.2s;
  display: block;
}
.result-link-box input#short-url-input:focus {
  border-color: var(--border-focus);
}

.link-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.action-card-btn {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Primary highlighted Copy Button */
.primary-copy-btn {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.45), rgba(139, 92, 246, 0.5));
  border: 1.5px solid rgba(139, 92, 246, 0.55);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
  position: relative;
  overflow: hidden;
}
.primary-copy-btn:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.7), rgba(139, 92, 246, 0.75));
  border-color: rgba(167, 139, 250, 0.85);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
}
.primary-copy-btn:active {
  transform: translateY(1px);
}
.primary-copy-btn.copied {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(52, 211, 153, 0.5));
  border-color: rgba(52, 211, 153, 0.7);
  color: #34d399;
  box-shadow: 0 4px 16px rgba(52, 211, 153, 0.3);
}

/* Secondary Open Link Button */
.open-link-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.open-link-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
  transform: translateY(-1px);
}
.open-link-btn:active {
  transform: translateY(1px);
}

.link-hint-text {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 14px;
  line-height: 1.5;
}

/* Show QR code button */
.qr-action-btn {
  width: 100%;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.qr-action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}
.qr-action-btn:active {
  transform: translateY(1px);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modalOverlayFade 0.2s ease-out;
}
@keyframes modalOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  position: relative;
  background: #111118;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px 24px 28px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(139, 92, 246, 0.15);
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: rotate(90deg);
}
.modal-close-btn:active {
  transform: rotate(90deg) scale(0.92);
}

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

#qr-code-wrapper {
  margin: 0 auto 16px;
  padding: 14px;
  background: #ffffff;
  border-radius: 16px;
  display: inline-block;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
#qr-code-wrapper img {
  display: block;
  border-radius: 4px;
}
.modal-hint {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 260px;
  margin: 0 auto;
}

/* How Section */
.how-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 56px;
}
@media (max-width: 540px) {
  .how-section { grid-template-columns: 1fr; gap: 12px; }
}
.how-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
}
.how-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  background: var(--accent-soft);
  border-radius: 12px;
  color: var(--accent);
}
.how-item h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.how-item p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; }

/* Footer */
.footer {
  text-align: center;
  margin-top: 64px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

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

/* Responsive tweaks */
@media (max-width: 480px) {
  .shell { padding: 32px 16px 60px; }
  .input-card { padding: 18px; }
  .result-card { padding: 18px; }
}
