:root {
  --bg: #0f0a1a;
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.14);
  --text: #f4f0ff;
  --muted: #b9a8d9;
  --accent: #a78bfa;
  --accent2: #f472b6;
  --success: #34d399;
  --danger: #fb7185;
  --radius: 1.25rem;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  font-family: "Outfit", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}

.b1 {
  width: 420px;
  height: 420px;
  background: #6d28d9;
  top: -120px;
  right: -80px;
  animation-delay: 0s;
}

.b2 {
  width: 360px;
  height: 360px;
  background: #db2777;
  bottom: -100px;
  left: -60px;
  animation-delay: -6s;
}

.b3 {
  width: 280px;
  height: 280px;
  background: #0ea5e9;
  top: 40%;
  left: 35%;
  opacity: 0.35;
  animation-delay: -12s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -20px) scale(1.05);
  }
  66% {
    transform: translate(-20px, 25px) scale(0.95);
  }
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2.5rem);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel {
  width: 100%;
}

.card {
  max-width: 420px;
  margin: 0 auto;
}

.card-inner {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #1a0a2e;
}

.title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.field input {
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

.btn {
  border: none;
  border-radius: 0.85rem;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

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

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(251, 113, 133, 0.35);
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
}

.btn.icon {
  padding: 0.45rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
}

/* App layout */
.app {
  align-items: stretch;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a0a2e;
  font-size: 1.25rem;
  box-shadow: var(--shadow);
  animation: wiggle 4s ease-in-out infinite;
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-6deg);
  }
  75% {
    transform: rotate(6deg);
  }
}

.brand-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.brand-sub {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.file-btn input {
  display: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  font: inherit;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.tile-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}

.tile-wrap:hover,
.tile-wrap:focus-within {
  transform: translateY(-4px);
}

.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.15rem 5rem 1.15rem 1.25rem;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), rgba(244, 114, 182, 0.08));
  opacity: 0;
  transition: opacity 0.25s;
}

.tile-wrap:hover .tile,
.tile-wrap:focus-within .tile {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.tile-wrap:hover .tile::before,
.tile-wrap:focus-within .tile::before {
  opacity: 1;
}

.tile-inner {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.tile-ico {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.tile-body h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.tile-url {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.tile-note {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--accent);
}

.tile-edit {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 3;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.tile-edit:hover,
.tile-edit:focus {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.45);
  color: var(--text);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 1rem;
}

/* Modal */
.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  background: #1e1533;
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: min(420px, 94vw);
}

.modal::backdrop {
  background: rgba(10, 5, 20, 0.75);
  backdrop-filter: blur(4px);
}

.modal-form {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.modal-actions .danger {
  margin-right: auto;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: #31255a;
  border: 1px solid var(--card-border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.err {
  border-color: rgba(251, 113, 133, 0.5);
  color: #fecaca;
}
