:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --ink: #101014;
  --muted: #777781;
  --line: #d9d9d5;
  --ribbon: #101014;
  --accent: #ff385c;
  --paper: rgba(255, 255, 255, 0.86);
  --shadow: 0 24px 80px rgba(16, 16, 20, 0.12);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #101014;
  --surface: #18181d;
  --ink: #f4f1e8;
  --muted: #aaa6a0;
  --line: #303038;
  --ribbon: #f4f1e8;
  --accent: #ff4f70;
  --paper: rgba(24, 24, 29, 0.86);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(16, 16, 20, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #fbfbf8 0%, var(--bg) 100%);
  background-size: 64px 64px, auto;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

body.theme-dark {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #15151a 0%, var(--bg) 100%);
  background-size: 64px 64px, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 5vw, 64px);
  background: rgba(244, 244, 241, 0.9);
  border-bottom: 1px solid rgba(16, 16, 20, 0.1);
  backdrop-filter: blur(18px);
}

body.theme-dark .topbar {
  background: rgba(16, 16, 20, 0.86);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: inset 0 0 0 8px #fff;
}

body.theme-dark .brand-mark {
  box-shadow: inset 0 0 0 8px #101014;
}

.brand-mark::after {
  position: absolute;
  right: -4px;
  bottom: 6px;
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.main-nav button {
  min-height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
  padding: 0 14px;
}

.main-nav button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.avatar-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

body.theme-dark .icon-button {
  background: rgba(24, 24, 29, 0.86);
}

.avatar-button {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vip-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(185, 145, 58, 0.7);
  background: linear-gradient(135deg, #111116, #2d2514 55%, #111116);
  color: #f6d27a;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  padding: 0 10px;
  text-transform: uppercase;
}

body:not(.vip-member) .vip-badge {
  background: var(--surface);
  color: var(--ink);
}

body.vip-member .avatar-button {
  border-color: #f6d27a;
  box-shadow: 0 0 0 3px rgba(246, 210, 122, 0.2);
}

.user-popover {
  position: absolute;
  top: 50px;
  right: 0;
  width: 230px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

body.theme-dark .user-popover {
  background: rgba(24, 24, 29, 0.98);
}

.user-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.user-popover strong {
  display: block;
  overflow: hidden;
  margin: 4px 0 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xp-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  background: rgba(16, 16, 20, 0.04);
  padding: 10px;
}

body.theme-dark .xp-panel {
  background: rgba(255, 255, 255, 0.05);
}

.xp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.xp-head span,
.xp-head strong {
  font-size: 12px;
  font-weight: 950;
}

.xp-head span {
  color: var(--accent);
}

.xp-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(16, 16, 20, 0.08);
}

body.theme-dark .xp-track {
  background: rgba(255, 255, 255, 0.08);
}

.xp-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f6d27a);
}

.xp-panel p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vip-popover-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0 0 12px;
  border: 1px solid rgba(185, 145, 58, 0.64);
  background: rgba(246, 210, 122, 0.16);
  color: #6c4e0f;
  font-size: 12px;
  font-weight: 950;
  padding: 0 12px;
}

.user-popover .vip-popover-badge {
  width: auto;
  min-height: 32px;
  border-radius: 0;
  background: rgba(246, 210, 122, 0.16);
  color: #8a6518;
}

body.theme-dark .user-popover .vip-popover-badge {
  color: #f6d27a;
}

.user-popover button {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

body.theme-dark #logoutButton {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.theme-dark #logoutButton:hover {
  background: rgba(255, 79, 112, 0.18);
  border-color: rgba(255, 79, 112, 0.48);
}

.user-popover .vip-popover-badge {
  width: auto;
  min-height: 32px;
  border: 1px solid rgba(185, 145, 58, 0.64);
  border-radius: 0;
  background: rgba(246, 210, 122, 0.16);
  color: #8a6518;
  padding: 0 12px;
}

body.theme-dark .user-popover .vip-popover-badge {
  color: #f6d27a;
}

main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 36px) 72px;
}

.hero {
  min-height: clamp(240px, 36vh, 430px);
  display: grid;
  align-items: end;
  padding: clamp(28px, 7vw, 80px) clamp(18px, 4vw, 40px) 28px;
  border: 1px solid rgba(16, 16, 20, 0.12);
  background:
    linear-gradient(90deg, rgba(255, 56, 92, 0.95) 0 6px, transparent 6px),
    linear-gradient(135deg, #111116, #29292f 56%, #111116);
  color: #fff;
}

body.vip-member .hero {
  background:
    linear-gradient(90deg, #f6d27a 0 6px, transparent 6px),
    radial-gradient(circle at 82% 18%, rgba(246, 210, 122, 0.24), transparent 34%),
    linear-gradient(135deg, #111116, #29292f 56%, #111116);
}

.hero-copy {
  display: grid;
  max-width: 820px;
  gap: 14px;
}

.kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .kicker {
  color: #fff;
}

h1 {
  font-size: clamp(42px, 8vw, 92px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

.hero p:last-child {
  max-width: 640px;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(15px, 2.2vw, 18px);
  line-height: 1.75;
}

.setup-panel,
.auth-card,
.composer,
.recipe-composer,
.wishlist-composer {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.setup-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.setup-panel[hidden],
.auth-card[hidden],
.composer[hidden],
.recipe-composer[hidden],
.wishlist-composer[hidden],
.user-menu[hidden],
.user-popover[hidden],
.vip-badge[hidden],
.vip-popover-badge[hidden],
.feed-head[hidden],
.filters[hidden],
.gallery[hidden],
#previewStrip[hidden],
#uploadForm[hidden],
.pager[hidden],
.feed-loader[hidden] {
  display: none;
}

body.signed-in .auth-card {
  display: none !important;
}

.auth-card,
.composer,
.recipe-composer,
.wishlist-composer {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 4vw, 30px);
}

.auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.8fr) auto auto;
  gap: 10px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: rgba(16, 16, 20, 0.92);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(16, 16, 20, 0.08);
}

.hint,
.status-line {
  color: var(--muted);
  font-size: 14px;
}

.section-title,
.feed-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-button {
  display: grid;
  gap: 4px;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.section-heading-button h2 {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.section-heading-button h2::after {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-size: 20px;
  content: "+";
}

.composer.expanded .section-heading-button h2::after,
.recipe-composer.expanded .section-heading-button h2::after,
.wishlist-composer.expanded .section-heading-button h2::after {
  content: "−";
}

.section-heading-button:focus-visible {
  outline: 3px solid rgba(255, 56, 92, 0.32);
  outline-offset: 6px;
}

#uploadStatus {
  color: var(--accent);
  font-size: 13px;
  font-weight: 950;
}

.ghost-button,
.pager button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 950;
  padding: 0 18px;
}

#uploadForm {
  display: grid;
  gap: 15px;
}

.file-drop {
  min-height: 210px;
  align-items: center;
  justify-items: center;
  border: 1.5px dashed #bdbdb8;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(16, 16, 20, 0.04), transparent),
    rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.file-drop:focus-visible {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(16, 16, 20, 0.08);
  outline: none;
}

.file-drop input {
  display: none;
}

#photoPreview {
  display: block;
  width: min(100%, 420px);
  max-height: 280px;
  margin-bottom: 12px;
  border-radius: 0;
  object-fit: cover;
  box-shadow: 0 18px 38px rgba(16, 16, 20, 0.16);
}

#photoPreview[hidden] {
  display: none;
}

.preview-strip {
  display: flex;
  width: min(100%, 520px);
  gap: 8px;
  justify-content: center;
  margin: 0 auto 12px;
  overflow-x: auto;
  padding: 4px 0;
}

.preview-thumb {
  display: block;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(16, 16, 20, 0.18);
  background: #fff;
  cursor: pointer;
}

.preview-thumb:focus-visible {
  outline: 3px solid rgba(255, 56, 92, 0.34);
  outline-offset: 2px;
}

.preview-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-drop span,
.file-drop strong {
  display: block;
}

.file-drop span {
  font-weight: 950;
}

.file-drop strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 14px;
}

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

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 13px;
  align-items: end;
}

.link-row button {
  min-height: 48px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-weight: 950;
  padding: 0 18px;
}

.primary,
.auth-row button,
.setup-panel button {
  min-height: 48px;
  border-radius: 0;
  background: var(--ink);
  color: white;
  font-weight: 950;
  padding: 0 18px;
}

#signupButton {
  background: var(--accent);
}

.feed-head {
  margin: 36px 0 18px;
}

.filters {
  position: sticky;
  top: 71px;
  z-index: 12;
  display: flex;
  gap: 9px;
  margin: 0 0 28px;
  overflow-x: auto;
  padding: 8px 0 12px;
  background: linear-gradient(180deg, rgba(244, 244, 241, 0.94), rgba(244, 244, 241, 0.76));
  backdrop-filter: blur(14px);
}

body.theme-dark .filters {
  background: linear-gradient(180deg, rgba(16, 16, 20, 0.94), rgba(16, 16, 20, 0.74));
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 950;
  padding: 10px 16px;
}

body.theme-dark .chip {
  background: #18181d;
}

.chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.gallery {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr);
  gap: 34px 0;
  align-items: start;
  padding: 30px 0 36px;
}

.gallery::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background:
    linear-gradient(180deg, transparent, var(--ink) 12%, var(--ink) 88%, transparent);
  content: "";
  transform: translateX(-50%);
}

.gallery::after {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 72px;
  background:
    repeating-linear-gradient(
      135deg,
      transparent 0 26px,
      rgba(16, 16, 20, 0.12) 26px 27px,
      transparent 27px 54px
    );
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.photo-card {
  position: relative;
  z-index: 1;
  width: min(100%, 500px);
  overflow: hidden;
  border: 1px solid rgba(16, 16, 20, 0.14);
  border-radius: 0;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(16, 16, 20, 0.13);
}

body.theme-dark .photo-card {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.photo-card:nth-child(odd) {
  grid-column: 1;
  justify-self: end;
  margin-right: 24px;
}

.photo-card:nth-child(even) {
  grid-column: 3;
  justify-self: start;
  margin-left: 24px;
  margin-top: 86px;
}

.photo-card::before {
  position: absolute;
  top: 38px;
  width: 52px;
  height: 1px;
  background: var(--ink);
  content: "";
}

.photo-card:nth-child(odd)::before {
  right: -52px;
}

.photo-card:nth-child(even)::before {
  left: -52px;
}

.strand-index {
  position: absolute;
  top: 22px;
  z-index: 3;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
}

.photo-status-badges {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.photo-status-badges span {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(16, 16, 20, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 6px 8px;
}

.photo-status-badges .featured-badge {
  background: #e8b94a;
  color: #151816;
}

.photo-status-badges .pin-badge {
  background: #55d6b5;
  color: #10241e;
}

.photo-card:nth-child(odd) .strand-index {
  right: -77px;
}

.photo-card:nth-child(even) .strand-index {
  left: -77px;
}

.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.photo-copy-open {
  display: grid;
  width: 100%;
  gap: 8px;
  border-top: 1px solid rgba(16, 16, 20, 0.08);
  background: transparent;
  color: inherit;
  padding: 18px 18px 12px;
  text-align: left;
}

.photo-media {
  position: relative;
  display: grid;
  width: 100%;
  background: #ededeb;
}

body.theme-dark .photo-media {
  background: #0e0e12;
}

.photo-media.single img,
.photo-card > .photo-open > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  background: #ededeb;
  object-fit: cover;
}

.photo-media button {
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  padding: 0;
}

.photo-media.collage {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  aspect-ratio: 1;
  padding: 2px;
}

.photo-media.collage.count-2,
.photo-media.collage.count-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-media.collage button,
.photo-media.collage img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.media-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(16, 16, 20, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  padding: 6px 10px;
  pointer-events: none;
}

.photo-card article {
  display: grid;
  gap: 8px;
  padding: 18px 18px 12px;
  border-top: 1px solid rgba(16, 16, 20, 0.08);
}

.photo-card h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.photo-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 18px 18px;
}

.edit-photo,
.delete-photo,
.favorite-photo,
.feature-photo,
.pin-photo {
  min-height: 36px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: 13px;
  font-weight: 950;
  padding: 0 16px;
}

.edit-photo {
  background: var(--ink);
  color: #fff;
}

.delete-photo {
  background: #fff;
  color: var(--ink);
}

.favorite-photo,
.feature-photo,
.pin-photo {
  background: transparent;
  color: var(--ink);
}

.favorite-photo.active {
  border-color: #f06450;
  background: rgba(240, 100, 80, 0.1);
  color: #d44d39;
}

.feature-photo.active {
  border-color: #e8b94a;
  background: rgba(232, 185, 74, 0.14);
}

.pin-photo.active {
  border-color: #32b896;
  background: rgba(50, 184, 150, 0.12);
}

body.theme-dark .edit-photo {
  border-color: rgba(255, 255, 255, 0.78);
  background: #f4f1e8;
  color: #101014;
}

body.theme-dark .favorite-photo,
body.theme-dark .feature-photo,
body.theme-dark .pin-photo {
  border-color: rgba(255, 255, 255, 0.28);
  color: #f0f4ef;
}

body.theme-dark .favorite-photo.active {
  border-color: var(--coral);
  background: rgba(255, 128, 109, 0.14);
  color: var(--coral);
}

body.theme-dark .feature-photo.active {
  border-color: var(--gold);
  background: rgba(240, 200, 95, 0.14);
  color: var(--gold);
}

body.theme-dark .pin-photo.active {
  border-color: var(--accent);
  background: rgba(85, 214, 181, 0.14);
  color: var(--accent);
}

body.theme-dark .delete-photo {
  border-color: rgba(255, 79, 112, 0.72);
  background: rgba(255, 79, 112, 0.12);
  color: #ff9caf;
}

body.theme-dark .edit-photo:focus-visible,
body.theme-dark .delete-photo:focus-visible {
  outline: 3px solid rgba(246, 210, 122, 0.34);
  outline-offset: 2px;
}

.empty {
  grid-column: 1 / -1;
  padding: 44px 18px;
  border: 1px dashed #bdbdb8;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
}

.pager span {
  min-width: 72px;
  color: var(--muted);
  font-weight: 950;
  text-align: center;
}

.feed-loader {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feed-loader-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: feed-loader-spin 900ms linear infinite;
}

.feed-loader.complete .feed-loader-mark {
  border: 0;
  border-radius: 0;
  animation: none;
}

.feed-loader.complete .feed-loader-mark::before {
  color: var(--accent);
  content: "◆";
}

@keyframes feed-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.recipes-page {
  display: grid;
  gap: 18px;
}

.recipe-form {
  display: grid;
  gap: 15px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 30px);
}

.recipe-cover-drop {
  min-height: 180px;
  align-items: center;
  justify-items: center;
  border: 1.5px dashed #bdbdb8;
  background:
    linear-gradient(135deg, rgba(16, 16, 20, 0.04), transparent),
    rgba(255, 255, 255, 0.72);
  padding: 16px;
  text-align: center;
}

body.theme-dark .recipe-cover-drop {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent),
    rgba(24, 24, 29, 0.72);
}

.recipe-cover-drop input {
  display: none;
}

.recipe-cover-drop img {
  display: block;
  width: min(100%, 420px);
  max-height: 240px;
  margin-bottom: 12px;
  object-fit: cover;
  box-shadow: 0 18px 38px rgba(16, 16, 20, 0.16);
}

.recipe-cover-drop img[hidden] {
  display: none;
}

.recipe-cover-drop span,
.recipe-cover-drop strong {
  display: block;
}

.recipe-cover-drop span {
  font-weight: 950;
}

.recipe-cover-drop strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 14px;
}

.seasoning-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  padding: 14px;
}

.seasoning-panel legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
  padding: 0 8px;
}

.seasoning-panel label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  padding: 0 10px;
}

.seasoning-panel input {
  width: auto;
  accent-color: var(--accent);
}

.recipe-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.recipe-form[hidden],
.recipes-page[hidden],
.wishlist-form[hidden],
.wishlist-page[hidden] {
  display: none;
}

.recipes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.recipe-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(16, 16, 20, 0.14);
  background: var(--surface);
  box-shadow: 0 20px 58px rgba(16, 16, 20, 0.1);
  padding: 18px;
}

body.theme-dark .recipe-card {
  border-color: rgba(255, 255, 255, 0.12);
}

.recipe-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recipe-card-head div {
  display: flex;
  gap: 8px;
}

.recipe-card-head span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
}

.recipe-card-head button {
  min-height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  padding: 0 12px;
}

.recipe-card-head button[data-edit-recipe] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.recipe-cover {
  display: grid;
  min-height: 210px;
  place-items: center;
  overflow: hidden;
  background: #ededeb;
}

body.theme-dark .recipe-cover {
  background: #0e0e12;
}

.recipe-cover img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
}

.recipe-cover.placeholder span {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-size: 34px;
  font-weight: 950;
}

.recipe-card h3 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recipe-meta span {
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
}

.seasoning-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seasoning-tags span {
  border: 1px solid rgba(255, 56, 92, 0.28);
  background: rgba(255, 56, 92, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
}

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

.recipe-columns section {
  display: grid;
  align-content: start;
  gap: 8px;
}

.recipe-columns strong {
  font-size: 13px;
  font-weight: 950;
}

.recipe-columns ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.recipe-empty,
.recipe-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.wishlist-page {
  display: grid;
  gap: 18px;
}

.wishlist-form {
  display: grid;
  gap: 15px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 30px);
}

.wishlist-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wish-card {
  position: relative;
  display: grid;
  min-height: 230px;
  align-content: space-between;
  gap: 16px;
  overflow: hidden;
  border: 1px solid rgba(16, 16, 20, 0.14);
  background:
    linear-gradient(90deg, var(--accent) 0 5px, transparent 5px),
    linear-gradient(135deg, rgba(255, 56, 92, 0.08), transparent 36%),
    var(--surface);
  box-shadow: 0 20px 58px rgba(16, 16, 20, 0.1);
  padding: 18px 18px 20px 22px;
}

body.theme-dark .wish-card {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(90deg, var(--accent) 0 5px, transparent 5px),
    linear-gradient(135deg, rgba(255, 79, 112, 0.13), transparent 38%),
    #18181d;
}

.wish-card.done {
  opacity: 0.72;
}

.wish-card.done h3 {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.wish-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.wish-card-head > span {
  color: rgba(16, 16, 20, 0.22);
  font-size: 38px;
  font-weight: 950;
  line-height: 0.9;
}

body.theme-dark .wish-card-head > span {
  color: rgba(255, 255, 255, 0.22);
}

.wish-card-head div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.wish-card-head button {
  min-height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  padding: 0 12px;
}

.wish-card-head button[data-toggle-wish] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.wish-card-head button[data-delete-wish] {
  border-color: rgba(255, 56, 92, 0.32);
  background: rgba(255, 56, 92, 0.08);
  color: var(--accent);
}

body.theme-dark .wish-card-head button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.theme-dark .wish-card-head button[data-toggle-wish] {
  border-color: #f4f1e8;
  background: #f4f1e8;
  color: #101014;
}

body.theme-dark .wish-card-head button[data-delete-wish] {
  border-color: rgba(255, 79, 112, 0.42);
  background: rgba(255, 79, 112, 0.16);
  color: #ff8aa0;
}

.wish-card .kicker {
  color: var(--accent);
}

.wish-card h3 {
  font-size: clamp(26px, 5vw, 48px);
  line-height: 0.96;
  word-break: break-word;
}

.wish-card p:not(.kicker) {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.wish-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wish-meta span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
}

body.theme-dark .wish-meta span {
  background: rgba(255, 255, 255, 0.06);
}

dialog {
  width: min(920px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 60px rgba(33, 26, 44, 0.24);
}

dialog::backdrop {
  background: rgba(16, 16, 20, 0.62);
}

#dialogImage {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #101014;
}

.dialog-media {
  position: relative;
  display: grid;
  place-items: center;
  background: #101014;
}

.carousel-button {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(16, 16, 20, 0.64);
  color: #fff;
  font-size: 42px;
  line-height: 1;
  transform: translateY(-50%);
}

.carousel-button.prev {
  left: 12px;
}

.carousel-button.next {
  right: 12px;
}

.carousel-button[hidden],
.media-counter[hidden],
.dialog-thumbs[hidden] {
  display: none;
}

.media-counter {
  position: absolute;
  right: 14px;
  bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(16, 16, 20, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  padding: 7px 10px;
}

.dialog-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-thumbs button {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 2px solid transparent;
  background: transparent;
  padding: 0;
}

.dialog-thumbs button.active {
  border-color: var(--accent);
}

.dialog-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

dialog article {
  padding: 20px;
}

.edit-dialog {
  width: min(760px, calc(100% - 24px));
}

.edit-dialog form {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 4vw, 30px);
}

.edit-dialog h2 {
  margin-top: 4px;
}

.edit-dialog .primary {
  justify-self: stretch;
}

.edit-media-manager {
  display: grid;
  gap: 12px;
}

.edit-media-heading,
.edit-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-media-heading h3 {
  margin: 3px 0 0;
}

.edit-media-heading > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.edit-image-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.edit-image-item {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0;
}

.edit-image-item > span {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  background: rgba(16, 16, 20, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 6px;
}

.edit-image-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.edit-image-item > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 7px;
}

.edit-image-item button,
.danger-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.edit-image-item button[data-delete-edit-image],
.danger-button {
  border-color: rgba(240, 100, 80, 0.5);
  color: var(--coral);
}

.edit-form-actions .primary {
  flex: 1;
}

.vip-dialog {
  width: min(980px, calc(100% - 24px));
}

.vip-center {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 30px);
}

.vip-hero {
  display: grid;
  gap: 12px;
  min-height: 220px;
  align-content: end;
  border: 1px solid rgba(246, 210, 122, 0.38);
  background:
    linear-gradient(90deg, #f6d27a 0 5px, transparent 5px),
    radial-gradient(circle at 82% 16%, rgba(246, 210, 122, 0.32), transparent 34%),
    linear-gradient(135deg, #111116, #28241d);
  color: #fff;
  padding: clamp(18px, 4vw, 34px);
}

.vip-hero .kicker {
  color: #f6d27a;
}

.vip-hero h2 {
  font-size: clamp(34px, 7vw, 76px);
}

.vip-hero p {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.7;
}

.vip-current {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.vip-current span,
.vip-current strong {
  border: 1px solid rgba(246, 210, 122, 0.5);
  background: rgba(246, 210, 122, 0.12);
  color: #f6d27a;
  font-weight: 950;
  padding: 8px 12px;
}

.vip-wallet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 160px));
  gap: 10px;
  margin-top: 4px;
}

.vip-wallet article {
  border: 1px solid rgba(246, 210, 122, 0.32);
  background: rgba(246, 210, 122, 0.09);
  padding: 12px;
}

.vip-wallet span {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 900;
}

.vip-wallet strong {
  display: block;
  margin-top: 4px;
  color: #f6d27a;
  font-size: 26px;
  line-height: 1;
}

.vip-next {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.vip-next strong,
.vip-next span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  padding: 8px 10px;
}

.vip-levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.vip-level {
  display: grid;
  gap: 8px;
  min-height: 180px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
}

.vip-level.active {
  border-color: #b9913a;
  box-shadow: inset 0 0 0 2px rgba(246, 210, 122, 0.36);
}

.vip-level.unlocked {
  background:
    linear-gradient(180deg, rgba(246, 210, 122, 0.12), transparent 46%),
    var(--surface);
}

.vip-level span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
}

.vip-level strong {
  font-size: 20px;
  line-height: 1;
}

.vip-level p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.vip-level small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.vip-level button {
  align-self: end;
  min-height: 38px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-weight: 950;
}

.vip-level.active button,
.vip-level button:disabled {
  background: transparent;
  color: var(--muted);
}

.vip-recharge {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.vip-recharge button {
  display: grid;
  gap: 6px;
  min-height: 72px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.vip-recharge button:hover {
  border-color: #b9913a;
  box-shadow: inset 0 0 0 2px rgba(246, 210, 122, 0.22);
}

.vip-recharge span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.vip-recharge strong {
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}

.vip-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vip-perks span {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  padding: 9px 12px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

body.theme-dark .dialog-close {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(16, 16, 20, 0.92);
  color: #fff;
}

@media (max-width: 860px) {
  main {
    padding-inline: 16px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .main-nav button {
    flex: 1 1 0;
  }

  .auth-row,
  .form-grid,
  .link-row {
    grid-template-columns: 1fr;
  }

  .recipes-list,
  .wishlist-list,
  .recipe-columns,
  .recipe-form-actions {
    grid-template-columns: 1fr;
  }

  .vip-levels {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .vip-level {
    flex: 0 0 210px;
  }

  .vip-recharge {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .vip-recharge button {
    flex: 0 0 150px;
  }

  .section-title,
  .feed-head {
    align-items: start;
    flex-direction: column;
  }

  .gallery {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 22px;
  }

  .gallery::before {
    left: 17px;
  }

  .gallery::after {
    left: 17px;
    width: 36px;
  }

  .photo-card,
  .photo-card:nth-child(odd),
  .photo-card:nth-child(even) {
    grid-column: 2;
    justify-self: stretch;
    width: 100%;
    margin: 0;
  }

  .photo-card::before {
    left: -24px !important;
    right: auto !important;
    width: 24px;
  }

  .photo-card .strand-index {
    left: -46px !important;
    right: auto !important;
    width: 32px;
    height: 32px;
  }

  .carousel-button {
    width: 38px;
    height: 54px;
    font-size: 34px;
  }
}

@media (max-width: 470px) {
  .topbar {
    padding: 11px 14px;
  }

  .brand small {
    display: none;
  }

  .hero {
    min-height: 230px;
  }

  .filters {
    top: 65px;
  }

  .photo-card h3 {
    font-size: 18px;
  }
}
