/* WizSwiss — Swiss-inspired: clean grid, strong type, one red accent. */
:root {
  --red: #e11d2e;
  --red-dark: #b91524;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --muted: #7a808c;
  --line: #e4e6ea;
  --bg: #f7f7f5;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef0f3;
    --ink-2: #c2c7d0;
    --muted: #8d94a1;
    --line: #2a2e36;
    --bg: #111317;
    --card: #191c22;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { font-size: 1.3rem; color: var(--ink); letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo b { color: var(--red); }
.logo-mark { background: var(--red); width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.logo-mark svg { display: block; }
.header-nav { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; }
.header-nav a { color: var(--ink-2); font-size: 0.92rem; white-space: nowrap; }
.header-nav a:hover { color: var(--red); text-decoration: none; }

/* Home */
.home-hero { padding: 64px 0 36px; text-align: center; }
.home-hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: -0.04em; line-height: 1.05; margin: 0 0 14px; }
.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 640px; margin: 0 auto; }
.search-box { max-width: 560px; margin: 28px auto 0; }
.search-box input { width: 100%; font: inherit; font-size: 1.05rem; padding: 16px 20px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); outline: none; box-shadow: var(--shadow); }
.search-box input:focus { border-color: var(--red); }
.category { margin: 36px 0; }
.category h2, .related h2 { font-size: 1.25rem; letter-spacing: -0.02em; margin: 0 0 14px; }

/* Tool cards */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tool-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); transition: border-color 0.15s, transform 0.15s; }
.tool-card:hover { border-color: var(--red); transform: translateY(-2px); text-decoration: none; }
.tool-icon { font-size: 1.6rem; line-height: 1; }
.tool-text { display: flex; flex-direction: column; gap: 2px; }
.tool-text small { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }

/* Tool page */
.crumbs { font-size: 0.85rem; color: var(--muted); margin: 18px 0 0; }
.crumbs a { color: var(--muted); }
.tool-hero { padding: 22px 0 18px; }
.tool-hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); letter-spacing: -0.03em; margin: 0 0 8px; line-height: 1.15; }
.tool-hero .lead { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.badges span { font-size: 0.8rem; background: var(--card); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; color: var(--ink-2); }
.tool-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.about-tool { margin: 36px 0; max-width: 760px; color: var(--ink-2); }
.about-tool h2 { color: var(--ink); font-size: 1.3rem; letter-spacing: -0.02em; margin-top: 28px; }
.about-tool h3 { color: var(--ink); font-size: 1.05rem; margin: 18px 0 4px; }
.related { margin: 36px 0 48px; }
.page { padding: 36px 20px 60px; max-width: 760px; }

/* Shared form controls used by tools */
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; }
.stack { display: grid; gap: 12px; }
label { font-weight: 600; font-size: 0.92rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"]:not(#tool-search), select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); }
textarea { width: 100%; min-height: 220px; resize: vertical; font-family: inherit; }
textarea.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
input[type="range"] { accent-color: var(--red); width: 200px; }
input[type="checkbox"] { accent-color: var(--red); width: 18px; height: 18px; }
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; background: var(--red); color: #fff; transition: background 0.15s; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.secondary:hover { border-color: var(--red); color: var(--red); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--red); background: rgba(225, 29, 46, 0.04); }
.dropzone b { display: block; font-size: 1.1rem; margin-bottom: 4px; }
.dropzone input { display: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 10px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; letter-spacing: -0.02em; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.result { background: var(--bg); border-radius: 10px; padding: 16px; font-size: 1.15rem; }
.result b { color: var(--red); }
.file-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 10px; background: var(--bg); padding: 10px 12px; border-radius: 10px; font-size: 0.92rem; }
.file-list li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list li button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 2px 6px; }
.file-list li button:hover { color: var(--red); }
.preview-img { max-width: 100%; max-height: 360px; border-radius: 10px; display: block; margin: 12px auto; }
.error { color: var(--red); font-weight: 600; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; z-index: 50; }

/* PDF page thumbnails */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.page-thumb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; background: var(--bg); border: 2px solid transparent; border-radius: 10px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color 0.15s, opacity 0.15s; }
.page-thumb:hover { border-color: var(--line); }
.page-canvas { display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1.3; }
.page-canvas canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); transition: transform 0.2s; background: #fff; }
.page-num { font-size: 0.8rem; color: var(--muted); }
.page-mark { position: absolute; top: 6px; right: 6px; font-size: 0.8rem; font-weight: 700; }
.page-thumb.selected { border-color: var(--red); }
.page-thumb.selected .page-mark::after { content: "✓"; background: var(--red); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.page-thumb.deleted { opacity: 0.45; border-color: var(--red); }
.page-thumb.deleted .page-canvas { position: relative; }
.page-thumb.deleted .page-canvas::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; color: var(--red); font-weight: 700; }
.loading { color: var(--muted); padding: 20px 0; text-align: center; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; width: 0; background: var(--red); transition: width 0.2s; }

/* Image cropper */
.crop-stage { position: relative; display: inline-block; max-width: 100%; user-select: none; touch-action: none; line-height: 0; }
.crop-stage img { max-width: 100%; max-height: 70vh; display: block; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55); cursor: move; outline: 1px solid rgba(0, 0, 0, 0.4); }
.crop-box::before, .crop-box::after { content: ""; position: absolute; border: 0 dashed rgba(255, 255, 255, 0.6); pointer-events: none; }
.crop-box::before { left: 33.33%; right: 33.33%; top: 0; bottom: 0; border-left-width: 1px; border-right-width: 1px; }
.crop-box::after { top: 33.33%; bottom: 33.33%; left: 0; right: 0; border-top-width: 1px; border-bottom-width: 1px; }
.crop-handle { position: absolute; width: 16px; height: 16px; background: #fff; border: 2px solid var(--red); border-radius: 50%; margin: -8px 0 0 -8px; }
.crop-wrap { text-align: center; overflow: hidden; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #ddd 25%, transparent 25%), linear-gradient(-45deg, #ddd 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ddd 75%), linear-gradient(-45deg, transparent 75%, #ddd 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare figure { margin: 0; text-align: center; }
.compare figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.compare img { max-width: 100%; max-height: 420px; border-radius: 10px; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 0.92rem; background: var(--card); }
.site-footer p { margin: 4px 0; }

@media (max-width: 640px) {
  .header-nav { display: none; }
  .tool-box { padding: 16px; }
  .home-hero { padding-top: 40px; }
}
