:root {
  --navy: #0F1B3D;
  --navy-soft: #16224D;
  --navy-tint: #E9ECF7;
  --white: #FFFFFF;
  --bg: #F5F7FC;
  --bg-alt: #EEF1FA;
  --blue: #2D6CFF;
  --blue-dark: #1E4FCC;
  --blue-tint: #E8EEFF;
  --text: #10142B;
  --text-muted: #5B6480;
  --border: #DFE4F3;
  --success: #1FAE6B;
  --success-tint: #E4F7ED;
  --danger: #E0453C;
  --danger-tint: #FCEAE9;
  --warning: #C98A1F;
  --warning-tint: #FBF0DE;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-clay: 6px 6px 14px rgba(15, 27, 61, 0.08), -5px -5px 12px rgba(255, 255, 255, 0.9);
  --shadow-clay-sm: 4px 4px 9px rgba(15, 27, 61, 0.06), -3px -3px 8px rgba(255, 255, 255, 0.85);
  --shadow-pressed: inset 4px 4px 10px rgba(15, 27, 61, 0.12), inset -4px -4px 10px rgba(255, 255, 255, 0.7);
  --shadow-lift: 0 18px 40px rgba(15, 27, 61, 0.12);
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --space-xs: 8px;
  --space-sm: 14px;
  --space-md: 24px;
  --space-lg: 40px;
  --space-xl: 64px;
  --space-2xl: 96px;
  --section-max: 1160px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--navy);
  margin: 0;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

p { margin: 0; }

a { color: var(--blue); }

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img, svg { display: block; max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

.shell {
  width: 100%;
  max-width: var(--section-max);
  margin: 0 auto;
  padding: 0 20px;
}

.anim-load {
  opacity: 0;
  animation: fadeUp 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245, 247, 252, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  color: var(--navy);
}

.main-nav {
  display: none;
  gap: var(--space-lg);
}

.main-nav a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.main-nav a:hover { color: var(--blue); }

.badge-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  color: var(--navy);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-clay-sm);
}

.badge-pill svg { color: var(--success); }

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl) 20px var(--space-2xl);
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 700;
  max-width: 15ch;
}

.hero-sub {
  margin-top: var(--space-sm);
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 50ch;
}

.shorten-form {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--navy);
}

.optional-tag {
  color: var(--text-muted);
  font-weight: 400;
}

.input-clay {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay);
  border: 1px solid var(--border);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.url-input-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 8px;
  flex-direction: column;
}

.url-input-row:focus-within {
  border-color: var(--blue);
  box-shadow: var(--shadow-clay), 0 0 0 4px var(--blue-tint);
}

.input-icon { color: var(--text-muted); flex-shrink: 0; display: none; margin-left: 10px; align-self: center; }

#urlInput {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 10px;
  font-size: 1rem;
  outline: none;
}

#urlInput::placeholder { color: #9AA3C2; }

.submit-btn { width: 100%; justify-content: center; }

.btn-clay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.btn-clay:active { transform: translateY(1px) scale(0.985); }

.btn-primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 8px 16px rgba(45, 108, 255, 0.28);
}

.btn-primary:hover { background: var(--blue-dark); }

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: var(--navy-tint);
  color: var(--navy);
}

.btn-ghost:hover { background: var(--border); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover { background: #C93830; }

.btn-outline {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--bg-alt); }

.btn-sm { padding: 9px 14px; font-size: 0.85rem; border-radius: 10px; }

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: var(--white);
  animation: spin 0.7s linear infinite;
}

.is-loading .btn-label { visibility: hidden; position: absolute; }
.is-loading .btn-spinner { display: block; }
.is-loading { position: relative; }

@keyframes spin { to { transform: rotate(360deg); } }

.field-msg {
  font-size: 0.82rem;
  min-height: 1.1em;
  color: var(--text-muted);
}

.field-msg.is-error { color: var(--danger); }
.field-msg.is-success { color: var(--success); }

.options-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.87rem;
  cursor: pointer;
  padding: 4px 2px;
}

.options-toggle svg { color: var(--blue); }

.advanced-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 20px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay-sm);
  border: 1px solid var(--border);
}

.slug-input-row {
  display: flex;
  align-items: center;
  padding: 4px 14px;
  gap: 4px;
}

.slug-input-row:focus-within {
  border-color: var(--blue);
  box-shadow: var(--shadow-clay-sm), 0 0 0 4px var(--blue-tint);
}

.slug-prefix {
  color: var(--text-muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

#slugInput {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 2px;
  outline: none;
  min-width: 0;
}

.slug-status { width: 18px; height: 18px; flex-shrink: 0; }
.slug-status.checking::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  animation: spin 0.7s linear infinite;
}
.slug-status.available::after {
  content: "\2713";
  color: var(--success);
  font-weight: 700;
}
.slug-status.taken::after {
  content: "\2715";
  color: var(--danger);
  font-weight: 700;
}

.select-row {
  display: flex;
  align-items: center;
  padding: 4px 14px;
  position: relative;
}

#expirationSelect {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 2px;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.select-caret { color: var(--text-muted); pointer-events: none; }

.date-input {
  border: none;
  padding: 12px 14px;
  outline: none;
  width: 100%;
}

.hero-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.hero-art {
  display: none;
  align-items: center;
  justify-content: center;
}

.hero-character {
  width: 100%;
  max-width: 560px;
  height: auto;
  filter: drop-shadow(0 26px 46px rgba(15, 27, 61, 0.2));
}

.result-section { padding: 0 20px var(--space-md); }

.result-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 26px;
  max-width: var(--section-max);
  margin: 0 auto;
  border: 1px solid var(--border);
  animation: fadeUp 0.5s ease forwards;
}

.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.result-short-url {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--navy);
  word-break: break-all;
}

.result-original {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
  word-break: break-all;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-active { background: var(--success-tint); color: var(--success); }
.status-active::before { background: var(--success); }
.status-expired { background: var(--warning-tint); color: var(--warning); }
.status-expired::before { background: var(--warning); }
.status-notfound { background: var(--danger-tint); color: var(--danger); }
.status-notfound::before { background: var(--danger); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--space-md);
}

.result-grid {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.qr-box {
  background: var(--navy-tint);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.qr-box img, .qr-box canvas { border-radius: 8px; background: var(--white); padding: 8px; }

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.87rem;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.meta-row:last-child { border-bottom: none; }

.meta-row span:first-child { color: var(--text-muted); }
.meta-row span:last-child { font-weight: 600; text-align: right; }

.how-it-works { padding: var(--space-2xl) 20px; text-align: center; }

.how-it-works h2 { font-size: clamp(1.6rem, 4vw, 2.15rem); }

.steps-row {
  margin-top: var(--space-lg);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.step-clay {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-clay);
  border: 1px solid var(--border);
  text-align: left;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--blue-tint);
  color: var(--blue);
  font-weight: 700;
  font-family: var(--font-display);
}

.step-clay h3 { margin-top: var(--space-sm); font-size: 1.08rem; }
.step-clay p { margin-top: 8px; color: var(--text-muted); font-size: 0.92rem; }

.features { padding: var(--space-2xl) 0; background: var(--bg-alt); }

.features h2 { text-align: center; font-size: clamp(1.6rem, 4vw, 2.15rem); }

.feature-grid {
  margin-top: var(--space-lg);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.feature-clay {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-clay-sm);
  border: 1px solid var(--border);
}

.feature-clay svg { background: var(--blue-tint); padding: 8px; border-radius: 10px; width: 42px; height: 42px; }
.feature-clay h3 { margin-top: var(--space-sm); font-size: 1.02rem; }
.feature-clay p { margin-top: 6px; color: var(--text-muted); font-size: 0.9rem; }

.history-section { padding: var(--space-2xl) 20px; }

.history-head { text-align: center; max-width: 52ch; margin: 0 auto; }

.history-head p { color: var(--text-muted); margin-top: 10px; font-size: 0.94rem; }

.history-list {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.history-item {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-clay-sm);
  border: 1px solid var(--border);
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-link-info { min-width: 0; flex: 1; }

.history-short {
  font-weight: 700;
  color: var(--navy);
  font-family: var(--font-display);
  word-break: break-all;
}

.history-original {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 3px;
  word-break: break-all;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: var(--space-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-sm);
}

.stats-panel {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
}

.stats-panel.is-open { display: flex; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats-box {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
}

.stats-box-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stats-box-value { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin-top: 4px; }

.stats-bars { display: flex; flex-direction: column; gap: 8px; }

.stats-bar-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.stats-bar-label { width: 90px; flex-shrink: 0; color: var(--text-muted); }
.stats-bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.stats-bar-fill { height: 100%; background: var(--blue); border-radius: 6px; }
.stats-bar-count { width: 26px; text-align: right; font-weight: 600; }

.expiration-editor {
  display: none;
  gap: 10px;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.expiration-editor.is-open { display: flex; }

.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
  margin-top: var(--space-lg);
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.empty-state.is-visible { display: flex; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-md) 20px;
  background: var(--white);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-muted { font-size: 0.78rem; }

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 61, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 61, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-clay {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 26px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lift);
  animation: fadeUp 0.3s ease forwards;
}

.modal-clay p { color: var(--text-muted); margin-top: 10px; font-size: 0.92rem; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--space-md);
}

.toast-stack {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  width: calc(100% - 40px);
  max-width: 380px;
}

.toast {
  background: var(--navy);
  color: var(--white);
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.22s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  font-family: var(--font-body);
}

.status-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px 30px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.status-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.status-card h1 {
  font-size: 1.5rem;
}

.status-card p {
  color: var(--text-muted);
  margin-top: 10px;
  font-size: 0.94rem;
}

.status-card .btn-clay {
  margin-top: var(--space-md);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
  .anim-load, .reveal { opacity: 1; transform: none; }
}

@media (min-width: 560px) {
  .url-input-row { flex-direction: row; align-items: center; }
  .submit-btn { width: auto; }
  .result-grid { grid-template-columns: 1.5fr 1fr; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
  .main-nav { display: flex; }
  .steps-row { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .history-actions { flex-wrap: nowrap; }
}

@media (min-width: 1024px) {
  .hero {
    grid-template-columns: 1.05fr 0.85fr;
    padding: var(--space-2xl) 20px 100px;
  }
  .hero-art { display: flex; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .input-icon { display: block; }
}

@media (min-width: 1280px) {
  .shell { padding: 0 32px; }
}
