:root {
  --bg: #f7f7f5;
  --card-bg: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.add-link {
  color: #fff;
  background: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.add-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.back-link:hover {
  color: var(--accent);
}

.search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search-form input[type="search"] {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-form button {
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.search-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.search-form .clear-search {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.search-form .clear-search:hover {
  color: var(--accent);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.sort-links a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
  transition: color 0.15s ease;
}

.sort-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.sort-links a:hover {
  color: var(--accent);
}

.sort-links a.active {
  color: var(--accent);
  font-weight: 600;
}

.sort-links a.active::after {
  transform: scaleX(1);
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 3rem 0;
}

.quote-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quote-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.75rem 1.25rem;
  opacity: 0;
  transform: translateY(10px);
  animation: card-in 0.4s ease forwards;
  animation-delay: var(--delay, 0s);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.quote-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08);
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quote-text {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.55;
  margin: 0 0 0.6rem;
  padding-right: 4.5rem;
}

.quote-mark {
  font-family: Georgia, serif;
  font-style: normal;
  font-size: 1.5rem;
  color: var(--border);
  vertical-align: -0.08em;
}

.quote-author {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.quote-context {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
}

.quote-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.quote-meta {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0;
}

.quote-actions {
  display: flex;
  gap: 0.3rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.icon-btn.is-copied {
  color: var(--accent);
}

.icon-btn-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.delete-form {
  display: inline;
  margin: 0;
}

.badge {
  position: absolute;
  top: 1.1rem;
  right: 1.25rem;
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin: 0;
  transition: transform 0.15s ease;
}

.quote-card:hover .badge {
  transform: scale(1.05);
}

/* Tier 1: basic */
.badge-basic {
  background: #eef0f2;
  color: #5b6472;
}

/* Tier 2: solid */
.badge-solid {
  background: #dbeafe;
  color: #1d4ed8;
}

/* Tier 3: quotable */
.badge-quotable {
  background: #d1fae5;
  color: #047857;
}

/* Tier 4: banger — gentle pulse */
.badge-banger {
  background: linear-gradient(90deg, #f472b6, #a855f7);
  color: #fff;
  animation: pulse-banger 1.8s ease-in-out infinite;
}

@keyframes pulse-banger {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.45);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(168, 85, 247, 0);
  }
}

/* Tier 5: masterclass — gold shimmer */
.badge-masterclass {
  background: linear-gradient(90deg, #fff6d5, #ffd666, #fff2c2, #ffd666, #fff6d5);
  background-size: 300% 100%;
  color: #7a5200;
  animation: shimmer 3s linear infinite;
  box-shadow: 0 0 0 1px rgba(255, 214, 102, 0.6);
}

@keyframes shimmer {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 300% 0%;
  }
}

.quote-card.is-masterclass {
  border-color: #ffd666;
  overflow: hidden;
  animation: card-in 0.4s ease forwards, glow-pulse 2.5s ease-in-out infinite;
  animation-delay: var(--delay, 0s), 0s;
}

@keyframes glow-pulse {
  0%,
  100% {
    box-shadow: 0 0 14px rgba(255, 214, 102, 0.3);
  }
  50% {
    box-shadow: 0 0 28px rgba(255, 214, 102, 0.6);
  }
}

.quote-card.is-masterclass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 1px, transparent 1.6px),
    radial-gradient(circle, #fff 1px, transparent 1.6px),
    radial-gradient(circle, #fff 1px, transparent 1.6px),
    radial-gradient(circle, #fff 1px, transparent 1.6px);
  background-size: 140px 140px, 100px 100px, 180px 180px, 120px 120px;
  background-position: 10% 20%, 70% 60%, 40% 85%, 90% 15%;
  opacity: 0;
  animation: sparkle 4s ease-in-out infinite;
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 0.7;
  }
}

.new-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.new-form label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.6rem;
}

.new-form .optional {
  font-weight: 400;
  color: var(--muted);
}

.new-form textarea,
.new-form input,
.new-form select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.new-form textarea:focus,
.new-form input:focus,
.new-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.new-form button {
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.new-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.new-form button:active {
  transform: translateY(0);
  box-shadow: none;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1.5rem;
}

.hint code {
  display: inline-block;
  margin-top: 0.3rem;
  background: #f1f1ef;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.new-form select#rating.is-masterclass {
  background: linear-gradient(90deg, #fff6d5, #ffd666, #fff2c2, #ffd666, #fff6d5);
  background-size: 300% 100%;
  animation: shimmer 3s linear infinite;
  border-color: #ffd666;
  color: #7a5200;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255, 214, 102, 0.6), 0 0 14px rgba(255, 214, 102, 0.35);
}
