:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.08rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.badge-beta {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--primary);
}

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

.live-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.live-counter .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

/* Hero */
.hero {
  padding: 36px 0 22px;
  text-align: center;
}

.hero-inner {
  max-width: 780px;
}

.hero-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 3.6vw, 2.55rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
}

.hero-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

/* Studio Layout */
.studio-section {
  padding: 12px 0 48px;
}

.studio-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.control-group {
  margin-bottom: 14px;
}

.control-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.control-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.input,
.select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
}

.input:focus,
.select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--primary);
}

.range {
  width: 100%;
  accent-color: var(--primary);
}

.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-row input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.help-text {
  display: block;
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

/* Preset buttons */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.preset-btn {
  text-align: left;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.12s ease;
}

.preset-btn:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.preset-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.preset-btn .p-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.preset-btn .p-dims {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.preset-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.76rem;
  color: var(--muted);
}

/* Workspace column */
.workspace-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}

.dropzone h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.dropzone p {
  margin: 0 0 16px;
  font-size: 0.86rem;
  color: var(--muted);
}

.dropzone-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Results */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.results-bar h3 {
  margin: 0;
  font-size: 1rem;
}

.results-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

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

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.preview-box {
  position: relative;
  aspect-ratio: 1 / 1;
  background-image:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-filename {
  font-size: 0.82rem;
  font-weight: 700;
  word-break: break-all;
}

.card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--muted);
}

.pill-good {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 700;
}

.pill-warn {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.72rem;
  font-weight: 700;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
}

/* Sections */
.features-section,
.specs-section,
.pricing-section {
  padding: 46px 0;
}

.specs-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  text-align: center;
  max-width: 660px;
  margin: 0 auto 28px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.feature-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feature-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
}

.specs-table th,
.specs-table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.specs-table th {
  background: var(--surface-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.specs-table tr:last-child td {
  border-bottom: none;
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.pricing-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.pricing-featured {
  border: 2px solid var(--primary);
  box-shadow: var(--shadow);
}

.tier-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.tier-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.tier-price {
  font-size: 2rem;
  font-weight: 800;
  margin: 10px 0 14px;
}

.tier-price span {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}

.tier-list {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  flex: 1;
}

.tier-list li {
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.tier-list li::before {
  content: "✓ ";
  color: var(--success);
  font-weight: 700;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a:hover {
  color: var(--primary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  padding: 26px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.modal h3 {
  margin: 8px 0 6px;
}

.modal-sub {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--muted);
}

.form-feedback {
  margin: 10px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 20px;
}

.form-feedback.ok {
  color: var(--success);
}

.form-feedback.err {
  color: #dc2626;
}

@media (max-width: 960px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
  .nav-links,
  .live-counter {
    display: none;
  }
}
