:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2030;
  --muted: #6b7080;
  --border: #e3e6ee;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --news: #e5484d;
  --tools: #0ea5e9;
  --guide: #16a34a;
  --column: #d97706;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #181b24;
    --text: #e8eaf2;
    --muted: #9aa0b2;
    --border: #2a2e3b;
    --accent: #8b85ff;
    --accent-soft: #23234a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo-mark { background: linear-gradient(135deg, #6366f1, #06b6d4); color: #fff; font-size: .8rem; padding: 4px 7px; border-radius: 8px; letter-spacing: .05em; }
.search input { width: 220px; max-width: 40vw; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: .9rem; }
.gnav { border-top: 1px solid var(--border); }
.gnav .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.gnav a { flex: none; padding: 10px 14px; color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 600; border-bottom: 2px solid transparent; }
.gnav a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; margin: 24px 0 48px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ---------- ads ---------- */
.ad { margin: 24px 0; text-align: center; min-height: 100px; }
.ad-label { display: block; font-size: .7rem; color: var(--muted); letter-spacing: .1em; margin-bottom: 4px; }
.ad-placeholder { display: grid; place-items: center; border: 2px dashed var(--border); border-radius: var(--radius); background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(127,127,127,.04) 10px, rgba(127,127,127,.04) 20px); }
.ad-placeholder .ad-label { margin: 0; }
.ad-header { min-height: 90px; margin: 16px 0 0; }
.ad-sidebar, .ad-sidebar-sticky { min-height: 250px; margin-top: 0; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.card-link { display: block; color: inherit; text-decoration: none; }
.thumb { aspect-ratio: 16 / 9; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.1rem; letter-spacing: .08em; position: relative; overflow: hidden; }
.thumb::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.25), transparent 50%); }
.thumb span { position: relative; z-index: 1; text-shadow: 0 1px 8px rgba(0,0,0,.2); }
.thumb-news { background: linear-gradient(135deg, #f43f5e, #f97316); }
.thumb-tools { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.thumb-guide { background: linear-gradient(135deg, #22c55e, #0d9488); }
.thumb-column { background: linear-gradient(135deg, #f59e0b, #db2777); }
.card-body { padding: 14px 16px 16px; }
.card h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.55; }
.card p { margin: 0 0 8px; color: var(--muted); font-size: .9rem; }
.card-big { display: block; }
.card-big .thumb { aspect-ratio: 21 / 9; font-size: 1.6rem; }
.card-big h3 { font-size: 1.4rem; }
.meta { color: var(--muted); font-size: .8rem; }

/* ---------- home ---------- */
.hero-tagline { margin: 0 0 16px; font-weight: 700; color: var(--muted); }
.home-section { margin: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--text); margin-bottom: 16px; }
.section-head h2 { margin: 0 0 6px; font-size: 1.2rem; }
.section-head a { font-size: .85rem; text-decoration: none; }
.list-header h1 { margin: 0 0 4px; }
.list-header { margin-bottom: 20px; }

/* ---------- article ---------- */
.breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px clamp(18px, 4vw, 44px); box-shadow: var(--shadow); }
.post-header h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.45; margin: 10px 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; color: #fff; padding: 2px 10px; border-radius: 999px; text-decoration: none; background: var(--accent); }
.badge-news { background: var(--news); } .badge-tools { background: var(--tools); } .badge-guide { background: var(--guide); } .badge-column { background: var(--column); }
.post-body { font-size: 1.02rem; }
.post-body h2 { font-size: 1.35rem; margin: 2.4em 0 .8em; padding: 10px 14px; background: var(--accent-soft); border-left: 5px solid var(--accent); border-radius: 4px; line-height: 1.5; scroll-margin-top: 120px; }
.post-body h3 { font-size: 1.12rem; margin: 2em 0 .6em; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.post-body p { margin: 1.1em 0; }
.post-body li { margin: .3em 0; }
.post-body blockquote { margin: 1.5em 0; padding: 12px 18px; border-left: 4px solid var(--border); color: var(--muted); background: var(--bg); border-radius: 4px; }
.post-body code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: .9em; }
.post-body pre { background: #1e2130; color: #e8eaf2; padding: 16px; border-radius: 8px; overflow-x: auto; }
.post-body pre code { background: none; padding: 0; }
.table-wrap { overflow-x: auto; margin: 1.5em 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
th { background: var(--bg); }
.toc { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 22px; margin: 24px 0; }
.toc-title { font-weight: 800; margin: 0 0 4px; }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: .8rem; color: var(--muted); background: var(--bg); padding: 2px 10px; border-radius: 999px; }
.share { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.share a, .share button { font: inherit; font-size: .8rem; font-weight: 700; padding: 6px 14px; border-radius: 999px; border: 0; color: #fff; text-decoration: none; cursor: pointer; }
.share-x { background: #111; } .share-hatena { background: #00a4de; } .share-line { background: #06c755; } .share-copy { background: var(--muted); }
.related { margin-top: 40px; }
.related h2 { font-size: 1.2rem; }

/* ---------- sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.widget h2 { font-size: 1rem; margin: 0 0 10px; }
.widget.sticky { position: sticky; top: 130px; padding: 0; border: 0; background: none; }
.popular { list-style: none; margin: 0; padding: 0; }
.popular li + li { border-top: 1px solid var(--border); }
.popular a { display: flex; gap: 10px; padding: 10px 0; color: var(--text); text-decoration: none; font-size: .9rem; line-height: 1.5; }
.popular a:hover { color: var(--accent); }
.rank { flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 800; display: grid; place-items: center; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list a { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text); text-decoration: none; }
.cat-list span { color: var(--muted); font-size: .85rem; }

/* ---------- footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0; text-align: center; font-size: .85rem; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.site-footer a { color: var(--muted); text-decoration: none; }

@media (max-width: 600px) {
  .search input { width: 140px; }
  .post { padding: 22px 16px; border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; }
}
