/* MintUI Cloud: the MintUI web UI's layout in the havemint.com look (dark first, Sora + Inter, mint glow).
   Brand: ink #12201c · mint #3ecf8e · deep mint #0d7d58 · frost #eef6f2 · slate teal #1d5c55 */
@font-face { font-family: "Sora"; src: url(fonts/sora.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/inter.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 400 500; font-display: swap; }

:root {
  --brand-ink: #12201c; --brand-mint: #3ecf8e; --brand-cream: #eef6f2;
  --bg: #0f1714; --bgA: rgba(15,23,20,.82); --panel: #16201d; --soft: #1e2a26; --line: #283430;
  --ink: #e8f1ed; --muted: #98a59f; --acc: #3ecf8e; --accInk: #06261a; --accA: rgba(62,207,142,.35);
  --glow: rgba(62,207,142,.13); --ok: #3ecf8e; --bad: #f07a6e; --warn: #e2b04a; --teal: #5fb3a8;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --head: "Sora", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --r: 16px; --r-sm: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f7f5; --bgA: rgba(243,247,245,.85); --panel: #fcfefd; --soft: #e6efeb; --line: #d9e4df;
          --ink: #12201c; --muted: #56645e; --acc: #0d7d58; --accInk: #fff; --accA: rgba(13,125,88,.28);
          --glow: rgba(62,207,142,.22); --ok: #2f8a4c; --bad: #b3362b; --warn: #a86f0c; --teal: #1d5c55; color-scheme: light; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.55 var(--sans); background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column;
       -webkit-font-smoothing: antialiased; }
a { color: var(--acc); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); letter-spacing: -.02em; }
::selection { background: var(--accA); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- top bar (web UI) ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
       padding: 10px 24px; padding-top: max(10px, env(safe-area-inset-top));
       background: var(--bgA); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
       border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.wm { font: 700 20px/1 var(--head); letter-spacing: -.03em; }
.wm b { color: var(--brand-mint); font-weight: 700; }
.tagline { font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--acc);
           padding-left: 10px; border-left: 1px solid var(--line); }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 500; }
.top nav a:hover { color: var(--ink); background: var(--soft); }
.top nav a.on { color: var(--ink); background: var(--soft); box-shadow: inset 0 -2px 0 var(--acc); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px;
        font-size: 13px; color: var(--ink); background: var(--panel); text-decoration: none; cursor: pointer; }
.pill:hover { border-color: var(--acc); }
.pill b { font: 600 14px var(--mono); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 3px var(--accA); flex: none; }
.dot.low { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 30%, transparent); }

/* ---------- layout ---------- */
main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 24px; flex: 1;
       padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
main.narrow { max-width: 640px; }
.eyebrow { font: 500 12.5px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--acc); margin: 0 0 8px; }
.ph { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.ph h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.1; margin: 0; }
.ph h1::after { content: "."; color: var(--acc); }
.ph .sub { color: var(--muted); margin: 6px 0 0; }
.ph .sp { flex: 1; }
h2 { font-size: 19px; margin: 36px 0 14px; display: flex; align-items: center; gap: 10px; }
h2 .count { font: 500 13px var(--mono); color: var(--muted); }
.panel > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.foot { width: 100%; max-width: 1320px; margin: 0 auto; padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.foot img { width: 20px; height: 20px; border-radius: 5px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot .sp { flex: 1; }
.foot .ai { font: 500 11.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* ---------- controls ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
label.f, .f { display: block; font: 500 11.5px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.fsec:first-child > label.f, .fsec:first-child > .f { margin-top: 0; }
textarea, input[type=text], input[type=email], input[type=number], select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; transition: border-color .15s; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--accA); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
       border: 1px solid var(--line); background: var(--panel); border-radius: 11px; cursor: pointer; font-weight: 500;
       white-space: nowrap; text-decoration: none; color: var(--ink); transition: filter .15s, border-color .15s; }
.btn:hover { border-color: var(--acc); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--accInk); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 13px; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--acc); }
.chip.on { background: var(--acc); color: var(--accInk); border-color: var(--acc); font-weight: 600; }
.chip small { opacity: .65; margin-left: 4px; font-family: var(--mono); }
.tag { display: inline-block; font: 12px var(--mono); background: var(--soft); border-radius: 6px; padding: 2px 7px; color: var(--muted); }
.tag.ok { color: var(--ok); } .tag.bad { color: var(--bad); } .tag.warn { color: var(--warn); }
.msg { font-size: 14px; margin-top: 10px; }
.msg:empty { display: none; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); }
.note { background: var(--soft); border-left: 3px solid var(--acc); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 14px; margin: 0 0 18px; }
.note:empty { display: none; }
.note.bad { border-left-color: var(--bad); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--acc); flex: none; }
code { font-family: var(--mono); font-size: .9em; background: var(--soft); padding: 1px 6px; border-radius: 5px; }
pre.code { background: #0b1210; color: #c9d6d0; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow: auto;
           font: 13px/1.6 var(--mono); margin: 10px 0 0; }

/* ---------- landing (havemint.com hero) ---------- */
.hero { position: relative; padding: clamp(40px, 8vw, 100px) 0 20px; text-align: center; }
.hero::before { content: ""; position: absolute; inset: -40px -200px 0; pointer-events: none;
                background: radial-gradient(620px circle at 50% 22%, var(--glow), transparent 65%); }
.hero > * { position: relative; }
.hero .mark { width: 88px; height: 88px; filter: drop-shadow(0 18px 36px rgba(0,0,0,.35)); margin-bottom: 18px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 60px); line-height: 1.05; margin: 0 auto 16px; max-width: 860px; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--acc); }
.hero .lead { font-size: clamp(16px, 1.6vw, 19px); color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.signin { display: flex; gap: 10px; max-width: 520px; margin: 0 auto; }
.signin input { min-height: 50px; border-radius: 14px; font-size: 16px; padding: 0 16px; }
.trust { display: flex; justify-content: center; gap: 8px 20px; flex-wrap: wrap; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.trust span::before { content: "✓ "; color: var(--acc); font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 24px 0 0; }
.tile { padding: 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 8px;
        transition: border-color .3s, transform .3s; text-align: left; }
.tile:hover { border-color: var(--acc); transform: translateY(-3px); }
.tile b { font: 600 18px/1.3 var(--head); }
.tile span { font-size: 14.5px; color: var(--muted); }
.tile .k { font: 600 26px/1 var(--head); color: var(--acc); letter-spacing: -.02em; }
.section-title { text-align: center; margin: 72px 0 6px; font-size: clamp(24px, 3vw, 32px); }
.section-sub { text-align: center; color: var(--muted); margin: 0; }

/* ---------- generate (web UI) ---------- */
.gen { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 20px; align-items: start; }
.models { display: grid; gap: 8px; }
.model { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; padding: 11px 13px; border-radius: 12px;
         border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.model:hover { border-color: var(--acc); }
.model b { font: 600 14.5px/1.3 var(--head); }
.model span { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.model .cost { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 500 12.5px var(--mono); color: var(--muted); }
.model.on { border-color: var(--acc); box-shadow: 0 0 0 3px var(--accA); background: var(--panel); }
.model.on .cost { color: var(--acc); }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted);
        font-size: 13.5px; cursor: pointer; margin-top: 10px; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--acc); background: var(--soft); }
.drop img { max-width: 100%; max-height: 150px; border-radius: 8px; display: block; margin: 0 auto 8px; }
details.adv { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.adv summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary .f { margin: 0; }
details.adv summary::after { content: "▾"; color: var(--muted); }
details.adv[open] summary::after { content: "▴"; }
.inline { display: flex; gap: 6px; }
.gobar { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.gobar .sum { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.35; }
.gobar .sum b { color: var(--ink); font-family: var(--mono); }
.viewer { position: sticky; top: 76px; }
.stage { min-height: 520px; display: grid; place-items: center; border-radius: 12px; background: var(--bg); overflow: hidden; position: relative; }
.stage img.result { max-width: 100%; max-height: 72vh; display: block; cursor: zoom-in; }
.stage .empty { color: var(--muted); text-align: center; padding: 24px; max-width: 380px; }
.stage .empty img { width: 64px; height: 64px; margin: 0 auto 14px; display: block; }
.stage .empty b { display: block; font: 600 18px var(--head); color: var(--ink); margin-bottom: 6px; }
.loading { text-align: center; color: var(--muted); }
.loading .clock { font: 700 clamp(34px, 6vw, 52px)/1 var(--head); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.loading .bar { width: 220px; height: 5px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 14px auto 8px; }
.loading .bar i { display: block; height: 100%; width: 35%; background: var(--acc); border-radius: inherit; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.stage::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px circle at 50% 45%, var(--glow), transparent 70%); pointer-events: none; }
.stage > * { position: relative; }
.rmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.rmeta:empty { display: none; }
.rmeta .sp { flex: 1; }

/* history (web UI galleries) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s; }
.card:hover { border-color: color-mix(in srgb, var(--acc) 55%, var(--line)); }
.card .thumb { aspect-ratio: 1; background: var(--soft); display: grid; place-items: center; overflow: hidden; cursor: zoom-in; position: relative; border: 0; padding: 0; width: 100%; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .state { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; }
.card .thumb.static { cursor: default; }
.card .badge { position: absolute; top: 8px; left: 8px; background: rgba(6,12,10,.72); color: #fff; font: 500 11px var(--mono); padding: 3px 8px; border-radius: 6px; }
.card .body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .prompt { font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font: 12px var(--mono); color: var(--muted); }
.card .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }
.empty-grid { color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--r); padding: 28px; text-align: center; }
.spin { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: rot .8s linear infinite; margin: 0 auto 8px; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- credits / account ---------- */
.balance { display: flex; align-items: baseline; gap: 10px; }
.balance .n { font: 700 clamp(44px, 6vw, 64px)/1 var(--head); letter-spacing: -.04em; }
.balance .u { color: var(--muted); }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pack { position: relative; padding: 24px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.pack.best { border-color: var(--acc); box-shadow: 0 0 0 3px var(--accA); }
.pack .ribbon { position: absolute; top: -11px; left: 20px; background: var(--acc); color: var(--accInk); font: 600 11px var(--mono);
                letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; }
.pack .cr { font: 700 30px/1.1 var(--head); letter-spacing: -.03em; }
.pack .per { font: 13px var(--mono); color: var(--muted); }
.pack ul { list-style: none; padding: 0; margin: 12px 0 18px; font-size: 13.5px; color: var(--muted); display: grid; gap: 4px; }
.pack ul li::before { content: "✓ "; color: var(--acc); }
.pack .btn { margin-top: auto; width: 100%; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 20px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
                padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.n { font-family: var(--mono); text-align: right; white-space: nowrap; }
td.n.plus { color: var(--ok); }
.keyrow { display: flex; gap: 8px; margin-top: 14px; }
.keyrow input { flex: 1; }
.newkey { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.newkey code { flex: 1; padding: 10px 12px; border: 1px dashed var(--acc); border-radius: 10px; word-break: break-all; background: var(--bg); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

/* lightbox + toast (web UI) */
.lb { position: fixed; inset: 0; background: rgba(6,10,9,.9); display: none; z-index: 50; padding: 24px; grid-template-columns: 1fr 340px; gap: 20px; }
.lb.show { display: grid; }
.lb .imgwrap { display: grid; place-items: center; min-height: 0; }
.lb img { max-width: 100%; max-height: calc(100vh - 48px); border-radius: 8px; }
.lb aside { background: var(--panel); border-radius: var(--r); padding: 18px; overflow: auto; font-size: 14px; display: flex; flex-direction: column; gap: 10px; }
.lb aside p { white-space: pre-wrap; word-break: break-word; margin: 0; }
.lb .close { position: absolute; top: 12px; right: 372px; color: #fff; background: none; border: 0; font-size: 30px; cursor: pointer; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--ink); color: var(--bg);
         padding: 9px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .gen, .split { grid-template-columns: minmax(0, 1fr); }
  .viewer { position: static; }
  .stage { min-height: 320px; }
  .tiles, .packs { grid-template-columns: minmax(0, 1fr); }
  .packs { gap: 20px; }
}
@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 8px 10px; padding: 8px 14px 0; padding-top: max(8px, env(safe-area-inset-top)); }
  .tagline { display: none; }
  .top nav { order: 3; width: 100%; }
  .top nav a { flex: 1; text-align: center; padding: 10px 4px; border-radius: 9px 9px 0 0; }
  main { padding: 18px 14px; }
  .panel { padding: 15px; }
  .signin { flex-direction: column; }
  textarea, input[type=text], input[type=email], input[type=number], select { font-size: 16px; } /* no iOS zoom */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lb.show { display: block; overflow-y: auto; padding: 56px 12px 16px; }
  .lb img { max-height: 62vh; display: block; margin: 0 auto; }
  .lb aside { margin-top: 12px; }
  .lb .close { position: fixed; top: 10px; right: 12px; }
  .foot { padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
.split.flush { margin-top: 0; }
