:root {
  --bg: #f2f2f2;
  --panel: #ffffff;
  --border: #d6d6d8;
  --text: #101010;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#saved-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(242, 242, 242, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

#saved-header h1 {
  margin: 0;
  text-align: center;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

#home-link {
  text-decoration: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #111111;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

#pump-link {
  text-decoration: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #111111;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
}

#x-link {
  text-decoration: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #111111;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
}

#x-link img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

#saved-main {
  padding: 18px 20px 26px;
}

#saved-description {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #3f3f46;
}

#empty-state {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px dashed #c9c9cd;
  border-radius: 8px;
  color: #5a5a5a;
  background: #fafafa;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#empty-state[hidden] {
  display: none;
}

#empty-state[data-state="error"] {
  border-color: #f4b4b4;
  background: #fff5f5;
}

.loader-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #d4d4d8;
  border-top-color: #111111;
  animation: spin-ring 0.9s linear infinite;
}

#empty-state-text {
  font-size: 0.9rem;
}

@keyframes spin-ring {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.saved-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
  padding: 12px;
}

.saved-head {
  margin-bottom: 10px;
}

.saved-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.saved-meta {
  margin: 4px 0 0;
  color: #66666f;
  font-size: 0.84rem;
}

.saved-preview {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  border-radius: 1px;
  border: 1px solid #e9dec7;
  background: #fffef9;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.04);
}

.saved-preview-shell {
  position: relative;
  padding: 12px;
  background:
    linear-gradient(
      135deg,
      #6d4116 0%,
      #b7792c 14%,
      #f3d08a 26%,
      #7b4818 38%,
      #d9ad62 52%,
      #8b531d 66%,
      #f2ce86 80%,
      #6a3f14 100%
    );
  border: 1px solid #7f4d1e;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 225, 153, 0.45),
    inset 0 0 0 7px rgba(107, 63, 20, 0.52),
    inset 0 0 0 11px rgba(240, 200, 118, 0.38),
    0 8px 18px rgba(58, 35, 12, 0.24);
  overflow: hidden;
}

.saved-preview-shell::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(117, 68, 24, 0.64);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 230, 170, 0.5);
}

.saved-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stroke-count {
  margin: 0;
  color: #555560;
  font-size: 0.83rem;
}

.like-btn {
  border: 1px solid #c8c8cc;
  background: #ffffff;
  color: #111111;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transform-origin: center;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.like-btn.is-liked {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
}

.like-btn.is-animating {
  animation: like-burst 300ms ease;
}

.like-btn.is-unliking {
  animation: unlike-burst 300ms ease;
}

.like-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

@keyframes like-burst {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes unlike-burst {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  #saved-header {
    padding: 10px 12px;
    gap: 8px;
  }

  #saved-header h1 {
    font-size: 1.2rem;
  }

  #home-link {
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  #pump-link {
    padding: 7px 10px;
    font-size: 0.74rem;
  }

  #header-actions {
    gap: 6px;
  }

  #saved-main {
    padding: 12px;
  }
}
