:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #1b1f27;
  --muted: #5b6472;
  --border: #e4e7ec;
  --brand: #2f6fed;
  --brand-dark: #1f52c4;
  --ok: #1f9d55;
  --warn: #b5540a;
  --danger: #c62828;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #eef1f6;
    --muted: #9aa4b2;
    --border: #262b35;
    --brand: #5b8def;
    --brand-dark: #7fa4f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

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

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .bar {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text) !important;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .dot { color: var(--brand); }

nav.site-nav {
  display: flex;
  gap: 18px;
  font-size: 14px;
}

nav.site-nav a { color: var(--muted) !important; }
nav.site-nav a:hover { color: var(--text) !important; }

main { padding: 40px 0 60px; }

.hero {
  padding: 36px 0 8px;
  text-align: center;
}

.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: block;
}

.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.card .emoji { font-size: 22px; margin-bottom: 8px; display: block; }

.tool-page h1 { font-size: 24px; margin-bottom: 4px; }
.tool-page .sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 160px; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

textarea { resize: vertical; min-height: 140px; }

input[type="range"] { width: 100%; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.checkbox-row input { width: auto; }

button, .btn {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover { background: var(--bg); }

.result {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 18px;
}

.result .big { font-size: 24px; font-weight: 700; color: var(--brand); }
.result .line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; border-bottom: 1px dotted var(--border); }
.result .line:last-child { border-bottom: none; }
.result .line span:first-child { color: var(--muted); }

table.sched { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
table.sched th, table.sched td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
table.sched th:first-child, table.sched td:first-child { text-align: left; }
table.sched thead { background: var(--bg); }

.notice {
  background: rgba(181, 84, 10, .1);
  border: 1px solid rgba(181, 84, 10, .3);
  color: var(--warn);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: rgba(31,157,85,.12); color: var(--ok); }
.badge.warn { background: rgba(181,84,10,.12); color: var(--warn); }
.badge.danger { background: rgba(198,40,40,.12); color: var(--danger); }

.article { max-width: 720px; }
.article h1 { font-size: 26px; margin-bottom: 6px; }
.article .meta { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.article h2 { font-size: 19px; margin-top: 32px; }
.article p, .article li { font-size: 15px; }
.article .cta {
  display: block;
  background: rgba(47,111,237,.08);
  border: 1px solid rgba(47,111,237,.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  font-weight: 600;
}

footer.site {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 13px;
}

footer.site .links { display: flex; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }

.copy-btn { cursor: pointer; }

@media (max-width: 560px) {
  nav.site-nav { gap: 12px; font-size: 13px; }
  .hero h1 { font-size: 22px; }
}
