:root {
  --bg: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --subtle: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.75);
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: rgba(0, 0, 0, 0.12);
  --toolbar-bg: rgba(255, 255, 255, 0.6);
  --glass-shadow:
    0 12px 40px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
}

[data-theme="dark"] {
  --bg: #0b0b0f;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --subtle: #8e8e93;
  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --glass-bg: rgba(28, 28, 34, 0.72);
  --glass-bg-strong: rgba(34, 34, 42, 0.88);
  --glass-border: rgba(255, 255, 255, 0.14);
  --input-bg: rgba(44, 44, 54, 0.92);
  --input-border: rgba(255, 255, 255, 0.16);
  --toolbar-bg: rgba(28, 28, 34, 0.7);
  --glass-shadow:
    0 14px 44px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(0, 113, 227, 0.09) 0%, transparent 70%),
    radial-gradient(50% 45% at 85% 15%, rgba(94, 92, 230, 0.08) 0%, transparent 70%),
    radial-gradient(55% 50% at 50% 85%, rgba(52, 199, 89, 0.05) 0%, transparent 70%);
}

.liquid-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(185%);
  -webkit-backdrop-filter: blur(28px) saturate(185%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Navbar (Fully Responsive) */
.navbar-wrap {
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 14px;
  pointer-events: none;
}

.navbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 113, 227, 0.5);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); }

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

.mobile-menu-btn {
  display: none;
  background: var(--glass-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-drawer {
  display: none;
  max-width: 1120px;
  margin: 8px auto 0;
  padding: 14px;
  border-radius: 20px;
  pointer-events: auto;
  flex-direction: column;
  gap: 10px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.mobile-drawer.open { display: flex; }
.mobile-drawer a {
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.28);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-glass {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: var(--input-border);
  color: var(--text);
}
.btn-glass:hover { background: var(--glass-bg); }

/* Framed Hero Section (No Fullscreen BG Video) */
.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: 96px 18px 36px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--text);
}

.hero p {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 24px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.video-showcase {
  max-width: 860px;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  padding: 10px;
  position: relative;
}

.video-frame {
  position: relative;
  border-radius: calc(var(--radius-xl) - 8px);
  overflow: hidden;
  background: #0b0b0f;
}

.video-frame video {
  width: 100%;
  display: block;
}

.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 11, 15, 0.35);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.video-play-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.play-pill {
  background: rgba(255, 255, 255, 0.92);
  color: #1d1d1f;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  border: none;
  cursor: pointer;
}

/* Dedicated Workspace Shell (Responsive) */
.workspace-page {
  padding-top: 76px;
}

.studio-section {
  max-width: 1220px;
  margin: 16px auto 64px;
  padding: 0 12px;
}

.studio-shell {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.studio-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--input-border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--toolbar-bg);
}

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

.toolbar-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  align-items: end;
}

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

.badge-count {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0, 113, 227, 0.14);
  color: var(--accent);
}

.control-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
  min-width: 0;
}

.control-item select {
  width: 100%;
  min-width: 0;
}

.checkbox-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

select, input[type="text"], textarea {
  padding: 7px 10px;
  font-size: 0.82rem;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-family: inherit;
  min-height: 36px;
}
select:focus, input[type="text"]:focus, textarea:focus { border-color: var(--accent); }

.studio-body {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.upload-zone {
  width: 100%;
  max-width: 720px;
  border: 1.5px dashed var(--input-border);
  border-radius: 22px;
  padding: 40px 20px;
  text-align: center;
  background: var(--glass-bg);
  cursor: pointer;
  transition: all 0.2s ease;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(0, 113, 227, 0.06);
}
.upload-zone svg { width: 38px; height: 38px; stroke: var(--accent); margin-bottom: 10px; }
.upload-zone h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.upload-zone p { font-size: 0.84rem; color: var(--muted); }

.status-bar {
  display: none;
  width: 100%;
  max-width: 720px;
  background: rgba(0, 113, 227, 0.1);
  border: 1px solid rgba(0, 113, 227, 0.25);
  color: var(--accent);
  padding: 10px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.84rem;
  font-weight: 500;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status-bar.visible { display: flex; }
.progress-track { flex: 1; height: 6px; background: rgba(0, 113, 227, 0.18); border-radius: 999px; overflow: hidden; max-width: 220px; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.12s ease; }

.hint-banner { font-size: 0.8rem; color: var(--muted); margin-bottom: 16px; text-align: center; }

.sheets-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.a4-page {
  width: min(100%, 210mm);
  aspect-ratio: 210 / 297;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  display: grid;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 210mm 297mm;
  contain: layout style paint;
}

.grid-3x3 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.grid-2x3 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.grid-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }

.card-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed #d1d5db;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}
.card-cell.dragging { opacity: 0.45; transform: scale(0.96); }
.card-cell.drag-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.no-cut-lines .card-cell { border: none; }

.photo-slot { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.photo-container { width: 100%; height: 100%; background: #f5f5f7; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
.photo-container:active { cursor: grabbing; }

.ratio-3x4 .photo-container { aspect-ratio: 3 / 4; height: 100%; width: auto; max-width: 100%; max-height: 100%; }
.ratio-4x3 .photo-container { aspect-ratio: 4 / 3; width: 100%; height: auto; max-width: 100%; max-height: 100%; }
.ratio-1x1 .photo-container { aspect-ratio: 1 / 1; width: 100%; height: auto; max-width: 100%; max-height: 100%; }
.ratio-auto .photo-container { width: 100%; height: 100%; }

.photo-container img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }

.polaroid-caption {
  position: absolute;
  bottom: 1.5%;
  left: 5%;
  right: 5%;
  height: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 1.3vw, 12px);
  color: #3a3a3c;
  text-align: center;
  outline: none;
  overflow: hidden;
}
.polaroid-caption:empty::before { content: attr(data-placeholder); color: #c7c7cc; }

.card-actions {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  display: none;
  justify-content: space-between;
  pointer-events: none;
  z-index: 20;
}
.card-cell:hover .card-actions,
.card-cell.selected .card-actions { display: flex; }

/* Selected Card Outline on Tap/Click */
.card-cell.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.action-group { display: flex; gap: 3px; flex-wrap: wrap; pointer-events: auto; align-items: center; }
.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 29, 31, 0.8);
  color: #fff;
  border: none;
  border-radius: 5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}
.mini-btn:hover { background: #1d1d1f; }
.mini-btn.danger:hover { background: #ff3b30; }

/* Sections & Parallax */
.section, .parallax-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 18px;
}
.section-header { text-align: center; margin-bottom: 34px; }
.section-header h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -0.025em; margin-bottom: 8px; }
.section-header p { color: var(--muted); max-width: 580px; margin: 0 auto; font-size: 0.95rem; }

.parallax-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  padding: 16px 0 32px;
}
.parallax-card {
  background: #ffffff;
  padding: 10px 10px 30px 10px;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
  will-change: transform;
}
.parallax-photo { width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; }
.parallax-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.parallax-label { margin-top: 10px; text-align: center; font-size: 0.82rem; font-weight: 500; color: #3a3a3c; }

.bento-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.bento-card { border-radius: var(--radius-lg); padding: 24px; }
.bento-card h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: 8px; }
.bento-card p { font-size: 0.88rem; color: var(--muted); }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; max-width: 720px; margin: 0 auto; }
.price-card { border-radius: var(--radius-xl); padding: 26px; display: flex; flex-direction: column; justify-content: space-between; }
.price-card.featured { border: 1.5px solid rgba(0, 113, 227, 0.5); }
.price-tag { font-size: 2.1rem; font-weight: 700; margin: 10px 0; }
.price-list { list-style: none; margin: 14px 0 22px; display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; color: var(--muted); }

.faq-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item { border-radius: var(--radius-lg); padding: 16px 20px; }
.faq-item summary { font-weight: 600; font-size: 0.94rem; cursor: pointer; }
.faq-item p { margin-top: 8px; font-size: 0.88rem; color: var(--muted); }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(8px); z-index: 2000; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal { border-radius: var(--radius-xl); max-width: 440px; width: 100%; padding: 26px; background: var(--glass-bg-strong); backdrop-filter: blur(32px); border: 1px solid var(--glass-border); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); }
.modal h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }
.modal p { font-size: 0.86rem; color: var(--muted); margin-bottom: 14px; }
.modal-input { width: 100%; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.footer { max-width: 1080px; margin: 20px auto 40px; padding: 24px 18px; border-top: 1px solid var(--input-border); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; font-size: 0.84rem; color: var(--muted); }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }

/* Mobile & Tablet Responsive Breakpoints */
@media (max-width: 860px) {
  .nav-links, .nav-actions { display: none; }
  .mobile-menu-btn { display: inline-flex; }

  .studio-section { padding: 0 8px; }
  .studio-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .toolbar-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    justify-content: stretch;
  }
  .control-item {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
  }
  .control-item select {
    width: 100%;
    min-width: 0;
    font-size: 13px;
    padding: 8px;
  }
  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }
  .toolbar-actions .btn {
    width: 100%;
    padding: 9px 8px;
    font-size: 13px;
  }
  .toolbar-actions .btn-primary {
    grid-column: span 2;
    padding: 12px 16px;
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .hero-content { padding: 28px 18px; }
  .parallax-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  .ambient-canvas, .navbar-wrap, .hero-fullscreen, .studio-toolbar, .upload-zone, .status-bar, .hint-banner, .section, .parallax-section, .footer, .card-actions, .modal-backdrop {
    display: none !important;
  }
  .workspace-page, .studio-section, .studio-shell, .studio-body {
    margin: 0 !important; padding: 0 !important; border: none !important; box-shadow: none !important; background: none !important;
  }
  .a4-page {
    width: 210mm !important; height: 297mm !important; box-shadow: none !important; border: none !important;
    page-break-after: always !important; break-after: page !important; content-visibility: visible !important; contain: none !important;
  }
  .a4-page:last-child { page-break-after: auto !important; break-after: auto !important; }
}
