:root {
      --bg: #0b1220;
      --bg-soft: #121a2b;
      --panel: rgba(255, 255, 255, 0.08);
      --panel-strong: rgba(255, 255, 255, 0.12);
      --text: #f8fafc;
      --muted: #cbd5e1;
      --subtle: #94a3b8;
      --accent: #ec4899;
      --accent-2: #f472b6;
      --success: #10b981;
      --border: rgba(255, 255, 255, 0.12);
      --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
      --radius-xl: 24px;
      --radius-lg: 18px;
      --radius-md: 14px;
    }

    * { box-sizing: border-box; }

    html, body {
      margin: 0;
      min-height: 100%;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background:
        radial-gradient(circle at top left, rgba(236,72,153,0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(59,130,246,0.14), transparent 24%),
        linear-gradient(180deg, #0b1220 0%, #111827 100%);
      color: var(--text);
    }

    .page {
      width: min(860px, calc(100% - 28px));
      margin: 24px auto 36px;
    }

    .hero {
      text-align: center;
      margin-bottom: 18px;
    }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      padding: 8px 14px;
      border-radius: 999px;
      background: rgba(236, 72, 153, 0.12);
      border: 1px solid rgba(244, 114, 182, 0.22);
      color: #fbcfe8;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.02em;
      margin-bottom: 14px;
    }

    h1 {
      margin: 0;
      font-size: clamp(30px, 6vw, 52px);
      line-height: 1.02;
      letter-spacing: -0.03em;
    }

    .hero p {
      width: min(640px, 100%);
      margin: 12px auto 0;
      color: var(--muted);
      font-size: 15px;
      line-height: 1.65;
    }

    .stack {
      display: grid;
      gap: 16px;
    }

    .panel {
      background: var(--panel);
      backdrop-filter: blur(14px);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .panel-body {
      padding: 20px;
    }

    .controls-grid {
      display: grid;
      gap: 14px;
    }

    .upload-card {
      border: 1.5px dashed rgba(255, 255, 255, 0.18);
      border-radius: var(--radius-lg);
      padding: 26px 18px;
      text-align: center;
      cursor: pointer;
      background: rgba(255,255,255,0.03);
      transition: 0.2s ease;
    }

    .upload-card:hover,
    .upload-card.dragging {
      transform: translateY(-1px);
      background: rgba(255,255,255,0.06);
      border-color: rgba(244,114,182,0.42);
      box-shadow: inset 0 0 0 1px rgba(244,114,182,0.14);
    }

    .upload-icon {
      width: 62px;
      height: 62px;
      margin: 0 auto 12px;
      border-radius: 20px;
      display: grid;
      place-items: center;
      font-size: 28px;
      background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(59,130,246,0.18));
      border: 1px solid rgba(255,255,255,0.1);
    }

    .upload-title {
      display: block;
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 4px;
    }

    .upload-sub {
      color: var(--subtle);
      font-size: 13px;
      line-height: 1.55;
    }

    #fileInput { display: none; }

    .file-pill {
      display: none;
      padding: 11px 12px;
      border-radius: 12px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.08);
      font-size: 13px;
      color: var(--muted);
      word-break: break-word;
    }

    .field {
      display: grid;
      gap: 8px;
    }

    .field-label {
      font-size: 13px;
      color: var(--muted);
      font-weight: 600;
    }

    .text-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
    }

    .text-input {
      width: 100%;
      padding: 13px 14px;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,0.1);
      background: rgba(255,255,255,0.05);
      color: var(--text);
      outline: none;
      font-size: 14px;
      transition: border-color 0.18s ease, box-shadow 0.18s ease;
    }

    .text-input::placeholder { color: #9ca3af; }

    .text-input:focus {
      border-color: rgba(244,114,182,0.45);
      box-shadow: 0 0 0 4px rgba(244,114,182,0.12);
    }

    .btn {
      appearance: none;
      border: 0;
      border-radius: 14px;
      height: 46px;
      padding: 0 18px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 700;
      transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
      white-space: nowrap;
    }

    .btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .btn:not(:disabled):hover { transform: translateY(-1px); }

    .btn-primary {
      color: white;
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      box-shadow: 0 10px 24px rgba(236,72,153,0.28);
    }

    .btn-secondary {
      width: 100%;
      color: #ecfdf5;
      background: linear-gradient(135deg, #059669, #10b981);
      box-shadow: 0 10px 24px rgba(16,185,129,0.22);
    }

    .range-row {
      display: grid;
      gap: 8px;
    }

    .range-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      font-size: 13px;
      color: var(--muted);
      font-weight: 600;
    }

    .range-value {
      color: var(--text);
    }

    input[type="range"] {
      width: 100%;
      accent-color: var(--accent);
      cursor: pointer;
    }

    .preview-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }

    .preview-head h2 {
      margin: 0;
      font-size: 18px;
      letter-spacing: -0.02em;
    }

    .preview-head p {
      margin: 4px 0 0;
      color: var(--subtle);
      font-size: 13px;
    }

    .status {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border-radius: 999px;
      background: rgba(255,255,255,0.05);
      border: 1px solid rgba(255,255,255,0.08);
      font-size: 12px;
      color: var(--muted);
      font-weight: 700;
    }

    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #64748b;
    }

    .status-dot.ready { background: var(--success); }

    .canvas-shell {
      min-height: 360px;
      border-radius: 22px;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,0.08);
      background:
        linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.04) 75%),
        linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.04) 75%),
        rgba(255,255,255,0.03);
      background-size: 24px 24px;
      background-position: 0 0, 12px 12px;
      display: grid;
      place-items: center;
      padding: 14px;
      position: relative;
    }

    .canvas-shell.empty::before {
      content: "Upload an image to preview your watermark";
      color: var(--subtle);
      font-size: 14px;
      text-align: center;
      max-width: 240px;
      line-height: 1.6;
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 20px;
    }

    canvas {
      display: none;
      max-width: 100%;
      max-height: 72vh;
      width: auto;
      height: auto;
      border-radius: 18px;
      box-shadow: 0 16px 48px rgba(0,0,0,0.28);
      background: white;
    }

    .canvas-shell.has-image canvas {
      display: block;
    }

    .download-wrap {
      margin-top: 14px;
    }

    @media (max-width: 640px) {
      .page {
        width: min(100% - 18px, 100%);
        margin: 14px auto 24px;
      }

      .panel-body { padding: 16px; }
      .hero p { font-size: 14px; }
      .text-row { grid-template-columns: 1fr; }
      .btn { width: 100%; }
      .canvas-shell { min-height: 280px; }
      canvas { max-height: 58vh; }
    }