/* Inkso Watermark — image.html */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('vendor/fonts/outfit-latin-var.woff2') format('woff2');
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--inkso-washi);
  color: var(--inkso-sumi);
}

/* ---------- header ---------- */
#i-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--inkso-kinari);
  border-bottom: 1px solid var(--inkso-divider);
}
.i-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--inkso-ai);
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.i-switch:hover { background: rgba(42,74,115,.08); border-color: rgba(42,74,115,.25); }
.i-switch-ico { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.i-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.i-brand svg { width: 30px; height: 30px; }
.i-brand-name { font-size: 19px; font-weight: 600; color: var(--inkso-sumi); white-space: nowrap; }
.i-brand-name .bn-ink { color: var(--inkso-ai); }
.i-brand-name .bn-so { color: var(--inkso-ai-tint); }
.i-brand-name .bn-tm { font-size: .5em; vertical-align: super; color: var(--inkso-ai-tint); }

.i-tagline { flex: 1; margin: 0; font-size: 13px; color: var(--inkso-cha); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.i-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.i-actions button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(192,70,46,.45);
  background: #fff;
  color: var(--inkso-shu);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.i-actions button:hover { background: rgba(192,70,46,.08); border-color: var(--inkso-shu); }
.i-actions button.primary { background: var(--inkso-shu); color: #fff; border-color: var(--inkso-shu); }
.i-actions button.primary:hover { background: var(--inkso-shu-hover); }

/* ---------- mode switch (Watermark / Signature) ---------- */
.i-modeseg { display: inline-flex; border: 1px solid var(--inkso-divider); border-radius: 8px; overflow: hidden; }
.i-actions .i-modebtn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 13px; border: none; border-radius: 0;
  background: #fff; color: var(--inkso-ai); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.i-actions .i-modebtn + .i-modebtn { border-left: 1px solid var(--inkso-divider); }
.i-actions .i-modebtn.active { background: var(--inkso-ai); color: #fff; }
.i-actions .i-modebtn:not(.active):hover { background: rgba(42,74,115,.08); border-color: transparent; }

/* ---------- watermark / signature toolbars ---------- */
#i-toolbar, #i-sig-toolbar {
  position: sticky;
  top: 52px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--inkso-washi);
  border-bottom: 1px solid var(--inkso-divider);
}
#i-toolbar[hidden], #i-sig-toolbar[hidden] { display: none; }
.i-hint { font-size: 12px; color: var(--inkso-cha); }
#wm-text {
  flex: 1 1 200px;
  min-width: 140px;
  max-width: 340px;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--inkso-divider);
  border-radius: 8px;
  background: #fff;
  color: var(--inkso-sumi);
  outline: none;
}
#wm-text:focus { border-color: var(--inkso-ai); }
#i-toolbar select, #i-sig-toolbar select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 7px;
  border: 1px solid var(--inkso-divider);
  border-radius: 6px;
  background: #fff;
  color: var(--inkso-sumi);
  cursor: pointer;
}
.i-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--inkso-cha);
  white-space: nowrap;
}
.i-field input[type="range"] { width: 96px; accent-color: var(--inkso-shu); cursor: pointer; }
.i-sep { width: 1px; height: 22px; background: var(--inkso-divider); margin: 0 2px; }

/* bold / italic / underline toggles */
.i-tbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-family: inherit; font-size: 14px;
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--inkso-divider); border-radius: 6px;
  background: #fff; color: var(--inkso-sumi);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.i-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.i-tbtn:hover { background: rgba(192,70,46,.06); border-color: rgba(192,70,46,.4); }
.i-tbtn[aria-pressed="true"] { background: var(--inkso-shu); color: #fff; border-color: var(--inkso-shu); }
.i-tbtn b, .i-tbtn i, .i-tbtn u { font-style: normal; font-weight: 400; }
.i-tbtn b { font-weight: 800; }
.i-tbtn i { font-style: italic; }
.i-tbtn u { text-decoration: underline; }

/* © ® ™ insert group */
.i-symgroup { display: inline-flex; align-items: center; gap: 4px; }
.i-symbtn { font-size: 15px; }
#wm-sym-super sup { font-size: .62em; }

/* colour control: preset palette popover + custom picker (mirrors the Writer) */
.i-color { position: relative; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--inkso-cha); }
#wm-color-btn, #sig-color-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px; border: 1px solid var(--inkso-divider); border-radius: 6px;
  background: #fff; cursor: pointer;
}
#wm-color-btn:hover, #sig-color-btn:hover { border-color: var(--inkso-ai); }
.i-color-chip {
  display: block; width: 22px; height: 18px; border-radius: 4px;
  border: 1px solid rgba(33,30,28,.25); background: #fff;
}
#wm-color-pop, #sig-color-pop {
  position: absolute;
  top: 36px; left: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--inkso-divider);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(33,30,28,.22);
  padding: 10px;
  width: max-content;
}
#wm-color-pop[hidden], #sig-color-pop[hidden] { display: none; }
.i-swatches { display: grid; grid-template-columns: repeat(4, 24px); gap: 7px; }
.i-sw {
  width: 24px; height: 24px; min-width: 0;
  padding: 0; border-radius: 6px;
  border: 1px solid rgba(33,30,28,.18);
  cursor: pointer; transition: transform .1s;
}
.i-sw:hover { transform: scale(1.12); }
.i-custom {
  display: flex; align-items: center; gap: 7px;
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid var(--inkso-divider);
  font-size: 12px; color: var(--inkso-cha); cursor: pointer;
}
.i-custom input[type="color"] {
  width: 28px; height: 22px; padding: 0;
  border: 1px solid var(--inkso-divider); border-radius: 5px;
  background: none; cursor: pointer;
}
#wm-center {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 11px; border-radius: 7px;
  border: 1px solid rgba(42,74,115,.35); background: #fff; color: var(--inkso-ai);
  cursor: pointer; transition: background .15s, border-color .15s;
}
#wm-center:hover { background: rgba(42,74,115,.08); border-color: var(--inkso-ai); }
#wm-remove {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 11px; border-radius: 7px;
  border: 1px solid rgba(192,70,46,.4); background: #fff; color: var(--inkso-shu);
  cursor: pointer; transition: background .15s, border-color .15s;
}
#wm-remove:hover { background: rgba(192,70,46,.08); border-color: var(--inkso-shu); }
#sig-undo, #sig-remove {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 11px; border-radius: 7px;
  border: 1px solid rgba(192,70,46,.4); background: #fff; color: var(--inkso-shu);
  cursor: pointer; transition: background .15s, border-color .15s;
}
#sig-undo { border-color: rgba(42,74,115,.35); color: var(--inkso-ai); }
#sig-undo:hover { background: rgba(42,74,115,.08); border-color: var(--inkso-ai); }
#sig-remove:hover { background: rgba(192,70,46,.08); border-color: var(--inkso-shu); }
.i-apply-note { margin-left: auto; font-size: 12.5px; color: var(--inkso-cha); }
.i-apply-note b { color: var(--inkso-ai); }

/* ---------- main / stage ---------- */
#i-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 16px;
  gap: 18px;
  min-height: 0;
}

#dropzone {
  margin: auto;
  max-width: 520px;
  text-align: center;
  border: 2px dashed var(--inkso-divider);
  border-radius: 16px;
  padding: 48px 34px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
#dropzone.drag { border-color: var(--inkso-ai); background: rgba(42,74,115,.05); }
#dropzone .dz-logo { width: 56px; height: 56px; margin-bottom: 10px; }
#dropzone h2 { margin: 4px 0 4px; font-size: 22px; font-weight: 600; }
#dropzone p { margin: 4px 0; color: var(--inkso-cha); font-size: 14px; }
#dropzone .primary {
  margin: 8px 0 4px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 10px 20px; border-radius: 9px;
  border: none; background: var(--inkso-shu); color: #fff; cursor: pointer;
}
#dropzone .primary:hover { background: var(--inkso-shu-hover); }
#dropzone .dz-hint { margin-top: 14px; font-size: 12.5px; line-height: 1.5; }

#stage-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 0;
}
#stage {
  position: relative;
  display: inline-block;
  line-height: 0;
  box-shadow: 0 6px 28px rgba(33,30,28,.22);
  background:
    repeating-conic-gradient(#e9e3d6 0% 25%, #f5f0e6 0% 50%) 0 / 22px 22px; /* checker = transparency */
}
#stage-img {
  display: block;
  max-width: min(100%, 1100px);
  max-height: calc(100vh - 320px);
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* watermark overlay: a <canvas> drawn with the SAME routine as the download,
 * so the on-screen preview is pixel-for-pixel what gets saved. */
#wm-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: move;
}
#wm-canvas[hidden] { display: none; }

/* ---------- filmstrip ---------- */
#filmstrip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 1100px;
  padding: 4px 2px 0;
}
.thumb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
  flex: none;
  box-shadow: 0 1px 5px rgba(33,30,28,.14);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { border-color: var(--inkso-shu); }
.thumb-x {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border: none; border-radius: 50%;
  background: rgba(33,30,28,.66); color: #fff;
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.thumb-x:hover { background: var(--inkso-shu); }
.thumb-add {
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--inkso-ai); font-weight: 300;
  border: 2px dashed var(--inkso-divider);
  box-shadow: none;
}
.thumb-add:hover { border-color: var(--inkso-ai); background: rgba(42,74,115,.05); }

/* ---------- toast ---------- */
#i-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--inkso-sumi);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(33,30,28,.32);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity .25s ease, transform .25s ease;
}
#i-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- status + footer ---------- */
#i-status {
  margin: 0;
  padding: 4px 18px;
  min-height: 20px;
  font-size: 12.5px;
  color: var(--inkso-cha);
  text-align: center;
}
#i-footer {
  padding: 14px 18px 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--inkso-cha);
  border-top: 1px solid var(--inkso-divider);
}
#i-footer a { color: var(--inkso-ai); text-decoration: none; }
#i-footer a:hover { text-decoration: underline; }

@media (max-width: 680px) {
  #i-header { flex-wrap: wrap; }
  .i-tagline { order: 3; flex-basis: 100%; white-space: normal; }
  #stage-img { max-height: calc(100vh - 360px); }
}

/* ---------- after-download reward modal (mirrors the rest of Inkso) ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 14, 22, .6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }

.reward-box {
  position: relative;
  background: var(--inkso-washi);
  color: var(--inkso-sumi);
  border-radius: 16px;
  padding: 28px 28px 22px;
  max-width: 440px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 14px 55px rgba(33,30,28,.45);
}
.reward-box h3 { margin: 0 0 8px; font-size: 21px; font-weight: 600; line-height: 1.25; }
.reward-sub { margin: 0 0 18px; font-size: 14px; color: var(--inkso-cha); line-height: 1.5; }
.reward-emoji { font-size: 40px; line-height: 1; margin-bottom: 6px; }
.reward-view.hidden { display: none; }

.reward-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 16px;
  color: var(--inkso-cha); cursor: pointer; line-height: 1; padding: 4px;
}
.reward-back {
  position: absolute; top: 14px; left: 14px;
  background: none; border: none; font-size: 14px;
  color: var(--inkso-ai); cursor: pointer; padding: 4px;
}

.rate-block { margin: 2px 0 16px; }
.rate-label { display: block; font-size: 13px; color: var(--inkso-cha); margin-bottom: 8px; }
.rate-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.stars { display: flex; justify-content: center; gap: 6px; }
.star { background: none; border: none; padding: 2px; cursor: pointer; line-height: 0; }
.star svg { width: 32px; height: 32px; fill: none; stroke: var(--inkso-shu); stroke-width: 1.5; stroke-linejoin: round; transition: fill .12s, transform .1s; }
.star:hover svg { transform: scale(1.12); }
.star.on svg { fill: var(--inkso-shu); }
.rate-thanks { margin: 12px 0 0; font-size: 13.5px; color: var(--inkso-ai); font-weight: 500; }

.fb-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; color: var(--inkso-shu);
  border: 1px solid rgba(192,70,46,.45); border-radius: 7px;
  padding: 6px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.fb-chip:hover { background: rgba(192,70,46,.08); border-color: var(--inkso-shu); }
.fb-chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.reward-later {
  display: block; margin: 16px auto 0;
  background: none; border: none; color: var(--inkso-cha);
  font-size: 12.5px; cursor: pointer; text-decoration: underline;
}

#reward-modal textarea,
#reward-modal input[type="email"] {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--inkso-divider); border-radius: 8px;
  padding: 10px; font-family: inherit; font-size: 14px;
  background: #fff; color: var(--inkso-sumi); margin-bottom: 10px; outline: none;
}
#reward-modal textarea { resize: vertical; }
#reward-modal textarea:focus,
#reward-modal input[type="email"]:focus { border-color: var(--inkso-ai); }
#reward-modal .primary {
  width: 100%; border: none; border-radius: 8px; cursor: pointer;
  padding: 10px 16px; font-family: inherit; font-size: 14px; font-weight: 600;
  background: var(--inkso-shu); color: #fff;
}
#reward-modal .primary:hover { background: var(--inkso-shu-hover); }
.reward-note { font-size: 12.5px; color: var(--inkso-cha); margin: 10px 0 0; min-height: 1em; }

.bmc-btn {
  display: inline-block;
  margin: 8px 0 2px;
  padding: 12px 24px;
  background: var(--inkso-shu);
  color: #fff;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.bmc-btn:hover { background: var(--inkso-shu-hover); }
.bmc-btn.disabled { background: var(--inkso-divider); color: var(--inkso-cha); pointer-events: none; font-weight: 500; font-size: 13px; }
.bmc-banner { display: block; width: 100%; box-sizing: border-box; margin: 4px 0 8px; }
.bmc-banner + .reward-note { margin-top: 0; }
