:root {
  --bg: #0c1a17;
  --bg-2: #122622;
  --surface: #16302b;
  --surface-2: #1c3a34;
  --line: rgba(232, 220, 196, 0.12);
  --text: #f4efe6;
  --muted: #a8b5ae;
  --accent: #e8a04a;
  --accent-2: #f0c27a;
  --ok: #3ecf8e;
  --danger: #ef6b6b;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --font: "Sora", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 160, 74, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(62, 207, 142, 0.12), transparent 50%),
    linear-gradient(180deg, #0b1613 0%, #0c1a17 40%, #0a1412 100%);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; }

.container {
  width: 100%;
  max-width: 1120px;
  padding-inline: 12px;
  margin-inline: auto;
  box-sizing: border-box;
}

body.is-app .container,
.container.container-app,
.container-app {
  width: 100%;
  max-width: none;
  padding-inline: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(12, 26, 23, 0.72);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}

.brand {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.nav a:not(.btn) {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav a:not(.btn):hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1208;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-danger {
  background: rgba(239, 107, 107, 0.15);
  color: #ffb4b4;
  border: 1px solid rgba(239, 107, 107, 0.35);
}
.container-app {
  width: 100%;
  max-width: none;
  padding-inline: 12px;
  box-sizing: border-box;
}

.btn-sm {
  padding: 0.38rem 0.72rem;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.hero {
  padding: 4.5rem 0 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.4rem, 5vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  max-width: 12ch;
}

.hero p.lead {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 36rem;
  margin: 0 0 1.6rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.trust {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-visual {
  position: relative;
  min-height: 320px;
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(232,160,74,.22), transparent 45%),
    linear-gradient(20deg, rgba(62,207,142,.15), transparent 40%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 1.5rem;
}

.metric-stack {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.metric {
  background: rgba(0,0,0,.22);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  animation: rise .7s ease both;
}
.metric:nth-child(2) { animation-delay: .12s; }
.metric:nth-child(3) { animation-delay: .24s; }
.metric strong {
  font-family: var(--display);
  font-size: 1.45rem;
}
.metric span { color: var(--muted); font-size: 0.9rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(62,207,142,.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(62,207,142,0); }
  100% { box-shadow: 0 0 0 0 rgba(62,207,142,0); }
}

.section {
  padding: 3.5rem 0;
}

.section-head {
  max-width: 40rem;
  margin-bottom: 2rem;
}
.section-head h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}
.section-head p { color: var(--muted); margin: 0; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.feature {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  transition: border-color .2s ease, transform .2s ease;
}
.feature:hover {
  border-color: rgba(232,160,74,.35);
  transform: translateY(-3px);
}
.feature .num {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.feature h3 {
  margin: 0.55rem 0 0.4rem;
  font-size: 1.1rem;
}
.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.cta-band {
  margin: 1rem 0 4rem;
  border-radius: 24px;
  padding: 2.4rem;
  background:
    linear-gradient(120deg, rgba(232,160,74,.18), rgba(62,207,142,.1)),
    var(--surface);
  border: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.cta-band h2 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
  font-size: 1.9rem;
}
.cta-band p { margin: 0; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-page {
  min-height: calc(100vh - 140px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 12px 3rem;
}
.auth-page .container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding-inline: 0;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
  font-size: 1.9rem;
}
.auth-card .sub {
  color: var(--muted);
  margin: 0 0 1.4rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(232,160,74,.55);
}
.form-actions { margin-top: 1.25rem; }
.form-actions .btn { width: 100%; }
.auth-switch {
  text-align: center;
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.auth-switch a { color: var(--accent-2); font-weight: 600; }

.flash-wrap { margin-top: 1rem; }
.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.92rem;
  border: 1px solid;
}
.flash-success {
  background: rgba(62,207,142,.12);
  border-color: rgba(62,207,142,.35);
  color: #9eefc5;
}
.flash-error {
  background: rgba(239,107,107,.12);
  border-color: rgba(239,107,107,.35);
  color: #ffb4b4;
}

.app-shell { padding: 2rem 0 3.5rem; }
.app-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.app-top h1 {
  font-family: var(--display);
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}
.app-top p { margin: 0.35rem 0 0; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.stat-card strong {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.create-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: end;
}
.create-form .form-group { margin: 0; }
.create-form .form-span,
.create-form .btn { grid-column: 1 / -1; }

.search-form {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 420px;
}
.search-form input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 1rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.links-table th,
.links-table td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.links-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.links-table tr:last-child td { border-bottom: 0; }
.links-table th:last-child,
.links-table td.actions {
  width: 1%;
  min-width: 168px;
  white-space: nowrap;
  vertical-align: middle;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  word-break: break-all;
}
.short-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
}
.short-link a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.copy-icon:hover {
  color: var(--text);
  border-color: rgba(232, 160, 74, 0.5);
}
.copy-icon.copied {
  color: var(--ok);
  border-color: rgba(62, 207, 142, 0.55);
}
.copy-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.copy-icon .icon-check { display: none; }
.copy-icon.copied .icon-copy { display: none; }
.copy-icon.copied .icon-check { display: block; }
.url-cell {
  max-width: 360px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.inline-form {
  display: flex;
  margin: 0;
  padding: 0;
  border: 0;
}
.actions {
  white-space: nowrap;
}
.copy-btn.copied { color: var(--ok); }

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--ok);
  font-weight: 600;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  place-items: center;
  z-index: 60;
  padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(520px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem;
}
.modal h3 { margin: 0 0 1rem; font-family: var(--display); }

@media (max-width: 900px) {
  .hero-grid,
  .features,
  .stats,
  .create-form {
    grid-template-columns: 1fr;
  }
  .hero { padding-top: 3rem; }
  .nav { gap: 0.5rem; }
  .app-shell { padding: 1.1rem 0 2.2rem; }
  .url-cell { max-width: none; }
}

@media (max-width: 720px) {
  .container,
  .container-app,
  body.is-app .container {
    width: 100%;
    padding-inline: 8px;
  }
  .header-inner { padding: 0.75rem 0; }
  .brand { font-size: 1.3rem; }
  .panel { padding: 0.85rem; border-radius: 14px; }
  .search-form { max-width: none; width: 100%; }
  .btn { padding: 0.6rem 0.95rem; }
  .btn-sm { padding: 0.34rem 0.62rem; font-size: 0.78rem; }

  table.links-table {
    min-width: 0;
  }
  .links-table td.actions {
    min-width: 0;
    width: 100%;
  }
  .action-row {
    width: 100%;
  }
  .links-table thead { display: none; }
  .links-table,
  .links-table tbody,
  .links-table tr,
  .links-table td {
    display: block;
    width: 100%;
  }
  .links-table tr {
    background: rgba(0, 0, 0, 0.16);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
    margin-bottom: 0.7rem;
  }
  .links-table tr:last-child { margin-bottom: 0; }
  .links-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.32rem 0;
    border-bottom: 0;
  }
  .links-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex: 0 0 5.5rem;
  }
  .links-table td.actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    padding-top: 0.7rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--line);
  }
  .links-table td.actions::before { display: none; }
  .url-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cta-band { padding: 1.4rem; }
  .modal { width: 100%; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .btn { flex: 1; }
}
