:root {
  color-scheme: dark;
  --background: #09090b;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --text: #fafafa;
  --muted: #a1a1aa;
  --dim: #71717a;
  --indigo: #6366f1;
  --indigo-light: #a5b4fc;
  --green: #6ee7b7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--background); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% -10%, rgba(99, 102, 241, 0.25), transparent 40%);
}

.header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  margin: auto;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 650; text-decoration: none; }
.brand-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--indigo); box-shadow: 0 0 45px -8px rgba(99, 102, 241, 0.8); }
.brand-icon svg, .url-field svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.status { display: flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid rgba(52, 211, 153, 0.2); border-radius: 999px; background: rgba(52, 211, 153, 0.08); color: var(--green); font-size: 12px; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px #34d399; }

main { position: relative; width: min(1120px, calc(100% - 40px)); margin: auto; }
.hero { max-width: 800px; margin: 0 auto; padding: 110px 0 76px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid rgba(129, 140, 248, 0.2); border-radius: 999px; background: rgba(129, 140, 248, 0.08); color: var(--indigo-light); font-size: 14px; }
.eyebrow svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

h1 { max-width: 760px; margin: 24px auto 0; font-size: clamp(42px, 7vw, 68px); line-height: 1.05; letter-spacing: -0.055em; }
h1 span { color: #818cf8; }
.lead { margin: 22px auto 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.65; }

.shorten-form { display: flex; gap: 8px; margin-top: 40px; padding: 8px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38); backdrop-filter: blur(16px); }
.url-field { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; padding: 0 12px; color: var(--dim); }
.url-field input { width: 100%; height: 52px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; }
.url-field input::placeholder { color: #52525b; }
.url-field:focus-within { color: var(--indigo-light); }

.shorten-form > button, .copy-button, .home-link { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: var(--indigo); color: white; font-weight: 600; cursor: pointer; transition: transform 160ms ease, background 160ms ease, opacity 160ms ease; }
.shorten-form > button { min-width: 128px; height: 52px; padding: 0 24px; }
.shorten-form > button:hover, .copy-button:hover, .home-link:hover { background: #7477f5; transform: translateY(-1px); }
.shorten-form > button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: white; border-radius: 50%; animation: spin 700ms linear infinite; }
.loading .button-label { display: none; }
.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.message { margin-top: 16px; padding: 13px 16px; border: 1px solid rgba(248, 113, 113, 0.25); border-radius: 12px; background: rgba(248, 113, 113, 0.08); color: #fca5a5; font-size: 14px; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 22px; padding: 22px; border: 1px solid rgba(129, 140, 248, 0.25); border-radius: 18px; background: rgba(99, 102, 241, 0.08); box-shadow: 0 0 55px -20px rgba(99, 102, 241, 0.75); text-align: left; }
.result[hidden], .message[hidden] { display: none; }
.result > div { min-width: 0; }
.result-label { margin: 0 0 8px; color: var(--indigo-light); font-size: 11px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
#short-url { display: block; overflow: hidden; color: white; font-size: clamp(18px, 3vw, 23px); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
#short-url:hover { color: var(--indigo-light); }
.original-url { max-width: 570px; margin: 7px 0 0; overflow: hidden; color: var(--dim); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.copy-button { flex: 0 0 auto; gap: 8px; min-width: 106px; height: 44px; padding: 0 16px; }
.copy-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.check-icon { display: none; }
.copy-button.copied { background: #059669; }
.copy-button.copied .copy-icon { display: none; }
.copy-button.copied .check-icon { display: block; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 760px; margin: 0 auto 100px; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: rgba(255, 255, 255, 0.025); }
.features article { display: flex; flex-direction: column; gap: 5px; padding: 22px; }
.features article + article { border-left: 1px solid var(--border); }
.features strong { font-size: 18px; }
.features span { color: var(--dim); font-size: 13px; }
footer { position: relative; padding: 24px; border-top: 1px solid rgba(255, 255, 255, 0.05); color: #52525b; font-size: 12px; text-align: center; }

.error-page { display: grid; min-height: 100vh; place-items: center; }
.error-card { width: min(480px, 100%); padding: 42px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); text-align: center; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4); }
.error-code { color: var(--indigo-light); font-size: 13px; font-weight: 700; letter-spacing: 0.15em; }
.error-card h1 { margin-top: 12px; font-size: 34px; letter-spacing: -0.04em; }
.error-card p { margin: 14px 0 26px; color: var(--muted); line-height: 1.6; }
.home-link { min-height: 46px; padding: 0 20px; text-decoration: none; }

@media (max-width: 640px) {
  .header, main { width: min(100% - 28px, 1120px); }
  .status { display: none; }
  .hero { padding: 74px 0 56px; }
  h1 { font-size: 43px; }
  .shorten-form { display: block; }
  .url-field { padding: 0 8px; }
  .shorten-form > button { width: 100%; }
  .result { align-items: stretch; flex-direction: column; }
  .copy-button { width: 100%; }
  .features { grid-template-columns: 1fr; }
  .features article { align-items: center; flex-direction: row; justify-content: space-between; }
  .features article + article { border-top: 1px solid var(--border); border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
