/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #faf9f7;
  color: #333;
}

.category-title,
.category-page-header h1,
.card-page-header h1,
.panel-label {
  font-family: 'DM Serif Display', Georgia, serif;
}

/* ===== Header ===== */
header { background: #2d1b14; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.logo { text-decoration: none; display: flex; align-items: center; }
.logo-img { height: 40px; width: auto; display: block; }
.header-nav { display: flex; align-items: center; gap: 10px; }
.nav-btn { color: #ccc; text-decoration: none; font-size: 0.85rem; padding: 6px 14px; border-radius: 5px; transition: background 0.2s; }
.nav-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-btn-primary { background: #d4455a; color: #fff; font-weight: 600; }
.nav-btn-primary:hover { background: #b33350; }
.nav-email { font-size: 0.8rem; color: #aaa; }
.nav-premium { font-size: 0.75rem; font-weight: 700; color: #f5c842; background: rgba(245,200,66,0.15); border: 1px solid rgba(245,200,66,0.35); border-radius: 12px; padding: 2px 10px; letter-spacing: 0.03em; }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* ===== Footer ===== */
.site-footer {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 16px 24px; margin-top: 48px;
  border-top: 1px solid #e8e8e8;
  font-size: 0.78rem; color: #aaa;
}
.footer-build { font-family: monospace; }

/* ===== Home Page ===== */

/* Hero */
.hero {
  background: linear-gradient(120deg, #fff5f0 0%, #fff8f2 40%, #fef3fb 100%);
  border-bottom: 1px solid #f0e8e0;
  padding: 18px 24px 16px;
  margin: -24px -24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, #f9c0c8 1px, transparent 1px),
    radial-gradient(circle, #ffd6a5 1px, transparent 1px),
    radial-gradient(circle, #c8e6c9 1px, transparent 1px);
  background-size: 60px 60px, 80px 80px, 100px 100px;
  background-position: 0 0, 30px 20px, 55px 40px;
  opacity: 0.35;
  pointer-events: none;
}
.hero-left { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
.hero h1 { font-family: 'Playfair Display', Georgia, serif; font-size: 1.25rem; font-weight: 600; margin: 0; color: #3a2a20; letter-spacing: -0.01em; line-height: 1.2; }
.hero p { display: none; }
.hero-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hero-step {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 16px; border-radius: 999px;
  font-family: 'Nunito', sans-serif; font-size: 0.82rem; font-weight: 700;
  text-decoration: none; white-space: nowrap; cursor: default;
  border: none; letter-spacing: 0.01em;
  transition: transform 0.15s, box-shadow 0.15s;
}
a.hero-step {
  background: linear-gradient(135deg, #ff7e5f, #e84393 160%);
  color: #fff; box-shadow: 0 3px 10px rgba(232,67,147,0.25); cursor: pointer;
}
a.hero-step:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(232,67,147,0.35); }
.hero-step.step-customize {
  background: linear-gradient(135deg, #f9a825, #ff7043 160%);
  color: #fff; box-shadow: 0 3px 10px rgba(249,168,37,0.2); opacity: 0.88;
}
.hero-step.step-print {
  background: linear-gradient(135deg, #26c6a2, #1565c0 180%);
  color: #fff; box-shadow: 0 3px 10px rgba(38,198,162,0.2); opacity: 0.88;
}
.hero-arrow { color: #c8b8a8; font-size: 1.1rem; font-weight: 800; flex-shrink: 0; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 1.5px solid #f0d9c8; border-radius: 999px;
  padding: 5px 14px 5px 10px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(180,120,80,0.08); position: relative; z-index: 1;
}
.hero-badge-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7e5f, #ffd54f);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; flex-shrink: 0;
}
.hero-badge-text { display: flex; flex-direction: column; line-height: 1.2; }
.hero-badge-num { font-family: 'Playfair Display', serif; font-size: 0.95rem; font-weight: 600; color: #3a2a20; }
.hero-badge-label { font-size: 0.68rem; font-weight: 700; color: #a08878; text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 520px) {
  .hero { padding: 14px 16px 12px; gap: 12px; }
  .hero h1 { font-size: 1.05rem; }
  .hero-step { padding: 5px 13px; font-size: 0.78rem; }
  .hero-badge { width: 100%; justify-content: center; }
}

/* How it works */
.how-strip { display: flex; gap: 0; margin-bottom: 48px; border: 1px solid #e8e8e8; border-radius: 10px; overflow: hidden; background: #fff; }
.how-step { flex: 1; padding: 20px 18px; text-align: center; border-right: 1px solid #eee; }
.how-step:last-child { border-right: none; }
.how-icon { font-size: 1.8rem; margin-bottom: 6px; }
.how-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.how-desc { font-size: 0.8rem; color: #777; }

/* Category rows */
.category-row { margin-bottom: 40px; }
.category-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.category-title { font-size: 1.15rem; font-weight: 700; color: #222; }
.category-count { font-size: 0.8rem; color: #999; }
.category-see-all-btn { display: block; margin-top: 12px; text-align: center; font-size: 0.85rem; font-weight: 600; color: #2a9d8f; text-decoration: none; padding: 8px 0; }
.category-see-all-btn:hover { text-decoration: underline; }

/* Horizontal scroll strip */
.card-strip {
  display: flex; gap: 20px;
  overflow-x: auto; padding-bottom: 10px; padding-left: 2px; padding-right: 2px;
  scrollbar-width: thin; scrollbar-color: #ccc transparent;
  scroll-snap-type: x mandatory;
}
.card-strip::-webkit-scrollbar { height: 4px; }
.card-strip::-webkit-scrollbar-track { background: transparent; }
.card-strip::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Card tile */
.card-tile {
  flex: 0 0 160px; text-decoration: none; color: inherit;
  scroll-snap-align: start; border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s; position: relative;
}
.card-tile:hover { transform: translateY(-4px) scale(1.03); box-shadow: 0 8px 24px rgba(0,0,0,0.16); z-index: 2; }
.card-tile-img { width: 160px; height: 213px; object-fit: cover; display: block; }
/* Frame-only thumbnail for moonshot cards on home page */
.card-tile-frame-bg { width: 160px; height: 213px; background: #d8e2ec; position: relative; overflow: hidden; flex-shrink: 0; }
.card-tile-frame-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card-tile-placeholder { width: 160px; height: 213px; background: linear-gradient(160deg,#7b5ea7 0%,#d4455a 100%); color: #fff; font-size: 0.75rem; font-weight: 600; text-align: center; align-items: center; justify-content: center; padding: 16px; line-height: 1.4; }
.card-tile-name { padding: 8px 10px 10px; font-size: 0.78rem; font-weight: 600; color: #333; line-height: 1.3; text-align: center; }
.card-tile-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 55%);
  opacity: 0; transition: opacity 0.2s;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px;
}
.card-tile:hover .card-tile-overlay { opacity: 1; }
.card-tile-overlay span { color: #fff; font-size: 0.8rem; font-weight: 700; background: #d4455a; padding: 5px 14px; border-radius: 20px; }

.home-empty { text-align: center; padding: 60px 20px; color: #999; }

/* ===== Saved Cards Page ===== */
.saved-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.btn-browse {
  background: #2a9d8f; color: #fff; text-decoration: none;
  padding: 9px 20px; border-radius: 6px; font-size: 0.9rem; font-weight: 600;
}
.btn-browse:hover { background: #21867a; }

.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.saved-tile {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); transition: box-shadow 0.2s;
}
.saved-tile:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.14); }
.saved-tile-img-wrap { display: block; position: relative; }
.saved-tile-img-wrap img { width: 100%; height: 220px; object-fit: cover; display: block; }

/* Moonshot saved-card preview (user photo + frame overlay) */
.saved-tile-ms-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: #d8e2ec;
}
.saved-tile-ms-photo {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}
.saved-tile-ms-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.saved-tile-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
  opacity: 0; transition: opacity 0.2s;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px;
}
.saved-tile-img-wrap:hover .saved-tile-overlay { opacity: 1; }
.saved-tile-overlay span { color: #fff; font-size: 0.85rem; font-weight: 700; background: #d4455a; padding: 5px 16px; border-radius: 20px; }
.saved-tile-body { padding: 12px 14px; }
.saved-tile-name { font-weight: 600; font-size: 0.85rem; color: #222; margin-bottom: 4px; }
.saved-tile-date { font-size: 0.75rem; color: #999; margin-bottom: 10px; }
.saved-tile-actions { display: flex; gap: 8px; }
.btn-edit {
  flex: 1; text-align: center; background: #2a9d8f; color: #fff;
  text-decoration: none; padding: 7px; border-radius: 5px;
  font-size: 0.82rem; font-weight: 600;
}
.btn-edit:hover { background: #21867a; }
.btn-delete {
  flex: 1; background: #fef0f0; color: #d4455a; border: 1px solid #fcc;
  padding: 7px; border-radius: 5px; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.btn-delete:hover { background: #d4455a; color: #fff; border-color: #d4455a; }

.saved-empty { text-align: center; padding: 80px 20px; color: #777; }
.saved-empty h2 { font-size: 1.3rem; margin-bottom: 10px; color: #444; }
.saved-empty p { font-size: 0.9rem; }

/* ===== Card Page ===== */
.card-page-header {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  margin-bottom: 20px;
}
.header-actions { display: flex; gap: 8px; flex-wrap: nowrap; align-items: center; }

.btn-save {
  background: #fff; color: #d4455a; border: 2px solid #d4455a;
  padding: 9px 16px; font-size: 0.95rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.btn-save:hover { background: #d4455a; color: #fff; }

.btn-pdf {
  background: #fff; color: #555; border: 1.5px solid #d1d5db;
  padding: 9px 16px; font-size: 0.95rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.btn-pdf:hover { background: #f3f4f6; border-color: #9ca3af; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #2c3e50; color: #fff; padding: 12px 28px;
  border-radius: 8px; font-size: 0.95rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 9999;
}
.toast.hidden { display: none; }

.btn-send {
  background: #fff; color: #555; border: 1.5px solid #d1d5db;
  padding: 9px 16px; font-size: 0.95rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.btn-send:hover { background: #f3f4f6; border-color: #9ca3af; }

.btn-share {
  background: #fff; color: #555; border: 1.5px solid #d1d5db;
  padding: 9px 16px; font-size: 0.95rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.btn-share:hover { background: #f3f4f6; border-color: #9ca3af; }

.btn-print {
  background: #d4455a; color: #fff; border: none;
  padding: 9px 16px; font-size: 0.95rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: background 0.2s;
}
.btn-print:hover { background: #b33350; }

/* Social share row (card page) */
.card-social-share {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}
.social-share-label { font-size: 0.8rem; color: #94a3b8; font-weight: 500; margin-right: 2px; }
.btn-social {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 0.75rem;
  font-weight: 700; text-decoration: none; letter-spacing: 0.01em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-social:hover {
  filter: brightness(1.08); transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2); text-decoration: none;
}
.btn-social:active { transform: translateY(0); filter: brightness(0.96); }
.btn-pinterest { background: #e60023; color: #fff; }
.btn-facebook  { background: #1877f2; color: #fff; }

.send-label { display: block; font-size: 0.875rem; font-weight: 600; color: #374151; }

/* Workspace: panels + sidebar */
.card-workspace {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
}

.panel { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }

.panel-label {
  font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: #666; margin-bottom: 8px;
}

/* Wrapper clips the scaled panel to correct display size */
.panel-inner-wrap {
  width: 360px; height: 460px;
  overflow: hidden; border: 2px solid #bbb; border-radius: 6px;
}

.panel-inner {
  width: 720px; height: 920px;
  background: #fffef8;
  transform: scale(0.5); transform-origin: top left;
}

.panel-inner img { display: block; width: 720px; height: 920px; object-fit: cover; }

/* Tools sidebar */
.tools-sidebar {
  flex: 0 0 200px;
  display: flex; flex-direction: column; gap: 0;
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  overflow: hidden; align-self: stretch;
}

.sidebar-section {
  padding: 12px; border-bottom: 1px solid #eee;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-section:last-child { border-bottom: none; }
.sidebar-bottom { margin-top: auto; }

.sidebar-section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #999; margin-bottom: 2px;
}

.btn-tool {
  background: #2a9d8f; color: #fff; border: none;
  padding: 8px 14px; border-radius: 5px; cursor: pointer;
  font-size: 0.88rem; transition: background 0.2s;
}
.btn-tool:hover { background: #21867a; }
.btn-tool.btn-block { width: 100%; text-align: left; }
.btn-tool.btn-danger { background: #d4455a; }
.btn-tool.btn-danger:hover { background: #b33350; }
.btn-tool.btn-reset { background: #e8a020; }
.btn-tool.btn-reset:hover { background: #c8841a; }

/* Sidebar text controls */
.sidebar-label {
  font-size: 0.8rem; color: #555;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-label select {
  font-size: 0.82rem; padding: 4px 6px;
  border: 1px solid #ccc; border-radius: 4px; width: 100%;
}
.size-row { display: flex; align-items: center; gap: 6px; }
.size-row input[type="range"] { flex: 1; }
#fcSizeVal { font-size: 0.75rem; color: #777; min-width: 20px; }

.bold-italic-row { display: flex; gap: 12px; }
.toggle-label {
  font-size: 0.82rem; color: #555;
  display: flex; align-items: center; gap: 4px; cursor: pointer;
}

/* Color swatches */
.color-row { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: #555; }
.color-label { white-space: nowrap; }
.color-swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatch {
  display: inline-block; width: 22px; height: 22px;
  border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; flex-shrink: 0; transition: transform 0.1s, border-color 0.1s;
}
.swatch:hover { transform: scale(1.2); border-color: #333; }
.swatch.active { border-color: #333; transform: scale(1.15); }
.swatch[data-color="#ffffff"] { border-color: #ccc; }
.swatch-custom {
  background: conic-gradient(red, yellow, green, cyan, blue, magenta, red);
  border: 2px solid #aaa;
}
.swatch-preview {
  width: 28px; height: 28px; border-radius: 4px;
  border: 2px solid #aaa; flex-shrink: 0;
}

/* ===== Photo Panel ===== */
.photo-panel {
  position: fixed; z-index: 1000;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); padding: 6px;
  display: flex; flex-direction: column; gap: 4px; min-width: 150px;
}
.photo-panel.hidden { display: none; }
.photo-panel button {
  background: none; border: none; padding: 8px 12px; text-align: left;
  cursor: pointer; border-radius: 6px; font-size: 0.9rem; color: #334155;
  white-space: nowrap;
}
.photo-panel button:hover { background: #f1f5f9; }

/* ===== Sticker Panel ===== */
.sticker-panel {
  position: fixed; right: 0; top: 60px;
  width: 270px; height: calc(100vh - 60px);
  background: #fff; border-left: 2px solid #ddd;
  display: flex; flex-direction: column;
  z-index: 100; box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}
.sticker-panel.hidden { display: none; }

.sticker-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #eee; font-weight: 600;
}
.sticker-panel-header button { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #666; }

.sticker-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; padding: 12px; overflow-y: auto; flex: 1;
  justify-items: center;
}

.sticker-thumb {
  display: block;
  width: 72px;
  height: 72px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer; border-radius: 4px;
  border: 2px solid transparent; background-color: #f5f5f5;
  transition: border-color 0.15s;
}
.sticker-thumb:hover { border-color: #2a9d8f; background-color: #e8f4fd; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: #fff; border-radius: 10px; width: 480px; max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #eee;
}
.modal-header h2 { font-size: 1.2rem; }
.modal-header button { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: #666; }

.modal-body { padding: 20px; }

.print-warning {
  background: #fff3cd; border: 1px solid #ffc107;
  border-radius: 6px; padding: 10px 14px;
  font-size: 0.85rem; color: #856404; margin-bottom: 18px;
}

.print-options { display: flex; flex-direction: column; gap: 12px; }
.print-option { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.print-option input[type="radio"] { margin-top: 4px; flex-shrink: 0; }

.option-card {
  border: 2px solid #ddd; border-radius: 6px; padding: 12px 14px; flex: 1;
  transition: border-color 0.15s;
}
.print-option input:checked + .option-card { border-color: #2a9d8f; background: #f0f8ff; }
.option-card strong { display: block; margin-bottom: 4px; }
.option-card small { color: #666; font-size: 0.82rem; }

.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 20px; border-top: 1px solid #eee;
}

.btn-print-go {
  background: #d4455a; color: #fff; border: none;
  padding: 10px 24px; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.btn-print-go:hover { background: #b33350; }
.btn-cancel {
  background: #eee; color: #333; border: none;
  padding: 10px 20px; border-radius: 6px; font-size: 1rem; cursor: pointer;
}
.btn-cancel:hover { background: #ddd; }

/* ===== Print Area ===== */
/* Printing is handled in a popup window (print.js) — no @media print needed here */
#print-area { display: none; }

/* ===== Print Count ===== */
.card-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.print-count { font-size: 0.8rem; color: #888; font-weight: 500; white-space: nowrap; }
.card-hearts-row {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 4px; max-width: 740px;
}
#btnLike { background: none; border: none; padding: 0; cursor: default; }
#heartsDisplay { display: inline-flex; gap: 3px; }
.heart { font-size: 1.5rem; line-height: 1; cursor: pointer; transition: transform 0.1s; }
.heart:hover { transform: scale(1.2); }
.heart-off { color: #cbd5e1; }
.heart-on  { color: #d4455a; }
.heart-mine { color: #f43f5e; }
.hearts-count { font-size: 0.85rem; color: #94a3b8; font-weight: 500; }
.card-description { font-size: 0.9rem; color: #64748b; line-height: 1.6; margin: 10px 0 4px; max-width: 740px; }.card-tile-prints { font-size: 0.68rem; color: #aaa; padding: 0 6px 5px; }
.card-thumb-prints { font-size: 0.68rem; color: #aaa; padding: 0 8px 5px; display: block; }
.card-tile-premium { font-size: 0.65rem; font-weight: 700; color: #fff; background: #f59e0b; padding: 2px 7px; border-radius: 10px; display: inline-block; margin: 3px 6px 0; }
.card-thumb-premium { font-size: 0.65rem; font-weight: 700; color: #fff; background: #f59e0b; padding: 2px 7px; border-radius: 10px; display: inline-block; margin: 3px 8px 0; }
.card-thumb-cat { font-size: 0.65rem; font-weight: 600; color: #fff; background: #2a9d8f; padding: 2px 7px; border-radius: 10px; display: inline-block; margin: 3px 8px 0; }
.card-tile-photo { font-size: 0.65rem; font-weight: 700; color: #fff; background: #3b82f6; padding: 2px 7px; border-radius: 10px; display: inline-block; margin: 3px 6px 0; }
.card-thumb-photo { font-size: 0.65rem; font-weight: 700; color: #fff; background: #3b82f6; padding: 2px 7px; border-radius: 10px; display: inline-block; margin: 3px 8px 0; }
.premium-wall { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.premium-wall-inner { text-align: center; background: #fff; border: 2px solid #f59e0b; border-radius: 16px; padding: 48px 40px; max-width: 400px; }
.premium-wall-icon { font-size: 3rem; color: #f59e0b; margin-bottom: 16px; }
.premium-wall-inner h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 10px; }
.premium-wall-inner p { color: #555; margin-bottom: 20px; }
.btn-upgrade { display: inline-block; background: #f59e0b; color: #fff; font-weight: 700; padding: 12px 28px; border-radius: 8px; text-decoration: none; font-size: 1rem; }
.btn-upgrade:hover { background: #d97706; }
.premium-wall-note { font-size: 0.85rem; color: #888; margin-top: 14px; margin-bottom: 0; }
.premium-wall-note a { color: #d4455a; }

/* ===== Category Page ===== */
.category-page-header {
  display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
}
.category-page-header h1 { font-size: 1.6rem; font-weight: 800; color: #222; }
.back-link { font-size: 0.85rem; color: #2a9d8f; text-decoration: none; white-space: nowrap; }
.back-link:hover { text-decoration: underline; }

/* Subcategory chips */
.subcat-chips {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px;
}
.chip {
  padding: 6px 16px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
  border: 2px solid #ddd; background: #fff; color: #555; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: #2a9d8f; color: #2a9d8f; }
.chip.active { background: #2a9d8f; border-color: #2a9d8f; color: #fff; }

/* Sort bar */
.sort-bar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  margin-bottom: 20px; border-bottom: 1px solid #e8e8e8; padding-bottom: 0;
}
.sort-label {
  font-size: 0.8rem; color: #aaa; font-weight: 500;
  margin-right: 8px; padding-bottom: 10px;
}
.sort-chip {
  padding: 8px 14px; font-size: 0.85rem; font-weight: 500;
  border: none; background: none; color: #888; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.sort-chip:hover { color: #333; }
.sort-chip.active { color: #d4455a; border-bottom-color: #d4455a; font-weight: 600; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}
.card-thumb {
  text-decoration: none; color: inherit; border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column;
}
.card-thumb:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.16); }
.card-thumb img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
/* Frame-only thumbnail for moonshot cards on category page */
.card-thumb-frame-bg { width: 100%; aspect-ratio: 3/4; background: #d8e2ec; position: relative; overflow: hidden; }
.card-thumb-frame-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb span { font-size: 0.78rem; color: #444; padding: 6px 8px; line-height: 1.3; }
.card-thumb.hidden { display: none; }

.no-results { text-align: center; padding: 60px 20px; color: #999; font-size: 1rem; }

/* ===== Editor Toolbar ===== */
/* Scroll wrapper handles mobile overflow so the toolbar itself can overflow: visible (needed for popover) */
.editor-toolbar-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}
.editor-toolbar {
  display: flex; align-items: center; flex-wrap: nowrap;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 6px 10px; gap: 0;
  width: 100%;
}

.toolbar-group {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

.toolbar-sep {
  width: 1px; height: 28px; background: #e2e8f0;
  margin: 0 8px; flex-shrink: 0;
}

.tbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 12px; min-height: 40px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  background: #f8fafc; color: #374151;
  font-size: 0.85rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tbtn:hover  { background: #f1f5f9; border-color: #cbd5e1; }
.tbtn.active { background: #e0e7ff; border-color: #818cf8; color: #3730a3; }

.tbtn-icon  { padding: 8px 10px; min-width: 40px; }
.tbtn-danger { color: #dc2626; border-color: #fca5a5; }
.tbtn-danger:hover { background: #fee2e2; border-color: #f87171; }
.tbtn-reset { color: #b45309; border-color: #fcd34d; }
.tbtn-reset:hover { background: #fef3c7; border-color: #fbbf24; }
.tbtn-font  { max-width: 140px; }

.toolbar-size-group {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.toolbar-size-group span { font-size: 0.85rem; color: #374151; min-width: 28px; text-align: center; font-weight: 600; }

/* fontControls disabled state (no text selected) */
#fontControls.disabled { opacity: 0.38; pointer-events: none; }

/* Color popover */
.color-picker-wrap { position: relative; flex-shrink: 0; }
.color-trigger { gap: 6px; }
.color-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.18); flex-shrink: 0; display: inline-block;
}
.color-popover {
  position: fixed; /* top/left set by JS — fixed escapes any overflow container */
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px; z-index: 1000; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.color-popover.hidden { display: none; }
.color-popover .color-swatches {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
}
.color-popover .swatch { width: 32px; height: 32px; border-radius: 6px; }

/* Mobile */
@media (max-width: 640px) {
  /* Compact action buttons — half the vertical bulk */
  .btn-save, .btn-pdf, .btn-send, .btn-share, .btn-print {
    padding: 5px 10px; font-size: 0.8rem;
  }
  .header-actions { flex-wrap: wrap; }

  /* Social share not needed while editing — hide it */
  .card-social-share { display: none; }

  /* Sticky toolbar so it stays visible while scrolling the canvas */
  .editor-toolbar-wrap {
    position: sticky; top: 0; z-index: 100;
    background: #fff; overflow-x: visible;
  }

  /* Two-row toolbar: wrap groups, show stickers, smaller buttons */
  .editor-toolbar { flex-wrap: wrap; }
  .tbtn { min-height: 38px; padding: 8px 10px; }
  .color-trigger-label { display: none; }
  .toolbar-size-group,
  .tbtn-reset,
  .toolbar-sep { display: none; }
  .tbtn-font { max-width: 110px; font-size: 0.78rem; }
  /* First separator forces the row break; second stays hidden */
  .editor-toolbar > .toolbar-sep:first-of-type {
    display: block; flex-basis: 100%; height: 0;
  }
}
.no-results.hidden { display: none; }
