    :root {
      color-scheme: dark;
      --bg: #0c0c10;
      --bg-2: #131318;
      --card: rgba(255, 255, 255, 0.045);
      --card-solid: #16161c;
      --card-hover: rgba(255, 255, 255, 0.075);
      --text: #f2f2f8;
      --muted: #9a9ab2;
      --line: rgba(255, 255, 255, 0.09);
      --line-strong: rgba(255, 255, 255, 0.18);
      --accent: #7c5cf0;
      --accent-2: #ec4899;
      --accent-3: #22d3ee;
      --accent-text: #ffffff;
      --grad: #7c5cf0;
      --grad-soft: rgba(124,92,240,.16);
      --danger: #ff7a8c;
      --ok: #4ade9c;
      --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
      --radius: 16px;
    }
        * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--text);
      font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
      position: relative;
      overflow-x: hidden;
    }
    a { color: var(--accent); }
    main#app { max-width: 1440px; margin: 0 auto; padding: 0 20px 80px; }
    h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
    .muted { color: var(--muted); font-size: 0.9rem; }
    .center { text-align: center; }
    .grad-text { color: var(--accent); }

    /* Buttons */
    button, .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 8px;
      font: inherit; font-weight: 500;
      padding: 10px 16px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: var(--card);
      color: var(--text);
      cursor: pointer;
      text-decoration: none;
      transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .2s ease;
    }
    button:hover:not(:disabled), .btn:hover { background: var(--card-hover); border-color: var(--line-strong); }
    button:active:not(:disabled) { transform: scale(0.97); }
    button:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .choice:focus-within {
      outline: 2px solid var(--accent); outline-offset: 2px;
    }
    button.primary, .btn.primary {
      background: var(--grad); border-color: transparent; color: var(--accent-text); font-weight: 600;
      
    }
    button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--grad); filter: brightness(1.12); }
    button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
    button.ghost:hover:not(:disabled) { color: var(--text); background: var(--card); }
    button.icon { padding: 9px 11px; }
    button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

    /* Nav */
    .nav {
      position: relative;
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      padding: 14px 0; margin-bottom: 8px;
      backdrop-filter: blur(14px);
      background: rgba(12,12,16,.8); border-bottom: 1px solid var(--line);
    }
    .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
    .logo-mark {
      width: 32px; height: 32px; border-radius: 10px; background: var(--grad);
      display: grid; place-items: center; color: #fff; font-size: 1rem;
      
    }
    .nav-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
    /* Account bar: the top part of the left panel (email dropdown, credits, free-today + check-in). */
    .acct { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
    .acct-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
    .acct-top .user-menu { min-width: 0; flex: 1 1 auto; }
    .acct .user-pop { left: 0; right: auto; min-width: 220px; }
    .acct-user { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 3px 6px 3px 3px; color: var(--muted); font-size: 0.8rem; cursor: pointer; }
    .acct-user:hover, .acct-user[aria-expanded="true"] { color: var(--text); border-color: var(--line-strong); }
    .acct-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .acct-credits { display: inline-flex; align-items: baseline; gap: 5px; font-size: 0.85rem; white-space: nowrap; }
    .acct-credits b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
    .acct-credits .coin { color: #fbbf24; }
    /* The info button sits outside the pill: the pill clips overflow, which would cut off its tooltip. */
    .acct-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
    .acct-row .acct-pill { flex: 1 1 auto; min-width: 0; }
    /* The free-image badge is a status line (dot + text), not a control; only the check-in is a button. */
    .acct-pill { display: flex; align-items: center; gap: 10px; }
    .acct-pill .free-badge { display: inline-flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 7px; border: 0; border-radius: 0; background: none; padding: 0; font-size: 0.8rem; font-weight: 500; color: var(--muted); cursor: default; white-space: nowrap; }
    .acct-pill .free-badge::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
    .acct-pill .free-badge[hidden] { display: none; }
    .acct-pill .free-badge.on { background: none; color: var(--text); }
    .acct-pill .free-badge.on::before { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2); }
    .acct-pill .btn { flex: 0 0 auto; border-radius: 999px; border: 0; padding: 6px 12px; font-size: 0.8rem; font-weight: 600; background: var(--accent-2); color: #fff; white-space: nowrap; }
    .acct-pill .btn:not(:disabled):hover { filter: brightness(1.12); }
    .acct-pill .btn:disabled { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
    .user-pop a[role="menuitem"] { display: block; box-sizing: border-box; width: 100%; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 0.9rem; }
    .user-pop a[role="menuitem"]:hover { background: rgba(255, 255, 255, 0.06); }
    .ad-slot { margin: 0 0 14px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--card); min-height: 90px; break-inside: avoid; }
    .ad-slot small { display: block; padding: 4px 10px 0; font-size: 0.65rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
    .ad-slot ins { display: block; }
    .user-menu { position: relative; }
    .who { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; max-width: 220px; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 6px 10px; cursor: pointer; }
    .who:hover, .who[aria-expanded="true"] { color: var(--text); border-color: var(--line-strong); }
    .who-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .who-av { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; background: var(--grad-soft); border: 1px solid var(--line-strong); color: var(--text); font-weight: 700; font-size: .8rem; }
    .user-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; max-width: 280px; padding: 8px; background: #16161c; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .55); }
    .user-pop[hidden] { display: none; }
    .user-pop-mail { padding: 6px 8px 8px; font-size: .8rem; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
    .user-pop button, .user-pop a.btn { display: block; box-sizing: border-box; width: 100%; text-align: left; }
    #ad-status { min-height: 0; margin: 0; font-size: 0.85rem; text-align: right; color: var(--muted); }
    #ad-status:empty { display: none; }
    .status.ok { color: var(--ok); }
    .status.error, .error { color: var(--danger); }
    .error { min-height: 1.2em; margin: 8px 0 0; font-size: 0.9rem; }
    #ad-retry { padding: 3px 10px; font-size: 0.8rem; }

    /* Hero */
    .hero { text-align: center; padding: 28px 0 22px; }
    .hero h1 { font-size: clamp(1.9rem, 5vw, 3.1rem); font-weight: 800; }
    .hero p { margin: 10px auto 0; color: var(--muted); max-width: 520px; }

    /* Composer */
    .composer {
      position: relative; border-radius: 22px; padding: 1.5px;
      background: var(--line-strong);
      box-shadow: var(--shadow);
    }
    .composer-inner { background: var(--card-solid); border-radius: 21px; padding: 18px; }
    .composer textarea {
      width: 100%; resize: none; border: 0; background: transparent; color: var(--text);
      font: inherit; font-size: 1.05rem; line-height: 1.55; padding: 4px; min-height: 96px;
    }
    .composer textarea:focus-visible { outline: none; }
    .composer-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
    .chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 0; }
    .chip {
      padding: 6px 12px; font-size: 0.82rem; border-radius: 999px; color: var(--muted);
      background: var(--card); border: 1px solid var(--line);
    }
    .chip:hover:not(:disabled) { color: var(--text); }

    .options { display: grid; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
    .opt-label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
    fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
    .choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
    .choice { position: relative; cursor: pointer; }
    .choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
    .choice span.pill {
      display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px;
      border: 1px solid var(--line); background: var(--card); font-weight: 500; font-size: 0.92rem;
      transition: all .15s ease;
    }
    .choice:hover span.pill { border-color: var(--line-strong); background: var(--card-hover); }
    .choice input:checked + span.pill { border-color: transparent; background: var(--grad-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
    .choice small { color: var(--muted); font-weight: 400; }
    .ratio {
      display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px; min-width: 76px;
      border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 0.82rem;
    }
    .choice input:checked + .ratio { border-color: transparent; background: var(--grad-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
    .choice:hover .ratio { border-color: var(--line-strong); }
    .ratio i { display: block; border: 1.5px solid currentColor; border-radius: 3px; opacity: 0.8; }
    .cost { color: var(--muted); font-size: 0.7rem; }
    .opt-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
    .select {
      width: 100%; padding: 11px 14px; font: inherit; color: var(--text); background: var(--card);
      border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
    }
    .select option { background: var(--card-solid); color: var(--text); }
    .summary { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 0.9rem; }
    .ratio b { font-size: 0.95rem; }
    .ratio.tier { min-width: 84px; }
    @media (max-width: 560px) { .opt-grid { grid-template-columns: 1fr; } }


    .composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
    .need { margin: 0; color: var(--muted); font-size: 0.88rem; flex: 1 1 220px; }
    .meter { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 8px; max-width: 280px; }
    .meter > div { height: 100%; width: 0; background: var(--grad); border-radius: 6px; transition: width .4s ease; }
    #send { padding: 13px 26px; font-size: 1rem; border-radius: 14px; }

    /* Two-panel workspace: 3 / 9 of a 12-column grid */
    .workspace { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; margin-top: 12px; }
    .panel-form { grid-column: span 3; position: sticky; top: 64px; height: calc(100vh - 80px); min-height: 0; overflow-y: auto; background: var(--card-solid); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 12px; }
    /* One panel: the form loses its own frame so the account bar and the form read as a single box. */
    .panel-form .composer { position: static; padding: 0; background: none; box-shadow: none; border-radius: 0; }
    .panel-form .composer-inner { background: none; border-radius: 0; }
    .panel-results { grid-column: span 9; min-height: 60vh; }
    .panel-form .composer-inner { padding: 14px; }
    .panel-form .composer textarea { min-height: 120px; font-size: 0.98rem; }
    .panel-form .opt-grid { grid-template-columns: 1fr; }
    .panel-form .composer-foot { flex-direction: column; align-items: stretch; }
    .panel-form #send { width: 100%; }
    .panel-form .options { gap: 14px; margin-top: 14px; padding-top: 14px; }
    /* Compact form: fits the viewport without scrolling */
    .panel-form .composer { height: auto; }
    .panel-form .composer-inner { height: auto; display: flex; flex-direction: column; padding: 0; min-height: 0; }
    .panel-form .composer form, .panel-form form.composer { }
    .panel-form .composer-top { margin-bottom: 2px; font-size: 0.75rem; }
    .panel-form .composer-top .chip { padding: 2px 8px; font-size: 0.72rem; margin-right: 4px; }
    .panel-form .composer textarea { flex: 0 1 84px; min-height: 56px; font-size: 0.92rem; }
    .panel-form .options { gap: 8px; margin-top: 8px; padding-top: 8px; flex: 0 0 auto; }
    .panel-form .opt-label { font-size: 0.68rem; margin-bottom: 4px; }
    .panel-form .opt-grid { gap: 8px; }
    .panel-form .choice-row { gap: 5px; }
    .panel-form #opt-ratio { display: grid; grid-template-columns: repeat(4, 1fr); }
    .panel-form #opt-ratio .ratio { flex-direction: row; justify-content: center; gap: 4px; min-width: 0; padding: 5px 4px; font-size: 0.74rem; border-radius: 9px; }
    .panel-form #opt-ratio .ratio i { transform: scale(0.8); }
    .panel-form #opt-tier { display: grid; grid-template-columns: repeat(3, 1fr); }
    .panel-form .ratio.tier { min-width: 0; padding: 5px 4px; gap: 0; border-radius: 9px; }
    .panel-form .ratio.tier b { font-size: 0.82rem; }
    .panel-form .cost { font-size: 0.64rem; }
    .panel-form #opt-quality { display: grid; grid-template-columns: repeat(3, 1fr); }
    .panel-form .choice span.pill { justify-content: center; padding: 6px 4px; font-size: 0.8rem; border-radius: 9px; }
    .panel-form .select { padding: 7px 10px; font-size: 0.82rem; border-radius: 9px; }
    .panel-form .summary { padding: 0; border: 0; background: none; font-size: 0.74rem; }
    .panel-form .composer-foot { margin-top: 8px; padding-top: 8px; gap: 6px; }
    .panel-form .need-wrap { flex: none !important; }
    .panel-form .need { font-size: 0.72rem; flex: none; }
    .panel-form .meter { height: 4px; margin-top: 4px; max-width: none; }
    .panel-form #send { padding: 10px; font-size: 0.92rem; border-radius: 11px; }
    .panel-form .error { margin: 4px 0 0; min-height: 0; font-size: 0.78rem; }
    .panel-form .error:empty { display: none; }
    /* Desktop app-shell: no page scroll; the results panel scrolls on its own */
    @media (min-width: 1001px) {
      html:has(body[data-page="me"]), body[data-page="me"] { height: 100%; overflow: hidden; }
      body[data-page="me"] main#app { height: 100vh; display: flex; flex-direction: column; padding-bottom: 14px; }
      .nav { padding: 8px 0; margin-bottom: 0; flex: none; }
      .workspace { flex: 1 1 auto; min-height: 0; margin-top: 12px; }
      .panel-form { position: static; height: 100%; overflow-y: auto; }
      .panel-results { height: 100%; min-height: 0; overflow-y: auto; padding-right: 6px; }
    }
    .panel-form .summary { display: none; }
    .panel-form .composer textarea { flex: 0 0 auto; height: 84px; min-height: 52px; }
    .panel-form .composer-inner { padding: 10px; }
    .panel-form .options { gap: 6px; margin-top: 6px; padding-top: 6px; }
    .panel-form .opt-label { margin-bottom: 3px; }
    .panel-form #opt-ratio .ratio { padding: 4px 2px; }
    .panel-form .composer-foot { padding-top: 6px; }
    .panel-results #job-stage { margin-top: 0; }
    .panel-results .canvas { max-width: 720px; }
    .panel-results .gallery-head { margin-top: 28px; }
    .panel-results .gallery-head:first-child { margin-top: 0; }
    /* Tablet: the control panel spans the full width, with resolution and effort side by side. */
    @media (max-width: 1000px) {
      .panel-form, .panel-results { grid-column: 1 / -1; position: static; height: auto; overflow: visible; }
      .panel-form .composer textarea { min-height: 96px; }
      .panel-form .opt-grid { grid-template-columns: 1fr 1fr; }
    }
    /* Phone: tighter panel, account pill full width, options and generate button stack cleanly. */
    @media (max-width: 560px) {
      .panel-form { padding: 10px; border-radius: 18px; }
      .panel-form .composer textarea { min-height: 84px; }
      .panel-form .opt-grid { grid-template-columns: 1fr; }
      .acct-pill .free-badge { font-size: 0.74rem; }
      .acct-pill .btn { padding: 6px 10px; font-size: 0.76rem; }
      .acct-credits { font-size: 0.8rem; }
      .panel-form .composer-foot { flex-direction: column; align-items: stretch; }
    }
    /* Stage / result */
    #job-stage { margin-top: 28px; }
    .stage { display: grid; gap: 14px; }
    .canvas {
      position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
      background: var(--bg-2); max-width: 560px; margin: 0 auto; width: 100%;
    }
    .canvas img { display: block; width: 100%; height: auto; animation: reveal .7s ease both; }
    @keyframes reveal { from { opacity: 0; filter: blur(18px); transform: scale(1.04); } }
    .canvas.loading { aspect-ratio: 1; display: grid; place-items: center; text-align: center; }
    .canvas.loading::before {
      content: ""; position: absolute; inset: 0; background: var(--bg-2);
    }
    .canvas.loading .shimmer {
      position: absolute; inset: 0;
      background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.07) 50%, transparent 70%);
      background-size: 200% 100%; animation: shimmer 1.8s linear infinite;
    }
    .canvas.loading .msg { position: relative; z-index: 1; padding: 20px; font-weight: 500; text-shadow: 0 1px 12px rgba(0,0,0,.4); color: #fff; }
    .canvas.loading .msg small { display: block; font-weight: 400; opacity: .8; margin-top: 4px; }
    .canvas.failed { aspect-ratio: auto; padding: 28px; text-align: center; }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes shimmer { to { background-position: -200% 0; } }
    .stage-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
    .stage-prompt { text-align: center; color: var(--muted); font-size: 0.9rem; max-width: 560px; margin: 0 auto; }
    #job-status { margin: 12px 0 0; text-align: center; min-height: 1.2em; font-size: 0.9rem; }

    /* Gallery */
    .gallery-head { display: flex; justify-content: space-between; align-items: baseline; margin: 48px 0 16px; }
    .gallery-head h2 { font-size: 1.3rem; }
    .gallery { columns: 3 220px; column-gap: 14px; }
    .tile {
      position: relative; break-inside: avoid; margin: 0 0 14px; border-radius: 14px; overflow: hidden;
      border: 1px solid var(--line); background: var(--bg-2); cursor: zoom-in; animation: pop .5s ease both;
    }
    .tile img { display: block; width: 100%; height: auto; transition: transform .5s ease; }
    .tile:hover img { transform: scale(1.05); }
    .tile .cap {
      position: absolute; inset: auto 0 0 0; padding: 36px 12px 10px;
      background: rgba(0,0,0,.72); color: #fff; font-size: 0.8rem;
      opacity: 0; transform: translateY(8px); transition: all .25s ease;
      display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    }
    .tile:hover .cap, .tile:focus-visible .cap { opacity: 1; transform: none; }
    @keyframes pop { from { opacity: 0; transform: translateY(12px); } }
    .empty { text-align: center; color: var(--muted); padding: 40px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }

    /* Lightbox */
    .lightbox {
      position: fixed; inset: 0; z-index: 50; background: rgba(5, 5, 10, 0.88); backdrop-filter: blur(8px);
      display: grid; place-items: center; padding: 20px; animation: fade .2s ease;
    }
    .lightbox-body { max-width: min(900px, 100%); max-height: 100%; display: grid; gap: 14px; justify-items: center; }
    .lightbox img { max-width: 100%; max-height: 72vh; border-radius: 14px; box-shadow: var(--shadow); }
    .lightbox p { margin: 0; color: #d6d6e6; max-width: 640px; text-align: center; font-size: 0.92rem; }
    .share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
    .share-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border-radius: 50%; color: var(--text); background: var(--card); border: 1px solid var(--line); text-decoration: none; cursor: pointer; }
    .share-btn svg { display: block; }
    .share-btn:hover { background: var(--card-hover); }
    .check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.85rem; color: var(--muted); margin: 10px 0; text-align: left; }
    .check input { margin-top: 3px; flex: none; }
    .site-foot { max-width: 1440px; margin: 0 auto; padding: 0 20px 32px; text-align: center; font-size: 0.85rem; }
    .share-foot { margin: 40px 0 8px; padding-top: 20px; border-top: 1px solid var(--line); }
    .auth-form-side .share-row { margin-top: 24px; }
    button.danger { color: #ff8a8a; border-color: rgba(255, 110, 110, 0.35); }
    button.danger:hover:not(:disabled) { background: rgba(255, 90, 90, 0.14); border-color: rgba(255, 110, 110, 0.6); }
    .tile-del { position: absolute; top: 8px; right: 8px; padding: 4px 8px; font-size: 0.8rem; background: rgba(12, 12, 16, 0.75); backdrop-filter: blur(6px); opacity: 0; transition: opacity .15s; }
    .tile:hover .tile-del, .tile:focus-within .tile-del, .tile-del[data-armed] { opacity: 1; }
    @media (hover: none) { .tile-del { opacity: 1; } }
    @keyframes fade { from { opacity: 0; } }

    /* Landing */
    .lp { max-width: 1120px; margin: 0 auto; }
    .lp-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 14px 0; background: linear-gradient(var(--bg) 70%, transparent); backdrop-filter: blur(8px); }
    .lp-nav-links { display: flex; gap: 22px; margin-left: 12px; flex: 1; }
    .lp-nav-links a { color: var(--muted); text-decoration: none; font-size: .92rem; }
    .lp-nav-links a:hover { color: var(--text); }
    .lp-nav-cta { display: flex; gap: 8px; margin-left: auto; }
    .lp-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; padding: 64px 0 72px; }
    .lp-pill { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: .8rem; color: var(--text); background: var(--grad-soft); border: 1px solid var(--line-strong); }
    .lp-hero h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); font-weight: 800; margin: 18px 0 16px; }
    .lp-lead { font-size: 1.1rem; color: var(--muted); max-width: 520px; margin: 0 0 28px; }
    .lp-cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
    .lp-big { padding: 14px 24px; font-size: 1rem; }
    .lp-note { margin: 16px 0 0; font-size: .85rem; }
    .lp-shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; position: relative; }
    .lp-shots::before { content: ""; position: absolute; inset: -10% -10%; z-index: -1; background: radial-gradient(closest-side, rgba(124,92,240,.35), transparent); filter: blur(20px); }
    .lp-shots div { aspect-ratio: 1; border-radius: 18px; overflow: hidden; border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
    .lp-shots div:nth-child(even) { transform: translateY(24px); }
    .lp-shots img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .lp-section { padding: 56px 0; }
    .lp-section h2, .lp-final h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); text-align: center; }
    .lp-sub { text-align: center; margin: 8px 0 0; }
    .lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
    .lp-card, .lp-step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
    .lp-card h3, .lp-step h3 { font-size: 1.1rem; margin: 14px 0 6px; }
    .lp-card p, .lp-step p { margin: 0; color: var(--muted); }
    .lp-ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 1.3rem; background: var(--grad-soft); color: var(--text); }
    .lp-steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .lp-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 700; background: var(--grad); color: var(--accent-text); }
    .lp-narrow { max-width: 760px; margin: 0 auto; }
    .lp-narrow h2 { margin-bottom: 24px; }
    .lp details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-top: 10px; }
    .lp summary { cursor: pointer; font-weight: 600; }
    .lp details p { color: var(--muted); margin: 10px 0 0; }
    .lp-final { text-align: center; padding: 56px 24px; margin: 24px 0; border-radius: 24px; background: var(--grad-soft); border: 1px solid var(--line-strong); }
    .lp-final h2 { margin-bottom: 20px; }
    .lp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 0 8px; border-top: 1px solid var(--line); margin-top: 32px; }
    .lp-foot nav { display: flex; gap: 18px; }
    .lp-foot nav a { color: var(--muted); text-decoration: none; font-size: .9rem; }
    @media (max-width: 860px) {
      .lp-nav-links { display: none; }
      .lp-hero { grid-template-columns: 1fr; gap: 40px; padding: 32px 0 48px; }
      .lp-grid, .lp-steps { grid-template-columns: 1fr; }
    }
    @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

    /* Auth */
    .auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; margin: 0 -20px; }
    .auth-art {
      position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
      background: #101016; border-right: 1px solid var(--line);
      color: #fff;
    }
    .auth-art h2 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; max-width: 440px; }
    .auth-art p { color: rgba(255,255,255,.75); max-width: 400px; }
    .mosaic { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 360px; margin-top: 28px; }
    .mosaic div { aspect-ratio: 1; border-radius: 14px; overflow: hidden; animation: float 6s ease-in-out infinite; }
    .mosaic div:nth-child(1) { background: #1d1d26; }
    .mosaic div:nth-child(2) { background: #1d1d26; animation-delay: -1s; }
    .mosaic div:nth-child(3) { background: #1d1d26; animation-delay: -2s; }
    .mosaic div:nth-child(4) { background: #1d1d26; animation-delay: -3s; }
    .mosaic div:nth-child(5) { background: #1d1d26; animation-delay: -4s; }
    .mosaic div:nth-child(6) { background: #1d1d26; animation-delay: -5s; }
    .mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; }
    @keyframes float { 50% { transform: translateY(-8px) rotate(1.5deg); } }
    .auth-form-side { display: grid; place-items: center; padding: 32px 20px; }
    .auth-card { width: 100%; max-width: 380px; }
    .auth-card h1 { font-size: 1.8rem; margin-bottom: 6px; }
    .field { display: block; margin-top: 16px; font-size: 0.85rem; color: var(--muted); }
    .field input {
      width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-size: 1rem; color: var(--text);
      background: var(--card); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s;
    }
    .field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(124,92,240,.25); }
    .wide { width: 100%; margin-top: 20px; padding: 13px; }

    @media (max-width: 820px) {
      .auth-wrap { grid-template-columns: 1fr; }
      .auth-art { min-height: 260px; padding: 28px; }
      .mosaic { display: none; }
    }
    @media (max-width: 560px) {
      main#app { padding: 0 14px 60px; }
      .who-text { display: none; }
      .who-av { display: inline-flex; }
      .composer-inner { padding: 14px; }
      #send { width: 100%; }
      .gallery { columns: 2 140px; column-gap: 10px; }
      .tile { margin-bottom: 10px; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation: none !important; transition: none !important; }
    }

    /* Free-image badge + auth copy */
    button.info { width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: .8rem; line-height: 1; font-style: italic; font-weight: 700; color: var(--muted); background: transparent; border: 1px solid var(--line); cursor: pointer; flex: none; }
    button.info:hover, button.info[aria-expanded="true"] { color: var(--text); border-color: var(--muted); }
    .info-wrap { position: relative; display: inline-flex; }
    .tip { display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 99999; width: max-content; max-width: 240px; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: .8rem; font-weight: 400; font-style: normal; line-height: 1.4; text-align: left; white-space: normal; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
    .info-wrap:hover .tip, .info-wrap:focus-within .tip, .info-wrap.open .tip { display: block; }
    .info-wrap:hover, .info-wrap:focus-within, .info-wrap.open { z-index: 99999; }
    .free-badge { padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
    .free-badge.on { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
    .auth-points { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; color: rgba(255,255,255,.85); font-size: .95rem; }
    .auth-points li::before { content: "✓"; color: var(--accent-3); margin-right: 8px; font-weight: 700; }
    a.logo { color: inherit; text-decoration: none; }
    .seo-fallback { max-width: 860px; margin: 0 auto; padding: 48px 20px; }
    .seo-fallback h1 { font-size: 2rem; margin: 0 0 12px; }
    .seo-fallback h2 { margin-top: 28px; }
    .seo-fallback ul { padding-left: 20px; }

/* ---- Validation messages ---- */
.field-error { display: block; margin-top: 6px; color: var(--danger); font-size: 0.8rem; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
#char-count.over { color: var(--danger); font-weight: 600; }
.custom-ratio small.error { color: var(--danger); }

/* ---- First-run tour ---- */
.tour-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.6); }
.tour { width: min(420px, 100%); padding: 24px; border-radius: var(--radius); background: var(--card-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.tour h2 { margin: 4px 0 8px; font-size: 1.25rem; }
.tour-body { margin: 0 0 16px; line-height: 1.5; }
.tour-count { margin: 0; font-size: 0.8rem; }
.tour-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.tour-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tour-dots .dot.on { background: var(--accent); }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-nav { display: flex; gap: 8px; margin-left: auto; }
.tour button[hidden] { display: none; }
.referral-dialog p { margin: 8px 0; }
.ref-link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ref-link-row input { flex: 1 1 220px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: inherit; font: inherit; }
.ref-stats { margin-top: 12px; }

.ref-page { max-width: 760px; margin: 0 auto; padding: 32px 20px; }
.ref-page h1 { margin: 20px 0 16px; font-size: 1.5rem; }
.ref-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.ref-card { border: 1px solid var(--line-strong); border-radius: 12px; padding: 18px; }
.ref-num { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.ref-page h2 { margin: 24px 0 10px; font-size: 1.1rem; }
.ref-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.ref-table th, .ref-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.ref-table th { font-weight: 600; font-size: 0.85rem; color: var(--muted); }
.ref-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0 16px; }
.ref-page-cur { padding: 2px 9px; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; }
.ref-page-of { margin-left: auto; }
.ref-page .nav { padding-top: 0; }
.ref-page .ref-link-row { margin-bottom: 18px; }
