:root {
  /* --ice/--ice-soft = hair accent (coral), --pink = eye accent (blue) — names kept from the original token set */
  --bg: #0a1220;
  --bg-deep: #060a14;
  --card: #121c32;
  --card-hover: #17233d;
  --ice: #e8846f;
  --ice-soft: #f7cdbf;
  --pink: #6fb7e0;
  --horn: #cfa968;
  --text: #eef3f8;
  --text-dim: #8ea0bb;
  --border: rgba(143, 184, 224, 0.16);
  --radius: 14px;
  --serif: "Noto Serif Thai", "Cormorant Garamond", serif;
  --sans: "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(ellipse at top, #0e1830 0%, var(--bg-deep) 60%);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* --- snowfall, one quiet orchestrated moment --- */
.snowfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.snowfield span {
  position: absolute;
  top: -5vh;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ice-soft);
  opacity: 0.55;
  animation: fall linear infinite;
}
@keyframes fall {
  to { transform: translateY(110vh) translateX(10px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .snowfield { display: none; }
}

/* --- hero --- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 5.5rem 1.5rem 3.5rem;
  border-bottom: 1px solid var(--border);
}
.horn {
  position: absolute;
  top: 1.6rem;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 46px solid var(--horn);
  opacity: 0.85;
  filter: drop-shadow(0 0 10px rgba(207, 169, 104, 0.35));
}
.horn-left { left: calc(50% - 64px); transform: rotate(-12deg); }
.horn-right { right: calc(50% - 64px); transform: rotate(12deg); }

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--pink);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  margin: 0;
  color: var(--ice-soft);
  text-shadow: 0 0 28px rgba(111, 183, 224, 0.35);
}
h1 span { color: var(--text); font-weight: 500; }
.tagline {
  max-width: 34rem;
  margin: 1rem auto 0;
  color: var(--text-dim);
  font-size: 1rem;
}

/* --- auth bar --- */
.auth-bar {
  margin-top: 1.8rem;
  display: flex;
  justify-content: center;
}
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #5865f2;
  color: #fff;
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: 10px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.auth-btn:hover { background: #4752c4; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem 0.4rem 0.4rem;
  border-radius: 999px;
  font-size: 0.88rem;
}
.user-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
}
.user-chip button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0;
}
.user-chip button:hover { color: var(--pink); }

.btn-download.locked {
  background: var(--card);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-download.locked:hover { background: var(--card-hover); }

.auth-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
}
.auth-btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.auth-btn.secondary:hover { border-color: var(--ice); color: var(--ice-soft); }

/* --- password modal --- */
.pw-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.86);
  backdrop-filter: blur(6px);
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.pw-modal-inner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 360px;
  width: 100%;
  padding: 1.6rem;
  position: relative;
  text-align: center;
}
.pw-modal-inner h2 {
  font-family: var(--serif);
  color: var(--ice-soft);
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
}
.pw-modal-inner > p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0 0 1.1rem;
}
.pw-modal-inner input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--sans);
  margin-bottom: 0.9rem;
}
.pw-modal-inner input:focus { outline: none; border-color: var(--ice); }
.pw-modal-inner .btn-download {
  width: 100%;
  border: none;
  font-family: var(--sans);
  cursor: pointer;
}
.pw-error {
  color: #e8846f;
  font-size: 0.8rem;
  margin: 0.7rem 0 0 !important;
}

/* --- toolbar --- */
main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}
.search-wrap input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
}
.search-wrap input::placeholder { color: var(--text-dim); }
.search-wrap input:focus {
  outline: none;
  border-color: var(--ice);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.filter-chip {
  padding: 0.45rem 0.95rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--sans);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.filter-chip:hover { border-color: var(--ice); color: var(--ice-soft); }
.filter-chip.active {
  background: var(--ice);
  border-color: var(--ice);
  color: #061018;
  font-weight: 600;
}

/* --- grid / cards --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--ice);
  background: var(--card-hover);
}
.card .thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0d1628;
  display: block;
}
.card .thumb-video {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0d1628;
}
.card-body { padding: 1rem 1.1rem 1.2rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ice-soft);
  margin: 0;
}
.card-desc {
  font-size: 0.86rem;
  color: var(--text-dim);
  margin: 0;
  flex: 1;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.card-tags span {
  font-size: 0.72rem;
  color: var(--pink);
  border: 1px solid rgba(230, 169, 195, 0.3);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
}

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

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* --- lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.86);
  backdrop-filter: blur(6px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.lightbox-inner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}
.lightbox-inner img, .lightbox-inner video {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 1rem;
  display: block;
}
.lightbox-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
}
.lightbox-inner h2 {
  font-family: var(--serif);
  color: var(--ice-soft);
  margin: 0 0 0.5rem;
}
.lightbox-inner p { color: var(--text-dim); margin: 0 0 1.2rem; }
.btn-download {
  display: inline-block;
  background: var(--ice);
  color: #061018;
  font-weight: 600;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-size: 0.9rem;
}
.btn-download:hover { background: var(--ice-soft); }

/* --- mobile tune --- */
@media (max-width: 480px) {
  .hero { padding: 4.5rem 1.2rem 2.5rem; }
  .horn-left { left: calc(50% - 46px); }
  .horn-right { right: calc(50% - 46px); }
  main { padding: 2rem 1rem 3rem; }
}