/* 地図を主領域とし、一覧と教材は同じ読書領域を切り替えて使う。 */
:root { color: #243c39; background: #f1f2ed; }
body { line-height: 1.6; }
[hidden] { display: none !important; }
.app { max-width: 1680px; padding: 0 36px; }
.app-header { height: 82px; border-color: #d5ddd5; }
.brand { color: #213f38; text-decoration: none; gap: 12px; }
.brand-icon { width: 36px; height: 36px; font-size: 22px; border-radius: 3px; background: #2b554c; }
.brand strong { font-size: 18px; letter-spacing: .03em; }
.header-right { gap: 16px; font-size: 12px; }
.progress { font-size: 12px; padding-left: 16px; }
.status { font-size: 11px; }
.status::before { content: ''; }
button, input, textarea { font: inherit; }
button { touch-action: manipulation; }
button:focus, a:focus { outline: 3px solid #bd8939; outline-offset: 3px; }
button:disabled { opacity: .4; cursor: default; }
.quiet-button { border: 1px solid #cbd8cf; border-radius: 5px; background: transparent; color: #375c50; padding: 8px 12px; }
.quiet-button:hover { background: #e8ede7; }
.atlas-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(400px, .88fr); gap: 26px; padding: 26px 0 34px; }
.map-workspace { align-self: start; position: sticky; top: 18px; min-width: 0; }
.place-breadcrumb { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 30px; margin-bottom: 15px; }
.place-breadcrumb button { padding: 2px; border: 0; color: #567367; background: none; font-size: 12px; }
.place-breadcrumb span { color: #789086; font-size: 12px; }
.place-breadcrumb [aria-current] { color: #294f43; font-weight: 700; }
.map-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 0 2px 18px; }
.eyebrow { font-size: 11px; font-weight: 600; line-height: 1.5; color: #6f867b; letter-spacing: .08em; margin: 0 0 4px; }
.map-heading h1 { margin: 0; font-size: 32px; font-weight: 600; line-height: 1.3; letter-spacing: .03em; }
.map-heading .quiet-button { font-size: 12px; }
.map-canvas { background: #e6eeec; border: 1px solid #cddbd5; border-radius: 8px; overflow: hidden; }
.japan-map { margin: 0; }
.japan-map svg { width: 100%; height: clamp(360px, 51vh, 610px); max-height: none; display: block; }
.japan-map figcaption { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: 11px; color: #577268; }
.japan-map figcaption a { color: #577268; text-underline-offset: 3px; }
.map-grid { color: #b6cbc7; pointer-events: none; }
.prefecture-shape { fill: #b5cdbe; stroke: #f3f6ee; stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-region { cursor: pointer; outline: none; }
.map-region-1 .prefecture-shape, .map-region-5 .prefecture-shape { fill: #a9c2b3; }
.map-region-2 .prefecture-shape, .map-region-6 .prefecture-shape { fill: #9ebdad; }
.map-region-3 .prefecture-shape, .map-region-7 .prefecture-shape { fill: #bed2bd; }
.map-region:hover .prefecture-shape, .map-region:focus .prefecture-shape { fill: #5b8978; }
.map-region:focus .prefecture-shape { stroke: #9b6c23; stroke-width: 2; }
.region-map-label { font: 600 12px sans-serif; fill: #25473d; text-anchor: middle; paint-order: stroke; stroke: #e6eeec; stroke-width: 5px; }
.prefecture-shape:hover, .prefecture-shape:focus { fill: #729b86; stroke: #b38435; stroke-width: 2; }
.prefecture-shape.active { fill: #326a59; }
.prefecture-shape.done { stroke: #a27733; stroke-width: 2; }
.prefecture-shape.outside-region { fill: #d8e2dc; stroke: #eaf0e9; pointer-events: none; }
.prefecture-marker { fill: #d4a359; stroke: white; stroke-width: 1; vector-effect: non-scaling-stroke; }
.region-picker, .prefecture-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.region-picker button, .prefecture-picker button { min-height: 39px; border: 1px solid #cbd8ce; background: #f8f9f4; }
.region-picker button, .prefecture-picker button { color: #48675b; padding: 7px 13px; border-radius: 5px; font-size: 12px; }
.region-picker button[aria-pressed=true], .prefecture-picker button[aria-pressed=true] { background: #326451; color: white; border-color: #326451; }
.prefecture-picker { border-top: 1px solid #d6dfd5; padding-top: 15px; }
.prefecture-picker .done::after { content: ' •'; color: #bb893e; }
.reading-column { min-width: 0; padding-top: 2px; }
.explorer { background: #fcfcf8; border: 1px solid #d9e0d6; border-radius: 8px; padding: 22px; }
.search-bar label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 600; color: #566e60; }
.search-input { display: flex; gap: 7px; }
.search-input input { min-width: 0; flex: 1; height: 45px; border: 1px solid #c8d4c9; border-radius: 5px; padding: 10px 12px; background: white; }
.search-input input:focus { outline: 2px solid #688e79; outline-offset: 1px; }
.search-input input::placeholder { color: #809086; font-size: 13px; }
.search-input button { font-size: 12px; padding: 5px 10px; }
.scope-tabs { display: flex; gap: 3px; border-bottom: 1px solid #dce3d9; margin-top: 17px; }
.scope-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 11px 4px; color: #789084; font-size: 12px; }
.scope-tabs button[aria-pressed=true] { color: #2c5c48; font-weight: 700; border-color: #3b6f55; }
.domain-section { padding: 20px 0; border-bottom: 1px solid #dce3d9; }
.domain-section h2 { margin: 0 0 10px; font-size: 13px; color: #556e5e; }
.domain-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.domain-picker button { padding: 9px 4px; min-height: 39px; color: #496652; background: #f3f5ed; border: 1px solid #e1e6da; border-radius: 4px; font-size: 11px; }
.domain-picker button:hover { border-color: #7c9e82; }
.domain-count { display: inline-block; min-width: 1.4em; margin-left: 3px; opacity: .75; font-size: 10px; }
.domain-picker button[aria-pressed=true] { color: #27533e; background: #e1ebda; border-color: #8eac8d; font-weight: 700; }
.place-summary { margin-top: 17px; padding: 17px; background: #edf2e7; border-radius: 5px; }
.place-summary > div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.place-summary h2 { font-size: 19px; margin: 0; }
.place-summary span { color: #64806c; font-size: 11px; }
.place-summary p { font-size: 13px; line-height: 1.85; margin: 9px 0 12px; }
.place-summary button { display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  padding: 8px 0 0;
  background: none;
  color: #2d6049;
  font-size: 12px;
  font-weight: 700;
  }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 21px 0 13px; }
.catalog-heading h2 { margin: 0; font-size: 15px; font-weight: 600; }
.catalog-heading > span { white-space: nowrap; color: #789080; font-size: 11px; }
.catalog-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 0; max-height: 640px; overflow: auto; }
.lesson-card { position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 135px;
  padding: 14px;
  text-align: left;
  border: 1px solid #dce4d7;
  border-radius: 5px;
  color: #2a4737;
  background: #fff;
  }
.lesson-card:hover { border-color: #7b9e80; background: #f9fbf5; }
.lesson-card strong { font-size: 13px; line-height: 1.7; font-weight: 600; overflow-wrap: anywhere; }
.lesson-category { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: #768776; font-size: 10px; }
.lesson-map-tag { color: #4c7667; font-size: 9px; padding: 1px 4px; border-radius: 2px; background: #eaf2eb; }
.lesson-tail { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 5px; color: #899888; font-size: 10px; }
.lesson-tail span { font-size: 15px; color: #67856c; }
.lesson-card.done .lesson-tail { color: #956e30; }
.catalog-pages { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 17px; color: #748371; font-size: 12px; }
.catalog-pages:empty { display: none; }
.catalog-pages button, .empty-results button { border: 1px solid #d4dfcd; padding: 8px 15px; border-radius: 4px; color: #446d4c; background: white; }
.empty-results { grid-column: 1 / -1; padding: 24px 0; font-size: 13px; }
.reader { background: #fcfcf8; border-color: #d6e0d2; border-radius: 8px; }
.reader-toolbar { display: flex; gap: 10px; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid #e1e7dc; }
.reader-toolbar button { font-size: 11px; padding: 7px 9px; border: 0; }
.reader-toolbar button:first-child { text-align: left; }
.reader-toolbar button:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-toolbar button:last-child { flex-shrink: 0; }
.reader-context { margin: 22px 28px 0; color: #7c907f; font-size: 11px; }
.detail-top { display: block; min-height: 0; background: none; color: #294a37; padding: 12px 28px 22px; }
.detail-top h2 { font-family: inherit; font-size: 25px; font-weight: 600; line-height: 1.6; letter-spacing: .02em; margin: 7px 0 10px; }
.detail-meta { color: #7d8d7b; font-size: 11px; }
.reader-locations { margin-top: 17px; padding-top: 13px; border-top: 1px solid #e1e7dc; }
.reader-locations h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; color: #687f6b; }
.reader-locations > div { display: flex; flex-wrap: wrap; gap: 6px; }
.reader-locations button { padding: 6px 10px; border: 1px solid #ccd8c5; border-radius: 4px; color: #46684b; background: #fff; font-size: 12px; }
.reader-locations button[aria-pressed=true] { background: #e6eedf; border-color: #8eac8d; }
.detail-content { padding: 0 28px 20px; max-height: 62vh; overflow: auto; scrollbar-gutter: stable; }
.capital { padding: 15px 0; font-size: 12px; color: #7c8a76; }
.info { padding-top: 24px; }
.info-title { gap: 10px; }
.info-title span { color: #9c9b79; font-size: 10px; }
.info h3 { font-size: 15px; color: #425c42; }
.info p { font-size: 15px; line-height: 2; margin-top: 10px; overflow-wrap: anywhere; }
.info a { color: #416c4b; font-size: 12px; }
.actions { padding: 18px 24px; gap: 7px; background: #f6f8f0; border-top: 1px solid #e0e7d8; }
.actions button { padding: 10px 7px; font-size: 11px; border-radius: 4px; }
.primary { background: #3b654a; border-color: #3b654a; }
.secondary { border-color: #ccd8c5; color: #46684b; }
.related { margin-top: 26px; padding-top: 18px; }
.related h3 { margin: 0 0 10px; font-size: 14px; color: #536f50; }
.related button { font-size: 12px; line-height: 1.7; padding: 11px; border-radius: 4px; }
.terrain-related { padding: 15px; background: #eff4e9; border: 1px solid #d9e3d0; border-radius: 5px; }
.terrain-related button { background: #fff; }
.tile-map { margin: 0 0 25px; border-radius: 5px; padding: 14px; }
.tile-map .tile-grid { margin: auto; }
.tile-map figcaption { font-size: 13px; }
.tile-map p { font-size: 12px; }
.reader .quiz-box { margin: 0; padding: 0 28px 25px; max-height: 70vh; overflow: auto; border: 0; }
.reader.quiz-open .detail-content, .reader.quiz-open .actions { display: none; }
.quiz-head { align-items: center; font-size: 13px; padding: 8px 0 15px; }
.quiz-head button { min-width: 36px; min-height: 36px; border-radius: 4px; }
.quiz-box p { font-size: 14px; line-height: 1.85; }
.quiz-box .tile-map { margin-top: 16px; }
.answers { gap: 8px; }
.answers button, #next-quiz { font-size: 13px; border-radius: 4px; }
.notes-panel { position: fixed; z-index: 50; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.notes-backdrop { position: fixed; z-index: 49; inset: 0; background: #1d322657; }
.notes-panel { width: min(620px, calc(100% - 32px)); margin: 0; max-height: calc(100dvh - 36px); overflow: auto; padding: 22px; }
.notes-panel { background: #f9fbf3; box-shadow: 0 12px 60px #182b2338; border-radius: 8px; overscroll-behavior: contain; }
.notes-panel textarea { padding: 10px; border: 1px solid #c5d3bd; line-height: 1.8; }
.notes-panel .quiz-head { padding-top: 0; }
.save-status { margin: 12px 25px; }
footer { border-top: 1px solid #d7dfd1; padding: 17px 0 25px; gap: 25px; font-size: 11px; }
.controls-help summary { cursor: pointer; }
.controls { line-height: 2.5; margin-top: 12px; gap: 8px 14px; }
.controls b { background: #e1e8da; }
.sources { align-items: start; gap: 15px; }
@media (min-width: 1500px) {
  .atlas-layout { grid-template-columns: minmax(0, 1.25fr) minmax(440px, .85fr); gap: 36px; }
  .explorer { padding: 26px; }
}
@media (max-width: 1100px) {
  .app { padding: 0 24px; }
  .atlas-layout { grid-template-columns: minmax(0, 1fr) minmax(355px, 1fr); gap: 20px; }
  .catalog-content { grid-template-columns: 1fr; max-height: 550px; }
  .lesson-card { min-height: 110px; }
  .header-right .status { display: none; }
  .map-heading h1 { font-size: 28px; }
  .detail-content { padding: 0 22px 20px; }
  .detail-top { padding: 12px 22px 22px; }
  .reader-context { margin-left: 22px; }
}
@media (max-width: 800px) {
  .app { padding: 0 18px; }
  .app-header { height: 70px; }
  .brand strong { font-size: 16px; }
  .brand-icon { width: 30px; height: 30px; font-size: 19px; }
  .header-right { gap: 10px; }
  .header-right .progress { border: 0; padding: 0; font-size: 10px; }
  .progress b { font-size: 16px; }
  #global-notes { font-size: 11px; padding: 7px; }
  .atlas-layout { display: block; padding-top: 18px; }
  .map-workspace { position: static; margin-bottom: 24px; }
  .place-breadcrumb { margin-bottom: 10px; }
  .map-heading { padding-bottom: 13px; }
  .japan-map svg { height: clamp(290px, 53vh, 470px); }
  .explorer { padding: 20px; }
  .catalog-content { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 570px; }
  .reader { position: fixed; z-index: 30; inset: 10px; overflow: auto; box-shadow: 0 0 0 30px #e8eee9d9, 0 10px 50px #18332440; }
  .reader-toolbar { position: sticky; top: 0; background: #fcfcf8; z-index: 2; padding: 12px 16px; }
  .reader-context { margin: 18px 22px 0; }
  .detail-content { max-height: none; overflow: visible; }
  .detail-top h2 { font-size: 23px; }
  .actions { position: sticky; bottom: 0; z-index: 1; padding: 14px 16px; }
  .reader .quiz-box { max-height: none; overflow: visible; padding: 0 22px 25px; }
  footer { flex-direction: column; }
}
@media (max-width: 450px) {
  .app { padding: 0 12px; }
  .app-header { gap: 8px; }
  .brand { gap: 7px; }
  .brand strong { font-size: 14px; }
  .brand-icon { width: 25px; height: 29px; font-size: 17px; }
  .header-right { gap: 8px; }
  .header-right .progress { display: none; }
  .map-heading h1 { font-size: 26px; }
  .map-heading .quiet-button { padding: 7px 10px; }
  .japan-map svg { height: 315px; }
  .region-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .region-picker button { padding: 7px 3px; font-size: 11px; }
  .explorer { padding: 16px; }
  .domain-picker button { font-size: 11px; }
  .catalog-content { gap: 8px; }
  .lesson-card { padding: 11px; min-height: 145px; }
  .lesson-card strong { font-size: 12px; }
  .reader { inset: 0; border: 0; border-radius: 0; }
  .reader-toolbar { padding: 10px; }
  .reader-toolbar button { padding: 7px; }
  .answers { grid-template-columns: 1fr; }
  .notes-keys { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
