/* Timelines of India
   The screen is designed at 1440 x 860 and scaled to fit the window
   (see js/main.js). Positions inside .stage are in design pixels. */

:root {
  --ink: #2E2418;
  --ink-2: #3C3022;
  --ink-3: #4A3B28;
  --ink-4: #6B5A44;
  --paper: #F3EBDB;
  --paper-2: #F7F0E2;
  --card: #FBF6EC;
  --line: #D9C9A8;
  --line-2: #C9B58F;
  --brown: #8A6E4B;
  --sea: #CFE2E6;
  --link: #33508C;
  --meanwhile: #1F5E73;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Source Sans 3', system-ui, sans-serif;
  --ease: 600ms ease;
}

html, body { margin: 0; height: 100%; }
body {
  background: var(--sea);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
}
a { color: #8A2B19; }
a:hover { color: #5E1D10; }
button { font-family: var(--sans); color: inherit; }
button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.boot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0;
  font-family: var(--serif); font-size: 24px; font-style: italic; color: var(--ink-3); }
.boot-error { flex-direction: column; gap: 12px; padding: 32px; text-align: center; font-style: normal; }
.boot-error small { font-family: var(--sans); font-size: 15px; max-width: 560px; line-height: 1.5; }


#app { position: fixed; inset: 0; overflow: hidden; overflow: clip; }
.stage {
  position: absolute; left: 0; top: 0; width: 1440px; height: 860px;
  transform-origin: 0 0;
}
.abs { position: absolute; }
.fill { position: absolute; left: 0; top: 0; width: 100%; height: 860px; }
.no-pe { pointer-events: none; }

@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes chapterIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- map */
.camera { position: absolute; left: 0; top: 0; width: 1440px; height: 860px; transform-origin: 0 0;
  transition: transform var(--ease); }
.camera img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; }
.camera svg, .overlay-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.region { transition: fill-opacity var(--ease); stroke: none; }
/* Republic of India: detailed official outline (holes for later pieces use even-odd). */
.shape { fill-rule: evenodd; stroke: none; }
/* Empire campaigns: solid marches, dashed raids and voyages, dotted envoys. */
.campaign-line { fill: none; stroke: currentColor; stroke-width: 2.6px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.campaign-halo { fill: none; stroke: #F6EFE1; stroke-width: 6px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; }
.campaign-raid .campaign-line, .campaign-voyage .campaign-line { stroke-dasharray: 8 5; }
.campaign-mission .campaign-line { stroke-dasharray: 0.5 5.5; stroke-width: 3.2px; }
.campaign-head { fill: currentColor; stroke: #F6EFE1; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.influence { stroke: none; }
/* A thin crisp edge on top, so small islands (Lakshadweep, Andaman and Nicobar) stay visible. */
.shape-edge { fill: none; stroke-width: 0.9px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.state-lines { fill: none; stroke: #1F4C56; stroke-opacity: 0.45; stroke-width: 0.8px; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; }
.river-minor { fill: none; stroke: #6E9FAD; stroke-width: 1.3; }
.river-major { fill: none; stroke: #5B92A3; stroke-width: 2; }
.river-minor, .river-major, .route { vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.route { fill: none; stroke-width: 2.5; stroke-dasharray: 7 5; }
.leaders { fill: none; stroke: #6B5236; stroke-width: 1; stroke-linejoin: round; transition: d var(--ease); }

.map-label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--serif);
  font-style: italic; transition: left var(--ease), top var(--ease); }
.lbl-sea { color: #3F5E66; font-size: 21px; letter-spacing: 1px; white-space: pre-line; text-align: center; line-height: 1.05; }
.lbl-land { color: #7A6243; font-size: 15px; letter-spacing: 2px; }
.lbl-river { color: #3F6E7A; font-size: 14px; letter-spacing: 1px; }
.lbl-terr { font-size: 18px; font-weight: 600; letter-spacing: 1px; }

.site-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--paper);
  box-sizing: border-box; border: 2px solid; transition: left var(--ease), top var(--ease); }
.site-dot span { position: absolute; top: -6px; left: 14px; white-space: nowrap; font-size: 13px; color: var(--ink); }

.ev-dot { position: absolute; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600; display: flex;
  align-items: center; justify-content: center; border: 2px solid var(--paper);
  transition: left var(--ease), top var(--ease), opacity var(--ease); }
.ev-dot span { position: absolute; top: 2px; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink); }
/* Battles: a diamond with a small crossed-swords badge. Raids: an open diamond. */
.ev-dot.battle, .ev-dot.raid { background: transparent !important; border-color: transparent; isolation: isolate; }
.ev-dot.battle::before, .ev-dot.raid::before { content: ''; position: absolute; inset: 1px; z-index: -1; border-radius: 3px;
  transform: rotate(45deg); background: var(--dot); border: 2px solid var(--paper); box-shadow: 0 0 0 1px rgba(46, 36, 24, 0.25); }
.ev-dot.raid::before { background: var(--paper); border-color: var(--dot); }
.ev-dot.raid { color: var(--dot); }
.ev-dot.battle::after, .ev-dot.raid::after { content: '\2694'; position: absolute; top: -11px; right: -11px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 11px; line-height: 15px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; transition-delay: 0ms !important; animation: none !important; }
}

/* ---------------------------------------------------------------- header */
.header { position: absolute; z-index: 0; left: 0; top: 0; width: 100%; height: 64px; box-sizing: border-box; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; }
.header::before { content: ''; position: absolute; left: -4000px; right: -4000px; top: 0; bottom: 0; z-index: -1;
  background: rgba(243, 235, 219, 0.94); border-bottom: 1px solid var(--line); }
.site-title { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: 0.2px; }
.tabs { display: flex; gap: 4px; height: 64px; align-items: stretch; }
.tab { background: none; border: none; border-radius: 0; padding: 0 14px; min-height: 44px; font-size: 15px; cursor: pointer; }

/* ---------------------------------------------------------------- chips and menu */
.chips { position: absolute; top: 72px; right: 24px; height: 44px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.chips-label { font-size: 13px; color: var(--ink-3); margin-right: 2px; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: 44px; right: 0; width: 260px; box-sizing: border-box; padding: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(46, 36, 24, 0.14); z-index: 5;
  display: flex; flex-direction: column; gap: 2px; }
.menu-title { padding: 6px 10px 4px; font-size: 12px; color: var(--ink-4); }
.menu-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border: none; border-radius: 8px;
  cursor: pointer; text-align: left; }
.menu-item:hover { background: #F1E6CF !important; }
.menu-sw { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 3px; }
.menu-text { display: flex; flex-direction: column; }
.menu-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.menu-period { font-size: 12px; color: var(--ink-4); }
.menu-none { padding: 8px 10px 10px; font-size: 13px; line-height: 1.45; color: var(--ink-3); }

/* ---------------------------------------------------------------- era rail */
.rail { position: absolute; left: 20px; top: 80px; width: 176px; height: 726px; }
.rail-line { position: absolute; left: 15px; top: 33px; bottom: 33px; width: 1px; background: #A88B5E; }
.rail-bracket { position: absolute; left: 178px; width: 4px; border-radius: 2px; transition: top 400ms ease, height 400ms ease, opacity 400ms ease; }
.rail-list { position: relative; display: flex; flex-direction: column; }
.rail-item { height: 66px; border: none; border-radius: 10px; padding: 0 8px 0 0; display: flex; align-items: center; gap: 10px;
  text-align: left; cursor: pointer; }
.rail-dot-wrap { flex: 0 0 32px; display: flex; justify-content: center; }
.rail-dot { display: block; border-radius: 50%; box-sizing: border-box; }
.rail-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rail-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.rail-period { font-size: 12px; color: var(--ink-3); }

/* ---------------------------------------------------------------- year wheel */
.wheel-col { position: absolute; left: 206px; top: 80px; width: 136px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.wheel-head { text-align: center; padding: 4px 0 2px; }
.wheel-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.wheel-count { font-size: 12px; color: var(--ink-3); }
.wheel-step { height: 44px; border: none; background: none; color: var(--ink-3); cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 6px; font-size: 14px; }
.wheel { position: relative; height: 540px; overflow: hidden; border-radius: 16px; background: rgba(243, 235, 219, 0.5);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 82%, transparent 100%); }
.wheel-window { position: absolute; left: 4px; right: 4px; top: 228px; height: 84px; border-radius: 12px; background: var(--paper-2);
  box-sizing: border-box; border: 1.5px solid; }
.wheel-item { position: absolute; left: 4px; right: 4px; top: 228px; height: 84px; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: transform 320ms ease, opacity 320ms ease; }
.wheel-year { font-family: var(--serif); font-weight: 600; line-height: 1; white-space: nowrap; }
.wheel-n { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.wheel-hint { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border-radius: 999px; color: #fff;
  font-size: 12px; font-weight: 600; }
.nudge { animation: nudge 1.4s ease-in-out infinite; }
.edge-prompt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px; border-radius: 12px;
  background: var(--card); color: var(--ink); cursor: pointer; border: 1.5px solid; }
.edge-cap { font-size: 12px; color: var(--ink-3); }
.edge-name { font-size: 13px; font-weight: 600; line-height: 1.2; }

/* ---------------------------------------------------------------- heading, legend, cards */
.heading { position: absolute; top: 116px; display: flex; align-items: baseline; gap: 16px; white-space: nowrap; }
.heading-year { font-family: var(--serif); font-size: 48px; font-weight: 600; line-height: 1; }
.heading-summary { font-family: var(--serif); font-size: 25px; font-weight: 500; font-style: italic; color: var(--ink); }
.legend-bar { position: absolute; top: 170px; height: 44px; display: flex; align-items: center; gap: 12px; }
.legend { display: flex; align-items: center; gap: 2px 10px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink); }
.map-note { position: absolute; left: 364px; top: 832px; font-size: 12px; font-style: italic; color: var(--ink-4);
  background: rgba(243, 235, 219, 0.75); padding: 2px 8px; border-radius: 999px; pointer-events: none; }
.m-map-note { left: 8px; top: auto; bottom: 8px; font-size: 11px; }
.legend-sw { width: 14px; height: 14px; border-radius: 3px; box-sizing: border-box; }
.follow { border: none; background: none; padding: 0 0 0 4px; min-height: 22px; cursor: pointer; font-size: 13px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; }
.card-range { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.card-step { flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px;
  background: rgba(247, 240, 226, 0.9); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }

.cards { position: absolute; top: 218px; height: 642px; overflow: hidden; }
.card { position: absolute; left: 0; right: 0; height: 148px; box-sizing: border-box; padding: 12px 16px;
  background: rgba(251, 246, 236, 0.94); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column;
  gap: 4px; transition: top var(--ease), opacity var(--ease); }
.card-meta { display: flex; align-items: center; gap: 8px; height: 22px; }
.card-badge { border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.card-where { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tag { flex: 0 0 auto; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; }
.card-pic { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 8px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 600; }
.card-src { flex: 0 0 auto; font-size: 12px; color: var(--ink-4); }
.card-src a { color: var(--ink-4); }
.card-title { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.card-also { align-self: flex-start; display: flex; align-items: center; gap: 4px; min-height: 22px; padding: 0; border: none;
  background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

.meanwhile { position: absolute; width: 234px; display: flex; flex-direction: column; gap: 10px; }
.mw-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--meanwhile); }
.mw-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--meanwhile); }
.mw-card { box-sizing: border-box; padding: 12px 16px 14px; background: rgba(251, 246, 236, 0.94); border: 1px solid #A9C4C9;
  border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.mw-top { display: flex; align-items: center; gap: 8px; }
.mw-badge { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; background: var(--meanwhile); color: #fff; font-size: 12px;
  font-weight: 600; display: flex; align-items: center; justify-content: center; }
.mw-genre { font-size: 12px; font-weight: 600; color: var(--meanwhile); background: #E1EDEF; border-radius: 999px; padding: 2px 10px; }
.mw-where { font-size: 13px; color: var(--ink-4); }
.mw-title { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.15; color: var(--ink); }
.mw-body { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }

/* ---------------------------------------------------------------- panels */
.nodata { position: absolute; left: calc(860px + var(--dx, 0px)); top: 260px; width: 470px; box-sizing: border-box; padding: 28px 32px;
  background: rgba(251, 246, 236, 0.94); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.nodata-name { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.1; }
.nodata-period { font-size: 15px; color: var(--ink-4); }
.nodata p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.nodata p:first-of-type { margin-top: 8px; }
.nodata-btns { display: flex; gap: 8px; margin-top: 8px; }
.btn { height: 44px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper-2); color: var(--ink);
  cursor: pointer; font-size: 14px; }

.chapter { position: absolute; left: 206px; top: 64px; width: calc(1234px + var(--dx, 0px)); height: 796px; background: rgba(243, 235, 219, 0.6);
  display: flex; align-items: center; justify-content: center; animation: fadeIn 300ms ease; }
.chapter-card { width: 420px; box-sizing: border-box; padding: 28px 32px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; text-align: center; animation: chapterIn 500ms ease; }
.chapter-cap { font-size: 13px; letter-spacing: 2px; color: var(--ink-4); }
.chapter-rule { width: 48px; height: 2px; margin: 12px auto; }
.chapter-name { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.chapter-period { font-size: 15px; color: var(--ink-4); margin-top: 6px; }

.nogeo { position: absolute; left: 0; top: 64px; width: calc(770px + var(--dx, 0px)); height: 796px; background: rgba(243, 235, 219, 0.72); animation: fadeIn 500ms ease; }
.nogeo p { position: absolute; left: calc(380px + var(--dx, 0px) / 2); top: 586px; width: 352px; margin: 0; text-align: center; font-family: var(--serif);
  font-style: italic; font-size: 20px; line-height: 1.4; color: var(--ink-3); }

.family-shift { position: absolute; left: 0; top: 0; width: 1440px; height: 860px; transform: translateX(calc(var(--dx, 0px) / 2)); }
.family-bg { position: absolute; left: 220px; top: 124px; width: 1196px; height: 720px; box-sizing: border-box;
  background: rgba(251, 246, 236, 0.96); border: 1px solid var(--line); border-radius: 16px; animation: fadeIn 400ms ease; }
.family-intro { position: absolute; left: 252px; top: 146px; width: 430px; }
.family-intro h2 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--ink); }
.family-intro p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.family-note { position: absolute; font-size: 12px; line-height: 1.45; color: var(--ink-4); }
.fam-node { position: absolute; width: 150px; height: 72px; box-sizing: border-box; padding: 8px 12px; border-radius: 10px;
  background: var(--card); cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 1px; border: 1.5px solid;
  justify-content: center; }
.fam-node:hover { background: #F1E6CF; }
.fam-static { border: 1px dashed #B8A27C; cursor: default; }
.fam-name { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink);
  line-height: 22px; flex-shrink: 0; }
.fam-dot { width: 8px; height: 8px; border-radius: 50%; }
.fam-role { font-size: 12px; line-height: 15px; flex-shrink: 0; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fam-note { font-size: 12px; line-height: 15px; flex-shrink: 0; color: var(--ink-4); }
.family-key { position: absolute; left: 1120px; top: 680px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--ink-3); }
.family-key span { display: flex; align-items: center; gap: 6px; }
.key-box { width: 14px; height: 10px; border-radius: 3px; border: 1.5px solid var(--link); }

.pic-shade { position: absolute; left: 0; top: 64px; width: calc(770px + var(--dx, 0px)); height: 796px; background: rgba(243, 235, 219, 0.88); animation: fadeIn 300ms ease; }
.pic { position: absolute; left: calc(330px + var(--dx, 0px) / 2); top: 92px; width: 420px; display: flex; flex-direction: column; gap: 12px; animation: chapterIn 400ms ease; }
.pic-frame { position: relative; width: 420px; height: 525px; box-sizing: border-box; padding: 12px; background: var(--card);
  border: 1px solid var(--brown); border-radius: 4px; }
.pic-frame img { width: 100%; height: 100%; object-fit: contain; background: #EDE2C8; }
.pic-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 100%;
  box-sizing: border-box; border: 1px solid var(--line-2); background: #EDE2C8; color: var(--ink-4); font-size: 13px; }
.pic-close { position: absolute; top: -14px; right: -14px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--brown);
  background: var(--card); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pic-caption { text-align: center; }
.pic-title { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--ink); }
.pic-credit { font-size: 13px; color: var(--ink-4); margin-top: 2px; }

/* ================================================================ phone
   Below 800px the app renders js/views/phone.js instead of the scaled
   1440 x 860 stage: one scrolling page in real pixels. */
@media (max-width: 799px) {
  html, body { height: auto; }
  body { overflow: auto; background: var(--paper); }
  #app { position: static; overflow: visible; }
}

.m-app { min-height: 100vh; background: var(--paper); padding-bottom: 32px; }

.m-header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.m-titlebar { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 8px; }
.m-title { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: 0.2px; }
.m-icon-btn { flex: 0 0 44px; width: 44px; height: 44px; border: none; background: none; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--ink); }
.m-tabs { display: flex; height: 44px; padding: 0 8px; }
.m-tab { flex: 1 1 0; padding: 0 8px; }

.m-chips { display: flex; align-items: center; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chips .chip { flex: 0 0 auto; white-space: nowrap; height: 40px; }

.m-map { position: relative; overflow: hidden; overflow: clip; background: var(--sea); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); }
.m-map .lbl-sea { font-size: 16px; }
.m-map .lbl-land { font-size: 13px; letter-spacing: 1.5px; }
.m-map .lbl-river { font-size: 12px; }
.m-map .lbl-terr { font-size: 15px; }
.m-map .site-dot span, .m-map .ev-dot span { font-size: 12px; text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper); }
.m-map .nogeo { left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.m-map .nogeo p { position: static; width: auto; max-width: 300px; padding: 0 24px; font-size: 18px; }

.m-strip-wrap { padding: 10px 0 4px; border-bottom: 1px solid var(--line); background: var(--paper); }
.m-strip-head { display: flex; align-items: baseline; gap: 8px; padding: 0 16px 6px; }
.m-strip-name { font-size: 14px; font-weight: 600; }
.m-strip-count { font-size: 13px; color: var(--ink-3); }
.m-strip-row { display: flex; align-items: center; }
.m-step { flex: 0 0 44px; height: 60px; border: none; background: none; color: var(--ink-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.m-strip { position: relative; flex: 1 1 auto; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px calc(50% - 50px);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%); }
.m-strip::-webkit-scrollbar { display: none; }
.m-year { flex: 0 0 auto; scroll-snap-align: center; min-width: 88px; min-height: 56px; padding: 4px 12px; border-radius: 12px;
  border: 1.5px solid transparent; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  justify-content: center; }
.m-year[aria-current=true] { background: var(--paper-2); }
.m-year-y { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.m-year[aria-current=true] .m-year-y { font-size: 24px; }
.m-year-n { font-size: 12px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; }

.m-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.m-heading { display: flex; flex-direction: column; gap: 2px; }
.m-heading-year { margin: 0; font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1; }
.m-heading-summary { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 500; font-style: italic; line-height: 1.2; color: var(--ink); }
.m-legend { gap: 8px 14px; }

.m-card { box-sizing: border-box; padding: 12px 16px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; gap: 6px; }
.m-card-meta { height: auto; min-height: 22px; }
.m-card-where { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--ink-4); }
.m-card-title { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.15; color: var(--ink); }
.m-card-body { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.m-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.m-card-foot:empty { display: none; }
.m-card-foot .card-pic { min-height: 36px; padding: 0 12px; }
.m-card-foot .card-src { font-size: 13px; }
.m-card-foot .card-src a { display: inline-block; padding: 8px 0; }
.m-card .card-also { min-height: 36px; font-size: 14px; }
.m-meanwhile { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.m-meanwhile .mw-body { font-size: 15px; line-height: 1.5; }

.m-era-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 16px;
  border-radius: 12px; border: 1.5px solid; background: var(--card); color: var(--ink); cursor: pointer; text-align: left; }
.m-era-btn > span { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }

/* drawer */
.m-shade { position: fixed; inset: 0; z-index: 40; background: rgba(46, 36, 24, 0.35); opacity: 0; pointer-events: none;
  transition: opacity 250ms ease; }
.m-shade.open { opacity: 1; pointer-events: auto; }
.m-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 41; width: min(320px, 86vw); box-sizing: border-box;
  background: var(--paper); border-right: 1px solid var(--line); box-shadow: 4px 0 24px rgba(46, 36, 24, 0.18);
  overflow-y: auto; overscroll-behavior: contain; transform: translateX(-105%); transition: transform 250ms ease;
  visibility: hidden; padding-bottom: 24px; }
.m-drawer.open { transform: none; visibility: visible; }
.m-drawer-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 8px 0 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.m-drawer-title { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.m-drawer-sec { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px 4px; scroll-margin-top: 52px; }
.m-drawer-h { padding: 4px 8px 6px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-4); }
.m-rail-item { height: auto; min-height: 56px; padding: 6px 8px 6px 0; background: transparent; }

/* divine family as a list */
.m-family { padding: 16px; }
.m-family-title { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--ink); }
.m-family-intro { margin: 6px 0 14px; font-size: 15px; line-height: 1.5; color: var(--ink-3); }
.m-fam-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.m-fam-row { width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px 10px 14px;
  border: 1.5px solid; border-radius: 12px; background: var(--card); color: var(--ink-3); cursor: pointer; text-align: left; }
.m-fam-static { border: 1px dashed #B8A27C; cursor: default; }
.m-fam-dot { flex: 0 0 10px; width: 10px; height: 10px; }
.m-fam-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.m-fam-name { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; color: var(--ink); }
.m-fam-role { font-size: 14px; color: var(--ink-3); }
.m-fam-note { font-size: 13px; color: var(--ink-4); }
.m-fam-aside { margin: 2px 4px 6px; font-size: 14px; line-height: 1.5; color: var(--ink-4); }

/* panels reused from the desktop, placed for a phone */
.m-app .nodata { position: static; width: auto; padding: 20px; }
.m-app .nodata-name { font-size: 30px; }
.m-app .chapter { position: fixed; inset: 0; width: auto; height: auto; z-index: 50; background: rgba(243, 235, 219, 0.85); padding: 16px; }
.m-app .chapter-card { width: 100%; max-width: 360px; }
.m-app .pic-shade { position: fixed; inset: 0; width: auto; height: auto; z-index: 50; background: rgba(243, 235, 219, 0.95); }
.m-app .pic { position: fixed; z-index: 51; left: 16px; right: 16px; top: 50%; width: auto; transform: translateY(-50%); animation: fadeIn 300ms ease; }
.m-app .pic-frame { width: 100%; height: min(62vh, 125vw); }
.m-app .pic-close { top: -12px; right: -6px; width: 44px; height: 44px; }

/* ---------------------------------------------------------------- Read more */
.card-more { flex: 0 0 auto; border: none; background: none; padding: 0; min-height: 22px; cursor: pointer; font-size: 12px;
  font-weight: 600; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.detail-shade { position: absolute; left: 0; top: 64px; width: 770px; height: 796px; background: rgba(243, 235, 219, 0.82);
  animation: fadeIn 250ms ease; }
.detail { position: absolute; left: 228px; top: 84px; width: 520px; max-height: 752px; overflow-y: auto; box-sizing: border-box;
  padding: 26px 30px 24px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(46, 36, 24, 0.16); animation: chapterIn 300ms ease; }
.detail-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.detail-where { font-size: 13px; color: var(--ink-4); margin-right: 44px; }
.detail-title { margin: 6px 44px 10px 0; font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.detail-lead { margin: 0 0 12px; font-size: 16px; line-height: 1.55; color: var(--ink); }
.detail-p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.detail-also { margin: 2px 0 14px; }
.detail-sources { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.detail-sources-title { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: var(--ink-4); margin-bottom: 6px; }
.detail-sources ul { margin: 0; padding-left: 18px; }
.detail-sources li { font-size: 13px; line-height: 1.5; color: var(--ink-3); margin-bottom: 4px; }
.detail-sources a { color: var(--link); }
.detail-phone { position: fixed; left: 0; top: 0; right: 0; bottom: 0; width: auto; max-height: none; border-radius: 0; border: none;
  border-top: 4px solid; padding: 20px 18px 32px; z-index: 50; }
.detail-phone .detail-title { font-size: 26px; }
.m-card-more { font-size: 14px; min-height: 36px; }

/* ---- Empire detail: succession strip (lanes on a time scale), overview card, battle tag */
.succession { position: absolute; top: 122px; left: 372px; width: 392px; display: flex; gap: 6px; padding: 16px 10px 6px 8px; box-sizing: border-box;
  background: rgba(243, 235, 219, 0.92); border-radius: 10px; box-shadow: 0 1px 4px rgba(46, 36, 24, 0.12); z-index: 3; }
.sx-labels { flex: 0 0 74px; display: flex; flex-direction: column; }
.sx-label { height: 18px; margin-bottom: 2px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); line-height: 18px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; position: relative; }
.sx-group { position: absolute; top: -11px; left: 0; font-size: 8.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.sx-tracks { position: relative; flex: 1; min-width: 0; }
.sx-row { position: relative; height: 18px; margin-bottom: 2px; }
.sx-band { position: absolute; top: 0; height: 18px; border-radius: 3px; border-bottom: 3px solid var(--bc); box-sizing: border-box; }
.sx-band::before { content: ''; position: absolute; inset: 0; background: var(--bc); opacity: 0.16; border-radius: 3px; }
.sx-key { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; font-size: 9.5px; color: var(--ink-3); }
.sx-key-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sx-key-item i { width: 10px; height: 4px; border-radius: 2px; display: inline-block; }
.sx-block { position: absolute; top: 1px; height: 13px; padding: 0 4px; box-sizing: border-box; border: 1px solid rgba(46, 36, 24, 0.22);
  background: #FBF6EC; border-radius: 4px; font: inherit; font-size: 10px; line-height: 11px; color: var(--ink-2); cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.sx-block span { pointer-events: none; }
.sx-block:hover { border-color: var(--rc); z-index: 3; }
.sx-block[aria-current=true] { background: var(--rc); border-color: var(--rc); color: #fff; font-weight: 600; z-index: 2; overflow: visible; min-width: max-content; }
.sx-gap { font-style: italic; background: transparent; border-style: dashed; }
.sx-link { position: absolute; width: 0; border-left: 2px solid var(--rc); top: calc(var(--r0) * 20px + 9px); height: calc((var(--r1) - var(--r0)) * 20px); opacity: 0.7; }
.sx-link::after { content: ''; position: absolute; bottom: -3px; left: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--rc); }
.sx-now { position: absolute; top: -6px; bottom: 0; width: 0; border-left: 1.5px solid var(--ink); opacity: 0.7; z-index: 4; pointer-events: none; }
.sx-now span { position: absolute; top: -10px; left: 3px; font-size: 9.5px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.sx-tick { position: absolute; top: -14px; height: 4px; border-left: 1px solid rgba(46, 36, 24, 0.3); }
.sx-tick span { position: absolute; top: -2px; left: 2px; font-size: 8.5px; color: var(--ink-3); white-space: nowrap; opacity: 0.8; }
.m-succession { position: relative; top: auto; left: auto; width: auto; margin: 6px 16px 0; }

.about-card { position: relative; background: var(--card); border-radius: 12px; border-top: 4px solid; padding: 18px 22px 20px;
  box-shadow: 0 2px 10px rgba(46, 36, 24, 0.12); margin-top: 6px; }
.about-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.about-title { font-family: var(--serif); font-size: 28px; margin: 4px 0 8px; font-weight: 600; }
.about-intro { font-size: 15px; line-height: 1.45; margin: 0 0 10px; }
.about-rows { margin: 0 0 14px; display: grid; gap: 7px; }
.about-row { display: grid; grid-template-columns: 118px 1fr; gap: 10px; font-size: 14.5px; line-height: 1.35; }
.about-row dt { color: var(--ink-3); font-weight: 600; }
.about-row dd { margin: 0; }
.about-start { border: none; color: #fff; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 20px; cursor: pointer; }
.card-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.card-kind::before { content: '\2694\00a0'; }

/* ---- succession strip along the bottom edge (desktop), collapsible to one line */
.succession.sx-bottom { align-items: flex-start; gap: 8px; padding: 18px 12px 6px 8px; overflow: hidden; z-index: 3; }
.sx-toggle { flex: none; display: flex; align-items: center; gap: 4px; height: 24px; margin-top: -4px; padding: 0 8px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--card); color: var(--ink-3); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.05em; }
.sx-collapsed { align-items: center; padding: 6px 12px 6px 8px !important; }
.sx-collapsed .sx-toggle { margin-top: 0; }
.sx-line { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; font-size: 13px; }
.sx-line::-webkit-scrollbar { display: none; }
.sx-line-item { border: none; background: none; padding: 2px 4px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  cursor: pointer; white-space: nowrap; }
.sx-line-item:hover { background: rgba(46, 36, 24, 0.07); }
.sx-line-lane { font-weight: 500; color: var(--ink-3); }
.sx-sep { color: var(--ink-4); }

/* Read more (desktop): a panel next to its card, with no shade over the page */
.detail.detail-beside { z-index: 4; box-shadow: 0 6px 24px rgba(46, 36, 24, 0.22); }
