/* Shared styles for every page */
:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #5d6475;
  --line: #e3ddd0;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e4f0eb;
  --tile: #f1e3c4;
  --tile-edge: #d9c393;
  --chip: #eef5f2;
  --warn: #b4532a;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181e;
    --card: #1e222a;
    --ink: #e9ebf0;
    --muted: #a3a9b6;
    --line: #2e333d;
    --accent: #5fbfa3;
    --accent-ink: #0f1a16;
    --accent-soft: #1f322c;
    --tile: #3a3325;
    --tile-edge: #5a4d33;
    --chip: #22302b;
    --warn: #e8875c;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
}
a { color: var(--accent); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header */
header.site { border-bottom: 1px solid var(--line); background: var(--card); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.logo .t { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--tile); border-bottom: 3px solid var(--tile-edge); font-size: 0.95rem; }
nav.top a { color: var(--muted); text-decoration: none; margin-left: 16px; font-size: 0.95rem; }
nav.top a:hover { color: var(--ink); }

/* Breadcrumb + page title */
.crumbs { font-size: 0.85rem; color: var(--muted); margin: 20px 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.hero { padding: 10px 0 18px; }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin: 0; max-width: 62ch; }
.home-hero { padding: 36px 0 10px; }

/* Tool card */
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.tool label, .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.row.tight > * { flex: 1 1 70px; }
.field { margin-top: 14px; }
input[type="text"], input[type="number"], input[type="datetime-local"], input[type="url"], select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 1.05rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.letters { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; font-size: 1.25rem; }
input[type="color"] { width: 100%; height: 46px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; font: inherit; font-weight: 700; border: none; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.btn.small { padding: 8px 14px; font-size: 0.92rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chips button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 0.92rem; cursor: pointer; }
.chips button:hover { border-color: var(--accent); }

/* Word results */
.results { margin-top: 20px; }
.summary { color: var(--muted); margin-bottom: 8px; }
.group h3 { font-size: 1rem; margin: 18px 0 8px; display: flex; align-items: baseline; gap: 8px; }
.group h3 small { color: var(--muted); font-weight: 500; }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.words span { background: var(--chip); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; }
.more { margin-top: 8px; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }

/* Stat tiles (word counter, IP, countdown) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.85rem; }

/* Key/value table */
.kv { width: 100%; border-collapse: collapse; margin-top: 12px; }
.kv th, .kv td { text-align: left; padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { color: var(--muted); font-weight: 500; width: 40%; }
.kv td { font-weight: 600; word-break: break-word; }

/* Big display (IP, timers, password) */
.big { font-size: clamp(1.8rem, 7vw, 3rem); font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; word-break: break-all; line-height: 1.15; }
.clock { font-size: clamp(3rem, 15vw, 6.5rem); font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.05; margin: 10px 0; }
.clock small { font-size: 0.45em; color: var(--muted); }
.center { text-align: center; }
.center .actions { justify-content: center; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-top: 14px; font-size: 0.92rem; }
.done { color: var(--warn); }

/* Password */
.pw-out { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.pw-out output { flex: 1 1 260px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.3rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; word-break: break-all; }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* QR */
.qr-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; place-items: center; aspect-ratio: 1; }
.qr-box canvas { width: 100%; height: auto; image-rendering: pixelated; }

/* Laps */
.laps { width: 100%; border-collapse: collapse; margin-top: 16px; font-variant-numeric: tabular-nums; }
.laps th, .laps td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.laps th:first-child, .laps td:first-child { text-align: left; }
.laps th { color: var(--muted); font-weight: 500; }

/* Home grid */
.cat { margin: 26px 0 0; }
.cat h2 { font-size: 1.1rem; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card svg { flex: 0 0 auto; width: 38px; height: 38px; padding: 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.card b { display: block; }
.card span { color: var(--muted); font-size: 0.9rem; }

/* Ad slots: placeholders until AdSense is approved */
.ad-slot { margin: 24px 0; min-height: 90px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 0.8rem; }

/* Article content */
article.content { padding: 4px 0 8px; }
article.content h2 { font-size: 1.35rem; margin: 28px 0 8px; letter-spacing: -0.01em; }
article.content h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.faq details { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { margin: 8px 0 2px; }
.related h2 { font-size: 1.1rem; margin: 28px 0 10px; }

footer.site { border-top: 1px solid var(--line); margin-top: 36px; padding: 24px 0 36px; color: var(--muted); font-size: 0.9rem; background: var(--card); }
.fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.fcols h4 { color: var(--ink); margin: 0 0 6px; font-size: 0.9rem; }
.fcols a { display: block; color: var(--muted); text-decoration: none; padding: 2px 0; }
.fcols a:hover { color: var(--ink); }
.fine { margin-top: 18px; }

@media (max-width: 640px) {
  .qr-layout { grid-template-columns: 1fr; }
  .qr-box { max-width: 280px; margin: 0 auto; width: 100%; }
}
@media (max-width: 520px) {
  nav.top a { margin-left: 0; margin-right: 16px; }
  .tool { padding: 16px; }
}
