/* ImagineX — premium dark-purple design system */
:root {
  --bg: #06040b;
  --bg2: #0b0714;
  --surface: #110b1d;
  --surface2: #170f27;
  --surface3: #1f1533;
  --border: #2a1d42;
  --border2: #3b2a5c;
  --text: #eee9f8;
  --muted: #9b90b4;
  --dim: #6c6283;
  --primary: #8b5cf6;
  --primary2: #a78bfa;
  --primary3: #6d28d9;
  --accent: #c084fc;
  --grad: linear-gradient(135deg, #a78bfa 0%, #7c3aed 50%, #5b21b6 100%);
  --grad-soft: linear-gradient(135deg, rgba(167,139,250,.18), rgba(109,40,217,.08));
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --glow: 0 0 0 1px rgba(139,92,246,.35), 0 8px 30px rgba(124,58,237,.25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --header-h: 64px;
  color-scheme: dark;
}
html[dir="rtl"] { --font: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; --font-head: "IBM Plex Sans Arabic", "Space Grotesk", sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg); min-height: 100vh; font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(124,58,237,.16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(167,139,250,.08), transparent 60%);
  background-attachment: fixed;
}
a { color: var(--primary2); text-decoration: none; }
a:hover { color: #c4b5fd; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0 0 .4em; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
img { max-width: 100%; display: block; }
::selection { background: rgba(139,92,246,.45); }
:focus-visible { outline: 2px solid var(--primary2); outline-offset: 2px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt2 { margin-top: 28px; } .mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- icons ---------- */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.lg { width: 22px; height: 22px; } .ic.xl { width: 34px; height: 34px; } .ic.sm { width: 15px; height: 15px; }
html[dir="rtl"] .ic.flip { transform: scaleX(-1); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border2); background: var(--surface2); color: var(--text); font: 600 .92rem var(--font); cursor: pointer;
  transition: background .2s, border-color .2s, transform .1s, box-shadow .2s, opacity .2s; white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface3); border-color: #4c3874; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 24px rgba(124,58,237,.35); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 8px 30px rgba(124,58,237,.5); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.danger { color: #fecaca; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.btn.danger:hover { background: rgba(248,113,113,.16); }
.btn.sm { height: 32px; padding: 0 12px; font-size: .83rem; border-radius: 10px; }
.btn.lg { height: 52px; padding: 0 26px; font-size: 1.05rem; border-radius: 14px; }
.btn.icon { width: 40px; padding: 0; } .btn.sm.icon { width: 32px; }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border-width: 2px; }

/* ---------- forms ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text); border-radius: 12px; padding: 10px 14px;
  font: 400 .95rem var(--font); transition: border-color .2s, box-shadow .2s; min-height: 42px;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,92,246,.2); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239b90b4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
html[dir="rtl"] select.input { background-position: left 12px center; padding-right: 14px; padding-left: 34px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface3); border: 1px solid var(--border2); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; top: 2px; left: 2px; background: #cfc6e4; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary3); border-color: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
html[dir="rtl"] .switch span::after { left: auto; right: 2px; }
html[dir="rtl"] .switch input:checked + span::after { transform: translateX(-18px); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-error { color: var(--bad); font-size: .88rem; min-height: 1em; }

/* segmented / chip selectors */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  height: 36px; padding: 0 14px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  font: 600 .85rem var(--font); cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover:not(:disabled) { color: var(--text); border-color: var(--border2); }
.seg button.on { color: #fff; background: rgba(139,92,246,.18); border-color: var(--primary); box-shadow: inset 0 0 0 1px rgba(139,92,246,.3); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg button .lock { width: 13px; height: 13px; opacity: .8; }

/* ---------- cards ---------- */
.card { background: linear-gradient(180deg, rgba(23,15,39,.9), rgba(17,11,29,.9)); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.glow { box-shadow: var(--glow); border-color: rgba(139,92,246,.4); }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 18px; }
.stat .label { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; }
.stat .value { font: 700 1.7rem var(--font-head); margin-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; background: var(--surface3); color: var(--muted); border: 1px solid var(--border); }
.badge.primary { background: rgba(139,92,246,.16); color: #d8ccff; border-color: rgba(139,92,246,.4); }
.badge.ok { background: rgba(52,211,153,.1); color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.badge.warn { background: rgba(251,191,36,.1); color: #fcd34d; border-color: rgba(251,191,36,.3); }
.badge.bad { background: rgba(248,113,113,.1); color: #fca5a5; border-color: rgba(248,113,113,.3); }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; background: var(--bg2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(139,92,246,.04); }

/* ---------- app shell ---------- */
.header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: rgba(6,4,11,.78); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 700 1.2rem var(--font-head); letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 2px; margin-inline-start: 12px; }
.nav a { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: .92rem; transition: .15s; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.on { color: #fff; background: var(--surface2); box-shadow: inset 0 0 0 1px var(--border2); }
.header .spacer { flex: 1; }
.credits-pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 99px; background: var(--grad-soft); border: 1px solid rgba(139,92,246,.35); font-weight: 700; font-size: .9rem; color: #e9e1ff; cursor: pointer; }
.credits-pill .ic { color: var(--accent); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: .95rem; cursor: pointer; border: 2px solid rgba(255,255,255,.12); }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 17px; height: 17px; padding: 0 4px; background: #ef4444; color: #fff; border-radius: 99px; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--border2); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; z-index: 60; animation: pop .15s ease-out;
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; color: var(--text); background: none; border: 0; font: 500 .9rem var(--font); cursor: pointer; text-align: start; }
.menu a:hover, .menu button:hover { background: var(--surface2); }
.menu .menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.main { max-width: 1320px; margin: 0 auto; padding: 26px 20px 100px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.mobile-nav { display: none; }
.announce { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; margin-bottom: 16px; font-size: .9rem; border: 1px solid; }
.announce.info { background: rgba(139,92,246,.1); border-color: rgba(139,92,246,.35); }
.announce.success { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.3); }
.announce.warning { background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.3); }

/* ---------- workspace ---------- */
.studio { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; scrollbar-width: thin; }
.panel .section { margin-bottom: 18px; }
.panel .section-label { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.prompt-box { position: relative; }
.prompt-box textarea { min-height: 150px; font-size: 1rem; padding: 14px 14px 44px; border-radius: 14px; background: #08050f; }
.prompt-tools { position: absolute; bottom: 8px; inset-inline: 10px; display: flex; gap: 6px; align-items: center; }
.prompt-tools .count { margin-inline-start: auto; font-size: .75rem; color: var(--dim); }
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-card { position: relative; height: 58px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); color: var(--muted); font: 600 .8rem var(--font); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: .15s; padding: 4px; text-align: center; }
.style-card:hover { color: var(--text); border-color: var(--border2); }
.style-card.on { color: #fff; border-color: var(--primary); background: rgba(139,92,246,.15); }
.style-card .lock { position: absolute; top: 5px; inset-inline-end: 5px; width: 12px; height: 12px; color: var(--warn); }
.style-card.rec::after { content: ""; position: absolute; top: 6px; inset-inline-start: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.gen-bar { position: sticky; bottom: -20px; background: #130d20; margin: 0 -20px -20px; padding: 14px 20px 20px; border-radius: 0 0 var(--radius) var(--radius); border-top: 1px solid var(--border); box-shadow: 0 -12px 24px rgba(10,6,18,.85); z-index: 2; }
.cost-line { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.cost-line b { color: var(--text); }
.canvas-area { min-height: 520px; display: flex; flex-direction: column; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 50px 20px; color: var(--muted); border: 1px dashed var(--border2); border-radius: var(--radius); background: radial-gradient(400px 260px at 50% 40%, rgba(139,92,246,.08), transparent); }
.empty-state .ic.xl { color: var(--primary2); margin-bottom: 14px; }
.results { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.results.n1 { grid-template-columns: 1fr; }
.results.n2 { grid-template-columns: repeat(2, 1fr); }
.tile { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface2); border: 1px solid var(--border); cursor: zoom-in; animation: fadeUp .35s ease-out both; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.tile:hover img { transform: scale(1.03); }
.tile .tile-actions { position: absolute; inset-inline: 8px; bottom: 8px; display: flex; gap: 6px; opacity: 0; transform: translateY(6px); transition: .2s; }
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; transform: none; }
.tile .tile-actions .btn { background: rgba(10,6,18,.78); backdrop-filter: blur(8px); border-color: rgba(255,255,255,.12); }
.tile .fav-flag { position: absolute; top: 8px; inset-inline-end: 8px; color: #f9a8d4; filter: drop-shadow(0 1px 3px #000); }
.tile .fav-flag .ic { fill: currentColor; }
.tile .pub-flag { position: absolute; top: 8px; inset-inline-start: 8px; }
.tile.sel { outline: 3px solid var(--primary); outline-offset: -3px; }
.tile .sel-box { position: absolute; top: 8px; inset-inline-start: 8px; width: 22px; height: 22px; border-radius: 6px; background: rgba(0,0,0,.6); border: 2px solid #fff; display: none; }
.selecting .tile .sel-box { display: block; }
.tile.sel .sel-box { background: var(--primary); }
.placeholder { border-radius: 14px; border: 1px solid var(--border); background: var(--surface); position: relative; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.placeholder::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(167,139,250,.13) 50%, transparent 70%); animation: shimmer 1.6s infinite; background-size: 200% 100%; }
.placeholder.failed { border-color: rgba(248,113,113,.4); color: var(--bad); }
.placeholder.failed::before { display: none; }
.progress-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 16px; }
.progress { height: 6px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--grad); border-radius: 99px; transition: width .5s ease; box-shadow: 0 0 12px rgba(139,92,246,.6); }
.orb { width: 44px; height: 44px; border-radius: 50%; flex: none; background: conic-gradient(from 0deg, #a78bfa, #6d28d9, #c084fc, #a78bfa); animation: spin 1.6s linear infinite; position: relative; }
.orb::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.strip .thumb { width: 92px; height: 92px; flex: none; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; background: var(--surface2); }
.strip .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- gallery ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search .ic { position: absolute; top: 12px; inset-inline-start: 12px; color: var(--dim); }
.toolbar .search input { padding-inline-start: 38px; }
.masonry { columns: 4 260px; column-gap: 14px; }
.masonry .tile { break-inside: avoid; margin-bottom: 14px; display: block; }
.masonry .tile img { height: auto; }
.tabs { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; overflow-x: auto; }
.tabs button { height: 34px; padding: 0 14px; border: 0; background: none; color: var(--muted); font: 600 .86rem var(--font); border-radius: 9px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tabs button.on { background: var(--surface3); color: #fff; box-shadow: inset 0 0 0 1px var(--border2); }

/* ---------- modal & lightbox ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(3,2,7,.78); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border2); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; animation: pop .18s ease-out; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.lightbox { display: grid; grid-template-columns: minmax(0, 1fr) 340px; width: min(1200px, 100%); max-height: calc(100vh - 40px); background: var(--surface); border: 1px solid var(--border2); border-radius: 20px; overflow: hidden; animation: pop .18s ease-out; }
.lightbox .lb-img { background: #000; display: flex; align-items: center; justify-content: center; min-height: 300px; position: relative; }
.lightbox .lb-img img { max-height: calc(100vh - 42px); width: auto; max-width: 100%; object-fit: contain; }
.lightbox .lb-side { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-nav.prev { inset-inline-start: 10px; } .lb-nav.next { inset-inline-end: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .86rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: end; }
.prompt-quote { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: .9rem; max-height: 180px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: var(--surface2); border: 1px solid var(--border2); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; animation: slideIn .25s ease-out; }
.toast.ok { border-color: rgba(52,211,153,.4); } .toast.ok .ic { color: var(--ok); }
.toast.bad { border-color: rgba(248,113,113,.4); } .toast.bad .ic { color: var(--bad); }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - var(--header-h) - 60px); display: grid; place-items: center; padding: 20px 0; }
.auth-card { width: 100%; max-width: 430px; padding: 30px; }
.auth-card .logo { width: 220px; margin: 0 auto 10px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: .8rem; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.plan { display: flex; flex-direction: column; gap: 14px; padding: 26px; position: relative; }
.plan.featured { border-color: var(--primary); box-shadow: var(--glow); background: linear-gradient(180deg, rgba(76,29,149,.35), rgba(17,11,29,.95)); }
.plan .price { font: 700 2.2rem var(--font-head); }
.plan .price small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan li { display: flex; gap: 9px; align-items: flex-start; font-size: .92rem; }
.plan li .ic { color: var(--ok); margin-top: 2px; }
.plan .tag { position: absolute; top: -11px; inset-inline-start: 24px; }

/* ---------- landing (signed out) ---------- */
.hero { text-align: center; padding: 30px 0 10px; }
.hero .logo { width: min(520px, 92%); margin: 0 auto; filter: drop-shadow(0 0 40px rgba(124,58,237,.35)); }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 620px; margin: 6px auto 24px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 40px; }
.feature .ic.lg { color: var(--primary2); margin-bottom: 10px; }

/* ---------- misc ---------- */
.spin { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--primary2); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.loading-page { display: grid; place-items: center; min-height: 50vh; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.unread { background: linear-gradient(90deg, rgba(139,92,246,.08), transparent); border-radius: 10px; padding-inline: 10px; }
.notif-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface3); color: var(--primary2); flex: none; }
.tool-card { cursor: pointer; transition: .2s; }
.tool-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.tool-card .ic.lg { color: var(--primary2); }
.drop { border: 2px dashed var(--border2); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .2s; display: block; }
.drop:hover, .drop.over { border-color: var(--primary); background: rgba(139,92,246,.06); color: var(--text); }
.drop img { max-height: 260px; margin: 0 auto; border-radius: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--border); font-size: .86rem; cursor: pointer; text-align: start; color: var(--text); font-family: var(--font); transition: .15s; }
.chip:hover { border-color: var(--primary); background: rgba(139,92,246,.08); }
.footer { text-align: center; color: var(--dim); font-size: .82rem; padding: 30px 20px; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 12px; background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.28); font-size: .88rem; color: #fde68a; display: flex; gap: 10px; }
.notice.info { background: rgba(139,92,246,.08); border-color: rgba(139,92,246,.3); color: #ddd6fe; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 6px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars div { flex: 1; background: var(--grad); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; position: relative; }
.bars div:hover { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .studio { grid-template-columns: 360px minmax(0, 1fr); }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .nav { display: none; }
  .studio { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; overflow: visible; }
  .gen-bar { position: sticky; bottom: 64px; z-index: 5; }
  .grid.c3 { grid-template-columns: 1fr; }
  .lightbox { grid-template-columns: 1fr; overflow-y: auto; }
  .lightbox .lb-img img { max-height: 60vh; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 50; height: 64px; background: rgba(9,6,16,.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--dim); font-size: .7rem; font-weight: 600; padding: 6px 10px; border-radius: 10px; }
  .mobile-nav a.on { color: #fff; }
  .mobile-nav a.on .ic { color: var(--primary2); }
  .main { padding: 18px 14px 110px; }
}
@media (max-width: 640px) {
  .header { padding: 0 12px; gap: 8px; }
  .brand span { display: none; }
  .grid.c2, .grid.c4 { grid-template-columns: 1fr 1fr; }
  .results.n2 { grid-template-columns: 1fr 1fr; }
  .masonry { columns: 2 150px; column-gap: 10px; }
  .masonry .tile { margin-bottom: 10px; }
  h1 { font-size: 1.5rem; }
  .card { padding: 16px; }
  .gen-bar { margin: 0 -16px -16px; padding: 14px 16px 16px; }
  .style-grid { grid-template-columns: repeat(3, 1fr); }
  .tile .tile-actions { opacity: 1; transform: none; }
  .modal { padding: 18px; border-radius: 16px; }
  .credits-pill span.lbl { display: none; }
  .hide-sm { display: none !important; }
}
