:root {
  --ink: #14151A;
  --paper: #EEF0F4;
  --amber: #FF7A33;
  --teal: #0F5C55;
  --spike-red: #FF3B4E;
  --line-grey: #DBDFE6;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --shadow-card: 0 1px 2px rgba(20, 21, 26, 0.04), 0 4px 10px rgba(20, 21, 26, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(20, 21, 26, 0.06), 0 8px 20px rgba(20, 21, 26, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  padding-bottom: 88px;
  position: relative;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.28s ease both; }

/* Header */

.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 20px 4px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.logo .dot { color: var(--amber); }

.tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  opacity: 0.55;
  padding: 0 20px 16px;
}

/* Feed */

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px;
}

.card {
  background: #fff;
  border: 1px solid rgba(219, 223, 230, 0.6);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover { box-shadow: var(--shadow-card-hover); }
.card:active { border-color: var(--amber); transform: scale(0.98); }

.card-body { flex: 1; min-width: 0; }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-price {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.category-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
  background: rgba(15, 92, 85, 0.1);
  border-radius: 999px;
  padding: 3px 8px;
}

.trend-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #fff;
  background: var(--amber);
  border-radius: 999px;
  padding: 3px 8px;
}

.tier-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(20, 21, 26, 0.06);
  border-radius: 999px;
  padding: 3px 8px;
}

.tier-pill.locked-pill {
  color: var(--amber);
  background: rgba(255, 122, 51, 0.1);
}

.featured-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  color: #fff;
  background: var(--spike-red);
  border-radius: 999px;
  padding: 3px 8px;
}

.sponsored-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  color: var(--teal);
  background: rgba(15, 92, 85, 0.12);
  border: 1px solid rgba(15, 92, 85, 0.3);
  border-radius: 999px;
  padding: 3px 8px;
}

.sparkline-wrap { flex-shrink: 0; }

.card-visual {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bottom tab bar */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-grey);
  box-shadow: 0 -2px 12px rgba(20, 21, 26, 0.06);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  text-decoration: none;
  color: var(--ink);
  opacity: 0.45;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tab-item:active { transform: scale(0.92); }

.tab-item.active { opacity: 1; }

.tab-item.active .tab-icon { color: var(--amber); }

.tab-icon { width: 22px; height: 22px; }

.tab-icon svg { width: 100%; height: 100%; display: block; }

.tab-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Sections */

.section { margin-bottom: 24px; }

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  padding: 0 16px 10px;
}

/* Explore filters */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.filter-bar select,
.filter-bar input {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line-grey);
  border-radius: 10px;
  background: #fff;
}

.filter-price-row {
  display: flex;
  gap: 8px;
  flex: 1;
}

.filter-price-row input { width: 100%; min-width: 0; }

/* Explore grid */

.explore-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}

.grid-card {
  background: #fff;
  border: 1px solid rgba(219, 223, 230, 0.6);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.grid-card:hover { box-shadow: var(--shadow-card-hover); }
.grid-card:active { transform: scale(0.97); }

.grid-card-visual {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.grid-card-visual img { width: 100%; height: 100%; object-fit: cover; }

.grid-card-body { padding: 10px; }

.grid-card-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.grid-card-price {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 6px;
}

.grid-card-meta { display: flex; flex-wrap: wrap; gap: 4px; }

.skeleton-grid-card {
  background: #fff;
  border: 1px solid rgba(219, 223, 230, 0.6);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-card);
}

/* Detail */

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 8px;
}

.back-btn {
  background: none;
  border: 1px solid var(--line-grey);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink);
}

.detail-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.detail-body { padding: 8px 20px 20px; }

.detail-hero {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.detail-price {
  font-family: var(--font-mono);
  font-size: 18px;
  margin: 4px 0 12px;
}

.detail-note {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.8;
  margin-bottom: 20px;
}

.affiliate-disclosure {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  opacity: 0.5;
  text-align: center;
  margin-bottom: 16px;
}

.powered-by {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  text-align: center;
  margin-top: 14px;
  opacity: 0.8;
}

.generate-btn {
  width: 100%;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.generate-btn:disabled { opacity: 0.6; cursor: default; }

.generate-btn.secondary {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal);
}

.variants {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.variant-card {
  background: #fff;
  border: 1px solid var(--line-grey);
  border-radius: 14px;
  padding: 14px;
}

.variant-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.variant-hook {
  font-weight: 600;
  margin-bottom: 8px;
}

.variant-caption {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.variant-hashtags {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--teal);
  margin-bottom: 10px;
}

.copy-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--line-grey);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.copy-btn.copied { color: var(--teal); border-color: var(--teal); }

/* States */

.state-msg {
  padding: 40px 20px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  opacity: 0.6;
}

.state-msg.error { color: var(--spike-red); opacity: 1; }

/* Admin */

.admin-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  flex: 1;
}

.logout-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  background: none;
  border: 1px solid var(--line-grey);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.admin-form, .admin-list { padding: 0 20px; }

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.admin-form input, .admin-form textarea, .admin-form select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-grey);
  border-radius: 10px;
  background: #fff;
  width: 100%;
}

.admin-form label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: -4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body) !important;
  font-size: 13px !important;
  text-transform: none !important;
  opacity: 1 !important;
}

.checkbox-label input { width: auto !important; }

.admin-row {
  background: #fff;
  border: 1px solid var(--line-grey);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.admin-row-info { min-width: 0; }

.admin-row-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-row-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.6;
}

.admin-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  background: var(--paper);
  border: 1px solid var(--line-grey);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.icon-btn.danger { color: var(--spike-red); border-color: var(--spike-red); }

.login-box {
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.login-box input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px;
  border: 1px solid var(--line-grey);
  border-radius: 10px;
}

/* Skeleton loading */

@keyframes shimmer {
  0% { background-position: -120% 0; }
  100% { background-position: 120% 0; }
}

.skeleton-card {
  background: #fff;
  border: 1px solid rgba(219, 223, 230, 0.6);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-card);
}

.skeleton-block {
  background: linear-gradient(90deg, #e3e6ec 25%, #eef0f4 37%, #e3e6ec 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}

.skeleton-card .skeleton-block:first-child { width: 64px; height: 28px; flex-shrink: 0; }
.skeleton-card .skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-card .skeleton-lines .skeleton-block:nth-child(1) { height: 14px; width: 70%; }
.skeleton-card .skeleton-lines .skeleton-block:nth-child(2) { height: 10px; width: 40%; }

/* Settings */

.settings-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }

.settings-row {
  background: #fff;
  border: 1px solid rgba(219, 223, 230, 0.6);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.settings-row-label { font-weight: 500; font-size: 14px; }

.settings-row-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.55;
  margin-top: 2px;
}

/* Desktop layout — the app widens into a real desktop layout instead of
   a stretched-out phone screen once there's room for it. */

@media (min-width: 900px) {
  body { background: #E2E5EC; }

  #app {
    max-width: 1100px;
    min-height: calc(100vh - 40px);
    margin: 20px auto;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(20, 21, 26, 0.08);
    overflow: hidden;
  }

  .header { padding: 28px 32px 4px; }
  .tagline { padding: 0 32px 20px; }

  .feed {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 0 32px;
  }

  .explore-grid {
    grid-template-columns: repeat(4, 1fr);
    padding: 0 32px;
  }

  .filter-bar { padding: 0 32px 16px; }

  .section-title { padding-left: 32px; padding-right: 32px; }

  .tab-bar { max-width: 1100px; border-radius: 0 0 20px 20px; }

  .detail-header { padding: 20px 32px 8px; }
  .detail-body, .admin-form, .admin-list, .settings-list, .login-box {
    max-width: 640px;
    margin: 0 auto;
  }
  .admin-header { padding: 20px 32px; }
}

.settings-about {
  text-align: center;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.4;
}
