:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface-alt: #f0eee9;
  --border: #e5e2da;
  --ink: #12141a;
  --muted: #5d6473;
  --accent: #ffd426;
  --accent-hover: #f2c400;
  --free-bg: #e7f8ef;
  --free-ink: #0f6b3d;
  --pro-bg: #161820;
  --pro-ink: #ffd426;
  --shadow-sm: 0 2px 10px rgba(16, 18, 26, 0.05);
  --shadow-lg: 0 24px 64px rgba(16, 18, 26, 0.16);
  --radius: 18px;
}

[data-theme="dark"] {
  --bg: #0e1015;
  --surface: #161922;
  --surface-alt: #1f2330;
  --border: #2a2f3e;
  --ink: #f4f5f8;
  --muted: #9aa2b4;
  --free-bg: rgba(20, 184, 102, 0.16);
  --free-ink: #5ae89c;
  --pro-bg: #ffd426;
  --pro-ink: #12141a;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand-mark span {
  background: var(--accent);
  color: #12141a;
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 2px;
}

.brand-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-alt);
  padding: 4px 10px;
  border-radius: 999px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #12141a;
  border-color: #12141a;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-dark {
  background: var(--ink);
  color: var(--bg);
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-alt);
}

.btn-full {
  width: 100%;
  padding: 13px 18px;
  font-size: 0.95rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unlocked-pill {
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--free-bg);
  color: var(--free-ink);
  padding: 8px 14px;
  border-radius: 999px;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
  padding: 36px 0 28px;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.hero-sub {
  color: var(--muted);
  font-size: 1rem;
  max-width: 540px;
  margin-bottom: 22px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.stat strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
}

.stat span {
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-visual {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: auto;
}

/* Controls & Filters */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0 12px;
}

.search-wrap {
  flex: 1 1 320px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.15rem;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.94rem;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--ink);
}

.format-tabs {
  display: inline-flex;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 22px;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.pill.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.free-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 56px;
}

.gallery-grid.desktop-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}

.wp-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.wp-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 19.2;
  background: var(--surface-alt);
  overflow: hidden;
}

.gallery-grid.desktop-mode .wp-thumb-wrap {
  aspect-ratio: 16 / 9;
}

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

.card-clock-overlay {
  position: absolute;
  top: 8.5%;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  color: rgba(24, 26, 34, 0.84);
}

.card-clock-overlay .mini-date {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.72;
}

.card-clock-overlay .mini-time {
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.wp-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.wp-badge.free {
  background: var(--free-bg);
  color: var(--free-ink);
}

.wp-badge.pro {
  background: var(--pro-bg);
  color: var(--pro-ink);
}

.wp-card-body {
  padding: 12px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wp-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-cat {
  font-size: 0.75rem;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 14px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.footer-links a,
.link-btn {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.84rem;
}

.link-btn.danger {
  color: #c93838;
  margin-top: 12px;
  display: block;
  width: 100%;
  text-align: center;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.preview-modal-card {
  width: 100%;
  max-width: 880px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 28px;
  align-items: center;
}

.preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  border-radius: 18px;
  padding: 22px;
  min-height: 460px;
}

.phone-frame {
  position: relative;
  width: 248px;
  aspect-ratio: 1440 / 3120;
  border-radius: 38px;
  overflow: hidden;
  border: 8px solid #14161c;
  box-shadow: 0 0 0 2px #c8ccd4, 0 22px 46px rgba(0, 0, 0, 0.34);
  background: #000;
}

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

.phone-island {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 68px;
  height: 18px;
  border-radius: 999px;
  background: #0a0b0e;
  z-index: 3;
}

.phone-lock-ui {
  position: absolute;
  top: 10.5%;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  color: #1c1e26;
}

.phone-lock-ui.light-text {
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.lock-date {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.8;
}

.lock-time {
  font-size: 2.9rem;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}

.lock-widgets {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.lw {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(25, 28, 38, 0.11);
  border: 1px solid rgba(25, 28, 38, 0.16);
}

.phone-lock-ui.light-text .lw {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
}

.phone-home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 82px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

.desktop-frame {
  width: 100%;
}

.desktop-bezel {
  border: 8px solid #14161c;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.desktop-bezel img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.desktop-stand {
  width: 96px;
  height: 14px;
  background: #c8ccd4;
  margin: 0 auto;
  border-radius: 0 0 8px 8px;
}

.preview-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-cat {
  background: var(--surface-alt);
  color: var(--muted);
}

.badge.free {
  background: var(--free-bg);
  color: var(--free-ink);
}

.badge.pro {
  background: var(--pro-bg);
  color: var(--pro-ink);
}

.preview-details h2 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.preview-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.variant-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.v-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 6px;
  border-radius: 9px;
  cursor: pointer;
}

.v-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.tag-chip {
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--surface-alt);
  padding: 4px 10px;
  border-radius: 999px;
}

.modal-cta-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* License Modal */
.license-modal-card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
}

.license-modal-card h2 {
  font-size: 1.45rem;
  margin-bottom: 8px;
}

.license-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.license-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.license-form input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.license-status {
  min-height: 22px;
  font-size: 0.83rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.license-status.ok {
  color: var(--free-ink);
}

.license-status.err {
  color: #d13838;
}

.license-divider {
  text-align: center;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 0.8rem;
}

.demo-hint {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .preview-modal-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brand-count,
  #openLicenseBtn {
    display: none;
  }
  .gallery-grid,
  .gallery-grid.desktop-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .card-clock-overlay .mini-time {
    font-size: 1.55rem;
  }
}
