:root {
  --bg: #f3f6f7;
  --surface: #ffffff;
  --ink: #12263a;
  --muted: #5c6b7a;
  --line: #d7e1e6;
  --accent: #0f766e;
  --accent-hover: #0b5d57;
  --accent-soft: #e6f4f3;
  --navy: #102a43;
  --navy-2: #243b53;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --shadow: 0 10px 28px rgba(16, 42, 67, 0.07);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  line-height: 1.5;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16, 42, 67, 0.04);
}
.site-header-inner, .hero-inner, .site-footer-inner, .hub-main, .home-wrap {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}
.site-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a, .ghost-link {
  color: var(--navy-2);
  font-weight: 600;
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 8px 14px;
  border-radius: 8px;
}
.nav-cta:hover { background: var(--accent-hover); color: #fff !important; }
.ghost-link {
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
}
.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
}

.hero {
  padding: 48px 0 32px;
}
.home-hero {
  background: linear-gradient(165deg, #102a43 0%, #1b3a4b 58%, #155e59 140%);
  color: #fff;
}
.home-hero h1, .hero h1 {
  margin: 0 0 10px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.03em;
}
.home-hero p {
  margin: 0 0 22px;
  color: #d5e3e6;
  max-width: 680px;
  font-size: 1.08rem;
}
.hero p {
  margin: 0 0 22px;
  color: var(--muted);
  max-width: 640px;
  font-size: 1.05rem;
}
.home-hero .search-box { max-width: 640px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: 560px;
}
.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.section { padding: 18px 0 36px; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section h2 { margin: 0; font-size: 1.35rem; }
.section p { margin: 4px 0 0; color: var(--muted); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-height: 100%;
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease, box-shadow .18s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(16, 42, 67, 0.1);
  border-color: #9dc4c1;
  text-decoration: none;
}
.tool-card .btn-secondary { margin-top: auto; align-self: flex-start; }
.hub-main, .home-wrap { padding-top: 8px; padding-bottom: 56px; }
.home-section { padding: 28px 0 8px; scroll-margin-top: 88px; }
.home-section h2 {
  margin: 0 0 6px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.55rem;
  color: var(--navy);
}
.home-section .section-lead { margin: 0 0 18px; color: var(--muted); max-width: 720px; }
.cat-section { scroll-margin-top: 88px; }
.cat-count {
  display: inline-block;
  margin-left: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.thumb-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 12px;
}
.tool-card img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.thumb-ph {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 16px;
  border: 1.5px dashed #9dc4c1;
  background: repeating-linear-gradient(-45deg, #e6f4f3, #e6f4f3 8px, #f8fafc 8px, #f8fafc 16px);
  color: var(--accent);
  text-align: center;
  padding: 6px;
}
.thumb-ph.is-visible { display: flex; }
.tool-card img.is-hidden { display: none; }
.tool-card img.is-hidden + .thumb-ph { display: flex; }
.thumb-ph-letter { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.thumb-ph-label { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: #0f766e; }
.tool-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.tool-lead { margin: 0 0 8px; color: var(--ink); font-size: 0.95rem; }
.tool-how { margin: 0 0 14px; color: var(--muted); font-size: 0.88rem; flex: 1; }
.tool-how strong { color: var(--ink); font-weight: 700; }
.badge {
  display: inline-flex;
  width: fit-content;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}
.empty-state {
  display: none;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.site-footer {
  margin-top: auto;
  border-top: 0;
  background: var(--navy);
  color: #b7c7d1;
}
.site-footer-inner { padding: 36px 0 28px; }
.site-footer p { margin: 10px 0 0; max-width: 720px; }
.site-footer a { color: #99f6e4; }
.site-footer .brand { color: #fff; }
.site-footer .brand:hover { color: #99f6e4; }
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-nav a { font-weight: 600; text-decoration: none; color: #d9e8ea; }
.footer-nav a:hover { color: #99f6e4; }
.brand-footer img { width: 28px; height: 28px; }

.wrap,
.is-tool .wrap {
  width: min(1040px, calc(100% - 40px));
  margin-left: auto;
  margin-right: auto;
  padding: 28px 0 48px;
}
.page-intro { margin-bottom: 20px; }
.page-intro h1 { margin: 0 0 6px; font-size: 1.8rem; letter-spacing: -0.03em; }
.page-intro p { margin: 0; color: var(--muted); }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.stack > * + * { margin-top: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}
textarea { min-height: 180px; resize: vertical; }
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hint, .error, .ok { font-size: 0.92rem; }
.hint { color: var(--muted); }
.error { color: var(--bad); }
.ok { color: var(--ok); }

.btn, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn { background: var(--accent); color: #fff; }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat, .result-box, .thumb-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.stat b, .result-box b { display: block; font-size: 1.15rem; }
.stat span, .result-box span { color: var(--muted); font-size: 0.9rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); font-size: 0.94rem; }
th { color: var(--muted); font-weight: 600; }

.score-good { color: var(--ok); font-weight: 700; }
.score-ok { color: var(--warn); font-weight: 700; }
.score-bad { color: var(--bad); font-weight: 700; }
.hidden { display: none !important; }
.loading { color: var(--muted); }

.qr-preview, .preview-img { display: flex; justify-content: center; }
.preview-img img { width: 100%; border-radius: 12px; background: #111; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 0.92rem;
}
.meter {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.meter > span { display: block; height: 100%; width: 0; background: var(--accent); }
.drop {
  border: 1.5px dashed #c7d0de;
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
}
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; }
.password-out {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.forecast {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.forecast article {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.stock-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  display: none;
}

.brand-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 400px);
  gap: 20px;
  align-items: start;
}
.brand-preview {
  position: sticky;
  top: 84px;
}
.brand-preview canvas,
.sig-pad {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: block;
}
.checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  border-radius: 14px;
  padding: 10px;
}
.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-field input[type="color"] {
  width: 46px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.color-field .field { flex: 1; }
.related {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.related a {
  font-weight: 600;
  font-size: 0.92rem;
}
.warn-note {
  background: var(--warn-soft);
  color: #7c4a08;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.92rem;
}
.sig-pad { touch-action: none; cursor: crosshair; background: transparent; }

@media (max-width: 1100px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .tool-grid, .stats, .forecast, .stock-grid, .row { grid-template-columns: 1fr 1fr; }
  .brand-grid { grid-template-columns: 1fr; }
  .brand-preview { position: static; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 72px;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
    min-width: 220px;
  }
  .site-nav.is-open { display: flex; }
  .tool-grid, .stats, .forecast, .stock-grid, .row { grid-template-columns: 1fr; }
  .wrap { width: min(100% - 24px, 1040px); margin: 0 auto; }
}
