:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --soft: #eff6ff;
  --code-bg: #0f172a;
  --code-text: #dbeafe;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Sans SC", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef5ff 0%, var(--bg) 260px);
  line-height: 1.75;
}
a { color: inherit; }
.site-header {
  padding: 48px 20px 32px;
  text-align: center;
}
.site-header h1,
.page-hero h1 { margin: 0 0 12px; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.15; }
.site-header p,
.page-hero p { margin: 0 auto; max-width: 850px; color: var(--muted); }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  padding-bottom: 56px;
}
.card {
  display: block;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: #bfdbfe; box-shadow: 0 20px 48px rgba(37, 99, 235, .12); }
.card .num { color: var(--brand); font-weight: 800; letter-spacing: .04em; font-size: .85rem; }
.card h2 { margin: 8px 0; font-size: 1.08rem; line-height: 1.35; }
.card p { margin: 0; color: var(--muted); font-size: .94rem; }
.page-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line);
}
.page-topbar .inner { width: min(1180px, calc(100% - 40px)); margin: 0 auto; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; }
.page-topbar a { text-decoration: none; color: var(--muted); font-size: .95rem; }
.page-topbar a:hover { color: var(--brand); }
.page-hero { padding: 42px 0 26px; }
.badges { display:flex; flex-wrap:wrap; gap:8px; margin-top:18px; }
.badge { background: var(--soft); color: var(--brand-dark); padding: 5px 10px; border-radius: 999px; font-size: .86rem; font-weight: 700; }
.layout { display:grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap:20px; align-items:start; padding-bottom:56px; }
.layout.left-wide { grid-template-columns: minmax(0, 1.24fr) minmax(0, .76fr); }
.panel { min-width: 0; background: var(--surface); border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding:22px; overflow: hidden; }
.panel h2 { margin: 0 0 12px; font-size: 1.25rem; }
.panel h3 { margin: 20px 0 8px; font-size: 1.02rem; }
.panel p { color: var(--muted); }
.demo-box { background:#f8fafc; border:1px dashed #cbd5e1; border-radius: 14px; padding:18px; margin:14px 0; }
.demo-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin:10px 0; }
button, .button {
  border:0;
  background: var(--brand);
  color:#fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor:pointer;
  transition: transform .15s ease, background .15s ease;
}
button:hover, .button:hover { background: var(--brand-dark); transform: translateY(-1px); }
button.secondary { background:#e2e8f0; color:#334155; }
button.secondary:hover { background:#cbd5e1; }
button.danger { background: var(--danger); }
button.ok { background: var(--ok); }
input, select, textarea {
  width: 100%;
  border:1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background:#fff;
}
label { font-weight: 700; display:block; margin-top:10px; }
.small { font-size:.9rem; color: var(--muted); }
.output, .log {
  min-height: 42px;
  padding: 12px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  color:#334155;
  white-space: pre-wrap;
}
ul.clean { padding-left: 20px; }
.two-col { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:12px; }
.three-col { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:12px; }
.item-card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px; }
.item-card h4 { margin:0 0 6px; }
.item-card p { margin:0; }
.code-head { display:flex; align-items:center; justify-content:space-between; margin-top:6px; }
.code-head strong { font-size:.95rem; }
.copy-btn { background:#334155; padding:7px 10px; border-radius:10px; font-size:.82rem; }
pre { width: 100%; max-width: 100%; margin: 10px 0 0; overflow:auto; background: var(--code-bg); color: var(--code-text); border-radius: 14px; padding:18px; line-height:1.55; font-size:.88rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.note { border-left:4px solid var(--brand); background:var(--soft); padding:12px 14px; border-radius:12px; color:#1e3a8a; }
.warn { border-left-color: var(--warn); background:#fffbeb; color:#78350f; }
.list-table { width:100%; border-collapse:collapse; overflow:hidden; border-radius:14px; }
.list-table th, .list-table td { border-bottom:1px solid var(--line); padding:10px; text-align:left; }
.list-table th { color:#475569; background:#f8fafc; }
.tag { display:inline-flex; align-items:center; padding:3px 8px; border-radius:99px; background:#f1f5f9; color:#475569; font-size:.8rem; font-weight:700; }
.hidden { display:none !important; }
.active { outline: 2px solid #93c5fd; }
.reveal { opacity:0; transform: translateY(18px); transition: all .55s ease; }
.reveal.visible { opacity:1; transform: translateY(0); }
.modal-mask { position:fixed; inset:0; background:rgba(15,23,42,.55); display:grid; place-items:center; padding:20px; }
.modal-card { background:#fff; max-width:460px; border-radius:20px; padding:24px; box-shadow:0 30px 80px rgba(0,0,0,.25); }
.toast { position:fixed; right:20px; bottom:20px; background:#0f172a; color:#fff; padding:12px 16px; border-radius:12px; box-shadow:var(--shadow); }
.footer { padding: 24px 0 48px; color:var(--muted); text-align:center; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .page-topbar .inner { flex-direction:column; align-items:flex-start; }
}
