:root {
  --red: #b21429;
  --red-deep: #96101f;
  --teal: #487e87;
  --peach: #efd1c7;
  --ink: #000000;
  --muted: #4d4d4d;
  --soft: #727272;
  --line: #e6e6e6;
  --border: #c4c4c4;
  --surface: #ffffff;
  --radius: 16px;
  --font: "Roboto Condensed", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--muted);
  font: 400 18px/1.45 var(--font);
  background-color: var(--surface);
  background-image: linear-gradient(180deg, rgba(239, 209, 199, 0.35), #fff 280px);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h2, h3 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  text-transform: uppercase;
}
.hidden { display: none !important; }
.muted { color: var(--soft); }
.error { color: var(--red); min-height: 1.2em; font-size: 16px; }

.page-container {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
}
.header-inner {
  width: min(1280px, calc(100% - 48px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.logo-words { display: flex; flex-direction: column; line-height: 0.95; }
.logo-kicker {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.logo-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 700; font-size: 16px; color: var(--ink); text-transform: uppercase; }
.user-remaining { color: var(--soft); font-size: 15px; }

.feed-row { padding: 28px 0 10px; }
.feed-row-heading { margin-bottom: 14px; }
.feed-row-heading h2 { font-size: 40px; }
.feed-row-heading span {
  margin-left: 10px;
  color: var(--soft);
  font-size: 22px;
  font-weight: 500;
}
.feed-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.feed-track::-webkit-scrollbar { display: none; }
.feed-tile {
  position: relative;
  flex: 0 0 clamp(200px, 22vw, 260px);
  aspect-ratio: 4 / 5;
  border: 0;
  padding: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #f5f5f5;
  color: #fff;
  scroll-snap-align: start;
  text-align: left;
}
.feed-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s;
}
.feed-tile:hover img { transform: scale(1.04); }
.feed-tile::after {
  content: "";
  position: absolute;
  inset: 46% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}
.feed-tile strong {
  position: absolute;
  z-index: 1;
  left: 14px;
  right: 14px;
  bottom: 14px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 36px;
  align-items: start;
  padding-top: 8px;
}
.detail-gallery { position: sticky; top: 108px; }
.detail-main {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 24px;
  background: #f5f5f5;
}
.gallery-thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; }
.gallery-thumbs button {
  width: 64px;
  height: 80px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  opacity: 0.7;
}
.gallery-thumbs button.selected,
.gallery-thumbs button:hover { opacity: 1; border-color: var(--red); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.detail-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--red);
  transform: rotate(45deg);
}
.detail h2 { font-size: 48px; margin: 10px 0 12px; }
.detail-description { color: var(--muted); font-size: 18px; line-height: 1.45; max-width: 560px; }

.detail-back { padding-top: 16px; }
.detail-side { min-width: 0; }
.detail-actions-card {
  margin: 22px 0 48px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
}
.detail-actions-card h2 { font-size: 28px; }

.gender-row { display: flex; gap: 10px; }
.gender-row button {
  flex: 1;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  text-transform: uppercase;
}
.gender-row button.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.detail-actions-card .button { width: 100%; margin-top: 10px; }
#uploadPhoto { margin-top: 14px; }

.button, .text-button { border-radius: 16px; font-weight: 500; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 20px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.button-red { background: var(--red); border-color: var(--red); color: #fff; }
.button-red:hover { background: var(--red-deep); border-color: var(--red-deep); }
.button-outline { background: #fff; color: var(--ink); border-color: var(--border); }
.button-outline:hover { background: #f5f5f5; }
.text-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel { padding: 28px 0 64px; }
.panel h2 { font-size: 42px; margin-bottom: 8px; }
.panel img, .history img {
  width: min(420px, 100%);
  border-radius: 20px;
  margin: 16px 0;
  object-fit: cover;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 16px 0 48px;
}
.history-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
}
.history-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; margin: 0 0 10px; border-radius: 14px; }

.spinner {
  width: 42px;
  height: 42px;
  margin-top: 18px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--red);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.auth-card {
  width: min(440px, 100%);
  padding: 28px 24px;
  border-radius: 24px;
  background: #fff;
}
.auth-card h2 { font-size: 32px; margin-bottom: 8px; }
.auth-card p { margin-bottom: 14px; color: var(--muted); }
.empty-state { padding: 48px 16px; text-align: center; color: var(--soft); }

@media (max-width: 800px) {
  .page-container, .header-inner { width: calc(100% - 28px); }
  .logo-name { font-size: 22px; }
  .logo-mark { width: 38px; height: 38px; font-size: 22px; }
  .header-inner { min-height: 72px; }
  .button { min-height: 42px; padding: 8px 14px; font-size: 14px; }
  .feed-row-heading h2 { font-size: 28px; }
  .feed-tile { flex-basis: 68vw; }
  .feed-tile strong { font-size: 18px; }
  .detail { grid-template-columns: 1fr; gap: 18px; }
  .detail-gallery { position: static; }
  .detail h2 { font-size: 34px; }
}
