:root {
  color-scheme: dark;
  --bg: #080b14;
  --panel: rgba(17, 21, 35, .82);
  --panel-strong: #111522;
  --line: rgba(175, 190, 225, .13);
  --line-strong: rgba(157, 138, 255, .35);
  --text: #f4f1ff;
  --muted: #969caf;
  --purple: #9c83ff;
  --cyan: #6ee7f5;
  --danger: #ff8fa3;
  --success: #78efb1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
  background: var(--bg);
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}
.ambient { position: fixed; width: 42rem; height: 42rem; border-radius: 50%; filter: blur(90px); pointer-events: none; opacity: .13; }
.ambient-one { top: -18rem; right: -12rem; background: #795bff; }
.ambient-two { top: 36rem; left: -24rem; background: #1daec0; }

.site-header, .page-shell, .site-footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; position: relative; }
.site-header { height: 86px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: .08em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(156,131,255,.5); border-radius: 10px; transform: rotate(45deg); }
.brand-mark i { width: 9px; height: 9px; border: 2px solid var(--cyan); border-radius: 50%; }
.header-note { display: flex; align-items: center; gap: 9px; color: #777f94; font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; }
.header-note span { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px var(--success); }

.page-shell { padding: 92px 0 110px; }
.intro { max-width: 870px; margin-bottom: 62px; }
.kicker { margin: 0 0 18px; color: var(--purple); font-size: .72rem; font-weight: 700; letter-spacing: .22em; }
h1 { margin: 0; font-size: clamp(3rem, 7.1vw, 6.25rem); line-height: .98; letter-spacing: -.065em; font-weight: 720; }
h1 em { color: transparent; font-style: normal; -webkit-text-stroke: 1px rgba(194, 181, 255, .78); }
.intro-copy { max-width: 660px; margin: 28px 0 24px; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }
.intro-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.intro-tags span { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: #aeb4c7; font-size: .78rem; }

#watermarkForm { display: grid; grid-template-columns: 1.08fr .92fr; gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 26px; background: linear-gradient(145deg, rgba(19,24,40,.93), rgba(12,15,26,.93)); box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.source-panel, .settings-panel { padding: clamp(22px, 3.3vw, 38px); }
.panel-heading { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.panel-heading > div:first-child { display: flex; align-items: center; gap: 12px; }
.panel-heading h2 { margin: 0; font-size: 1.18rem; }
.step { color: var(--purple); font-size: .7rem; font-weight: 800; letter-spacing: .1em; }
.short-tip { color: #7f879c; font-size: .75rem; }
.source-tabs { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,6,12,.36); }
.source-tab { padding: 7px 11px; border: 0; border-radius: 8px; color: #858da2; background: transparent; font-size: .75rem; cursor: pointer; }
.source-tab.active { color: #eeeaff; background: rgba(156,131,255,.17); }

.drop-zone { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 1px dashed rgba(156,131,255,.38); border-radius: 20px; background: radial-gradient(circle at center, rgba(123,101,234,.08), transparent 55%); cursor: pointer; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--purple); background-color: rgba(156,131,255,.07); transform: translateY(-2px); }
.drop-zone strong { font-size: 1rem; }
.drop-zone > span:last-child { color: #7c8498; font-size: .8rem; }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 8px; color: var(--purple); border-radius: 18px; background: rgba(156,131,255,.12); }
.upload-icon svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.source-view.hidden, .hidden { display: none !important; }
.url-field { display: flex; gap: 10px; }
.url-field input { flex: 1; }

.file-summary { display: flex; align-items: center; gap: 13px; margin-top: 14px; padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.file-summary img { width: 50px; height: 50px; border-radius: 10px; object-fit: cover; background: #05070d; }
.file-info { min-width: 0; flex: 1; }
.file-info strong, .file-info span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info strong { font-size: .84rem; }
.file-info span { margin-top: 5px; color: #7e869a; font-size: .72rem; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 50%; color: #9299aa; background: rgba(255,255,255,.05); cursor: pointer; font-size: 1.2rem; }

.field-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; color: #c6c9d5; font-size: .8rem; font-weight: 620; }
.field-label b { color: var(--purple); font-size: .68rem; }
input[type="text"], input[type="url"], select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--text); background: rgba(4,6,12,.5); transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: rgba(156,131,255,.65); box-shadow: 0 0 0 3px rgba(156,131,255,.09); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8f95a8 50%), linear-gradient(135deg, #8f95a8 50%, transparent 50%); background-position: calc(100% - 17px) 21px, calc(100% - 12px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.payload-field { position: relative; }
.payload-field input { padding-right: 61px; }
.payload-field > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #696f81; font-size: .7rem; }
.payload-field b { color: #b7bdd0; }
.field-hint, .privacy-note { color: #70788c; font-size: .72rem; line-height: 1.55; }
.field-hint { margin: 8px 0 25px; }
.setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 19px 13px; }
.setting-grid label, .strength-field { display: block; }
.disabled-field { opacity: .42; }
input[type="range"] { width: 100%; accent-color: var(--purple); cursor: pointer; }
.strength-field { margin-top: 25px; }
.range-labels { display: flex; justify-content: space-between; margin-top: 5px; color: #666e80; font-size: .64rem; }
.range-labels i { font-style: normal; }
.range-labels i:nth-child(2) { color: #8f95a8; }

.primary-button, .download-button { height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 14px; font-weight: 700; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.primary-button { width: 100%; margin-top: 27px; color: #0b0c12; background: linear-gradient(120deg, #b6a5ff, #78e8ef); box-shadow: 0 14px 34px rgba(121,112,229,.2); }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(121,112,229,.3); }
.primary-button:disabled { cursor: wait; opacity: .72; transform: none; }
.primary-button svg, .download-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button-loading { display: none; align-items: center; gap: 9px; }
.button-loading i { width: 15px; height: 15px; border: 2px solid rgba(8,11,20,.25); border-top-color: #080b14; border-radius: 50%; animation: spin .75s linear infinite; }
.primary-button.loading .button-label, .primary-button.loading > svg { display: none; }
.primary-button.loading .button-loading { display: flex; }
.form-message { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: .76rem; text-align: center; }
.privacy-note { margin: 11px 12px 0; text-align: center; }
.quiet-button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; color: #c0c5d3; background: rgba(255,255,255,.025); cursor: pointer; }

.result-section { margin-top: 72px; padding-top: 70px; border-top: 1px solid var(--line); scroll-margin-top: 30px; }
.result-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.result-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.04em; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.preview-card { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #060810; }
.preview-card > div { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-bottom: 1px solid var(--line); color: #9ba2b5; font-size: .75rem; }
.preview-card > div span:last-child { color: #686f81; }
.result-card { border-color: rgba(121,232,239,.24); }
.result-card > div span:last-child { color: var(--success); }
.preview-card img { width: 100%; height: min(36vw, 430px); display: block; object-fit: contain; background-image: linear-gradient(45deg,#0b0e17 25%,transparent 25%),linear-gradient(-45deg,#0b0e17 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#0b0e17 75%),linear-gradient(-45deg,transparent 75%,#0b0e17 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
.result-bar { display: grid; grid-template-columns: 1.25fr 1fr 1fr .8fr auto; gap: 14px; align-items: center; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.metric { min-width: 0; padding-left: 15px; border-left: 1px solid var(--line); }
.metric span, .metric strong { display: block; }
.metric span { margin-bottom: 6px; color: #747c90; font-size: .68rem; }
.metric strong { overflow: hidden; color: #e4e1ed; font-size: .86rem; white-space: nowrap; text-overflow: ellipsis; }
.metric strong b { font-weight: inherit; }
.download-button { padding: 0 20px; color: #0b0c12; text-decoration: none; background: linear-gradient(120deg,#b6a5ff,#78e8ef); }
.site-footer { display: flex; justify-content: space-between; padding: 24px 0 36px; border-top: 1px solid var(--line); color: #5d6475; font-size: .7rem; letter-spacing: .12em; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  .page-shell { padding-top: 70px; }
  #watermarkForm { grid-template-columns: 1fr; }
  .drop-zone { min-height: 285px; }
  .result-bar { grid-template-columns: repeat(2, 1fr); }
  .download-button { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .site-header, .page-shell, .site-footer { width: min(100% - 24px, 1180px); }
  .site-header { height: 72px; }
  .header-note { display: none; }
  .page-shell { padding: 54px 0 74px; }
  .intro { margin-bottom: 38px; }
  h1 { font-size: clamp(2.65rem, 13vw, 4rem); }
  .intro-copy { font-size: .95rem; }
  .panel { border-radius: 20px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .source-tabs { width: 100%; }
  .source-tab { flex: 1; }
  .drop-zone { min-height: 230px; }
  .setting-grid { grid-template-columns: 1fr; }
  .url-field { flex-direction: column; }
  .preview-grid { grid-template-columns: 1fr; }
  .preview-card img { height: 72vw; }
  .result-heading { align-items: flex-start; flex-direction: column; }
  .result-bar { grid-template-columns: 1fr 1fr; }
  .metric { padding-left: 10px; }
  .site-footer { gap: 12px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation-duration: .01ms !important; transition: none !important; } }
