.loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.loader.hidden { display: none; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222f;
  --border: #2e2e42;
  --accent: #7c5cfc;
  --accent-hover: #9b7ffe;
  --danger: #e05252;
  --text: #e8e8f0;
  --text-muted: #8888aa;
--radius: 0px;
}

html {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.container {
  width: 100%;
  max-width: 720px;
}

/* ── Header ── */
header {
  text-align: center;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 0.2rem;
  color: var(--accent);
}

.logo-url {
  color: var(--text);
}

.domain-subtitle {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Shorten box ── */
.shorten-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.input-row {
  display: flex;
  gap: 0.6rem;
}

#url-input {
  flex: 1;
  background: var(--bg);
  border: none;
  border-radius: 0;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

#url-input:focus {
  outline: none;
}

#url-input::placeholder { color: var(--text-muted); }

.length-picker {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.len-btn {
  flex: 1;
  background: var(--surface2);
  border: none;
  border-radius: 0;
  color: var(--text-muted);
  padding: 0.5rem 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-align: center;
}

.len-btn:hover { color: var(--text); }
.len-btn.active { background: var(--border); color: var(--text); }

#shorten-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

#shorten-btn:hover  { background: var(--accent-hover); }
#shorten-btn:active { transform: scale(0.97); }

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

/* ── Result box ── */
.result-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.25s ease;
}

.result-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.result-url-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

#result-link {
  color: var(--accent-hover);
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-all;
  text-decoration: none;
}

#result-link:hover { text-decoration: underline; }

.copy-btn {
  background: var(--surface2);
  border: none;
  border-radius: 0;
  color: var(--text);
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

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

/* ── Footer ── */
footer {
  text-align: center;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.footer-sep {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.bmc-link {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.15s;
}

.bmc-link:hover {
  color: var(--text);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.4rem;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(124,92,252,0.4);
  animation: fadeIn 0.2s ease;
  z-index: 999;
}

/* ── Utilities ── */
.hidden { display: none !important; }

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

/* Responsive */
@media (max-width: 520px) {
  .input-row { flex-direction: column; }
  .logo { font-size: 2.2rem; }
}
