:root {
  --bg: #041125;
  --bg-deep: #020b1b;
  --surface: #091b34;
  --surface-2: #0d2442;
  --surface-3: #122c4d;
  --line: rgba(159, 195, 227, .15);
  --line-strong: rgba(159, 195, 227, .3);
  --text: #edf5ff;
  --muted: #94aac4;
  --faint: #617d9c;
  --cyan: #82e3ee;
  --cyan-strong: #38bed3;
  --green: #83e0bb;
  --amber: #f7c87b;
  --pink: #ef9fbf;
  --danger: #ff8f9f;
  --shadow: 0 24px 70px rgba(0, 0, 0, .26);
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; min-height: 100dvh; margin: 0; background: radial-gradient(circle at 75% -10%, rgba(36, 119, 166, .16), transparent 36rem), linear-gradient(135deg, var(--bg-deep), var(--bg) 48%, #061a32); color: var(--text); }
body.modal-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--cyan); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .55rem; color: var(--cyan); font-size: .66rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

/* Shared controls */

.button { min-height: 42px; border: 1px solid transparent; border-radius: 11px; padding: .7rem 1rem; cursor: pointer; color: var(--text); transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.primary { background: var(--cyan); color: #052034; font-weight: 800; }
.button.primary:hover { background: #a2f2f4; }
.button.secondary { border-color: var(--line-strong); background: rgba(22, 48, 79, .85); color: var(--text); }
.button.secondary:hover, .button.secondary.active { border-color: rgba(130, 227, 238, .65); background: rgba(40, 96, 128, .55); }
.button.danger { border-color: rgba(255, 143, 159, .35); background: rgba(135, 42, 72, .28); color: #ffb9c5; }
.button.full { display: flex; align-items: center; justify-content: center; width: 100%; gap: .6rem; }
.button.full span:last-child { margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 29, 54, .8); color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: var(--line-strong); color: var(--text); }

input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #06152b; color: var(--text); padding: .78rem .85rem; transition: border-color .18s ease, box-shadow .18s ease; }
input::placeholder, textarea::placeholder { color: #5f7895; }
input:focus, textarea:focus, select:focus { border-color: rgba(130, 227, 238, .72); box-shadow: 0 0 0 3px rgba(130, 227, 238, .11); }
textarea { resize: vertical; }
label { display: grid; gap: .45rem; color: #bdd0e5; font-size: .77rem; font-weight: 700; }
.form-error, .form-message { min-height: 1.2rem; margin: .2rem 0 0; color: var(--danger); font-size: .78rem; }
.form-message.show { color: var(--green); }

/* Login */

.login-page { position: relative; display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: max(2rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left)); overflow: hidden; }
.login-page::before { position: absolute; inset: 0; content: ""; opacity: .33; background-image: linear-gradient(rgba(130, 227, 238, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(130, 227, 238, .04) 1px, transparent 1px); background-size: 55px 55px; mask-image: linear-gradient(to bottom, black, transparent 80%); }
.login-orbit { position: absolute; border: 1px solid rgba(130, 227, 238, .12); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 46rem; height: 46rem; right: -21rem; top: -18rem; box-shadow: 0 0 90px rgba(46, 154, 187, .12); }
.orbit-two { width: 30rem; height: 30rem; left: -18rem; bottom: -15rem; }
.login-card { position: relative; z-index: 1; width: min(100%, 480px); padding: 3rem; border: 1px solid var(--line); border-radius: 27px; background: rgba(6, 22, 44, .88); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 1.6rem; border: 1px solid rgba(130, 227, 238, .45); border-radius: 16px; background: linear-gradient(145deg, rgba(116, 213, 230, .22), rgba(30, 91, 131, .35)); color: var(--cyan); font-size: 1.7rem; box-shadow: 0 10px 32px rgba(37, 157, 190, .16); }
.brand-mark.small { flex: 0 0 auto; width: 37px; height: 37px; margin: 0; border-radius: 11px; font-size: 1.1rem; }
.login-card h1 { margin: 0; font-size: clamp(2.3rem, 7vw, 3.7rem); letter-spacing: -.06em; line-height: .98; }
.login-intro { max-width: 35rem; margin: 1.3rem 0 2rem; color: var(--muted); line-height: 1.7; }
.form-stack { display: grid; gap: 1rem; }
.login-footnote { margin: 2rem 0 0; color: var(--faint); font-size: .68rem; line-height: 1.5; }
.oidc-slot { margin-top: .25rem; }
.login-divider { display: flex; align-items: center; gap: .7rem; margin: .8rem 0; color: var(--faint); font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; }
.login-divider::before, .login-divider::after { flex: 1; height: 1px; content: ""; background: var(--line); }
.oidc-button { text-decoration: none; text-align: center; }
.authentik-logo { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #7e9bb9; border-radius: 6px; color: #bdd0e5; font-size: .7rem; font-weight: 900; }

/* App shell and navigation */

.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: max(1.35rem, calc(1.35rem + env(safe-area-inset-top))) max(1rem, env(safe-area-inset-right)) max(1rem, calc(1rem + env(safe-area-inset-bottom))) max(1rem, env(safe-area-inset-left)); border-right: 1px solid var(--line); background: rgba(3, 15, 32, .74); backdrop-filter: blur(20px); }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .45rem 1.65rem; }
.sidebar-brand strong { display: block; font-size: .85rem; letter-spacing: -.015em; }
.sidebar-brand small { display: block; margin-top: .18rem; color: var(--faint); font-size: .62rem; }
.sidebar-copy { padding: .85rem .55rem 1.4rem; border-top: 1px solid var(--line); }
.sidebar-copy p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.sidebar-stat { padding: 1rem .7rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(13, 36, 66, .52); }
.sidebar-stat span { color: var(--muted); font-size: .68rem; }
.sidebar-stat strong { display: block; margin: .22rem 0 .7rem; font-size: 1.55rem; letter-spacing: -.06em; }
.sidebar-nav { display: grid; gap: .35rem; margin-top: 1.5rem; }
.nav-button { display: flex; align-items: center; gap: .7rem; border: 1px solid transparent; border-radius: 11px; padding: .72rem .7rem; background: transparent; color: var(--muted); cursor: pointer; text-align: left; font-size: .77rem; font-weight: 700; }
.nav-button:hover, .nav-button.active { border-color: var(--line); background: rgba(23, 55, 91, .45); color: var(--text); }
.nav-button > span { min-width: 0; }
.nav-icon { flex: 0 0 24px; width: 24px; height: 24px; overflow: visible; color: var(--cyan); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: color .18s ease, transform .18s ease, filter .18s ease; }
.nav-button:hover .nav-icon, .nav-button.active .nav-icon { color: #a5f1f4; filter: drop-shadow(0 0 7px rgba(130, 227, 238, .22)); }
.nav-button:hover .nav-icon { transform: translateX(1px); }
.sidebar-user { display: flex; align-items: center; gap: .6rem; margin-top: auto; padding: .75rem .2rem .1rem; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #36768d, #183e6a); color: var(--cyan); font-size: .8rem; font-weight: 900; }
.sidebar-user > div:nth-child(2) { min-width: 0; flex: 1; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: var(--text); font-size: .72rem; }
.sidebar-user small { margin-top: .15rem; color: var(--faint); font-size: .6rem; }
.mobile-sidebar-backdrop { display: none; }

.content { width: min(100%, 1440px); min-width: 0; margin: 0 auto; padding: 2.2rem clamp(1.1rem, 3vw, 3.4rem) 2rem; }
.page-view { display: none; }
.page-view.active { display: block; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.topbar h1 { margin: 0; font-size: clamp(1.65rem, 3.2vw, 2.5rem); letter-spacing: -.055em; }
.topbar-subtitle { margin: .45rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.mobile-menu { display: none; }
/* Progress and panels */

.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: rgba(122, 162, 195, .17); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan-strong), var(--cyan)); transition: width .35s ease; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(150deg, rgba(10, 32, 59, .88), rgba(5, 20, 40, .88)); box-shadow: 0 12px 45px rgba(0, 0, 0, .1); }
.standalone-panel { min-height: calc(100vh - 9.5rem); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel-heading h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.035em; }
.panel-heading .muted { margin: .45rem 0 0; font-size: .76rem; line-height: 1.45; }
.panel-heading.compact { align-items: center; padding: 0 .35rem; }
.panel-heading.compact h2 { font-size: 1.05rem; }

/* Timeline */

.timeline-panel { margin-bottom: 1.2rem; padding: 1.3rem 1.4rem 1.1rem; }
.timeline-heading { align-items: center; }
.timeline-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; }
.timeline-filter-button { border: 1px solid transparent; border-radius: 99px; padding: .42rem .62rem; background: transparent; color: var(--faint); cursor: pointer; font-size: .64rem; font-weight: 700; }
.timeline-filter-button:hover, .timeline-filter-button.active { border-color: var(--line-strong); background: rgba(43, 91, 129, .3); color: var(--text); }
.timeline-list { position: relative; display: grid; gap: .65rem; max-height: 540px; margin-top: 1rem; overflow: auto; padding: .45rem .25rem .55rem 0; }
.timeline-list::before { position: absolute; top: 1rem; bottom: 1rem; left: 8px; width: 1px; content: ""; background: linear-gradient(var(--cyan-strong), var(--line)); }
.timeline-entry { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 1.05rem; padding: .55rem 0 .95rem; }
.timeline-entry-marker { position: relative; z-index: 1; display: flex; justify-content: center; }
.timeline-entry-dot { display: grid; place-items: center; width: 18px; height: 18px; border: 3px solid var(--surface); border-radius: 50%; background: var(--cyan-strong); color: #062039; font-size: .48rem; font-weight: 900; box-shadow: 0 0 0 1px rgba(130, 227, 238, .55); }
.timeline-entry-visit .timeline-entry-dot { background: var(--green); box-shadow: 0 0 0 1px rgba(131, 224, 187, .5); }
.timeline-entry-progress .timeline-entry-dot { background: var(--amber); box-shadow: 0 0 0 1px rgba(247, 200, 123, .5); }
.timeline-entry-highlight .timeline-entry-dot { background: var(--pink); box-shadow: 0 0 0 1px rgba(239, 159, 191, .5); }
.timeline-entry-card { min-width: 0; padding: 1rem 1.05rem; border: 1px solid var(--line); border-radius: 15px; background: rgba(6, 23, 45, .66); }
.timeline-entry-copy { min-width: 0; }
.timeline-entry-header { display: flex; align-items: flex-start; flex-direction: column; gap: .3rem; margin-bottom: .65rem; }
.timeline-entry-type { color: var(--cyan); font-size: .61rem; font-weight: 800; letter-spacing: .06em; line-height: 1.35; text-transform: uppercase; }
.timeline-entry-visit .timeline-entry-type { color: var(--green); }
.timeline-entry-progress .timeline-entry-type { color: var(--amber); }
.timeline-entry-highlight .timeline-entry-type { color: var(--pink); }
.timeline-entry-date { color: var(--faint); font-size: .62rem; line-height: 1.35; white-space: nowrap; }
.timeline-entry-copy h3 { margin: 0; color: var(--text); font-size: .88rem; letter-spacing: -.02em; line-height: 1.35; overflow-wrap: anywhere; }
.timeline-entry-copy > p { margin: .5rem 0 0; color: var(--muted); font-size: .7rem; line-height: 1.6; overflow-wrap: anywhere; }
.timeline-entry-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; }
.timeline-entry-action { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; border: 1px solid var(--line); border-radius: 9px; padding: .42rem .58rem; background: rgba(18, 55, 87, .48); color: var(--muted); cursor: pointer; font-size: .61rem; font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none; }
.timeline-entry-action:hover, .timeline-entry-map-action { border-color: rgba(130, 227, 238, .5); color: var(--cyan); }

/* Full-page SVG map */

.map-page-layout { display: block; }
.map-panel { min-height: 630px; padding: 1.4rem 1.4rem 1rem; }
.map-page-panel { display: flex; flex-direction: column; min-height: calc(100vh - 9.5rem); padding: 1.35rem 1.4rem 1rem; }
.map-stage { position: relative; flex: 1; min-height: min(68vh, 720px); margin-top: .8rem; overflow: hidden; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 15px; background: radial-gradient(circle at 52% 40%, rgba(22, 83, 126, .22), transparent 55%), rgba(3, 17, 36, .64); user-select: none; }
.map-page-panel .japan-map { height: 100%; min-height: min(68vh, 720px); margin-top: 0; background: transparent; }
.map-page-panel .japan-map svg { width: min(100%, 760px); max-height: min(68vh, 760px); }
.map-controls { position: absolute; z-index: 4; right: 1rem; bottom: 1rem; display: flex; align-items: center; gap: .3rem; border: 1px solid var(--line-strong); border-radius: 12px; padding: .3rem; background: rgba(3, 15, 32, .86); box-shadow: 0 10px 28px rgba(0, 0, 0, .24); backdrop-filter: blur(10px); }
.map-progress-meter { position: absolute; z-index: 4; top: 1rem; left: 1rem; display: flex; align-items: baseline; gap: .5rem; border: 1px solid var(--line-strong); border-radius: 12px; padding: .55rem .75rem; background: rgba(3, 15, 32, .86); box-shadow: 0 10px 28px rgba(0, 0, 0, .24); backdrop-filter: blur(10px); pointer-events: none; }
.map-progress-meter strong { color: var(--cyan); font-size: .9rem; font-weight: 900; }
.map-progress-meter span { color: var(--muted); font-size: .62rem; }
.map-control, .map-zoom-value { display: grid; place-items: center; min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: rgba(17, 51, 83, .7); color: var(--text); cursor: pointer; font-size: 1rem; font-weight: 800; touch-action: manipulation; }
.map-zoom-value { min-width: 60px; padding: 0 .45rem; color: var(--cyan); font-size: .64rem; }
.map-control:hover, .map-zoom-value:hover { border-color: rgba(130, 227, 238, .6); background: rgba(39, 102, 133, .7); }
.map-tooltip { position: absolute; z-index: 6; display: grid; min-width: 170px; max-width: 230px; gap: .16rem; pointer-events: none; border: 1px solid rgba(130, 227, 238, .45); border-radius: 12px; padding: .7rem .78rem; background: rgba(3, 17, 36, .94); box-shadow: 0 14px 35px rgba(0, 0, 0, .32); backdrop-filter: blur(10px); }
.map-tooltip[hidden] { display: none; }
.map-tooltip strong { overflow: hidden; color: var(--text); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.map-tooltip span { color: var(--cyan); font-size: 1.15rem; font-weight: 900; letter-spacing: -.04em; }
.map-tooltip small { color: var(--muted); font-size: .62rem; }
.japan-map { display: grid; place-items: center; min-height: 505px; margin-top: .7rem; padding: .6rem; border-radius: 15px; background: radial-gradient(circle at 52% 40%, rgba(22, 83, 126, .22), transparent 55%), rgba(3, 17, 36, .64); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.japan-map.is-dragging { cursor: grabbing; }
.japan-map svg { display: block; width: min(100%, 520px); height: auto; max-height: 520px; overflow: visible; }
.map-transform-layer { transform-box: fill-box; }
.japan-map path { vector-effect: non-scaling-stroke; }
.prefecture-shape { cursor: pointer; stroke: rgba(4, 18, 38, .7); stroke-width: .8px; transition: filter .18s ease, opacity .18s ease, stroke .18s ease; }
.japan-map .prefecture-shape { cursor: grab; }
.japan-map.is-dragging .prefecture-shape { cursor: grabbing; }
.prefecture-shape:hover, .prefecture-shape:focus { filter: brightness(1.35) drop-shadow(0 0 3px rgba(130, 227, 238, .7)); stroke: #e8fdff; stroke-width: 1.5px; outline: none; }
.map-photo-layer { pointer-events: none; }
.map-photo-marker { pointer-events: auto; cursor: pointer; outline: none; }
.map-photo-marker:hover, .map-photo-marker:focus { filter: drop-shadow(0 0 4px rgba(255, 222, 146, .95)); }
.map-photo-fallback .map-photo-ring { stroke: var(--amber); stroke-dasharray: 2 1.5; }
.map-photo-thumbnail { pointer-events: auto; }
.map-photo-ring { fill: none; stroke: #ffdd92; stroke-width: 1.15; vector-effect: non-scaling-stroke; }
.map-loading { color: var(--muted); font-size: .8rem; }

/* Prefecture list */

.prefecture-panel { min-height: 630px; padding: 1.4rem 1rem 1rem; }
.prefecture-tools { margin: 1rem .25rem .7rem; }
.prefecture-search { position: relative; display: block; }
.prefecture-search svg { position: absolute; top: 50%; left: .8rem; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--cyan); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; pointer-events: none; }
.prefecture-search input { min-height: 41px; padding-left: 2.35rem; font-size: .72rem; }
.prefecture-tools .filter-row { margin: .65rem 0 0; }
.filter-row { display: flex; gap: .35rem; margin: 1rem .25rem .7rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.filter-button { border: 1px solid transparent; border-radius: 99px; padding: .4rem .62rem; background: transparent; color: var(--faint); cursor: pointer; font-size: .66rem; }
.filter-button:hover, .filter-button.active { border-color: var(--line); background: rgba(43, 91, 129, .3); color: var(--text); }
.prefecture-list { max-height: 535px; overflow: auto; padding-right: .25rem; }
.prefectures-page .prefecture-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .8rem; max-height: none; }
.timeline-page .timeline-panel { margin-bottom: 0; }
.achievements-panel { padding: 1.4rem; }
.achievement-group { margin-top: 1.4rem; }
.achievement-group-title { margin: 0 0 .7rem; color: var(--cyan); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.achievement-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.achievement-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: .8rem; padding: .8rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(6, 23, 45, .66); }
.achievement-card.is-locked { opacity: .68; }
.achievement-icon { display: grid; place-items: center; width: 58px; height: 58px; border: 2px solid var(--line-strong); border-radius: 12px; background: rgba(18, 55, 87, .8); color: var(--amber); font-size: 1.45rem; }
.achievement-card.is-unlocked .achievement-icon { box-shadow: 0 0 18px rgba(247, 200, 123, .18); }
.achievement-copy { min-width: 0; }
.achievement-topline { display: flex; justify-content: space-between; gap: .4rem; color: var(--faint); font-size: .57rem; text-transform: uppercase; }
.achievement-category { color: var(--cyan); font-weight: 800; }
.achievement-copy h3 { margin: .25rem 0 .2rem; font-size: .82rem; }
.achievement-copy p { margin: 0 0 .55rem; font-size: .66rem; line-height: 1.45; }
.achievement-progress { height: 5px; overflow: hidden; border-radius: 99px; background: rgba(122, 162, 195, .17); }
.achievement-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan-strong), var(--amber)); }
.achievement-count { display: block; margin-top: .35rem; color: var(--faint); font-size: .58rem; }
.achievement-nav-icon { display: grid; place-items: center; font-size: .95rem; }
.prefecture-row { display: flex; align-items: center; width: 100%; border: 1px solid transparent; border-radius: 11px; padding: .62rem .45rem .62rem .55rem; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.prefecture-row:hover { border-color: var(--line); background: rgba(21, 56, 91, .45); }
.prefecture-row-main { min-width: 0; flex: 1; }
.prefecture-row-title { position: relative; display: flex; align-items: baseline; gap: .35rem; padding-right: 2.4rem; }
.prefecture-row-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.prefecture-row-title small { color: var(--faint); font-size: .59rem; }
.prefecture-row-value { position: absolute; right: 0; font-size: .68rem; font-weight: 800; }
.mini-progress { display: block; height: 4px; margin-top: .43rem; overflow: hidden; border-radius: 99px; background: rgba(123, 168, 203, .13); }
.mini-progress i { display: block; height: 100%; border-radius: inherit; }
.progress-status { display: block; margin-top: .36rem; color: var(--muted); font-size: .61rem; font-weight: 700; }
.progress-status-0 { color: var(--cyan); }
.progress-status-100 { color: var(--green); }
.row-previews { display: flex; height: 25px; margin-top: .42rem; }
.row-previews img { width: 25px; height: 25px; margin-right: -5px; border: 2px solid var(--surface); border-radius: 7px; object-fit: cover; }
.row-arrow { margin-left: .55rem; color: var(--faint); font-size: 1rem; }
.empty-state, .empty-inline { display: grid; place-items: center; min-height: 120px; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 1rem; color: var(--faint); font-size: .75rem; line-height: 1.5; text-align: center; }

/* Prefecture detail */

.overlay { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(0, 8, 21, .8); backdrop-filter: blur(10px); }
.detail-card { display: flex; flex-direction: column; width: min(100%, 1100px); max-height: min(94vh, 940px); max-height: min(94dvh, 940px); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 22px; background: linear-gradient(145deg, #0a2140, #05152c); box-shadow: var(--shadow); }
.detail-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: 1.35rem 1.45rem 1rem; border-bottom: 1px solid var(--line); }
.close-button { grid-column: 1; grid-row: 1; font-size: 1.25rem; }
.detail-header > div:nth-child(2) { grid-column: 2; grid-row: 1; }
.detail-header h2 { margin: 0; font-size: clamp(1.45rem, 3.8vw, 2.4rem); letter-spacing: -.06em; }
.detail-header .muted { margin: .3rem 0 0; font-size: .8rem; }
.detail-progress-badge { grid-column: 3; grid-row: 1; min-width: 82px; padding: .55rem .65rem; border: 1px solid rgba(130, 227, 238, .23); border-radius: 12px; background: rgba(12, 57, 87, .46); text-align: center; }
.detail-progress-badge span, .detail-progress-badge small { display: block; }
.detail-progress-badge span { color: var(--cyan); font-size: 1.15rem; font-weight: 900; }
.detail-progress-badge small { margin-top: .15rem; color: var(--faint); font-size: .58rem; }
.detail-progress { padding: .85rem 1.45rem .9rem; }
.progress-track.large { height: 8px; }
.progress-options { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: .65rem; color: var(--muted); font-size: .67rem; }
.progress-options > div { display: flex; flex-wrap: wrap; gap: .25rem; }
.progress-options button { border: 1px solid transparent; border-radius: 99px; padding: .3rem .45rem; background: transparent; color: var(--faint); cursor: pointer; font-size: .63rem; }
.progress-options button:hover, .progress-options button.active { border-color: rgba(130, 227, 238, .4); background: rgba(40, 119, 145, .3); color: var(--cyan); }
.detail-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; overflow: visible; padding: .75rem 1.45rem; border-bottom: 1px solid var(--line); }
.detail-tab { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; min-width: 0; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; padding: .62rem .85rem; background: rgba(8, 28, 53, .45); color: var(--faint); cursor: pointer; font-size: .72rem; font-weight: 700; text-align: left; white-space: nowrap; }
.detail-tab small { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; padding: .2rem .38rem; color: var(--cyan); font-size: .6rem; font-weight: 800; line-height: 1; }
.detail-tab.active small { border-color: rgba(130, 227, 238, .45); background: rgba(130, 227, 238, .1); }
.detail-tab:hover, .detail-tab.active { border-color: rgba(130, 227, 238, .48); background: rgba(40, 119, 145, .24); color: var(--text); }
.detail-content { display: none; overflow: auto; padding: 1.3rem 1.45rem 1.6rem; }
.detail-content.active { display: block; }
.detail-loading { padding: 4rem 1rem; color: var(--muted); text-align: center; }
.overview-highlight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; width: 100%; }
.overview-highlight-card { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; padding: 0; background: #07172d; cursor: zoom-in; }
.overview-highlight-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.overview-highlight-card:hover img { transform: scale(1.035); }
.overview-highlight-card.is-empty { border-style: dashed; background: rgba(7, 23, 45, .48); cursor: default; }
.detail-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .65rem; margin-bottom: 1rem; }
.detail-stat { padding: .82rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(9, 31, 57, .66); }
.detail-stat strong { display: block; font-size: 1.2rem; letter-spacing: -.04em; }
.detail-stat span { display: block; margin-top: .2rem; color: var(--faint); font-size: .62rem; }
.detail-stat.blue strong { color: var(--cyan); }
.detail-stat.green strong { color: var(--green); }
.detail-stat.amber strong { color: var(--amber); }
.detail-stat.pink strong { color: var(--pink); }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.detail-card-section { min-height: 235px; padding: 1.1rem; border: 1px solid var(--line); border-radius: 15px; background: rgba(7, 24, 47, .58); }
.detail-card-section h3 { margin: 0; font-size: 1rem; letter-spacing: -.025em; }
.detail-card-section > .muted { margin: .5rem 0 1rem; font-size: .73rem; line-height: 1.55; }
.regional-achievements-heading { display: flex; align-items: start; justify-content: space-between; gap: .7rem; }
.regional-achievements-heading .muted { max-width: 31rem; }
.regional-achievement-list { display: grid; gap: .4rem; margin-top: .9rem; }
.regional-achievement-row { display: flex; align-items: center; gap: .45rem; min-width: 0; padding: .35rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(4, 18, 38, .38); }
.regional-achievement-row.is-complete { border-color: rgba(131, 224, 187, .35); background: rgba(22, 91, 78, .18); }
.regional-achievement-info { display: flex; align-items: center; min-width: 0; flex: 1; gap: .6rem; border: 0; padding: .15rem; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.regional-achievement-info:hover .regional-achievement-name { color: var(--cyan); }
.regional-achievement-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(24, 67, 94, .85); color: var(--amber); font-size: 1.05rem; }
.regional-achievement-name { overflow-wrap: anywhere; font-size: .7rem; font-weight: 800; line-height: 1.3; }
.regional-achievement-status { display: grid; place-items: center; flex: 0 0 auto; min-width: 34px; min-height: 34px; padding: 0 .35rem; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--muted); font-size: .65rem; font-weight: 800; }
.regional-achievement-status.is-complete { border-color: rgba(131, 224, 187, .5); background: rgba(33, 113, 91, .45); color: var(--green); font-size: 1rem; }
.progress-overview { min-height: 235px; }
.detail-overview-track { height: 9px; margin: 1.25rem 0 .55rem; }
.detail-navigation { display: flex; justify-content: flex-end; margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.detail-view-heading .button { flex: 0 0 auto; }
.travel-chapter { min-height: auto; margin-bottom: 1.25rem; }
.travel-chapter .notes-input { min-height: 155px; }
.travel-spots { padding-bottom: .2rem; }
.inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-top: .65rem; }
.inline-actions .button { min-height: 36px; padding: .52rem .7rem; font-size: .7rem; }
.inline-hint { color: var(--faint); font-size: .66rem; }
.highlight-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; min-height: 98px; margin: .8rem 0; }
.highlight-preview-photo { display: block; width: 100%; height: 98px; overflow: hidden; border: 0; border-radius: 8px; padding: 0; background: #07172d; cursor: zoom-in; }
.highlight-preview-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.highlight-preview-photo:hover img { transform: scale(1.045); }
.highlight-preview-photo:nth-child(1):only-child { grid-column: span 4; }
.highlight-preview-photo:nth-child(2) { grid-column: span 2; }
.highlight-preview .empty-inline { grid-column: 1 / -1; min-height: 98px; padding: .5rem; }
.detail-highlight-only-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.detail-highlight-only-card { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; padding: 0; background: #07172d; cursor: zoom-in; }
.detail-highlight-only-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.detail-highlight-only-card:hover img { transform: scale(1.035); }
.tab-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tab-heading h3 { margin: 0; font-size: 1.2rem; letter-spacing: -.035em; }
.tab-heading .muted { max-width: 680px; margin: .4rem 0 0; font-size: .74rem; line-height: 1.55; }
.count-badge { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; padding: .45rem .65rem; color: var(--cyan); font-size: .62rem; font-weight: 800; }

/* Attractions and chapter forms */

.spot-list { display: grid; gap: .55rem; }
.spot-row { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: .95rem 1rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(6, 23, 45, .62); }
.spot-copy { min-width: 0; }
.spot-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .45rem; }
.category-pill, .seed-pill { display: inline-block; border-radius: 99px; padding: .25rem .45rem; font-size: .58rem; font-weight: 800; }
.category-pill { background: rgba(130, 227, 238, .11); color: var(--cyan); }
.seed-pill { background: rgba(247, 200, 123, .1); color: var(--amber); }
.spot-row h4 { margin: 0; font-size: .86rem; }
.spot-row p { margin: .35rem 0 .5rem; font-size: .7rem; line-height: 1.5; }
.spot-links { display: flex; flex-wrap: wrap; gap: .55rem; }
.coordinate-link { color: var(--faint); font-size: .64rem; text-decoration: none; }
.coordinate-link:hover, .coordinate-link.maps-link { color: var(--cyan); }
.spot-controls { flex: 0 0 210px; }
.status-select { min-height: 35px; padding: .45rem .55rem; font-size: .65rem; }
.status-select.status-visited { border-color: rgba(131, 224, 187, .38); color: var(--green); }
.status-select.status-planned { border-color: rgba(247, 200, 123, .38); color: var(--amber); }
.spot-status-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
.status-button { min-height: 35px !important; padding: .42rem .35rem !important; border: 1px solid var(--line) !important; border-radius: 8px !important; background: rgba(8, 28, 53, .55) !important; color: var(--faint); cursor: pointer; font-size: .62rem !important; }
.status-button:hover, .status-button.active { border-color: var(--cyan) !important; background: rgba(40, 119, 145, .3) !important; color: var(--text); }
.status-button.status-planned.active { border-color: rgba(247, 200, 123, .65) !important; color: var(--amber); }
.status-button.status-visited.active { border-color: rgba(131, 224, 187, .65) !important; color: var(--green); }
.add-section { margin-top: 1rem; padding: 1rem; border: 1px dashed var(--line-strong); border-radius: 14px; }
.add-section h3 { margin: 0; font-size: .94rem; }
.inline-form { display: grid; grid-template-columns: 1.1fr .8fr 1.3fr .7fr .7fr 1fr auto; gap: .45rem; margin-top: .75rem; }
.inline-form input { min-width: 0; font-size: .67rem; }
.inline-form .button { white-space: nowrap; font-size: .68rem; }

/* Highlight gallery and upload */

.highlight-editor, .photo-library { margin-top: 1rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(4, 18, 38, .38); }
.highlight-editor > summary, .photo-library > summary { display: flex; align-items: center; justify-content: space-between; gap: .7rem; list-style: none; padding: .78rem .9rem; color: var(--text); cursor: pointer; font-size: .7rem; font-weight: 800; }
.highlight-editor > summary::-webkit-details-marker, .photo-library > summary::-webkit-details-marker { display: none; }
.highlight-editor > summary::after, .photo-library > summary::after { content: "+"; color: var(--cyan); font-size: 1rem; line-height: 1; }
.highlight-editor[open] > summary, .photo-library[open] > summary { border-bottom: 1px solid var(--line); }
.highlight-editor[open] > summary::after, .photo-library[open] > summary::after { content: "−"; }
.highlight-editor-body, .photo-library-body { padding: 1rem; }
.highlight-editor-body > .tab-heading:first-child, .photo-library-body > .tab-heading:first-child { margin-top: 0; }
.photo-library-section + .photo-library-section { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.upload-panel { display: grid; grid-template-columns: minmax(210px, .8fr) minmax(0, 1.2fr); gap: 1rem; padding: 1rem; border: 1px dashed rgba(130, 227, 238, .33); border-radius: 15px; background: rgba(19, 72, 100, .16); }
.upload-copy { display: flex; align-items: center; gap: .65rem; }
.upload-copy strong, .upload-copy small { display: block; }
.upload-copy strong { font-size: .78rem; }
.upload-copy small { margin-top: .25rem; color: var(--faint); font-size: .61rem; line-height: 1.4; }
.upload-icon { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border: 1px solid rgba(130, 227, 238, .35); border-radius: 11px; color: var(--cyan); font-size: 1.3rem; }
.upload-fields { display: grid; grid-template-columns: .85fr 1fr 1.2fr auto; align-items: center; gap: .45rem; }
.upload-fields input { min-width: 0; font-size: .66rem; }
.upload-fields input[type=file] { padding: .68rem .4rem; }
.upload-fields .button { white-space: nowrap; font-size: .68rem; }
.upload-panel .form-message { grid-column: 1 / -1; margin: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-top: 1rem; }
.photo-card { position: relative; min-width: 0; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; padding: 0; background: #07172d; cursor: pointer; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.photo-card:hover img { transform: scale(1.045); }
.photo-card-overlay { position: absolute; right: 0; bottom: 0; left: 0; display: block; padding: 2rem .6rem .55rem; background: linear-gradient(transparent, rgba(1, 8, 19, .9)); text-align: left; }
.photo-card-overlay strong, .photo-card-overlay small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-card-overlay strong { color: white; font-size: .67rem; }
.photo-card-overlay small { margin-top: .18rem; color: #b6cce1; font-size: .57rem; }
.highlight-controls { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.slot-fixed-label { color: var(--cyan); font-size: .68rem; font-weight: 800; }
.slot-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.slot-option { min-height: 34px !important; padding: .45rem .65rem !important; font-size: .64rem !important; }
.selection-count { color: var(--muted); font-size: .68rem; }
.highlight-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.highlight-choice { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; border: 2px solid transparent; border-radius: 12px; padding: 0; background: #06152b; cursor: pointer; }
.highlight-choice input { position: absolute; z-index: 2; width: 22px; height: 22px; margin: .5rem; accent-color: var(--cyan); }
.highlight-choice img { width: 100%; height: 100%; object-fit: cover; opacity: .7; transition: opacity .18s ease, transform .18s ease; }
.highlight-choice:hover img, .highlight-choice.selected img { opacity: 1; transform: scale(1.03); }
.highlight-choice.selected { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(130, 227, 238, .14); }
.choice-check { position: absolute; right: .45rem; bottom: .4rem; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: rgba(2, 13, 28, .75); color: transparent; font-size: .75rem; font-weight: 900; }
.highlight-choice.selected .choice-check { background: var(--cyan); color: #062039; }
.highlight-actions { justify-content: flex-end; }

/* Dialog and feedback */

.edit-dialog { width: min(100% - 2rem, 620px); max-height: 92vh; max-height: 92dvh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 19px; padding: 0; background: #081b35; color: var(--text); box-shadow: var(--shadow); }
.edit-dialog::backdrop { background: rgba(0, 8, 21, .75); backdrop-filter: blur(7px); }
.photo-viewer-dialog { width: min(96vw, 1180px); height: min(94vh, 900px); height: min(94dvh, 900px); max-width: 96vw; max-height: 94vh; max-height: 94dvh; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 19px; padding: 0; background: #020b1b; color: var(--text); box-shadow: var(--shadow); }
.photo-viewer-dialog::backdrop { background: rgba(0, 3, 12, .9); backdrop-filter: blur(8px); }
.photo-viewer-shell { position: relative; display: flex; height: 100%; min-height: 0; flex-direction: column; gap: .75rem; padding: 1rem; }
.photo-viewer-close { position: absolute; z-index: 2; top: .7rem; right: .7rem; }
.photo-viewer-image { display: block; width: 100%; min-height: 0; flex: 1 1 auto; border-radius: 12px; background: #010714; object-fit: contain; }
.photo-viewer-copy { padding: 0 .25rem; }
.photo-viewer-copy h2 { margin: 0; font-size: 1rem; }
.photo-viewer-copy p { margin: .25rem 0 0; font-size: .7rem; }
.photo-viewer-actions { margin-top: 0; }
.achievement-dialog > form { min-width: min(100%, 340px); }
.edit-dialog form { padding: 1.25rem; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.045em; }
.dialog-photo-preview { display: block; width: 100%; max-height: 260px; margin: 1rem 0; border-radius: 12px; background: #020b1b; object-fit: contain; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-grid label:nth-child(2) { grid-column: 1 / -1; }
.hint { color: var(--faint); font-size: .66rem; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.dialog-actions .danger { margin-right: auto; }
.dialog-actions .button { min-height: 37px; font-size: .68rem; }
.toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(90vw, 360px); transform: translateY(1rem); border: 1px solid rgba(131, 224, 187, .35); border-radius: 11px; padding: .75rem .9rem; background: #0d3c3d; color: #d8fff0; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; font-size: .73rem; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(255, 143, 159, .4); background: #4a1c31; color: #ffe1e6; }
.app-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; padding: 0 .2rem; color: var(--faint); font-size: .6rem; }

/* Responsive layout */

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .inline-form { grid-template-columns: repeat(3, 1fr); }
  .inline-form .button { grid-column: span 3; }
  .upload-panel { grid-template-columns: 1fr; }
  .upload-fields { grid-template-columns: 1fr 1fr; }
  .upload-fields .button { width: 100%; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 15; top: 0; left: 0; width: 260px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open ~ .mobile-sidebar-backdrop { position: fixed; z-index: 14; inset: 0; display: block; border: 0; padding: 0; background: rgba(0, 8, 21, .52); cursor: pointer; }
  .mobile-menu { display: inline-flex; }
  .content { padding-top: 1.4rem; }
  .prefecture-panel { min-height: auto; }
  .prefecture-list { max-height: 390px; }
  .japan-map { min-height: 470px; }
  .app-footer { flex-direction: column; }
  .prefectures-page .prefecture-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .login-card { padding: 2rem 1.3rem; border-radius: 21px; }
  .content { padding-right: .75rem; padding-left: .75rem; }
  .topbar h1 { font-size: 1.55rem; }
  .topbar-subtitle { max-width: 29rem; font-size: .68rem; }
  .timeline-panel, .prefecture-panel { padding: 1rem .75rem .75rem; }
  .timeline-heading { flex-direction: column; align-items: start; }
  .timeline-filters { justify-content: flex-start; }
  .timeline-list { max-height: none; }
  .detail-card { width: 100%; height: 100%; height: 100dvh; max-height: 100%; max-height: 100dvh; border-radius: 0; }
  .overlay { padding: 0; }
  .detail-header { padding-top: max(1.35rem, calc(1.35rem + env(safe-area-inset-top))); padding-right: 1rem; padding-left: 1rem; }
  .detail-progress { padding-right: 1rem; padding-left: 1rem; }
  .detail-content { padding: 1rem .85rem max(1.5rem, calc(1.5rem + env(safe-area-inset-bottom))); }
  .detail-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .detail-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; padding: .6rem .7rem; }
  .detail-tab { justify-content: center; flex-direction: column; gap: .25rem; padding: .55rem .35rem; font-size: .67rem; text-align: center; white-space: normal; }
  .detail-highlight-only-grid { grid-template-columns: 1fr; }
  .detail-view-heading { align-items: stretch; flex-direction: column; }
  .detail-view-heading .button, .detail-navigation .button { width: 100%; }
  .spot-row { flex-direction: column; }
  .spot-controls { width: 100%; }
  .spot-controls select { width: 100%; }
  .inline-form { grid-template-columns: 1fr; }
  .inline-form .button { grid-column: auto; }
  .upload-fields { grid-template-columns: 1fr; }
  .photo-grid, .highlight-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .achievement-grid { grid-template-columns: 1fr; }
  .highlight-controls { align-items: start; flex-direction: column; }
  .highlight-editor-body, .photo-library-body { padding: .75rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label:nth-child(2) { grid-column: auto; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .danger { width: 100%; margin-right: 0; }
  .progress-options { align-items: start; flex-direction: column; }
  .progress-options > div { width: 100%; justify-content: space-between; }
  .app-footer { padding-bottom: 1rem; }
  .map-controls { right: .6rem; bottom: max(.6rem, env(safe-area-inset-bottom)); }
  .map-control, .map-zoom-value { min-width: 42px; height: 42px; }
  .map-progress-meter { top: max(.65rem, env(safe-area-inset-top)); left: max(.7rem, env(safe-area-inset-left)); padding: .45rem .6rem; }
  .map-progress-meter strong { font-size: .8rem; }
  .map-progress-meter span { font-size: .56rem; }
}

/* The map is the default full-content page beside the navigation. */

body.map-page-active { overflow: hidden; }
body.map-page-active .content { display: flex; width: 100%; max-width: none; height: 100vh; height: 100dvh; min-height: 100vh; min-height: 100dvh; flex-direction: column; padding: 0; }
body.map-page-active .topbar { display: none; }
body.map-page-active #page-map { display: block; min-height: 0; flex: 1 1 auto; }
body.map-page-active #mapSection, body.map-page-active .map-page-panel { height: 100%; min-height: 0; }
body.map-page-active .map-page-panel { border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none; }
body.map-page-active .map-page-panel .map-stage { min-height: 0; margin-top: 0; border: 0; border-radius: 0; }
body.map-page-active .map-page-panel .japan-map { min-height: 0; margin-top: 0; border-radius: 0; background: transparent; }
body.map-page-active .map-page-panel .japan-map svg { width: min(92%, 1050px); max-height: 100%; }
body.map-page-active .app-footer { display: none; }

body.map-page-active .map-page-panel:fullscreen,
body.map-page-active .map-page-panel.map-fullscreen-fallback { display: flex; width: 100vw; height: 100vh; height: 100dvh; min-height: 100vh; min-height: 100dvh; max-height: 100vh; max-height: 100dvh; margin: 0; border-radius: 0; padding: 1.2rem 1.5rem 1rem; }
body.map-page-active .map-page-panel.map-fullscreen-fallback { position: fixed; z-index: 40; inset: 0; }
body.map-page-active .map-page-panel:fullscreen .map-stage,
body.map-page-active .map-page-panel.map-fullscreen-fallback .map-stage { min-height: 0; }

@media (max-width: 820px) {
  body.map-page-active .topbar { position: fixed; z-index: 10; inset: 0; display: block; height: 0; padding: 0; pointer-events: none; }
  body.map-page-active .topbar > div { display: none; }
  body.map-page-active .topbar .mobile-menu { position: fixed; top: max(.65rem, env(safe-area-inset-top)); right: max(.7rem, env(safe-area-inset-right)); display: inline-flex; pointer-events: auto; }
  body.map-page-active .map-page-panel:fullscreen,
  body.map-page-active .map-page-panel.map-fullscreen-fallback { padding: .8rem .75rem .7rem; }
  body.achievements-page-active .content { padding-right: .75rem; padding-left: .75rem; }
  body.achievements-page-active .achievements-panel { padding-top: 0; }
}
