* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
  line-height: 1.7;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container, .wrap {
  max-width: 960px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

nav {
  padding: 20px 30px 0;
}

nav a {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

nav a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 48px 30px;
  text-align: center;
}

header h1 {
  font-size: 2.2em;
  margin-bottom: 10px;
  font-weight: 700;
}

header p {
  font-size: 1.1em;
  opacity: 0.95;
}

main, .content {
  padding: 40px 30px;
}

section {
  margin-bottom: 32px;
}

h2 {
  color: #333;
  font-size: 1.6em;
  margin: 36px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

h3 {
  color: #444;
  font-size: 1.25em;
  margin: 28px 0 10px;
}

h4 {
  color: #555;
  font-size: 1.05em;
  margin: 20px 0 8px;
}

h5 {
  color: #666;
  font-size: 0.98em;
  margin: 16px 0 6px;
}

p {
  margin: 1em 0;
}

a {
  color: #667eea;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  padding-left: 1.6em;
  margin: 1em 0;
}

li {
  margin: 0.5em 0;
}

li > ul, li > ol {
  margin: 0.3em 0;
}

code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', Consolas, 'Lucida Console', monospace;
  font-size: 0.9em;
  color: #333;
}

pre {
  background: #f8f9fa;
  color: #333;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Fira Code', Consolas, 'Lucida Console', monospace;
  font-size: 0.9em;
  line-height: 1.5;
  border: 1px solid #e0e0e0;
  margin: 1em 0;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e8e8e8;
}

th {
  background: #f4f4f4;
  color: #333;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

img, video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 12px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

figure {
  margin: 1.2em 0;
}

figure > figcaption {
  text-align: center;
}

figure > img, figure > video {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

figure > video {
  max-height: 70vh;
}

blockquote {
  margin: 1.2em 0;
  padding: 14px 20px;
  border-left: 3px solid #667eea;
  background: #f8f9fa;
  color: #555;
}

strong {
  color: #222;
  font-weight: 700;
}

.card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border-left: 3px solid #667eea;
  margin: 20px 0;
}

.badge {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.feature-card {
  display: block;
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  text-decoration: none;
  color: #333;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.feature-card h3 {
  color: #667eea;
  font-size: 1.2em;
  margin: 0 0 10px;
}

.feature-card p {
  color: #555;
  font-size: 0.95em;
  margin: 0;
}

.version-badge {
  display: inline-block;
  background: #28a745;
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.4em;
  vertical-align: middle;
  margin-left: 10px;
  font-weight: 600;
}

.demo-link {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 30px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.05em;
  transition: transform 0.2s, box-shadow 0.2s;
}

.demo-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  text-decoration: none;
}

.demo-link.cloudflare {
  background: linear-gradient(135deg, #f6821f 0%, #e06c00 100%);
}

.demo-link.cloudflare:hover {
  box-shadow: 0 8px 20px rgba(246, 130, 31, 0.4);
}

.url-box {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #28a745;
  margin: 15px 0;
}

.url-box h3 {
  color: #28a745;
  font-size: 1.2em;
  margin: 0 0 10px;
}

.install-steps {
  background: #fff8e1;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #ffc107;
  margin: 15px 0;
}

.install-steps h3 {
  color: #b8860b;
  font-size: 1.2em;
  margin: 0 0 10px;
}

.install-steps.webgis {
  background: #eef0ff;
  border-left-color: #667eea;
}
.install-steps.webgis h3 { color: #4a5dd4; }
.install-steps.app {
  background: #e9f7ee;
  border-left-color: #2e9e56;
}
.install-steps.app h3 { color: #237a44; }

.install-steps ol {
  margin-left: 20px;
}

.install-steps li {
  margin: 10px 0;
}

/* ===== 4形態ナビ（各ガイドページ共通） ===== */
.form-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 0 0 28px;
}

.form-nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-left: 4px solid #9aa5b1;
  color: #333;
  font-size: 0.9em;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.form-nav a.webgis { border-left-color: #667eea; }
.form-nav a.app { border-left-color: #2e9e56; }
.form-nav a.api { border-left-color: #8a4fff; }
.form-nav a.bridge { border-left-color: #e06c00; }
.form-nav a.cache { border-left-color: #0e8a9e; }

.form-nav a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  text-decoration: none;
}

.form-nav a.current {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #5a6fd0;
  color: #fff;
  pointer-events: none;
}

@media (max-width: 720px) {
  body {
    padding: 12px;
  }

  main, .content {
    padding: 24px 18px;
  }

  header {
    padding: 32px 20px;
  }

  header h1 {
    font-size: 1.7rem;
  }

  nav {
    padding: 16px 18px 0;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

/* ===== 共通サイドバーナビゲーション（nav.js） ===== */
#site-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  padding: 16px 14px 24px;
  z-index: 1000;
  font-size: 0.92em;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
}

#site-nav .nav-title {
  font-weight: 700;
  font-size: 1.05em;
  color: #667eea;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#site-nav .nav-title a {
  color: #667eea;
}

#site-nav .nav-version {
  font-size: 0.72em;
  background: #28a745;
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}

#site-nav .nav-demos {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 6px;
}

#site-nav .nav-demo {
  display: block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 7px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9em;
}

#site-nav .nav-demo:hover {
  text-decoration: none;
  opacity: 0.9;
}

#site-nav .nav-group {
  margin-top: 14px;
}

#site-nav .nav-group-label {
  font-size: 0.78em;
  font-weight: 700;
  color: #999;
  text-transform: none;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  padding-left: 10px;
}

#site-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#site-nav ul li {
  margin: 1px 0;
}

#site-nav ul li a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: #333;
}

#site-nav ul li a:hover {
  background: #e8ecff;
  color: #667eea;
  text-decoration: none;
}

#site-nav ul li a.active {
  background: #667eea;
  color: #fff;
  font-weight: 600;
}

#site-nav .nav-sub {
  padding-left: 14px;
  border-left: 2px solid #e8e8e8;
  margin-left: 14px !important;
}

#site-nav .nav-sub a {
  font-size: 0.92em;
  padding: 4px 8px;
}

.nav-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1100;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  font-size: 1.2em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media (min-width: 901px) {
  body.has-nav {
    padding-left: 280px;
  }
}

@media (max-width: 900px) {
  #site-nav {
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  body.nav-open #site-nav {
    transform: none;
  }

  .nav-toggle {
    display: block;
  }
}
