:root {
  --bg: #0b1220;
  --surface: #101a2e;
  --surface-raised: #142140;
  --border: #223049;
  --text: #e7ecf5;
  --text-dim: #8a97ac;
  --accent: #4f8cff;
  --accent-dim: #2e4a8c;
  --good: #34d399;
  --error: #f87171;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(79, 140, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(79, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 20px 80px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  margin-bottom: 28px;
}

.eyebrow__mark {
  color: var(--accent);
  font-weight: 700;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

.title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field__label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}

input[type="text"]:focus {
  border-color: var(--accent);
}

input[type="text"]::placeholder {
  color: #4a5670;
}

.field--inline {
  margin-bottom: 18px;
}

.field--alias {
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

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

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #051029;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.error {
  color: var(--error);
  font-size: 13px;
  margin: 10px 0 0;
}

/* --- Result card / compression gauge (signature element) --- */

.result {
  animation: rise 0.35s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.compress-gauge__track {
  position: relative;
  height: 8px;
  background: var(--surface-raised);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.compress-gauge__before {
  position: absolute;
  inset: 0;
  background: var(--accent-dim);
  width: 100%;
}

.compress-gauge__after {
  position: absolute;
  inset: 0;
  background: var(--good);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 999px;
}

.compress-gauge__label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 20px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.short-url {
  flex: 1;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--good);
  overflow-x: auto;
  white-space: nowrap;
}

.btn-copy {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.btn-copy:hover {
  background: var(--border);
}

.btn-copy.copied {
  color: var(--good);
  border-color: var(--good);
}

.result-original {
  font-size: 12px;
  color: var(--text-dim);
  margin: 10px 2px 0;
  overflow-wrap: anywhere;
}

/* --- Recent list --- */

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

.recent__head h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recent__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent__empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

.recent__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.recent__item-main {
  min-width: 0;
}

.recent__item-code {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.recent__item-code:hover {
  text-decoration: underline;
}

.recent__item-original {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.recent__item-clicks {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .wrap { padding: 40px 16px 60px; }
  .card { padding: 20px; }
  .recent__item-original { max-width: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .result, .compress-gauge__after {
    animation: none;
    transition: none;
  }
}
