: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); }
