/* The players' wiki: a read-only copy of a campaign from Table Scribe.
   The same styles as the Mac app: SF, ink and grays, the green accent, and one color per kind of name.
   Phones get a home page that lists the sessions, the kinds and the maps; wider screens get a sidebar. */

:root {
  --ink: #262B27;
  --body: #2A2F2B;
  --secondary: #646B66;
  --tertiary: #838A84;
  --quaternary: #AEB4AE;
  --divider: #EDF0EA;
  --line: #E6EAE3;
  --fill: #EFF2EC;
  --selected: #E3F2E6;
  --accent: #1A763F;
  --character: #2A61B1;
  --location: #A8471B;
  --item: #976B03;
  --faction: #8D2D7D;
  --sidebar: #F7F7F6;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: #FFFFFF; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.character { --k: var(--character); }
.location { --k: var(--location); }
.item { --k: var(--item); }
.faction { --k: var(--faction); }

/* ---------- Frame ---------- */
.layout { min-height: 100vh; }
.side { display: none; }
.main { padding: 8px 18px calc(110px + var(--safe-bottom)); max-width: 720px; margin: 0 auto; }
.main.wide { max-width: 900px; }

@media (min-width: 760px) {
  .layout { display: flex; }
  .side { display: block; position: sticky; top: 0; height: 100vh; width: 210px; flex-shrink: 0; padding: 22px 12px; background: var(--sidebar); border-right: 1px solid var(--divider); overflow-y: auto; }
  .main { flex: 1; min-width: 0; padding: 48px 48px 120px; }
  .main > .col { max-width: 660px; margin: 0 auto; }
  .main.wide > .col { max-width: 840px; }
  .back.phone { display: none; }
}

.side-head { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; color: var(--ink); }
.side-head .cover { width: 34px; height: 34px; border-radius: 9px; }
.side-head b { font-size: 14px; font-weight: 600; line-height: 1.25; }
.nav a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px; border-radius: 6px; font-size: 13.5px; color: var(--ink); }
.nav a svg { font-size: 15px; color: var(--secondary); }
.nav a .n { margin-left: auto; font-size: 12px; color: var(--tertiary); }
.nav a.on { background: var(--selected); font-weight: 500; }
.nav a:hover:not(.on) { background: #EFF1ED; }
.nav .character svg, .nav .location svg, .nav .item svg, .nav .faction svg { color: var(--k); }

/* ---------- Type ---------- */
.back { display: inline-flex; align-items: center; gap: 3px; font-size: 13.5px; color: var(--accent); margin: 6px 0 6px -2px; }
.back svg { font-size: 12px; stroke-width: 2.4; }
h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
@media (min-width: 760px) { h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.48px; } }
.sub { margin-top: 4px; font-size: 13px; color: var(--tertiary); }
.label { font-size: 11.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--tertiary); }
.empty { margin-top: 18px; font-size: 14.5px; color: var(--secondary); line-height: 1.5; }

/* ---------- Covers and pictures ---------- */
.cover { background: linear-gradient(135deg, var(--c, #1A763F), color-mix(in srgb, var(--c, #1A763F) 62%, #0E1A12)); background-size: cover; background-position: center; position: relative; overflow: hidden; display: flex; align-items: flex-end; color: rgba(255,255,255,.92); font-weight: 700; }
.cover.pic { background-image: var(--img); }
.cover span { padding: 0 0 10px 14px; font-size: 26px; letter-spacing: -.5px; }
.pic { background-size: cover; background-position: center; }

/* ---------- Home (phones) ---------- */
.home .hero { margin: -8px -18px 0; height: 150px; }
.home h1 { margin-top: 14px; font-size: 26px; }
.rows { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.row .ic { width: 30px; height: 30px; border-radius: 8px; background: var(--fill); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; color: var(--secondary); }
.row.character .ic, .row.location .ic, .row.item .ic, .row.faction .ic { color: var(--k); }
.row .t { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; }
.row .t small { display: block; font-size: 12.5px; font-weight: 400; color: var(--tertiary); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .n { font-size: 13.5px; color: var(--tertiary); }
.row .chev { font-size: 11px; color: var(--quaternary); stroke-width: 2.4; }

/* ---------- Sessions ---------- */
.latest { display: block; margin-top: 16px; border-radius: 14px; overflow: hidden; background: #FFFFFF; box-shadow: 0 0 0 1px var(--divider), 0 4px 14px rgba(0,0,0,.06); }
.latest .banner { height: 150px; }
@media (min-width: 760px) { .latest .banner { height: 220px; } }
.latest .meta { display: flex; align-items: center; padding: 12px 14px 14px; }
.latest .meta div { flex: 1; }
.latest .meta b { display: block; margin-top: 3px; font-size: 18px; font-weight: 600; }
.list { margin-top: 14px; }
.list .row .t { font-size: 15px; }

/* ---------- A session ---------- */
.session h1 { margin-top: 2px; }
.tools { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px; background: var(--fill); font-size: 13px; font-weight: 500; color: var(--ink); }
.pill:hover { background: #E3E8E1; }
.pill svg { font-size: 14px; }
.tools .sub { margin: 0 0 0 4px; }
.rule { height: 1px; background: var(--line); margin-top: 16px; }
.recap { margin-top: 6px; }
.recap h2 { margin: 30px 0 8px; font-size: 20px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.3; color: var(--ink); }
.recap p { margin: 0 0 14px; font-size: 17px; line-height: 1.65; color: var(--body); }
@media (min-width: 760px) { .recap p { font-size: 17.5px; } }
.banner { border-radius: 12px; margin: 4px 0 16px; background-size: cover; background-color: var(--fill); }
.recap .banner { aspect-ratio: 640 / 250; }
.ent { font-weight: 600; color: var(--k); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.ent:hover { text-decoration-thickness: 2px; }

/* ---------- Lists of entities ---------- */
.people { margin-top: 14px; }
.person { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--divider); }
.person .av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.person .av.kind { color: var(--k); font-size: 20px; }
.person .t { flex: 1; min-width: 0; }
.person .t b { display: flex; align-items: center; gap: 6px; font-size: 15.5px; font-weight: 500; }
.person .t b .pc { font-size: 11px; font-weight: 500; color: var(--tertiary); }
.person .t small { display: block; font-size: 13px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) {
  .person { gap: 14px; }
  .person .t { display: flex; align-items: center; gap: 16px; }
  .person .t b { width: 230px; flex-shrink: 0; }
  .person .t small { flex: 1; font-size: 14px; }
}

/* ---------- An entity ---------- */
.entity h1 { color: var(--k); }
.entity .portrait { width: 148px; height: 148px; border-radius: 20px; margin-top: 18px; }
.desc { margin-top: 18px; }
.desc p { margin: 0 0 12px; font-size: 16px; line-height: 1.65; color: var(--body); }
.aka { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.aka span { font-size: 12.5px; padding: 3px 9px; border-radius: 12px; background: var(--fill); color: var(--secondary); }
.onmap { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.onmap .label { margin-right: 4px; }
.onmap a { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--fill); color: var(--ink); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.onmap a svg { font-size: 13px; color: var(--secondary); }
.onmap a .chev { font-size: 10px; color: var(--tertiary); }
.timeline { margin-top: 26px; }
.timeline .label { margin-bottom: 4px; }
.tl-session { display: block; margin-top: 16px; font-size: 14px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.tl { padding: 9px 0; border-bottom: 1px solid var(--divider); font-size: 15px; line-height: 1.55; color: var(--body); }

/* ---------- Maps ---------- */
.mapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 18px; }
.mapcard { border-radius: 14px; overflow: hidden; background: #FFFFFF; box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(20,30,22,.05); }
.mapcard .pic { height: 150px; background-color: #EFE6D2; }
.mapcard div:last-child { padding: 10px 14px 12px; }
.mapcard b { display: block; font-size: 15px; font-weight: 600; }
.mapcard small { font-size: 12.5px; color: var(--tertiary); }

.mapview { position: relative; margin-top: 14px; height: calc(100vh - 150px); min-height: 360px; border-radius: 14px; overflow: hidden; background: #EFE6D2; box-shadow: 0 0 0 1px var(--line); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.mapview.dragging { cursor: grabbing; }
@media (max-width: 759px) { .mapview { margin: 12px -18px 0; border-radius: 0; box-shadow: none; height: calc(100vh - 128px - var(--safe-bottom)); } }
.mapinner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mapinner img { display: block; pointer-events: none; }
.mapinner svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.mapinner .route { stroke-width: calc(3px / var(--s, 1)); }
.mapinner .route.dashed { stroke-dasharray: calc(10px / var(--s, 1)) calc(8px / var(--s, 1)); }
.mapinner .route.dotted { stroke-dasharray: calc(0.01px / var(--s, 1)) calc(7px / var(--s, 1)); }
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; display: flex; align-items: center; gap: 5px; transform: translate(-13px, -13px); pointer-events: auto; cursor: pointer; }
.pin .dot { width: 26px; height: 26px; border-radius: 13px; background: var(--k, #5B6460); box-shadow: 0 0 0 2px #FFFFFF, 0 2px 6px rgba(0,0,0,.3); display: inline-flex; align-items: center; justify-content: center; color: #FFFFFF; font-size: 13px; background-size: cover; background-position: center; }
.pin.map .dot { border-radius: 7px; background: #2E3330; }
.pin span { font-size: 12px; font-weight: 600; color: #2E3330; background: rgba(255,250,240,.9); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; border-radius: 9px; background: rgba(255,255,255,.97); box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.zoom button { width: 34px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.zoom button svg { stroke-width: 2.2; }
.card { position: absolute; z-index: 5; width: 300px; max-width: calc(100% - 24px); padding: 12px; display: flex; gap: 12px; border-radius: 13px; background: #FFFFFF; box-shadow: 0 10px 28px rgba(0,0,0,.18), 0 0 0 .5px rgba(0,0,0,.06); }
.card .pic { width: 56px; height: 56px; border-radius: 11px; flex-shrink: 0; }
.card b { display: block; font-size: 14.5px; color: var(--k); }
.card small { display: block; font-size: 12px; color: var(--tertiary); }
.card p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card a { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 500; color: var(--accent); }
@media (max-width: 759px) { .card { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; max-width: none; } }

/* ---------- The player ---------- */
.player { position: fixed; left: 10px; right: 10px; bottom: calc(14px + var(--safe-bottom)); z-index: 20; height: 54px; border-radius: 14px; background: rgba(255,255,255,.97); box-shadow: 0 0 0 .5px rgba(0,0,0,.1), 0 6px 18px rgba(0,0,0,.14); display: flex; align-items: center; gap: 10px; padding: 0 12px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (min-width: 760px) { .player { left: calc(50% + 105px); right: auto; transform: translateX(-50%); width: 520px; } }
.player .pp { width: 32px; height: 32px; border-radius: 16px; background: var(--accent); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.player .pp svg { fill: #FFFFFF; stroke: none; }
.player .what { flex: 1; min-width: 0; }
.player .what b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .bar { margin-top: 6px; height: 4px; border-radius: 2px; background: var(--fill); cursor: pointer; position: relative; }
.player .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--accent); }
.player .time { font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.player .speed { font-size: 12.5px; font-weight: 600; color: var(--secondary); padding: 4px; }
.player .x { font-size: 12px; color: var(--tertiary); padding: 4px; }

/* ---------- Share menu ---------- */
.menu { position: absolute; z-index: 30; min-width: 210px; padding: 5px; border-radius: 10px; background: #FFFFFF; box-shadow: 0 10px 30px rgba(0,0,0,.18), 0 0 0 .5px rgba(0,0,0,.08); }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--fill); }
.menu svg { font-size: 14px; color: var(--secondary); }
.menu hr { border: 0; height: 1px; background: var(--divider); margin: 4px 6px; }

/* ---------- Notices and the Home Screen banner ---------- */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%); z-index: 40; padding: 9px 14px; border-radius: 10px; background: rgba(30,34,32,.92); color: #FFFFFF; font-size: 13.5px; }
.install { position: fixed; left: 10px; right: 10px; bottom: calc(14px + var(--safe-bottom)); z-index: 25; padding: 12px 14px; border-radius: 16px; background: #FFFFFF; box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 0 0 .5px rgba(0,0,0,.1); display: flex; gap: 10px; align-items: center; }
.install .cover { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.install .cover span { display: none; }
.install div { flex: 1; font-size: 12.5px; line-height: 1.4; color: var(--secondary); }
.install div b { display: block; font-size: 13.5px; color: var(--ink); }
.install .go { height: 30px; padding: 0 12px; border-radius: 8px; background: var(--accent); color: #FFFFFF; font-size: 13px; font-weight: 600; }
.install .x { color: var(--tertiary); font-size: 12px; padding: 6px; }

.flat { margin: 0 !important; border-radius: 0 !important; }
.latest .cover.banner span { font-size: 34px; padding: 0 0 14px 16px; }
