:root {
  --bg: #f5f8ff;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.18);
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --error: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 12px 32px rgba(37, 99, 235, 0.10);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

/* Ensure the HTML `hidden` attribute always wins over display rules below. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    radial-gradient(1200px 500px at 50% -200px, #e0ecff 0%, rgba(224, 236, 255, 0) 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

/* ---------- nav ---------- */
.nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1100px;
}

.brand {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.92rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-email {
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-link {
  background: var(--primary);
  color: #fff !important;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.btn-link:hover {
  background: var(--primary-hover);
}

/* ---------- generic surfaces ---------- */
.card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-top: 2.5rem;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- forms ---------- */
form {
  display: flex;
  gap: 0.5rem;
}

input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: #9aa7bd;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring);
}

button {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.error {
  margin: 1rem 0 0;
  color: var(--error);
  font-size: 0.9rem;
}

/* ---------- result block ---------- */
.result {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.short-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-soft);
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  padding: 0.5rem 0.5rem 0.5rem 0.85rem;
}

.short-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.short-link:hover {
  text-decoration: underline;
}

.stat {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.link-btn {
  padding: 0;
  background: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
}

.link-btn:hover {
  background: none;
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ---------- hero ---------- */
.hero {
  width: 100%;
  max-width: 720px;
  text-align: center;
  padding: 2.5rem 1.5rem 0;
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.1;
}

.hero .accent {
  color: var(--primary);
}

.hero p {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 540px;
  margin: 0.75rem auto 0;
}

.hero .card {
  margin-top: 2rem;
  text-align: left;
}

/* ---------- custom-code row ---------- */
.custom-row {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding-left: 0.6rem;
  background: #fff;
}

.custom-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring);
}

.custom-prefix {
  color: var(--muted);
  font-weight: 600;
}

.custom-row input {
  border: none;
  box-shadow: none !important;
  padding-left: 0.25rem;
}

#shorten-form {
  flex-wrap: wrap;
}

#shorten-form #url-input {
  flex-basis: 100%;
}

/* ---------- features ---------- */
.features {
  width: 100%;
  max-width: 1100px;
  padding: 4rem 1.5rem 2rem;
  text-align: center;
}

.features h2 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.features .lead {
  color: var(--muted);
  margin: 0 auto 2.5rem;
  max-width: 560px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  text-align: left;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--primary-soft);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.feature-card .why {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  color: var(--text);
  font-size: 0.88rem;
}

.feature-card .why strong {
  color: var(--primary);
}

/* ---------- footer ---------- */
.footer {
  width: 100%;
  max-width: 1100px;
  padding: 2rem 1.5rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- auth (login/signup) ---------- */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--primary-soft);
  padding: 0.3rem;
  border-radius: 12px;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form button {
  margin-top: 0.4rem;
}

/* ---------- dashboard ---------- */
.card-wide {
  max-width: 980px;
}

.dash-create {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.dash-create input[type="url"] {
  flex: 2;
  min-width: 220px;
}

.dash-create input[type="text"] {
  flex: 1;
  min-width: 150px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.links-table th,
.links-table td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.links-table tr:last-child td {
  border-bottom: none;
}

.links-table thead th {
  background: var(--primary-soft);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.links-table a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.links-table a:hover {
  text-decoration: underline;
}

.dest {
  max-width: 300px;
}

.dest-text {
  display: inline-block;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 0.85rem;
  white-space: nowrap;
}

.links-table .link-btn,
.actions .link-btn {
  font-size: 0.85rem;
}

.link-btn.danger {
  color: var(--error);
}

.link-btn.danger:hover {
  color: #b91c1c;
}

.muted {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem 0;
}

.edit-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.edit-input {
  flex: 1;
  min-width: 160px;
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .dest,
  .dest-text {
    max-width: 150px;
  }
  form {
    flex-direction: column;
  }
  .custom-row {
    width: 100%;
  }
}

/* ---------- professional icons & auth polish ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-icon {
  width: 20px;
  height: 20px;
}

.feature-icon {
  color: var(--primary);
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

/* auth card */
.auth-card {
  max-width: 440px;
}

.auth-head {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

.auth-logo svg {
  width: 26px;
  height: 26px;
}

.auth-head h1 {
  font-size: 1.45rem;
}

.auth-head .subtitle {
  margin-bottom: 0;
}

/* icon-in-field inputs */
.field {
  position: relative;
  display: block;
}

.field-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  pointer-events: none;
}

.field-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.field input {
  width: 100%;
  padding-left: 2.6rem;
}

/* "I'm not a robot" verification box */
.robot-check {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.robot-check.checked {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.robot-check label {
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
}

.robot-badge {
  width: 26px;
  height: 26px;
  margin-left: auto;
  color: #cbd5e1;
  transition: color 0.15s ease;
}

.robot-check.checked .robot-badge {
  color: #16a34a;
}

/* terms / agreement checkbox */
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.check a {
  color: var(--primary);
  text-decoration: none;
}

.check a:hover {
  text-decoration: underline;
}

input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 1px;
}

/* icon buttons */
button svg {
  width: 16px;
  height: 16px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.link-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- FAQ (AEO) ---------- */
.faq {
  width: 100%;
  max-width: 760px;
  padding: 1rem 1.5rem 2rem;
}

.faq h2 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 1.5rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.25rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0.9rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-item code {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  font-size: 0.85em;
}

/* ---------- guides / articles ---------- */
.guide {
  width: 100%;
  max-width: 720px;
  padding: 2rem 1.5rem 1rem;
}

.crumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.crumbs a {
  color: var(--primary);
  text-decoration: none;
}

.guide h1 {
  font-size: 2rem;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.guide-lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
  line-height: 1.6;
}

.guide h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.6rem;
  letter-spacing: -0.01em;
}

.guide p,
.guide li {
  font-size: 1rem;
  line-height: 1.7;
  color: #334155;
}

.guide ul,
.guide ol {
  padding-left: 1.25rem;
}

.guide li {
  margin: 0.35rem 0;
}

.guide a {
  color: var(--primary);
}

.guide code {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-size: 0.9em;
}

.guide-cta {
  margin-top: 2rem;
}

.guide-cta .btn-link {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
}

/* guide index cards */
.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.guide-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.guide-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.guide-card h2 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.guide-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

/* ---------- logo / brand wordmark ---------- */
.brand {
  gap: 0.5rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand-name { color: var(--text); }
.brand-icon { flex: none; }

/* ---------- responsive refinements (fix nav/layout gaps) ---------- */
@media (max-width: 760px) {
  .nav { padding: 0.85rem 1rem; }
  .nav-links { gap: 0.65rem; font-size: 0.9rem; }
  .hero { padding-top: 1.75rem; }
  .features { padding-top: 2.5rem; }
}

@media (max-width: 560px) {
  .nav-email { display: none; }            /* free up space on phones */
  .card { padding: 1.5rem; }
  .auth-card { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .brand-name { display: none; }           /* icon-only logo on small screens */
  .nav-links .btn-link { padding: 0.4rem 0.75rem; }
  .hero h1 { font-size: 1.85rem; }
  .features h2, .faq h2 { font-size: 1.45rem; }
  .guide h1 { font-size: 1.6rem; }
}

/* ---------- dashboard table -> stacked cards on phones ---------- */
@media (max-width: 640px) {
  .table-wrap { border: none; overflow: visible; }
  .links-table thead { display: none; }
  .links-table, .links-table tbody { display: block; }
  .links-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem 0.9rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
  }
  .links-table tr:last-child { margin-bottom: 0; }
  .links-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    border: none;
    border-bottom: 1px solid var(--border);
  }
  .links-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: none;
  }
  .links-table td a,
  .links-table .dest-text {
    text-align: right;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .links-table td.actions {
    justify-content: flex-start;
    gap: 1.4rem;
    border-bottom: none;
    padding-top: 0.6rem;
  }
  .links-table td.actions::before { display: none; }
  .links-table td.muted { display: block; text-align: center; }
  .links-table td.muted::before { display: none; }
}

/* main landmark wrapper — preserve the centered column layout */
.page {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- QR code box (homepage result) ---------- */
.qr-box {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.qr-img {
  width: 132px;
  height: 132px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  background: #fff;
}

/* ---------- API docs ---------- */
.docs pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.docs pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.docs .code-label {
  margin: 1.1rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}
.muted-inline { color: var(--muted); font-weight: 400; }
.method {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  color: #fff;
  vertical-align: middle;
}
.method.post { background: #16a34a; }
.method.get { background: var(--primary); }
.api-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 0.5rem;
  padding: 1rem;
  background: var(--primary-soft);
  border: 1px solid #dbe7ff;
  border-radius: 12px;
  font-size: 0.9rem;
}
.api-meta-k {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.5rem 0 0.5rem;
}
.params th, .params td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.params th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table-wrap-docs { overflow-x: auto; }

/* fix: keep API meta cells from overflowing */
.api-meta > div { min-width: 0; }
.api-meta code { word-break: break-all; font-size: 0.82rem; }
