:root {
  --ink: #1f2a36;
  --ink-soft: #5e6b78;
  --bg: #e8eef3;
  --paper: #ffffff;
  --line: #d3dce4;
  --blue: #3f7fbf;
  --blue-dark: #2a5a8a;
  --red: #c8302e;
  --rail: #5a4a3a;
  --font: "Zen Kaku Gothic New", system-ui, sans-serif;
  --title: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.7; line-break: strict; }
[hidden] { display: none !important; }
.g-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 540px; margin: 0 auto; font-size: 13px; font-weight: 900; }
.g-brand { color: var(--ink-soft); text-decoration: none; }
.g-title { flex: 1; text-align: center; font: 400 15px var(--title); color: var(--blue-dark); }
.g-head [data-mg-account] a { color: var(--blue-dark); text-decoration: none; }
main { max-width: 540px; margin: 0 auto; padding: 0 12px 24px; }

.top { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 6px; }
.top > div { background: var(--paper); border-radius: 12px; padding: 6px 10px; min-width: 0; }
.lbl { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.top b { display: block; font-size: 17px; font-weight: 900; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.t-rank b { font: 400 14px/1.45 var(--title); color: var(--blue-dark); }
.top small { display: block; font-size: 10px; color: var(--ink-soft); line-height: 1.45; }
.req { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 12px; border-radius: 12px; background: #fff5e2; border: 2px solid #f0c878; font-size: 12px; line-height: 1.5; }
.req.done { background: #eaf3fa; border-color: #9cc0e0; }
.req small { display: block; color: var(--ink-soft); font-weight: 700; }
.r-tag { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 900; font-size: 11px; }

.mapbox { margin-top: 8px; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 20px rgba(31, 42, 54, 0.15); background: #cfe3b0; }
#map { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.rail { stroke: var(--rail); stroke-width: 5; stroke-linecap: round; }
.tie { stroke: #efe4cc; stroke-width: 2; stroke-dasharray: 3 4; }
.plan { stroke: var(--rail); stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; opacity: 0.45; }
.plan.near { stroke: var(--red); opacity: 0.9; stroke-width: 2.6; }
.town { cursor: pointer; outline: none; }
.town .hit { fill: transparent; }
.town .dot { fill: #e8e4da; stroke: #9a9488; stroke-width: 2; }
.town.on .dot { fill: #fff; stroke: var(--blue-dark); stroke-width: 3; }
.town.on .dot.lv3 { stroke: var(--red); stroke-width: 3.6; }
.town .ben { fill: #e2a03c; stroke: #fff; stroke-width: 1.2; }
.town .nm { font: 900 11px var(--font); text-anchor: middle; fill: #4a5560; paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 3px; }
.town.on .nm { fill: var(--ink); }
.town.sel .dot { stroke: #e2683c; stroke-width: 4; }
.town:focus-visible .dot { stroke: #e2683c; stroke-width: 4; }

.box { margin-top: 8px; background: var(--paper); border-radius: 14px; padding: 10px 12px; }
.p-hint { margin: 0; font-size: 13px; color: var(--ink-soft); text-align: center; }
.p-h { margin: 0; font-size: 16px; font-weight: 900; line-height: 1.4; }
.p-h small { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.p-info { margin: 0; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.p-sub { margin: 6px 0 0; font-size: 12px; color: #9a6a1a; font-weight: 700; }
.p-h2 { margin: 12px 0 4px; font-size: 12px; font-weight: 900; color: var(--ink-soft); }
.routes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.routes li > .rt, .routes li { font-size: 13px; }
.routes li:not(:has(button)) { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: 10px; background: var(--bg); }
.rbtn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: var(--font); color: var(--ink); text-align: left; cursor: pointer; }
.rbtn:disabled { opacity: 0.5; cursor: default; }
.rt b { font-size: 14px; } .rt small { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.45; }
.rc { font-size: 13px; font-weight: 900; color: var(--blue-dark); white-space: nowrap; }
.done { font-size: 12px; font-weight: 900; color: var(--blue); }
.tr-top { display: flex; align-items: center; gap: 10px; }
.ti svg { width: 44px; height: 44px; display: block; }
.crowd { margin-top: 8px; }
.crowd p { margin: 0 0 4px; font-size: 12px; font-weight: 900; }
.crowd b { font-size: 15px; color: var(--blue-dark); } .crowd b.over { color: var(--red); }
.crowd small { margin-left: 8px; font-weight: 700; color: var(--ink-soft); }
.crowd-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.crowd-track span { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.goal { margin-top: 8px; background: var(--paper); border-radius: 12px; padding: 8px 12px 10px; }
.goal-text { margin: 0 0 4px; font-size: 12px; font-weight: 900; }
.goal-track { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.goal-track span { display: block; height: 100%; background: var(--red); border-radius: 999px; }
.book-wrap { margin-top: 8px; background: var(--paper); border-radius: 12px; padding: 0 12px; }
.book-wrap summary { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-weight: 900; cursor: pointer; list-style: none; }
.book-wrap summary::-webkit-details-marker { display: none; }
.book-wrap summary b { color: var(--red); font-size: 13px; }
.hint { margin: 0 0 8px; font-size: 12px; color: var(--ink-soft); }
.book { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.book li { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; background: var(--bg); }
.book li.got { background: #fff7e8; }
.book svg { flex: none; width: 40px; height: 40px; }
.book b { font-size: 13px; } .book small { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.45; }
.mg { margin-top: 12px; display: grid; gap: 10px; }
.mg .mg-box { background: var(--paper); border-color: transparent; }

.btn { display: block; width: 100%; margin: 8px 0 0; padding: 12px 10px; border: 0; border-radius: 12px; font: 900 14px/1.35 var(--font); cursor: pointer; background: var(--blue); color: #fff; }
.btn.alt { background: var(--blue-dark); }
.btn:disabled { background: #e0e6ec; color: #8a96a2; cursor: default; font-size: 13px; }
.btn.primary { background: var(--red); box-shadow: 0 4px 0 #8e1f1d; font-size: 15px; }
.btn.ghost { background: transparent; border: 2px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.dlg { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(20, 30, 40, 0.55); }
.dlg-in { width: 100%; max-width: 380px; background: var(--paper); border-radius: 18px; padding: 20px 18px 16px; text-align: center; }
.dlg h2 { margin: 0 0 10px; font: 400 22px/1.4 var(--title); color: var(--blue-dark); }
.dlg p { margin: 0 0 10px; font-size: 14px; text-align: left; }
.dlg .aw { text-align: center; } .dlg .aw b { font-size: 24px; color: var(--blue-dark); }
.aw-sub { text-align: center !important; font-weight: 900; color: var(--red); }
.aw-sub:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 16px; background: rgba(42, 90, 138, 0.96); color: #fff; font-weight: 900; font-size: 14px; text-align: center; pointer-events: none; }

.guide { margin-top: 28px; background: var(--paper); border-radius: 18px; padding: 22px 20px 12px; font-size: 15px; line-height: 1.85; }
.guide p { margin: 0 0 1em; }
.guide h2 { font-size: 19px; margin: 32px 0 12px; padding-left: 10px; border-left: 5px solid var(--blue); line-height: 1.4; }
.guide h2:first-child { margin-top: 0; }
.guide h3 { font-size: 16px; margin: 22px 0 6px; line-height: 1.5; }
.guide .steps { list-style: none; padding: 0; margin: 0 0 1em; }
.guide .steps li { display: flex; align-items: baseline; gap: 6px; margin: 6px 0; }
.guide .steps .num { flex: none; font-weight: 900; color: var(--blue); }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details p { margin: 8px 0 4px; }
.guide summary { font-weight: 900; cursor: pointer; }
.reset-row { text-align: center; margin-top: 16px !important; }
.reset-row .btn { display: inline-block; width: auto; padding: 8px 16px; }
.g-foot { max-width: 540px; margin: 0 auto; padding: 14px 16px 28px; font-size: 12px; text-align: center; }
.g-foot a { color: var(--ink-soft); }
.g-title, .t-rank b, .top b { white-space: nowrap; }
@media (max-width: 360px) {
  .g-head { gap: 6px; font-size: 12px; }
  .g-title { font-size: 13px; }
  .top > div { padding: 6px 8px; }
  .top b { font-size: 15px; }
  .t-rank b { font-size: 12px; }
  .lbl { font-size: 10px; }
}
