:root {
  --ink: #111;
  --bg: #F5F1E8;
  --paper: #FFFFFF;
  --yellow: #FFD502;
  --blue: #3D6BF3;
  --pink: #FF5C8A;
  --mint: #4BE3A5;
  --orange: #FFA020;
  --border: 3px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Arial Black", "Avenir Next", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: var(--ink);
  line-height: 1.7;
  background: var(--bg);
}

h1, h2, h3 { font-weight: 900; line-height: 1.2; }

a { color: inherit; text-decoration: underline; text-underline-offset: 4px; }

.container { width: 92%; max-width: 1100px; margin: 0 auto; }

/* Neo brutalism: hard shadow helper */
.brutal {
  border: var(--border) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: var(--border) solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 120px; height: auto; }
.brand-name {
  background: var(--yellow);
  border: var(--border) solid var(--ink);
  padding: 6px 12px;
  font-size: 1.2rem;
  transform: rotate(-2deg);
}

.nav-links { display: flex; gap: 18px; list-style: none; }
.nav-links a {
  background: var(--paper);
  border: var(--border) solid var(--ink);
  padding: 8px 16px;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .12s, box-shadow .12s;
}
.nav-links a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  border: var(--border) solid var(--ink);
  background: var(--paper);
  cursor: pointer;
}
.nav-toggle span { display: block; height: 4px; width: 26px; margin: 0 auto; background: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 88px; position: relative; overflow: hidden; }

.hero::before {
  content: "";
  position: absolute;
  width: 200px; height: 200px;
  background: var(--pink);
  border: var(--border) solid var(--ink);
  right: 6%; top: 10%;
  z-index: -1;
  animation: spin 18s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  text-transform: uppercase;
  line-height: 1.05;
  margin-bottom: 24px;
  letter-spacing: -.01em;
}
.hero h1 .hl {
  display: inline-block;
  background: var(--yellow);
  padding: 0 10px;
  box-shadow: 6px 6px 0 var(--ink);
}

.hero-text p { font-size: 1.05rem; max-width: 620px; }

.hero-info {
  margin-top: 26px;
  background: var(--mint);
  border: var(--border) solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 16px 20px;
}
.hero-info a { background: var(--yellow); padding: 0 6px; font-weight: 900; }

.hero-actions { display: flex; gap: 18px; margin-top: 34px; flex-wrap: wrap; }

.hero-logo { display: flex; justify-content: center; }
.hero-logo img {
  width: 85%;
  max-width: 340px;
  border: var(--border) solid var(--ink);
  background: var(--yellow);
  padding: 16px;
  box-shadow: 10px 10px 0 var(--ink);
  animation: wobble 3.5s ease-in-out infinite;
}
@keyframes wobble {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(2deg) translateY(-8px); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 15px 30px;
  border: var(--border) solid var(--ink);
  font-weight: 900;
  font-size: 1.05rem;
  text-decoration: none;
  font-family: inherit;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); text-decoration: none; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-bg2 { background: var(--orange); color: var(--ink); }
.btn-bg3 { background: var(--pink); color: #fff; }

/* Doc button inside cards */
.doc-btn { margin-top: 18px; padding: 11px 22px; font-size: .95rem; }

/* ---------- Sections ---------- */
.section { padding: 84px 0; border-top: var(--border) solid var(--ink); position: relative; }
.section-alt { background: var(--paper); }

.section h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  text-transform: uppercase;
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  padding: 6px 22px;
  box-shadow: 6px 6px 0 var(--yellow);
  margin-bottom: 26px;
}

.section .lead {
  max-width: 780px;
  font-size: 1.1rem;
  margin-bottom: 36px;
  font-family: -apple-system, "Helvetica Neue", "Segoe UI", sans-serif;
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 26px;
}

.card {
  background: var(--paper);
  border: var(--border) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 30px 24px;
  transition: transform .15s;
}
.card:hover { transform: translate(-4px, -4px); box-shadow: 12px 12px 0 var(--ink); }

.card:nth-child(1) .card-tag { background: var(--yellow); }
.card:nth-child(2) .card-tag { background: var(--mint); }
.card:nth-child(3) .card-tag { background: var(--pink); }

.card-tag {
  display: inline-block;
  border: var(--border) solid var(--ink);
  padding: 2px 12px;
  font-weight: 900;
  font-size: .9rem;
  margin-bottom: 16px;
}
.card-icon { font-size: 3rem; margin-bottom: 12px; }
.card h3 { font-size: 1.3rem; margin-bottom: 10px; }
.card p { font-family: -apple-system, "Helvetica Neue", "Segoe UI", sans-serif; font-size: .98rem; }

/* ---------- Spec detail (逐条解説) ---------- */
.spec-page-hero {
  background: var(--ink);
  color: var(--bg);
  padding: 56px 0 44px;
  border-bottom: var(--border) solid var(--ink);
}
.spec-page-hero .crumb a { color: var(--yellow); }
.spec-page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-transform: uppercase;
  margin-top: 16px;
  line-height: 1.3;
}
.spec-page-hero h1 .hl {
  background: var(--yellow);
  color: var(--ink);
  padding: 0 10px;
  box-shadow: 5px 5px 0 var(--pink);
}

.spec-nav {
  position: sticky;
  top: 72px;
  z-index: 40;
  background: var(--bg);
  border-bottom: var(--border) solid var(--ink);
  padding: 14px 0;
  overflow-x: auto;
}
.spec-nav ul { display: flex; gap: 12px; list-style: none; white-space: nowrap; }
.spec-nav a {
  background: var(--paper);
  border: 3px solid var(--ink);
  padding: 8px 16px;
  font-size: .9rem;
  font-weight: 900;
  text-decoration: none;
  transition: transform .12s, box-shadow .12s;
}
.spec-nav a:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }

.spec-main { padding: 56px 0 72px; }
.spec-article { max-width: 900px; }

.file-block {
  margin-bottom: 56px;
  scroll-margin-top: 150px;
}
.file-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.file-name {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 900;
  font-size: 1.05rem;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 8px 16px;
}
.file-tag {
  background: var(--mint);
  border: 3px solid var(--ink);
  padding: 4px 14px;
  font-weight: 900;
  font-size: .85rem;
  box-shadow: 3px 3px 0 var(--ink);
}
.file-desc {
  font-family: -apple-system, "Helvetica Neue", sans-serif;
  margin-bottom: 18px;
  padding-left: 4px;
}

.spec-table-wrap {
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  background: var(--paper);
  overflow-x: auto;
}
.spec-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.spec-table th, .spec-table td {
  border-bottom: 2px solid var(--ink);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.spec-table thead { background: var(--blue); color: #fff; }
.spec-table th { font-size: .9rem; }
.spec-table td {
  font-family: -apple-system, "Helvetica Neue", "Segoe UI", sans-serif;
  font-size: .92rem;
}
.spec-table .mono { font-family: "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; }
code.file { background: var(--yellow); padding: 1px 6px; border: 2px solid var(--ink); font-size: .85em; }

.req {
  display: inline-block;
  border: 2px solid var(--ink);
  padding: 1px 8px;
  font-weight: 900;
  font-size: .8rem;
}
.req.req-must { background: var(--pink); color: #fff; }
.req.req-cond { background: var(--orange); color: var(--ink); }
.req.req-opt { background: var(--mint); color: var(--ink); }

.back-link {
  display: inline-block;
  margin-top: 8px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 12px 24px;
  font-weight: 900;
  text-decoration: none;
}
.back-link:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }

.spec-note {
  font-family: -apple-system, "Helvetica Neue", "Segoe UI", sans-serif;
  opacity: .8;
  margin: 8px 0 40px;
}

/* ---------- Map ---------- */
.map-wrap { max-width: 820px; margin: 42px auto 0; }
.japan-map {
  width: 100%;
  border: var(--border) solid var(--ink);
  box-shadow: 10px 10px 0 var(--ink);
  display: block;
}
.map-wrap figcaption {
  margin-top: 14px;
  font-family: -apple-system, sans-serif;
  font-weight: 700;
  text-align: center;
}

/* ---------- Demo preview (LP) ---------- */
.demo-preview {
  border: var(--border) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  background: var(--paper);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  max-width: 900px;
}
.demo-preview-art {
  position: relative;
  min-height: 150px;
  background: #f2f7ef;
  border: var(--border) solid var(--ink);
  overflow: hidden;
}
.mini-route { position: absolute; height: 5px; transform-origin: left center; }
.mini-route1 { width: 230px; background: var(--pink); top: 60px; left: 20px; transform: rotate(8deg); box-shadow: 3px 3px 0 var(--ink); }
.mini-route2 { width: 210px; background: var(--blue); top: 100px; left: 40px; transform: rotate(-6deg); box-shadow: 3px 3px 0 var(--ink); }
.mini-stop {
  position: absolute;
  width: 26px; height: 26px;
  border: 3px solid var(--ink);
  background: var(--yellow);
  border-radius: 50%;
  font-size: .6rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  line-height: 1.1;
}
.mini-stop:nth-child(2) { top: 40px; left: 40px; }
.mini-stop:nth-child(3) { top: 70px; left: 160px; }
.mini-stop:nth-child(4) { top: 40px; left: 290px; }
.mini-code {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .68rem;
  line-height: 1.5;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 12px;
}
.mini-hl { color: var(--yellow); font-weight: 900; }
.demo-preview-cta { display: flex; align-items: center; justify-content: center; }

@media (max-width: 700px) {
  .demo-preview { grid-template-columns: 1fr; }
}

/* ---------- Demo (データ可視化シミュレーター) ---------- */
.demo-hero {
  background: var(--ink);
  color: var(--bg);
  padding: 56px 0 44px;
  border-bottom: var(--border) solid var(--ink);
}
.demo-hero .crumb a { color: var(--yellow); }
.demo-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-transform: uppercase;
  margin-top: 16px;
  line-height: 1.3;
}
.demo-hero h1 .hl {
  background: var(--yellow);
  color: var(--ink);
  padding: 0 10px;
  box-shadow: 5px 5px 0 var(--pink);
}
.demo-sub { margin-top: 18px; max-width: 720px; font-family: -apple-system, sans-serif; }
.demo-sub strong { background: var(--yellow); color: var(--ink); padding: 0 6px; }

.demo-main { padding: 48px 0 64px; }
.demo-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px;
  align-items: start;
}

/* Panels */
.demo-canvas-panel, .demo-output-panel {
  background: var(--paper);
  border: var(--border) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-title {
  font-weight: 900;
  font-size: 1.1rem;
  background: var(--ink);
  color: var(--bg);
  padding: 4px 14px;
  transform: rotate(-1deg);
}

/* Tools */
.tool-btn {
  border: var(--border) solid var(--ink);
  background: var(--paper);
  padding: 8px 14px;
  font-weight: 900;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.tool-btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.tool-btn-warn { background: var(--pink); color: #fff; }
.tool-btn-toggle { background: var(--mint); }

/* Legend */
.map-legend { display: flex; gap: 20px; margin-bottom: 12px; font-size: .85rem; font-weight: 700; align-items: center; flex-wrap: wrap; }
.map-legend .dot { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--ink); margin-right: 6px; vertical-align: middle; }
.dot-route { background: var(--pink); }
.dot-route2 { background: var(--blue); }

/* Place search */
.place-search {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  border: var(--border) solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
}
.place-search input {
  border: none;
  outline: none;
  padding: 7px 10px;
  font-size: .85rem;
  font-family: -apple-system, sans-serif;
  min-width: 0;
  width: 170px;
}
.place-search .search-btn {
  border: none;
  border-left: 3px solid var(--ink);
  background: var(--yellow);
  cursor: pointer;
  padding: 7px 12px;
  font-size: .9rem;
}
.place-search .search-btn:hover { background: var(--mint); }
@media (max-width: 640px) {
  .place-search { width: 100%; }
  .place-search input { flex: 1; width: auto; }
}

/* SVG canvas */
.canvas-wrap {
  border: var(--border) solid var(--ink);
  background: #f2f7ef;
  position: relative;
}
.osm-tile-layer image { opacity: .9; }

.zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border: var(--border) solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 4px;
}
.zoom-controls.is-off { display: none; }
.zoom-btn {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  background: var(--bg);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.zoom-btn:hover { background: var(--yellow); transform: translate(-1px,-1px); box-shadow: 2px 2px 0 var(--ink); }
.zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: .8rem;
  font-weight: 900;
  font-family: -apple-system, sans-serif;
}
#mapSvg { display: block; width: 100%; height: auto; }
.map-bg { fill: none; pointer-events: all; cursor: crosshair; }
.grid-line { stroke: rgba(17, 17, 17, .08); stroke-width: 1; }
.route-path { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.route-route1 { stroke: var(--pink); }
.route-route2 { stroke: var(--blue); }
.stop-node { cursor: grab; }
.stop-node:active { cursor: grabbing; }
.stop-circle {
  stroke: var(--ink);
  stroke-width: 3;
  fill: var(--yellow);
  transition: r .15s;
}
.stop-circle.route2 { fill: var(--mint); }
.stop-node:hover .stop-circle { stroke-width: 4; }
.stop-label {
  font-size: 12px;
  font-weight: 900;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  pointer-events: none;
  user-select: none;
}
.canvas-hint { margin-top: 12px; font-size: .85rem; font-family: -apple-system, sans-serif; color: var(--muted); }

/* Output */
.output-actions { display: flex; gap: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab-btn {
  border: 3px solid var(--ink);
  background: var(--paper);
  padding: 6px 12px;
  font-weight: 900;
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
}
.tab-btn.active { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); transform: translate(-2px,-2px); }

.code-view {
  border: var(--border) solid var(--ink);
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 14px;
  overflow: auto;
  max-height: 420px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.5;
  box-shadow: 5px 5px 0 var(--ink);
}
.code-view code { white-space: pre; }

/* Demo note */
.demo-note {
  margin-top: 56px;
  border: var(--border) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  background: var(--paper);
  padding: 30px;
}
.demo-note h2 {
  font-size: 1.5rem;
  margin-bottom: 14px;
  text-transform: uppercase;
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  padding: 4px 16px;
  box-shadow: 5px 5px 0 var(--yellow);
}
.demo-note p { font-family: -apple-system, sans-serif; margin-bottom: 22px; }

/* Responsive */
@media (max-width: 900px) {
  .demo-layout { grid-template-columns: 1fr; }
}

/* ---------- Virtual city (仮想都市) ---------- */
.person-dot {
  fill: var(--ink);
  stroke: var(--yellow);
  stroke-width: 1.5px;
  transition: cx .15s linear, cy .15s linear;
}
.stop-count {
  font-size: 11px;
  font-weight: 900;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 2.5px;
  pointer-events: none;
}
.demand-list { list-style: none; padding: 0; margin: 14px 0; }
.demand-row { margin-bottom: 10px; }
.demand-info {
  display: block;
  font-family: -apple-system, sans-serif;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.demand-bar {
  height: 16px;
  border: 2px solid var(--ink);
  background: #eee;
  overflow: hidden;
}
.demand-bar-inner {
  height: 100%;
  background: var(--blue);
  transition: width .3s;
}
.demand-row:nth-child(odd) .demand-bar-inner { background: var(--pink); }

.insight {
  margin-top: 16px;
  border: var(--border) solid var(--ink);
  background: var(--bg);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 16px;
}
.insight-tag {
  display: inline-block;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 2px 12px;
  font-weight: 900;
  font-size: .8rem;
  margin-bottom: 10px;
}
.insight p { font-family: -apple-system, sans-serif; font-size: .9rem; }
.insight a { font-weight: 900; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: var(--border) solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  padding: 40px 0;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; list-style: none; padding: 0; }
.footer-links a { color: var(--bg); font-weight: 900; }
.footer-links a:hover { background: var(--yellow); color: var(--ink); }
.copyright { margin-top: 22px; font-size: .9rem; opacity: .8; font-family: -apple-system, sans-serif; }
.copyright a { color: var(--orange); }
.attribution { margin-top: 6px; font-size: .75rem; opacity: .6; font-family: -apple-system, sans-serif; }
.attribution a { color: var(--orange); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-logo { order: -1; margin-bottom: 10px; }
  .hero-text p, .hero-info { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-info { text-align: left; }
  .hero::before { display: none; }

  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 10px;
    background: var(--yellow);
    border-bottom: var(--border) solid var(--ink);
    padding: 16px 22px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { background: var(--paper); text-align: center; }
  .nav-toggle { display: flex; }
}