/* Media AI — clean product UI (no gradient chrome) */
:root {
  --ma-bg: #f4f6f8;
  --ma-surface: #ffffff;
  --ma-surface-2: #f8fafc;
  --ma-border: #e2e8f0;
  --ma-border-strong: #cbd5e1;
  --ma-text: #0f172a;
  --ma-muted: #64748b;
  --ma-muted-2: #94a3b8;
  --ma-primary: #0f766e;
  --ma-primary-hover: #0d9488;
  --ma-primary-soft: #ccfbf1;
  --ma-ink: #1e293b;
  --ma-accent: #b45309;
  --ma-accent-soft: #fef3c7;
  --ma-ok: #047857;
  --ma-ok-soft: #d1fae5;
  --ma-danger: #b91c1c;
  --ma-danger-soft: #fee2e2;
  --ma-radius: 12px;
  --ma-radius-sm: 8px;
  --ma-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --ma-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ma-thumb-ratio: 16 / 10;
  --ma-demo-ratio: 16 / 9;
  --ma-result-min: 320px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--ma-bg);
  color: var(--ma-text);
  font-family: var(--ma-font);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ma-primary); text-decoration: none; }
a:hover { color: var(--ma-primary-hover); text-decoration: underline; }

.ma-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

/* ── Nav ─────────────────────────────────────────── */
.ma-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
  padding: 12px 14px;
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  box-shadow: var(--ma-shadow);
  flex-wrap: wrap;
}
.ma-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ma-text);
  text-decoration: none;
}
.ma-brand:hover { text-decoration: none; color: var(--ma-text); }
.ma-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--ma-ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  overflow: hidden;
}
.ma-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ma-brand small {
  display: block;
  font-weight: 500;
  color: var(--ma-muted);
  font-size: 12px;
  margin-top: 1px;
}
.ma-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ma-pill {
  background: var(--ma-surface-2);
  border: 1px solid var(--ma-border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ma-muted);
}
.ma-pill strong { color: var(--ma-text); font-weight: 700; }

/* ── Buttons ─────────────────────────────────────── */
.ma-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: var(--ma-radius-sm);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.2;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.ma-btn:hover { text-decoration: none; }
.ma-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ma-btn-primary {
  background: var(--ma-primary);
  color: #fff;
}
.ma-btn-primary:hover:not(:disabled) {
  background: var(--ma-primary-hover);
  color: #fff;
}
.ma-btn-ghost {
  background: var(--ma-surface);
  color: var(--ma-text);
  border: 1px solid var(--ma-border);
}
.ma-btn-ghost:hover:not(:disabled) {
  border-color: var(--ma-border-strong);
  background: var(--ma-surface-2);
  color: var(--ma-text);
}
.ma-btn-accent {
  background: var(--ma-ink);
  color: #fff;
}
.ma-btn-accent:hover:not(:disabled) {
  background: #334155;
  color: #fff;
}
.ma-btn-block { width: 100%; }

/* ── Hero ────────────────────────────────────────── */
.ma-hero {
  margin: 4px 0 28px;
  padding: 4px 2px;
}
.ma-hero .ma-kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--ma-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
.ma-hero h1 {
  font-size: clamp(1.65rem, 3.2vw, 2.15rem);
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--ma-text);
}
.ma-hero p {
  color: var(--ma-muted);
  font-size: 1rem;
  max-width: 540px;
  margin: 0 0 14px;
}
.ma-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.ma-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--ma-muted);
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: 999px;
  padding: 5px 10px;
}
.ma-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ma-muted);
  margin-bottom: 10px;
}
.ma-back:hover { color: var(--ma-primary); }

/* ── Tool cards grid ─────────────────────────────── */
.ma-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ma-card {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ma-shadow);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.ma-card:hover {
  border-color: var(--ma-border-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.ma-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ma-thumb-ratio);
  background: var(--ma-surface-2);
  border-bottom: 1px solid var(--ma-border);
  overflow: hidden;
}
.ma-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}
.ma-card-media .ma-ph-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ma-muted-2);
  letter-spacing: 0.02em;
}
.ma-card-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.ma-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.ma-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ma-accent-soft);
  color: var(--ma-accent);
}
.ma-badge.soon {
  background: #f1f5f9;
  color: var(--ma-muted);
}
.ma-cat {
  font-size: 12px;
  color: var(--ma-muted);
  font-weight: 600;
}
.ma-card h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.ma-card p {
  margin: 0;
  color: var(--ma-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  flex: 1;
}
.ma-card .ma-btn { margin-top: 4px; width: 100%; }

/* ── Tool workspace ──────────────────────────────── */
.ma-work {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) {
  .ma-work { grid-template-columns: 1fr; }
}

.ma-panel {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  padding: 16px;
  box-shadow: var(--ma-shadow);
}
.ma-panel h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ma-panel .hint {
  color: var(--ma-muted);
  font-size: 0.875rem;
  margin: 0 0 12px;
}

/* Demo strip on tool page */
.ma-demo {
  margin: 0 0 18px;
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  overflow: hidden;
  background: var(--ma-surface);
  box-shadow: var(--ma-shadow);
}
.ma-demo-media {
  width: 100%;
  aspect-ratio: var(--ma-demo-ratio);
  background: #e2e8f0;
  position: relative;
}
.ma-demo-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ma-demo-cap {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ma-muted);
  border-top: 1px solid var(--ma-border);
  background: var(--ma-surface-2);
}

/* Upload dropzone */
.ma-drop {
  border: 1.5px dashed var(--ma-border-strong);
  border-radius: var(--ma-radius);
  padding: 0;
  text-align: center;
  background: var(--ma-surface-2);
  cursor: pointer;
  transition: border-color .12s, background .12s;
  overflow: hidden;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ma-drop:hover,
.ma-drop.drag {
  border-color: var(--ma-primary);
  background: #f0fdfa;
}
.ma-drop input { display: none; }
.ma-drop-inner {
  padding: 28px 16px;
  pointer-events: none;
}
.ma-drop-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--ma-text);
}
.ma-drop-sub {
  color: var(--ma-muted);
  font-size: 13px;
}
.ma-drop-size {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ma-muted-2);
  letter-spacing: 0.03em;
}

.ma-preview {
  margin-top: 12px;
  border-radius: var(--ma-radius-sm);
  overflow: hidden;
  border: 1px solid var(--ma-border);
  aspect-ratio: 4 / 3;
  max-height: 280px;
  display: none;
  background: #0f172a;
}
.ma-preview.show { display: block; }
.ma-preview img,
.ma-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Styles */
.ma-styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 14px;
}
@media (max-width: 420px) {
  .ma-styles { grid-template-columns: 1fr; }
}
.ma-style {
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius-sm);
  padding: 11px 12px;
  background: var(--ma-surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--ma-text);
  text-align: left;
  font-family: inherit;
  transition: border-color .12s, background .12s;
}
.ma-style:hover { border-color: var(--ma-border-strong); }
.ma-style.active {
  border-color: var(--ma-primary);
  background: var(--ma-primary-soft);
  color: #115e59;
}

/* Result */
.ma-result {
  min-height: var(--ma-result-min);
  aspect-ratio: 4 / 3;
  border-radius: var(--ma-radius-sm);
  border: 1px solid var(--ma-border);
  background: var(--ma-surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--ma-muted);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}
.ma-result.has-media {
  padding: 0;
  background: #0f172a;
}
.ma-result img,
.ma-result video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ma-result-empty {
  max-width: 220px;
  line-height: 1.45;
}

.ma-examples {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ma-chip {
  font-size: 12px;
  color: var(--ma-muted);
  border: 1px solid var(--ma-border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--ma-surface);
}

/* Auth modal */
.ma-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.ma-modal-backdrop.open { display: flex; }
.ma-modal {
  width: min(400px, 100%);
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  padding: 20px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}
.ma-modal h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}
.ma-modal p {
  color: var(--ma-muted);
  font-size: 0.9rem;
  margin: 0 0 14px;
}
.ma-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.ma-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ma-muted);
}
.ma-field input {
  border-radius: var(--ma-radius-sm);
  border: 1px solid var(--ma-border);
  background: var(--ma-surface);
  color: var(--ma-text);
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.ma-field input:focus {
  border-color: var(--ma-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.ma-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ma-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ma-muted-2);
  font-size: 12px;
  margin: 12px 0;
}
.ma-divider::before,
.ma-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ma-border);
}
.ma-msg {
  font-size: 13px;
  margin-top: 8px;
  min-height: 1.2em;
}
.ma-msg.err {
  color: var(--ma-danger);
  background: var(--ma-danger-soft);
  padding: 8px 10px;
  border-radius: var(--ma-radius-sm);
}
.ma-msg.ok {
  color: var(--ma-ok);
  background: var(--ma-ok-soft);
  padding: 8px 10px;
  border-radius: var(--ma-radius-sm);
}
.google-signin-container {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

/* Footer */
.ma-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--ma-border);
  color: var(--ma-muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.ma-loading {
  color: var(--ma-muted);
  font-size: 14px;
  padding: 24px 0;
}

/* Section label on hub */
.ma-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ma-muted);
  margin: 0 0 12px;
}
