/* ── Reset & base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.hidden {
  display: none !important;
}

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --muted: #888;
  --accent: #e8ff4d;
  --radius: 12px;
  --max-w: 480px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(
    90deg,
    #ff3d3d,
    #ff8c00,
    #ffe600,
    #00e676,
    #00b0ff,
    #d500f9,
    #ff3d3d
  );
  background-size: 300% 100%;
  animation: hue-shift 10s linear infinite;
  border-bottom: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

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

.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.site-header .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

.site-header .btn-logout {
  color: #fff;
  opacity: 0.85;
}
.site-header .btn-logout:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.15);
}

.username {
  font-weight: 600;
}
.streak {
  font-size: 0.9rem;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
  text-align: center;
  margin-top: 1.5rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
  transition:
    color 0.15s,
    background 0.15s;
}
.btn-logout:hover {
  color: var(--text);
  background: var(--surface);
}

/* ── Challenge card ───────────────────────────────────────── */
.challenge-card {
  text-align: center;
  padding-top: 1rem;
}

.home-about-link {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}
.home-about-link:hover {
  color: var(--accent);
}

.gallery-links {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.date-label {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.color-swatch {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.color-swatch:hover {
  transform: scale(1.06);
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.14);
}

.color-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3rem;
  cursor: pointer;
}
.color-fullscreen-hint {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.prompt-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.prompt-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.gallery-locked {
  margin-top: 0.75rem;
}

/* ── Feed ─────────────────────────────────────────────────── */
.feed-color-chip {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
  flex: 1;
  text-align: center;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.feed-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.feed-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
}

.feed-username {
  font-weight: 700;
  font-size: 0.9rem;
}
a.feed-username:hover {
  text-decoration: underline;
  color: var(--accent);
}

.feed-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.feed-img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 480px;
  opacity: 0;
  transition: opacity 0.3s ease var(--feed-delay, 0ms);
}
.feed-img.loaded {
  opacity: 1;
}

.feed-caption {
  padding: 0.6rem 0.9rem 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Profile ──────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profile-username {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-streak {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.post-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
}

.post-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.post-img.loaded {
  opacity: 1;
}

.post-tile-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.3rem 0.4rem;
  font-size: 0.65rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

/* ── Post modal ───────────────────────────────────────────── */
.post-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.post-modal.hidden {
  display: none;
}

.post-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.post-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-w);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}

.post-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.post-modal-img {
  width: 100%;
  object-fit: contain;
  max-height: 70dvh;
  display: block;
  background: #000;
}

.post-modal-body {
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.post-detail-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.post-detail-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.post-detail-chip {
  font-family: monospace;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.post-detail-description {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.btn-delete {
  margin-top: 0.5rem;
  background: transparent;
  border: 1px solid #ff4d4d44;
  color: #ff6b6b;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.btn-delete:hover {
  background: #ff4d4d22;
}

/* ── About page ───────────────────────────────────────────── */
.about-page {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-bottom: 3rem;
}
.about-hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.about-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(
    90deg,
    #ff3d3d,
    #ff8c00,
    #ffe600,
    #00e676,
    #00b0ff,
    #d500f9,
    #ff3d3d
  );
  background-size: 300% 100%;
  animation: hue-shift 10s linear infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.about-lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.6;
}
.about-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.about-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.about-section p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}
.about-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-left: 1.25rem;
}
.about-steps li {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}
.about-section em {
  color: var(--text);
  font-style: italic;
}
.about-features {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.about-feature {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.about-feature-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.about-feature strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--text);
}
.about-feature p {
  margin: 0;
  font-size: 0.88rem;
}
.about-cta {
  text-align: center;
  padding-top: 1rem;
}
.about-cta-sub {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Archive ──────────────────────────────────────────────── */
.archive-header {
  margin-bottom: 1.25rem;
}
.archive-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.archive-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.archive-tile {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  padding: 0.3rem 0.35rem;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  position: relative;
}
.archive-tile:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.archive-tile-date {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  opacity: 0.85;
}

.archive-day-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.archive-day-swatch {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
}
.archive-day-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.archive-day-prompt {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.flash--error {
  background: #3a1a1a;
  color: #ff8080;
}
.flash--success {
  background: #1a3a1a;
  color: #80ff80;
}
.flash--info {
  background: #1a2a3a;
  color: #80c0ff;
}
