:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color-scheme: light;
  --page: #f1f1fa;
  --text: #25243a;
  --muted: #69677f;
  --accent: #6c47bd;
  --accent-soft: #ece4ff;
  --glass: rgb(255 255 255 / 65%);
  --glass-strong: rgb(255 255 255 / 86%);
  --inset: rgb(255 255 255 / 42%);
  --line: rgb(109 91 151 / 17%);
  --edge: rgb(255 255 255 / 88%);
  --shadow: 0 24px 80px -32px #51458130, inset 0 1px 0 var(--edge);
  --focus: #8c68e3;
  --error: #b72e57;
  --orb-one: #bdacf26e;
  --orb-two: #a1cfe95e;
  --orb-three: #edb6d240;
  background: var(--page);
  color: var(--text);
}
[data-theme=dark] {
  color-scheme: dark;
  --page: #0c0c15;
  --text: #efedf9;
  --muted: #b1acc7;
  --accent: #c0a4ff;
  --accent-soft: #b28aff24;
  --glass: rgb(30 28 47 / 67%);
  --glass-strong: rgb(31 28 47 / 91%);
  --inset: rgb(11 10 22 / 32%);
  --line: rgb(205 189 255 / 14%);
  --edge: rgb(238 229 255 / 12%);
  --shadow: 0 28px 100px -32px #0009, inset 0 1px 0 var(--edge);
  --focus: #c5a6ff;
  --error: #ffa1b9;
  --orb-one: #7444b63b;
  --orb-two: #216e8930;
  --orb-three: #99496c25;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100svh; background: transparent; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 7% 2%, var(--orb-one), transparent 49%), radial-gradient(ellipse at 92% 28%, var(--orb-two), transparent 47%), radial-gradient(ellipse at 35% 100%, var(--orb-three), transparent 55%);
}
button, input, textarea, select { font: inherit; }
button, a, input, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, a { transition: color .18s, background .18s, border-color .18s, box-shadow .18s, transform .18s; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
a { color: var(--accent); text-underline-offset: 4px; }
button, a { -webkit-user-select: none; user-select: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[tabindex='-1']:focus { outline: none; }
[hidden] { display: none !important; }
main { max-width: 1320px; margin: auto; padding: 32px 40px 48px; }
h2, h3, p { overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 1.25rem; font-weight: 620; letter-spacing: -.5px; }
h3 { font-size: 1rem; font-weight: 600; }
.community-nav, .workspace, .community-panel, dialog {
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(28px) saturate(145%); backdrop-filter: blur(28px) saturate(145%);
}
.community-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 22px; padding: 10px 12px; margin-bottom: 14px; }
.community-links, .account-controls, .auth-controls { display: flex; align-items: center; gap: 5px; min-width: 0; }
.community-links { flex-wrap: wrap; }
.community-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 15px; border-radius: 13px; text-decoration: none; color: var(--muted); font-size: .875rem; font-weight: 550; white-space: nowrap; }
.community-nav a:hover { background: var(--inset); color: var(--text); }
.community-nav a[aria-current=page] { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 1px 0 var(--edge); }
.account-controls { justify-content: center; gap: 12px; margin-left: auto; }
.auth-controls { gap: 12px; }
#account-label { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8125rem; }
#account-label:empty { display: none; }
#login-open, #logout { display: inline-flex; align-items: center; justify-content: center; text-align: center; background: var(--inset); border: 1px solid var(--line); padding: 10px 18px; border-radius: 13px; text-decoration: none; white-space: nowrap; min-height: 44px; }
#login-open:hover, #logout:hover { border-color: var(--accent); background: var(--accent-soft); }
.flow-nav { display: flex; align-items: center; gap: 6px; padding-bottom: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.flow-step, .theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid transparent; border-radius: 13px; padding: 10px 17px; color: var(--muted); background: transparent; font-size: .875rem; }
.flow-step[aria-current=step] { color: var(--text); border-color: var(--line); background: var(--glass); box-shadow: inset 0 1px 0 var(--edge); }
.flow-step:hover:enabled { background: var(--inset); color: var(--text); }
.flow-step { min-height: 40px; padding: 8px 14px; }
.theme-toggle { background: var(--inset); border-color: var(--line); color: var(--text); white-space: nowrap; }
.theme-toggle::before { content: "☾"; font-size: 20px; line-height: 1; color: var(--accent); }
.theme-toggle[aria-pressed=true] { background: var(--accent-soft); border-color: var(--line); }
.theme-toggle[aria-pressed=true]::before { content: "☀"; }
.workspace { width: 100%; padding: 24px 32px 32px; border-radius: 28px; min-width: 0; }
.inputs, .result-panel { min-width: 0; }
.community-panel { padding: 32px; border-radius: 28px; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 0; background: transparent; color: var(--accent); padding: 8px 0; text-align: center; text-decoration: none; font-size: .875rem; }
.text-button:hover:enabled { color: var(--text); }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.image-input { min-width: 0; }
.drop-zone { height: clamp(280px, 38vh, 470px); border: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 21px; background: linear-gradient(145deg, var(--inset), transparent); box-shadow: inset 0 1px 0 var(--edge); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; transition: background .2s, border-color .2s, box-shadow .2s; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 36px #a581ee0c; }
.drop-zone:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }
.drop-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.drop-zone img { width: 100%; height: 100%; object-fit: contain; }
.upload-prompt { display: flex; align-items: center; flex-direction: column; gap: 10px; color: var(--muted); font-size: .875rem; }
.upload-prompt strong { font-size: 1.0625rem; font-weight: 550; color: var(--text); }
.upload-icon { display: grid; place-items: center; height: 58px; width: 58px; border-radius: 19px; border: 1px solid var(--line); background: var(--glass); box-shadow: inset 0 1px 0 var(--edge), 0 8px 25px #6345970c; font-size: 31px; color: var(--accent); margin-bottom: 10px; }
.replace { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--glass-strong); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 20px; padding: 8px 14px; font-size: .8125rem; color: var(--text); pointer-events: none; }
.image-input h3 { font-size: .9375rem; margin: 18px 0 4px; }
.image-input p { font-size: .8125rem; color: var(--muted); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-input p:empty { display: none; }
.source-actions { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 5px; }
.source-actions .text-button { font-size: .8125rem; }
.settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .65fr); align-items: center; gap: 64px; padding-top: 28px; }
.setting-title { display: flex; justify-content: space-between; font-size: .875rem; margin-bottom: 12px; }
.setting-title output { color: var(--accent); font-variant-numeric: tabular-nums; background: var(--accent-soft); padding: 3px 9px; border-radius: 8px; margin-top: -3px; }
input[type=range] { width: 100%; height: 6px; accent-color: #9c75e7; margin: 10px 0 15px; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .8125rem; }
.resolution { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: .875rem; }
select { color: var(--text); background-color: var(--inset); border: 1px solid var(--line); border-radius: 12px; padding: 12px 36px 12px 14px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10'%3E%3Cpath d='m2 3 4 4 4-4' fill='none' stroke='%239a85bb' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; font-size: .875rem; min-height: 46px; max-width: 100%; }
select option { background: var(--page); color: var(--text); }
.primary { display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; margin-top: 28px; min-height: 50px; background: linear-gradient(115deg, #9d72e4, #7654c9 65%, #695ed0); border: 1px solid #d0afff30; border-radius: 14px; color: #fff; padding: 14px 22px; font-weight: 600; font-size: .9375rem; letter-spacing: .1px; box-shadow: 0 8px 28px -10px #8358c87a, inset 0 1px 0 #ffffff3b; }
.primary:hover:enabled { transform: translateY(-1px); box-shadow: 0 12px 32px -10px #8358c8a0, inset 0 1px 0 #ffffff45; filter: brightness(1.07); }
.primary:active:enabled { transform: translateY(0); }
.primary:disabled { opacity: .42; box-shadow: none; }
.inputs>.primary { max-width: 340px; margin-left: auto; }
.status-wrap { max-width: 720px; margin: 20px auto 0; padding: 14px 20px; }
#status { font-size: .875rem; line-height: 1.6; text-align: center; color: var(--muted); margin: 0; }
#status.error, .error, #auth-error, #donate-error { color: var(--error); }
progress { width: 100%; height: 5px; accent-color: #9c75e7; margin-top: 10px; }
.tag { font-size: .75rem; letter-spacing: .8px; color: var(--muted); border: 1px solid var(--line); background: var(--inset); padding: 7px 11px; border-radius: 30px; }
.result-panel { display: flex; flex-direction: column; }
.canvas-area { flex: 1; min-height: clamp(360px, 60vh, 720px); border: 1px solid var(--line); border-radius: 21px; background-color: var(--inset); background-image: radial-gradient(color-mix(in srgb, var(--muted) 20%, transparent) .6px, transparent .6px); background-size: 18px 18px; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 24px; position: relative; }
.canvas-area img { max-width: 100%; max-height: 65vh; object-fit: contain; box-shadow: 0 15px 45px #0002; border-radius: 5px; }
#empty-result { text-align: center; color: var(--muted); }
#empty-result h3 { font-size: 1.5rem; font-weight: 450; }
#empty-result p { max-width: 240px; line-height: 1.6; font-size: .875rem; }
.canvas-symbol { font-size: 48px; color: var(--accent); }
.result-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; gap: 16px; }
.result-tools { display: flex; align-items: center; gap: 24px; }
.compare { font-size: .875rem; color: var(--muted); display: flex; align-items: center; gap: 9px; }
input[type=checkbox] { accent-color: #956be0; width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.download, .load-more, .follow-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--accent); background: var(--inset); font-size: .875rem; font-weight: 550; text-decoration: none; padding: 10px 16px; text-align: center; }
.download:hover, .load-more:hover, .follow-button:hover { background: var(--accent-soft); border-color: var(--accent); }
.download.disabled { opacity: .4; pointer-events: none; }
body.busy .drop-zone { pointer-events: none; }
body.busy .canvas-area { opacity: .65; }
.community-panel>h2 { font-size: 1.75rem; margin-bottom: 22px; letter-spacing: -.8px; }
#community-notice { font-size: .875rem; color: var(--muted); }
#community-notice:empty { display: none; }
#community-notice.error { color: var(--error); }
.community-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; margin-top: 24px; }
.image-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--inset); box-shadow: inset 0 1px 0 var(--edge); transition: transform .2s, box-shadow .2s; }
.image-card:hover { transform: translateY(-3px); box-shadow: 0 16px 35px -20px #63459750, inset 0 1px 0 var(--edge); }
.image-card>img { display: block; width: 100%; height: 260px; object-fit: contain; background: var(--inset); }
.card-info { padding: 22px; }
.card-info h3 { margin: 0 0 10px; font-size: 1.0625rem; }
.author-link { font-size: .875rem; text-decoration: none; }
.author-link:hover { text-decoration: underline; }
.post-caption, .profile-bio { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.image-meta { font-size: .8125rem; color: var(--muted); line-height: 1.5; }
.card-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.card-actions .text-button { font-size: .8125rem; }
.danger { color: var(--error); }
.library-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--inset); }
.library-tabs a { font-size: .875rem; text-decoration: none; color: var(--muted); padding: 10px 16px; border-radius: 10px; }
.library-tabs a[aria-current=page] { background: var(--glass); color: var(--accent); box-shadow: inset 0 1px 0 var(--edge); }
.load-more { display: flex; margin: 28px auto 0; }
.profile-header { display: flex; align-items: flex-start; gap: 24px; margin: 28px 0; flex-wrap: wrap; }
.profile-header>div:nth-child(2) { flex: 1; min-width: 180px; }
.profile-header h3 { margin: 0 0 8px; font-size: 1.625rem; letter-spacing: -.6px; }
.profile-header p { margin: 8px 0; }
.profile-avatar { width: 96px; height: 96px; border-radius: 28px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); box-shadow: 0 8px 24px #0001; }
.avatar-placeholder { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 2rem; }
.account-form { display: grid; gap: 20px; min-width: 0; }
.account-form label, .share-form label { display: grid; gap: 9px; font-size: .875rem; color: var(--muted); }
.account-form input:not([type=checkbox]), .account-form textarea, .share-form input:not([type=checkbox]), .share-form textarea { width: 100%; min-width: 0; background: var(--inset); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; font: inherit; font-size: 1rem; transition: border-color .18s, box-shadow .18s; }
.account-form input:focus, .account-form textarea:focus, .share-form input:focus, .share-form textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 10%, transparent); outline: none; }
.account-form input[type=file] { font-size: .875rem; padding: 9px; }
input::file-selector-button { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-right: 12px; cursor: pointer; }
.account-form textarea, .share-form textarea { resize: vertical; }
.account-form .primary { margin: 0 auto; }
.account-form>p, .share-form>p { margin: 0; font-size: .875rem; line-height: 1.6; }
.account-form>p:empty, .share-form>p:empty { display: none; }
.profile-editor { max-width: 680px; margin: 28px 0 40px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--inset); }
.profile-editor h3 { margin: 0 0 4px; }
dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100svh - 40px); overflow-y: auto; padding: 36px; border-radius: 28px; background: var(--glass-strong); color: var(--text); }
dialog::backdrop { background: #08061270; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.auth-heading { position: relative; text-align: center; padding: 4px 0 10px; }
.auth-heading h2 { font-size: 1.875rem; letter-spacing: -1px; }
.auth-emblem { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 22px; color: var(--accent); border: 1px solid var(--line); border-radius: 22px; background: var(--accent-soft); box-shadow: inset 0 1px 0 var(--edge), 0 8px 28px #8c60d418; }
.auth-emblem svg { width: 30px; height: 30px; }
.dialog-close { display: grid; place-items: center; position: absolute; top: -17px; right: -17px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--inset); font-size: 25px; font-weight: 300; line-height: 1; }
.dialog-close:hover { background: var(--accent-soft); color: var(--text); }
#auth-submit, #auth-switch { width: 100%; max-width: none; margin: 0 auto; justify-self: center; text-align: center; justify-content: center; }
#auth-switch { min-height: 44px; padding: 10px; border-radius: 12px; }
#auth-switch:hover { background: var(--inset); }
#auth-error, #donate-error { text-align: center; }
.password-group { display: grid; gap: 9px; }
.password-field { display: block; position: relative; }
.password-field input { padding-right: 70px !important; }
#password-toggle { display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 0; right: 8px; height: 100%; min-width: 50px; border: 0; color: var(--accent); background: transparent; font-size: .8125rem; }
.donate-preview { display: block; width: 100%; height: 210px; object-fit: contain; background: var(--inset); border: 1px solid var(--line); border-radius: 16px; }
.consent { display: flex !important; align-items: flex-start; gap: 11px !important; line-height: 1.6; }
.consent input { margin-top: 3px; }
.share-form { margin-top: 32px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--inset); width: min(100%, 740px); align-self: center; }
.share-form h3 { font-size: 1.0625rem; margin: 0 0 18px; }
.share-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 18px; min-width: 0; }
.share-form .primary { margin: 0 auto; }
.share-form fieldset:disabled { opacity: .45; }
.empty-community { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 60px 20px; text-align: center; color: var(--muted); line-height: 1.7; font-size: .9375rem; }
.empty-community p { max-width: 380px; }
@supports not (backdrop-filter: blur(1px)) { .community-nav, .workspace, .community-panel { background: var(--glass-strong); } }
@media (max-width: 1000px) {
  main { padding: 24px; }
  .community-nav { flex-wrap: wrap; justify-content: center; }
  .community-links { justify-content: center; }
  .community-links:not([hidden]) + .account-controls { width: 100%; border-top: 1px solid var(--line); padding-top: 10px; }
  .community-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings { gap: 32px; }
}
@media (max-width: 640px) {
  main { padding: 16px 14px 32px; }
  .community-nav { padding: 8px; border-radius: 20px; gap: 10px; margin-bottom: 12px; }
  .community-links { gap: 0; }
  .community-nav a { padding: 10px 11px; font-size: .8125rem; }
  .flow-nav { gap: 2px; padding-bottom: 10px; margin-bottom: 16px; }
  .flow-step, .theme-toggle { padding: 9px 11px; font-size: .8125rem; }
  .theme-toggle { gap: 5px; }
  .workspace { padding: 18px; border-radius: 24px; }
  .community-panel { padding: 22px; border-radius: 24px; }
  .section-heading { gap: 10px; margin-bottom: 22px; }
  .section-heading h2 { font-size: 1.125rem; }
  .section-heading .text-button { font-size: .8125rem; }
  .upload-grid { grid-template-columns: 1fr; gap: 24px; }
  .drop-zone { height: 260px; border-radius: 18px; }
  .settings { grid-template-columns: 1fr; gap: 26px; padding-top: 24px; }
  .inputs>.primary { max-width: none; }
  .canvas-area { min-height: 300px; padding: 14px; border-radius: 17px; }
  .result-actions { align-items: stretch; flex-direction: column; gap: 16px; }
  .result-actions>.text-button { align-self: center; }
  .result-tools { justify-content: space-between; gap: 12px; }
  .community-grid { grid-template-columns: 1fr; gap: 20px; }
  .image-card>img { height: 260px; }
  .community-panel>h2 { font-size: 1.5rem; }
  .profile-editor, .share-form { padding: 20px; }
  .profile-avatar { width: 76px; height: 76px; border-radius: 22px; }
  dialog { padding: 30px 24px; border-radius: 25px; }
  .auth-heading h2 { font-size: 1.625rem; }
  .dialog-close { right: -10px; top: -14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
