:root {
  --ink: #f5ebe0;
  --muted: #a89888;
  --line: rgba(212, 160, 84, 0.22);
  --line-strong: rgba(212, 160, 84, 0.45);
  --surface: rgba(36, 28, 22, 0.72);
  --surface-solid: #241c16;
  --surface-raised: rgba(48, 38, 30, 0.85);
  --accent: #d4a054;
  --accent-bright: #e8b86d;
  --accent-deep: #a67c3a;
  --danger: #e07a6a;
  --radius: 12px;
  --radius-sm: 8px;
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --glow: 0 0 24px rgba(212, 160, 84, 0.18);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(212, 160, 84, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(196, 137, 58, 0.1), transparent 50%),
    linear-gradient(165deg, #14100c 0%, #1a1410 38%, #120e0b 100%);
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 16, 12, 0.85);
  backdrop-filter: blur(14px);
}

.top-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 1.35rem;
}

.top h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.picks-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.picks-pill:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.picks-pill:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.text-btn:focus-visible,
.chip:focus-visible,
.filter-chip:focus-visible,
.ghost-icon:focus-visible,
.card:focus-visible,
.star-btn:focus-visible,
.search-wrap input:focus-visible,
.sort-wrap select:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.picks-pill-count {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent-bright));
  color: #1a1410;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.controls {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.35rem;
  display: grid;
  gap: 0.75rem;
}

.search-sort {
  display: grid;
  gap: 0.55rem;
}

@media (min-width: 640px) {
  .search-sort {
    grid-template-columns: 1fr 10rem;
    align-items: end;
  }
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  backdrop-filter: blur(8px);
  padding: 0.62rem 0.85rem;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-wrap input:focus {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
  outline: none;
}

.sort-wrap {
  display: grid;
  gap: 0.25rem;
}

.sort-wrap label {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sort-wrap select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--ink);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: rgba(36, 28, 22, 0.55);
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter-chip.is-open,
.filter-chip.has-value {
  border-color: var(--accent);
  color: var(--accent-bright);
  box-shadow: 0 0 16px rgba(212, 160, 84, 0.12);
}

.filter-chip-count {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1410;
  font-size: 0.72rem;
  text-align: center;
  font-weight: 600;
}

.filter-panel {
  padding: 0.4rem 0 0.2rem;
}

.filter-panel[hidden] {
  display: none;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(36, 28, 22, 0.65);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.84rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.chip.is-on {
  border-color: var(--accent);
  color: var(--accent-bright);
  font-weight: 500;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.results-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--accent-bright);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.text-btn:hover {
  border-bottom-color: var(--accent);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.35rem 3.5rem;
}

.banner {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(224, 122, 106, 0.35);
  background: rgba(224, 122, 106, 0.12);
  border-radius: var(--radius-sm);
  color: var(--danger);
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty p {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 560px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card.is-picked {
  border: 2px solid var(--accent-bright);
  box-shadow: 0 0 0 1px rgba(232, 184, 109, 0.25);
}

.card-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.15;
  object-fit: cover;
  background: rgba(14, 11, 9, 0.65);
}

.sheet-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.15;
  object-fit: contain;
  background:
    radial-gradient(circle at 50% 40%, rgba(212, 160, 84, 0.08), transparent 65%),
    rgba(14, 11, 9, 0.65);
}

.tray-thumb {
  width: 48px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(14, 11, 9, 0.65);
  border: 1px solid var(--line);
}

.card-body {
  padding: 0.65rem 0.75rem 0.8rem;
}

.card-brand {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.12rem 0 0.2rem;
  line-height: 1.2;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.ca-badge {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-bright);
  letter-spacing: 0.06em;
  background: rgba(212, 160, 84, 0.08);
}

.star-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
}

.star-btn svg {
  width: 2.7rem;
  height: 2.7rem;
  display: block;
  overflow: visible;
}

.star-btn .star-shape {
  fill: rgba(200, 195, 188, 0.45);
  transform-origin: 12px 12px;
  transition:
    fill 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-btn .star-outline {
  fill: none;
  stroke: var(--accent-bright);
  stroke-width: 1.5;
  stroke-linejoin: round;
  opacity: 1;
  transition: opacity 0.25s;
}

.star-btn:hover .star-shape {
  fill: rgba(220, 215, 208, 0.62);
}

.star-btn:hover .star-outline {
  stroke: #ffcf7a;
}

.star-btn.is-on .star-shape {
  fill: var(--accent-bright);
}

.star-btn.is-on .star-outline {
  opacity: 0;
}

.star-btn.is-pop svg {
  animation: star-pop 0.48s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes star-pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.42);
  }
  70% {
    transform: scale(0.92);
  }
  100% {
    transform: scale(1);
  }
}

.confetti-burst {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.confetti-piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 6px;
  opacity: 1;
  animation: confetti-fly 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes confetti-fly {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.4);
    opacity: 0;
  }
}

.btn-primary,
.btn-secondary {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.58rem 0.85rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent-bright));
  border-color: transparent;
  color: #1a1410;
}

.btn-primary:hover {
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.btn-primary.is-on {
  background: linear-gradient(135deg, #8b6914, var(--accent));
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.ghost-icon {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
  color: var(--muted);
  transition: color 0.2s;
}

.ghost-icon:hover {
  color: var(--ink);
}

.sheet[hidden],
.tray[hidden],
.shared-modal[hidden] {
  display: none;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 5, 0.72);
  backdrop-filter: blur(4px);
}

.sheet-panel {
  position: fixed;
  z-index: 40;
  background: var(--surface-raised);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

@media (max-width: 719px) {
  .sheet-panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 90vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

@media (min-width: 720px) {
  .sheet-panel {
    top: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: min(400px, calc(100vw - 2rem));
    border-radius: var(--radius);
  }
}

.sheet-panel > .ghost-icon {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
}

.sheet-body {
  overflow: auto;
  flex: 1;
}

.sheet-photo {
  max-height: 260px;
}

.sheet-content {
  padding: 0.9rem 1.05rem;
}

.sheet-brand {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#drawer-title {
  margin: 0.15rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.15;
}

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

.sheet-notes {
  margin: 0.55rem 0 0;
  color: var(--ink);
  font-style: italic;
  opacity: 0.9;
}

.sheet-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
}

.sheet-details dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sheet-details dd {
  margin: 0.12rem 0 0;
}

.sheet-details a {
  color: var(--accent-bright);
}

.sheet-footer {
  padding: 0.85rem 1.05rem;
  border-top: 1px solid var(--line);
}

.sheet-footer .btn-primary {
  width: 100%;
}

.tray {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(8, 6, 5, 0.72);
  backdrop-filter: blur(6px);
}

.tray-card {
  width: min(480px, 100%);
  max-height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.15rem;
  box-shadow: var(--shadow);
}

.tray:not([hidden]) .tray-card {
  animation: modal-in 0.28s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
}

.tray-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.tray-intro {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.tray-empty {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tray-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(50vh, 380px);
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.tray-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.tray-item:last-child {
  border-bottom: 0;
}

.tray-item-name {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
}

.tray-item-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.tray-item-remove {
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0.2rem;
  transition: color 0.2s;
}

.tray-item-remove:hover {
  color: var(--danger);
}

.tray-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
  flex-shrink: 0;
}

.copy-feedback {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent-bright);
}

.shared-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.shared-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 3, 0.88);
  backdrop-filter: blur(10px);
}

.shared-modal-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 1600px);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding: 2rem 2.25rem 1.75rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(212, 160, 84, 0.14), transparent 55%),
    var(--surface-raised);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    0 0 0 1px rgba(232, 184, 109, 0.12),
    0 24px 80px rgba(0, 0, 0, 0.55),
    var(--glow);
}

.shared-modal:not([hidden]) .shared-modal-panel {
  animation: shared-modal-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes shared-modal-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(24px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.shared-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.shared-modal-eyebrow {
  margin: 0;
  color: var(--accent-bright);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.shared-modal-panel h2 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.05;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.shared-modal-subtitle {
  margin: 0.5rem 0 1.25rem;
  color: var(--muted);
  font-size: 1rem;
}

.shared-modal-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.15rem 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .shared-modal-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .shared-modal-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .shared-modal-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.shared-pick {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20, 16, 12, 0.55);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.shared-pick:hover,
.shared-pick:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--glow);
  transform: translateY(-2px);
  outline: none;
}

.shared-pick-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  object-fit: cover;
  background: rgba(14, 11, 9, 0.65);
}

.shared-pick-body {
  padding: 0.75rem 0.8rem 0.85rem;
}

.shared-pick-brand {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.shared-pick-name {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.15;
}

.shared-pick-meta {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.shared-pick .ca-badge {
  margin-top: 0.45rem;
}

.shared-modal-browse {
  width: 100%;
  margin-top: 1.25rem;
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

@media (max-width: 480px) {
  .shared-modal {
    padding: 0.5rem;
  }

  .shared-modal-panel {
    width: 100%;
    padding: 1.35rem 1.15rem 1.15rem;
  }

  .shared-modal-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover {
    transform: none;
  }
}
