:root {
  --brand: #6D5DF6;
  --brand-dark: #5A4AE0;
  --brand-soft: #EFECFF;
  --brand-line: #D9D3FF;
  --bg: #F8F7FF;
  --surface: #FFFFFF;
  --text: #22203A;
  --muted: #6E6B85;
  --line: #E6E3F5;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(80, 64, 200, .07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14131C;
    --surface: #1E1C2B;
    --text: #EEEDF7;
    --muted: #A9A6C2;
    --line: #34314A;
    --brand-soft: #2E2950;
    --brand-line: #4A4380;
    --shadow: 0 2px 10px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--brand); }
@media (prefers-color-scheme: dark) { a { color: #A99FFF; } }
img { max-width: 100%; }

.site-header {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 10px 16px; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-header a { color: var(--text); text-decoration: none; }
.brand span { color: var(--brand); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.brand img { border-radius: 8px; }
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a { opacity: .9; font-size: .95rem; }

.btn {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; min-height: 40px;
}
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn.big { font-size: 1.15rem; padding: 14px 28px; border-radius: 12px; }

.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
  max-width: 1120px; margin: 0 auto; padding: 40px 16px 24px;
}
.hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.15; margin: 0 0 12px; }
.lead { font-size: 1.08rem; color: var(--muted); }
.lead strong { color: var(--text); }
.ticks { padding: 0; list-style: none; }
.ticks li { padding-left: 26px; position: relative; margin: 6px 0; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.drop {
  background: var(--surface); border: 2px dashed var(--line); border-radius: 20px; padding: 36px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; box-shadow: var(--shadow);
  color: var(--brand); outline: none;
}
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .88rem; }
.quality { display: flex; gap: 8px; align-items: center; color: var(--text); }
select, input[type=color] { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }

.editor { max-width: 1320px; margin: 0 auto; padding: 12px 16px 24px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.spacer { flex: 1; }
.workspace { display: grid; grid-template-columns: 1fr 340px; gap: 14px; }
.stage {
  position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  height: min(72vh, 760px); overflow: hidden; touch-action: none;
}
#view { width: 100%; height: 100%; display: block; cursor: grab; }
.hint { position: absolute; left: 10px; bottom: 6px; margin: 0; font-size: .8rem; color: var(--muted); pointer-events: none; }
.busy { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; }
.busy-card { background: var(--surface); padding: 22px 26px; border-radius: 14px; text-align: center; min-width: 240px; box-shadow: var(--shadow); }
.busy-card p { margin: 10px 0; }
.spinner { width: 34px; height: 34px; margin: 0 auto; border: 4px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: var(--brand-soft); border-radius: 3px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; align-self: start; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.tab { font: inherit; font-size: .9rem; border: 0; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.tab.active { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.tabpanel { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip, .segbtn {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.chip.active, .segbtn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg { gap: 0; }
.seg .segbtn { border-radius: 0; margin-left: -1px; }
.seg .segbtn:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.seg .segbtn:last-child { border-radius: 0 999px 999px 0; }
.swatches { display: grid; grid-template-columns: repeat(6, 36px); gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); cursor: pointer; padding: 0; }
.swatch.active { outline: 3px solid var(--brand); outline-offset: 2px; }
.field { display: flex; align-items: center; gap: 10px; }
.field > span { min-width: 54px; }
.field input[type=range] { flex: 1; accent-color: var(--brand); }
.field.col { flex-direction: column; align-items: stretch; gap: 4px; }
.field em { font-style: normal; color: var(--muted); font-size: .85rem; min-width: 36px; }

.content { max-width: 980px; margin: 0 auto; padding: 28px 16px; }
.content h2 { font-size: 1.6rem; }
.steps { padding-left: 22px; }
.steps li { margin: 8px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.cards article { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.cards h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--brand); }
@media (prefers-color-scheme: dark) { .cards h3 { color: #A99FFF; } }
.cards p { margin: 0; color: var(--muted); }
details { background: var(--surface); border-radius: 12px; padding: 12px 16px; margin: 10px 0; box-shadow: var(--shadow); }
summary { cursor: pointer; font-weight: 600; }
.site-footer { text-align: center; color: var(--muted); padding: 24px 16px 32px; font-size: .9rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .workspace { grid-template-columns: 1fr; }
  .stage { height: 58vh; }
  .hint { display: none; }
}
@media (max-width: 420px) {
  .site-header nav { display: none; }
  .swatches { grid-template-columns: repeat(6, 32px); gap: 8px; }
  .swatch { width: 32px; height: 32px; }
}

/* ad spaces: light boxes with a small "Advertisement" label; fixed minimum heights so the page does not jump */
.ad-slot { position: relative; overflow: hidden; text-align: center; background: var(--surface); border: 1px solid var(--brand-line);
  border-radius: var(--radius); padding: 22px 10px 10px; box-shadow: var(--shadow); }
.ad-slot::before { content: "Advertisement"; position: absolute; top: 5px; left: 12px; font-size: .7rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.ad-wide { grid-column: 1 / -1; min-height: 122px; margin: 12px 0; }
.ad-side { min-height: 282px; margin-top: 14px; }
.content-ad { max-width: 980px; margin: 12px auto; }
main > .content-ad { width: calc(100% - 32px); }
@media (min-width: 901px) { .ad-wide { min-height: 142px; } }
/* "?ads=preview": shows where the ads go, before AdSense is set up */
.ad-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; min-height: inherit;
  border: 2px dashed var(--brand-line); border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.ad-wide .ad-placeholder { min-height: 90px; }
.ad-side .ad-placeholder { min-height: 250px; }
.btn.improve { border-style: dashed; }

/* ---- shared menu ---- */
.site-header nav { align-items: center; }
.site-header nav a { padding: 6px 10px; border-radius: 999px; }
.site-header nav a:hover { background: var(--brand-soft); }
.site-header nav a.current { background: var(--brand-soft); color: var(--brand); opacity: 1; font-weight: 600; }
.btn.install { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); min-height: 34px; padding: 5px 12px; border-radius: 999px; }
.menu-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.6rem; cursor: pointer; }
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; }
  .menu-toggle { display: block; }
  .site-header nav { display: none !important; width: 100%; flex-direction: column; align-items: flex-start; gap: 10px; padding: 8px 0 4px; }
  body.menu-open .site-header nav { display: flex !important; }
}
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-bottom: 8px; }

/* ---- page heads, pills, cards ---- */
.page-head { max-width: 980px; margin: 0 auto; padding: 36px 16px 8px; text-align: center; }
.page-head .kicker { color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; margin: 0 0 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.pill:hover { border-color: var(--brand); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.plan { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.plan.featured { outline: 2px solid var(--brand); }
.plan h3 { margin: 0; }
.plan .price { font-size: 1.8rem; font-weight: 700; }
.plan ul { padding-left: 18px; margin: 4px 0 12px; flex: 1; }
.plan .btn { text-align: center; text-decoration: none; }
.steps-box { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); margin: 14px 0; }
.content pre { background: #1E1A1C; color: #F4ECEE; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: .86rem; }
.content code { font-family: ui-monospace, Consolas, monospace; }

/* ---- bulk ---- */
.bulk-wrap { max-width: 1100px; margin: 0 auto; padding: 8px 16px 24px; }
.bulk-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 18px; background: var(--surface);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin: 14px 0; }
.bulk-options label { display: flex; gap: 8px; align-items: center; }
.bulk-options fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.bulk-options legend { font-weight: 600; margin-bottom: 4px; }
#list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.bulk-item { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 10px; align-items: center; background: var(--surface);
  border-radius: 12px; padding: 8px; box-shadow: var(--shadow); }
.bulk-item.done { outline: 1px solid #43A047; }
.bulk-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.bulk-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-info { min-width: 0; }
.err { color: #C62828; }
.small-btn { min-height: 32px; padding: 4px 10px; font-size: .88rem; }
.icon-btn { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--muted); }

/* ---- uploads ---- */
.upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.upload-card { background: var(--surface); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.upload-pic { height: 160px; display: flex; align-items: center; justify-content: center; border-radius: 10px; overflow: hidden; }
.upload-pic img { max-width: 100%; max-height: 100%; }
.upload-name { font-weight: 600; margin: 8px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #e3e3e3 25%, transparent 25%), linear-gradient(-45deg, #e3e3e3 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #e3e3e3 75%), linear-gradient(-45deg, transparent 75%, #e3e3e3 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }

/* light look: soft lavender borders on cards and boxes */
.drop { border-color: var(--brand-line); background: linear-gradient(180deg, #FFFFFF, var(--brand-soft)); }
@media (prefers-color-scheme: dark) { .drop { background: var(--surface); } }
.panel, .stage, .cards article, details, .plan, .steps-box, .bulk-options, .bulk-item, .upload-card, .pill, .busy-card {
  border: 1px solid var(--brand-line); }
.btn { border-radius: 12px; }
.btn.primary { box-shadow: 0 4px 14px rgba(109, 93, 246, .25); }
.chip.active, .segbtn.active { box-shadow: none; }
.tab.active { color: var(--brand); }
.page-head .kicker { color: var(--brand); }
.footer-tools { font-size: .9em; opacity: .9; border-top: 1px solid rgba(127,127,127,.2); padding-top: 8px; }
.crumbs { margin: 0 0 6px; }
.badges { margin: 8px 0 0; text-align: center; } .badges img { height: 51px; width: auto; vertical-align: middle; } .badges a + a { margin-left: 10px; }
.btn.hd { border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* language picker */
.lang-pick { display: inline-flex; align-items: center; gap: 4px; color: var(--muted, #666); }
.lang-pick select { border: 1px solid var(--line, #ddd); border-radius: 999px; padding: 4px 8px; background: transparent; color: var(--text); font: inherit; font-size: .9rem; max-width: 9.5rem; }
/* right-to-left languages (Arabic, Urdu) */
[dir="rtl"] .ticks li, [dir="rtl"] .content { text-align: right; }
[dir="rtl"] .footer-links a { margin: 0 0 0 12px; }
:lang(ur) body, body:lang(ur) { line-height: 1.9; }

/* AI Studio */
.studio { max-width: 980px; margin: 0 auto; padding: 8px 16px 24px; }
.studio-tabs { margin-bottom: 14px; }
.studio-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.studio textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical; }
.studio .ideas { align-items: center; }
.pill.small-pill { font-size: .85rem; padding: 4px 10px; cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; }
.pill.small-pill:hover { border-color: var(--brand); color: var(--brand); }
.drop-small { padding: 18px; min-height: 0; }
.drop-small img { max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 10px; }
.drop.has-photo p { display: none; }
.styles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.style-card { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; font: inherit; }
.style-card b { display: block; }
.style-card span { font-size: .8rem; color: var(--muted); }
.style-card:hover { border-color: var(--brand); }
.style-card.active { border-color: var(--brand); background: var(--brand-soft); }
.result { position: relative; margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; min-height: 160px; }
.result img { max-width: 100%; max-height: 70vh; border-radius: 10px; }
.result .toolbar { justify-content: center; margin: 10px 0 0; }
.result .busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.7); border-radius: 14px; }
@media (prefers-color-scheme: dark) { .result .busy { background: rgba(0,0,0,.5); } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery-item img { width: 100%; border-radius: 10px; display: block; margin-bottom: 6px; }
.notice { background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 14px; padding: 18px 20px; }
.notice h2 { margin-top: 0; }

/* Unblur page: before / after slider */
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; cursor: pointer; }
.compare { position: relative; display: inline-block; max-width: 100%; line-height: 0; border-radius: 10px; overflow: hidden; }
.compare > img { max-width: 100%; max-height: 70vh; display: block; }
.compare-after { position: absolute; top: 0; left: 0; height: 100%; width: 50%; overflow: hidden; border-right: 2px solid #fff; box-shadow: 2px 0 6px rgba(0,0,0,.3); }
.compare-after img { height: 100%; width: auto; max-width: none; display: block; }
.compare-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.compare-label { position: absolute; top: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: .8rem; padding: 3px 8px; border-radius: 999px; line-height: 1.2; }
.compare-label.left { left: 10px; } .compare-label.right { right: 10px; }

/* plain colour downloads (blue / black background pages) */
.swatch-big { height: 72px; border-radius: 12px; border: 1px solid rgba(0,0,0,.12); margin-bottom: 8px; }
.btn.small { padding: 6px 10px; font-size: .85rem; margin: 2px 2px 2px 0; }

/* "Install app" floats in the corner instead of sitting in the menu: it appears a moment after the page loads,
   and inside the menu it made the menu wrap to a second line and pushed the whole page down (layout shift). */
.site-header .btn.install { position: fixed; right: 16px; bottom: 16px; z-index: 60; background: var(--brand); color: #fff;
  border-color: var(--brand); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
@media (max-width: 760px) { body.menu-open .site-header .btn.install { position: static; box-shadow: none; } }
