@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink: #1f1d1b;
  --paper: #faf7f2;
  --muted: #6b645c;
  --line: #e4ddd2;
  --red: #c8352b;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

/* Navigation */
nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 247, 242, 0.95);
  border-bottom: 1px solid var(--line);
}
nav .inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
nav .brand {
  font-family: 'Noto Serif JP', serif; font-weight: 700; font-size: 1.2rem;
  color: var(--ink); text-decoration: none;
}
nav .brand span { color: var(--red); }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
nav a.link {
  display: block; padding: 6px 14px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
nav a.link:hover { background: var(--line); }
nav a.link.active { background: var(--red); color: #fff; }

/* Hero */
.hero {
  position: relative; min-height: 340px;
  display: flex; align-items: flex-end;
  background: #2b2724 center/cover no-repeat;
  color: #fff;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,.05));
}
.hero .inner {
  position: relative; z-index: 1;
  max-width: 1100px; width: 100%; margin: 0 auto; padding: 40px 20px;
}
.hero .jp { font-family: 'Noto Serif JP', serif; font-size: 1.1rem; opacity: .85; margin: 0; }
.hero h1 { font-family: 'Noto Serif JP', serif; font-size: clamp(2.2rem, 6vw, 3.8rem); margin: 4px 0 8px; line-height: 1.1; }
.hero p.lead { max-width: 640px; margin: 0; font-size: 1.1rem; opacity: .95; }

/* Layout */
main { max-width: 1100px; margin: 0 auto; padding: 40px 20px 60px; }
section { margin-bottom: 48px; }
h2 {
  font-family: 'Noto Serif JP', serif; font-size: 1.6rem; margin: 0 0 18px;
  padding-left: 14px; border-left: 4px solid var(--red);
}

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
}
.card img { width: 100%; height: 180px; object-fit: cover; display: block; background: var(--line); }
.card .body { padding: 16px 18px 18px; }
.card .icon { font-size: 1.8rem; line-height: 1; margin-bottom: 8px; }
.card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); }

/* Phrase list */
.phrases { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.phrase { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.phrase .jp { font-family: 'Noto Serif JP', serif; font-size: 1.2rem; }
.phrase .ro { color: var(--red); font-weight: 600; }
.phrase .en { color: var(--muted); }

/* Placeholder notice */
.todo {
  border: 2px dashed var(--line); border-radius: 14px; padding: 18px;
  color: var(--muted); text-align: center; background: #fff;
}

/* Next-city links */
.next { display: flex; gap: 12px; flex-wrap: wrap; }
.next a {
  flex: 1 1 200px; padding: 18px; border-radius: 12px; text-decoration: none;
  background: var(--ink); color: #fff; font-weight: 600; text-align: center;
}
.next a:hover { background: var(--red); }

footer { text-align: center; padding: 24px; color: var(--muted); border-top: 1px solid var(--line); font-size: .9rem; }

/* Info page extras */
section[id] { scroll-margin-top: 80px; }
.card p a { color: var(--red); }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; }
.jump a {
  padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.jump a:hover { border-color: var(--red); color: var(--red); }
.note {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #fbefe9; border-left: 3px solid var(--red); font-size: .93rem; color: var(--ink);
}
ul.book { margin: 0; padding-left: 0; list-style: none; color: var(--muted); }
ul.book li { padding: 8px 0; border-top: 1px solid var(--line); }
ul.book li:first-child { border-top: 0; padding-top: 0; }
ul.book strong { display: block; color: var(--ink); }

/* Emergency & contacts */
.intro { margin: -6px 0 16px; color: var(--muted); }
.sos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.sos-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 14px;
  background: var(--red); color: #fff; text-decoration: none;
}
.sos-tile.soft { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.sos-tile .num { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.sos-tile.soft .num { color: var(--red); }
.sos-tile .what { font-weight: 600; }
.sos-tile .desc { font-size: .9rem; opacity: .9; }
.sos-tile.soft .desc { color: var(--muted); opacity: 1; }
dl.contact { margin: 12px 0 0; font-size: .93rem; }
dl.contact dt { font-weight: 600; color: var(--ink); margin-top: 8px; }
dl.contact dd { margin: 0; color: var(--muted); }
dl.contact a, .note a { color: var(--red); text-decoration: none; font-weight: 500; }
dl.contact small { color: var(--muted); }

/* City page: map & places */
#map { height: 460px; border-radius: 14px; border: 1px solid var(--line); z-index: 0; }
.pin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--red); color: #fff; font-weight: 700; font-size: .9rem;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.pin.station { background: var(--ink); }
.pin.sm { width: 24px; height: 24px; font-size: .78rem; border-width: 0; box-shadow: none; flex: none; }
.legend {
  list-style: none; padding: 0; margin: 14px 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px;
}
.legend a { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; padding: 4px 0; }
.legend a:hover { color: var(--red); }
.places { display: flex; flex-direction: column; gap: 22px; }
.place {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  scroll-margin-top: 80px;
}
.place .ph {
  position: relative; min-height: 260px;
  background: linear-gradient(135deg, #e9dccb, #d9c3a8);
}
.place .ph::before {
  content: "Photo: " attr(data-label); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center;
  color: #8a7660; font-size: .9rem;
}
.place .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.place .ph .pin { position: absolute; top: 14px; left: 14px; }
.pbody { padding: 22px 24px; }
.pjp { margin: 0; color: var(--red); font-family: 'Noto Serif JP', serif; }
.pbody h3 { margin: 2px 0 8px; font-family: 'Noto Serif JP', serif; font-size: 1.4rem; }
.pdesc { margin: 0 0 14px; color: var(--muted); }
dl.facts { margin: 0; display: grid; gap: 10px; font-size: .93rem; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 2px 0 0; color: var(--muted); }
dl.facts a { color: var(--red); text-decoration: none; font-weight: 500; }
.eta { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #fbefe9; color: var(--red); font-size: .8rem; }
@media (max-width: 720px) {
  .place { grid-template-columns: 1fr; }
  .place .ph { min-height: 200px; }
  #map { height: 360px; }
}

/* Summary table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table.summary { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 640px; }
table.summary th { text-align: left; padding: 12px 14px; background: var(--ink); color: #fff; font-weight: 600; }
table.summary td { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
table.summary tbody tr:nth-child(even) { background: #fcfaf6; }
table.summary td:first-child a { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; text-decoration: none; }
table.summary td:first-child a:hover { color: var(--red); }
.mapbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.mapbtns button {
  font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.mapbtns button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Photo focus points */
#sensoji .ph img { object-position: 30% center; }
#shibuya-sky .ph img { object-position: 60% center; }

/* App sub-groups */
.subhead { font-size: 1.1rem; margin: 26px 0 12px; }
#apps .subhead:first-of-type { margin-top: 0; }

/* Phrases page */
.phr-tools { margin-bottom: 16px; }
.phr-tools input {
  width: 100%; max-width: 480px; font: inherit; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
}
.phr-tools input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.phr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.phr { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 52px 14px 16px; }
.phr .jp { font-family: 'Noto Serif JP', serif; font-size: 1.2rem; line-height: 1.4; }
.phr .ro { color: var(--red); font-weight: 600; margin-top: 2px; }
.phr .en { color: var(--muted); font-size: .93rem; }
.say {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fbefe9; cursor: pointer; font-size: 1rem; line-height: 1;
}
.say:hover { background: var(--red); }
ul.vocab { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
ul.vocab .phr { padding: 10px 50px 10px 14px; display: flex; align-items: center; min-height: 48px; }
.say.sm { top: 50%; transform: translateY(-50%); width: 30px; height: 30px; font-size: .85rem; }
.psec .subhead:first-of-type { margin-top: 0; }
.phr-link {
  display: flex; gap: 18px; align-items: center; padding: 18px 20px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--muted);
}
.phr-link strong { color: var(--ink); }
.phr-link .big { font-family: 'Noto Serif JP', serif; font-size: 1.6rem; color: var(--red); white-space: nowrap; }
.phr-link:hover { border-color: var(--red); }

/* Etiquette */
.jump .jlabel { align-self: center; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); min-width: 78px; }
.jump + .jump { margin-top: -26px; }
.part {
  font-family: 'Noto Serif JP', serif; font-size: 2rem; font-weight: 700; margin: 8px 0 26px;
  padding-bottom: 12px; border-bottom: 2px solid var(--ink); scroll-margin-top: 80px;
}
.part span { display: block; font-family: 'Inter', sans-serif; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.dd { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dd-col { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; border-top: 4px solid #3f8f5a; }
.dd-col.dont { border-top-color: var(--red); }
.dd-col h3 { margin: 0 0 10px; font-size: 1.05rem; }
.dd-col > ul { list-style: none; margin: 0; padding: 0; }
.dd-col > ul > li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.dd-col > ul > li:first-child { border-top: 0; padding-top: 0; }
.dd-col li strong { color: var(--ink); }
.dd-col li ul { margin: 8px 0 0; padding-left: 18px; }
.dd-col li ul li { margin: 6px 0; }
@media (max-width: 720px) { .dd { grid-template-columns: 1fr; } .jump + .jump { margin-top: -26px; } }
