:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --ink: #14181f;
  --muted: #5b6572;
  --accent: #8cb1db;        /* muted blue */
  --accent-ink: #46719c;    /* darker shade for text/links */
  --accent-soft: #eef4fa;   /* pale tint for hovers/active */
  --line: #e7eaf0;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 13px 20px;
  display: flex; align-items: center; gap: 24px;
}
.logo {
  font-weight: 800; font-size: 1.12rem; text-decoration: none; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.logo .dot { width: 13px; height: 13px; border-radius: 4px; background: var(--accent); display: inline-block; }
.navlink { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .94rem; }
.navlink:hover { color: var(--ink); }
.navlink.active { color: var(--accent-ink); }
.nav-spacer { flex: 1; }
.nav-tag { font-size: .76rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
@media (max-width: 560px) {
  .nav-inner { gap: 14px; }
  .nav-tag { display: none; }
}

/* ---------- Landing ---------- */
.hero { text-align: center; padding: 50px 0 22px; }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); line-height: 1.15; margin: 0 0 10px; }
.hero h1 span { color: var(--accent-ink); }
.hero p { color: var(--muted); font-size: 1.08rem; max-width: 560px; margin: 0 auto; }

.bigcards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 30px 0 14px; }
@media (max-width: 700px) { .bigcards { grid-template-columns: 1fr; } }
.bigcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; text-decoration: none; color: var(--ink); display: block;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.bigcard:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(70, 113, 156, .12); border-color: var(--accent); }
.bigcard .emoji { font-size: 1.9rem; }
.bigcard h2 { margin: 10px 0 4px; font-size: 1.25rem; }
.bigcard p { color: var(--muted); margin: 0 0 10px; font-size: .95rem; }
.bigcard ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.bigcard .go { display: inline-block; margin-top: 12px; font-weight: 700; color: var(--accent-ink); }

.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0 30px; }
@media (max-width: 700px) { .trust { grid-template-columns: 1fr; } }
.trust div {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 18px; font-size: .92rem; color: var(--muted);
}
.trust b { color: var(--ink); display: block; margin-bottom: 2px; }

/* ---------- Tool pages: sidebar layout ---------- */
.page-head { padding: 28px 0 4px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.7rem; }
.page-head p { color: var(--muted); margin: 0; font-size: .96rem; }

.tool-layout { display: grid; grid-template-columns: 205px 1fr; gap: 22px; align-items: start; margin-top: 18px; }
.tool-layout > *,
.tool-main { min-width: 0; }
.side { position: sticky; top: 74px; }
.side-nav {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.side-nav a {
  appearance: none; border: none; background: none; text-align: left; text-decoration: none;
  font: inherit; font-size: .93rem; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  transition: background .12s ease, color .12s ease;
}
.side-nav a:hover { background: var(--accent-soft); color: var(--ink); }
.side-nav a.on { background: var(--accent); color: #10233a; }

@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .side-nav { flex-direction: row; overflow-x: auto; max-width: 100%; width: 100%; }
  .side-nav a { white-space: nowrap; }
  .side-ad { display: none; }
}

/* panels */
.panel { display: none; }
.panel.active { display: block; }

.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin: 0 0 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.tool-card > h2 { margin: 0 0 4px; font-size: 1.12rem; display: flex; align-items: center; gap: 10px; }
.tool-card > h2 .chip {
  font-size: .68rem; font-weight: 700; color: #10233a;
  background: var(--accent); border-radius: 6px; padding: 2px 8px;
}
.tool-card > p.desc { color: var(--muted); margin: 2px 0 12px; font-size: .9rem; }

.dropzone {
  border: 2px dashed var(--accent); border-radius: var(--radius);
  padding: 40px 22px; text-align: center; cursor: pointer;
  background: #fbfcfe; transition: all .15s ease; color: var(--muted);
}
.dropzone b { color: var(--ink); }
.dropzone.drag { border-color: var(--accent-ink); background: var(--accent-soft); }
.dropzone .hint { font-size: .84rem; margin-top: 5px; }

.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; font-size: .91rem;
  padding: 9px 15px; border-radius: var(--radius); cursor: pointer;
  transition: all .13s ease;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn.primary { background: var(--accent); color: #10233a; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: #c2374b; }
.btn:disabled, select:disabled { opacity: .48; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip-btn {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  padding: 6px 13px; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; color: var(--muted);
}
.chip-btn.on { border-color: var(--accent-ink); color: var(--accent-ink); background: var(--accent-soft); }

.range-row { display: grid; grid-template-columns: 100px 1fr 60px; align-items: center; gap: 12px; margin: 8px 0; font-size: .89rem; }
.range-row label { color: var(--muted); font-weight: 600; }
.range-row output { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent-ink); }
input[type="color"] { width: 44px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 2px; cursor: pointer; }
input[type="number"], select {
  font: inherit; font-size: .89rem; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.inline-controls { display: flex; flex-wrap: wrap; gap: 13px; align-items: center; margin: 10px 0; font-size: .89rem; }
.inline-controls label { color: var(--muted); font-weight: 600; }

/* preview */
.preview-wrap {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: auto;
  display: flex; justify-content: center; align-items: center;
  max-height: 420px; padding: 12px;
}
.checker {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Crect width='11' height='11' fill='%23e9ebf1'/%3E%3Crect x='11' y='11' width='11' height='11' fill='%23e9ebf1'/%3E%3C/svg%3E");
  background-size: 22px 22px;
}
#preview { max-width: 100%; max-height: 392px; display: block; }
.meta { color: var(--muted); font-size: .84rem; margin-top: 9px; }

/* crop */
#cropStage { display: none; margin-top: 13px; max-height: 460px; }
#cropStage img { display: block; max-width: 100%; }
#cropStage.circle .cropper-view-box,
#cropStage.circle .cropper-face { border-radius: 50%; }
.cropper-view-box { outline-color: var(--accent); }
.cropper-line, .cropper-point { background-color: var(--accent); }

.progress { height: 8px; background: #edf0f6; border-radius: 99px; overflow: hidden; margin-top: 12px; display: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent-ink); transition: width .2s ease; }
.status-line { font-size: .84rem; color: var(--muted); margin-top: 8px; min-height: 1.2em; }

/* pdf lists */
.pdf-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pdf-list li {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin: 8px 0; background: #fff; cursor: grab; font-size: .92rem;
}
.pdf-list li .grip { color: #aab3c2; font-size: 1.05rem; cursor: grab; }
.pdf-list li .name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-list li .sub { color: var(--muted); font-size: .81rem; white-space: nowrap; }
.pdf-list li .x { border: none; background: none; color: #c2374b; font-size: 1rem; cursor: pointer; padding: 2px 6px; }
.sortable-ghost { opacity: .4; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 12px; margin-top: 13px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 4px; background: #fff; cursor: grab; text-align: center; }
.thumb canvas { width: 100%; border-radius: 6px; display: block; }
.thumb .pnum { font-size: .74rem; color: var(--muted); padding: 3px 0 1px; }
.thumb .x {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255,255,255,.95);
  color: #c2374b; font-size: .78rem; line-height: 1; cursor: pointer;
}
.thumb.removed { opacity: .35; filter: grayscale(1); }
.thumb.removed .x { color: #2c7a4b; }

.reader-frame {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #f1f3f7; overflow: auto; padding: 14px; max-height: 680px;
}
.reader-frame canvas {
  display: block; margin: 0 auto; max-width: none;
  background: #fff; box-shadow: 0 2px 10px rgba(16, 24, 40, .12);
}

/* ---------- Ads ---------- */
.ad-box { margin: 18px 0; text-align: center; }
.ad-leader { margin: 16px 0 22px; min-height: 90px; }
.ad-box .ad-label {
  display: block; font-size: .66rem; text-transform: uppercase;
  color: #aab3c2; margin-bottom: 4px;
}
.side-ad { margin-top: 14px; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
ins.adsbygoogle[data-ad-status="unfilled"] + script { display: none; }
.ad-box:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }

body:not(.has-image) .image-only,
body.has-image .no-image,
body.has-docs .no-docs { display: none; }
.empty-note {
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid #dbe7f3;
  border-radius: var(--radius);
  display: block;
  font-size: .86rem;
  margin: 10px 0 12px;
  padding: 8px 10px;
}

/* toast + footer */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
  background: #14181f; color: #fff; padding: 11px 20px; border-radius: 99px;
  font-size: .9rem; opacity: 0; transition: all .25s ease; z-index: 99;
  pointer-events: none; max-width: 84vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #b3261e; }

footer { border-top: 1px solid var(--line); margin-top: 46px; padding: 22px 0 30px; color: var(--muted); font-size: .85rem; text-align: center; }
footer a { color: var(--muted); }

.hidden { display: none !important; }
.note { font-size: .83rem; color: var(--muted); }
