/* Red Sea — one colour world, minimal UI. */
:root {
  --ink: #140708; --red: #e8513f; --red-deep: #9a2430; --paper: #fff4ec; --paper-2: #fbe3d8; --muted: #9a6a62; --line: #f1cdbf;
  --ui: 'Inter', system-ui, sans-serif; --display: 'Fredoka', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--red); color: var(--ink); font-family: var(--ui); overflow: hidden; }
body { display: grid; grid-template-columns: 1fr 360px; }
#stage { position: relative; overflow: hidden; isolation: isolate; }
#map { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.vignette { display: none; }

/* ── map labels ── */
.label { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.shield { display: inline-grid; place-items: center; width: 22px; height: 27px; background: var(--ink); color: var(--accent); font-size: 12px; font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%); }
.shield.sm { width: 19px; height: 24px; font-size: 11px; }
.town { display: flex; align-items: center; }
.town .name { font-family: var(--display); font-weight: 700; font-size: 14px; color: #fff4ec; padding-left: 4px;
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.town.village .name { font-size: 12px; }
.town.city .name { font-size: 16px; }

.party { pointer-events: auto; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.party .row { display: flex; align-items: center; gap: 4px; }
.party .count { font: 700 19px/1 var(--display); color: #ffe08a; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.party .handle { font: 600 11.5px var(--display); color: #fff4ec; background: var(--ink); padding: 2px 8px; border-radius: 10px; }
.party .handle i { font-style: normal; opacity: .7; margin-right: 4px; }
.party .intent { display: none; font: 600 11px var(--display); color: #fff; background: var(--red-deep); padding: 2px 8px; border-radius: 10px; border: 2px solid var(--ink); }
.party:hover .intent, .party.selected .intent { display: block; }
.party.selected .handle { outline: 2px solid #ffe08a; }
.party .bubble { display: none; position: relative; max-width: 190px; white-space: normal; text-align: center;
  font: 600 12.5px/1.25 var(--display); color: var(--ink); background: var(--paper); padding: 7px 11px; border-radius: 16px;
  box-shadow: 0 2px 0 rgba(0,0,0,.25); margin-bottom: 7px; }
.party .bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.party.talk .bubble, .party.selected .bubble, .party:hover .bubble { display: block; }
.party.selected { z-index: 999999 !important; }

/* ── panel ── */
#panel { background: var(--paper); display: flex; overflow: hidden; min-width: 0; flex-direction: column; min-height: 0; border-left: 3px solid var(--ink); }
#panel header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
#panel .brand { font: 700 26px var(--display); letter-spacing: .01em; }
#panel .explain { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font: 700 17px var(--display); cursor: pointer; }
#panel .days { display: flex; gap: 6px; overflow-x: auto; padding: 4px 18px 12px; scrollbar-width: none; }
#panel .days::-webkit-scrollbar { display: none; }
#panel .days button { flex: none; font: 600 13px var(--display); padding: 7px 12px; border-radius: 999px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
#panel .days button.on { background: var(--ink); color: var(--paper); }
#panel .dayinfo { padding: 2px 18px 12px; border-bottom: 2px solid var(--line); font-size: 14px; line-height: 1.45; }
#panel .dayinfo p { margin: 0 0 4px; }
#panel .dayinfo .live { font-weight: 600; color: var(--red-deep); }
#panel .dayinfo .live::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 7px; vertical-align: 1px; animation: pulse 1.4s infinite; }
#panel .dayinfo .cd { color: var(--ink); font-variant-numeric: tabular-nums; }
#panel .meta { color: var(--muted); font-size: 12px; }
@keyframes pulse { 50% { opacity: .3; } }
.feed { list-style: none; margin: 0; padding: 4px 0 18px; overflow-y: auto; flex: 1; position: relative; }
.feed li { padding: 11px 18px; border-bottom: 1px solid var(--line); }
.feed li.move { cursor: pointer; background: linear-gradient(90deg, var(--paper-2), transparent 70%); }
.feed li.move:hover, .feed li.hl { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--red); }
.feed .who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.feed .who time { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.feed .pf { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--ink); color: var(--paper); }
.ico { width: 14px; height: 14px; display: block; }
.party .handle { display: inline-flex; align-items: center; gap: 4px; }
.party .handle i { display: inline-flex; opacity: .85; margin: 0; }
.party .handle .ico { width: 12px; height: 12px; }
.feed .likes { display: flex; align-items: center; gap: 8px; }
.result { font: 700 11px var(--display); padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; }
.result.won { background: var(--ink); color: #ffe08a; }
.result.lost { background: transparent; color: var(--red-deep); box-shadow: inset 0 0 0 1.5px var(--red-deep); }
#panel .winner { font: 600 13px var(--display); color: var(--ink); margin: 6px 0 4px; }
#panel .winner b { color: var(--red-deep); }
.feed p { margin: 4px 0 3px; font-size: 14px; line-height: 1.4; }
.feed p b { color: var(--red-deep); font-weight: 600; }
.feed .likes { font-size: 12px; color: var(--muted); }

/* desktop: there's room for every day, so the chips wrap instead of scrolling sideways */
@media (min-width: 761px) {
  #panel .days { flex-wrap: wrap; overflow: visible; }
}
@media (min-width: 761px) and (max-width: 1100px) { body { grid-template-columns: 1fr 320px; } }

/* ── explainer ── */
.explainer { position: fixed; inset: 0; background: rgba(20,7,8,.55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.explainer[hidden] { display: none; }
.explainer .card { background: var(--paper); border-radius: 18px; padding: 22px 22px 18px; max-width: 380px; border: 3px solid var(--ink); }
.explainer h2 { font: 700 22px var(--display); margin: 0 0 10px; }
.explainer ol { padding-left: 20px; margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.explainer li { margin-bottom: 6px; }
.explainer p { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.explainer .close { width: 100%; padding: 11px; border: 0; border-radius: 12px; background: var(--ink); color: var(--paper); font: 600 15px var(--display); cursor: pointer; }

/* ── loading card ── */
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--red); z-index: 30; }
#loading div { display: grid; gap: 6px; text-align: center; color: #fff1e8; font-family: var(--display); }
#loading b { font-size: 44px; color: var(--ink); }
#loading span { font-size: 15px; }

/* ── phones: full-screen map + bottom sheet (peek / 50% / 80%, moved by transform).
      The page has a short strip of real scroll that is only there to let Safari shrink its bar. ── */
.grabber { display: none; }
@media (max-width: 760px) {
  html, body { height: auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: none; }
  body { display: block; min-height: calc(100lvh + 160px); background: var(--red); }
  #stage { position: fixed; left: 0; top: 0; width: 100%; height: 100lvh; }
  #panel { position: fixed; left: 0; right: 0; bottom: 0; height: 80vh; z-index: 5;
    border-left: 0; border-top: 3px solid var(--ink); border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 24px rgba(20,7,8,.25); will-change: transform; padding-bottom: env(safe-area-inset-bottom); }
  #panel.anim { transition: transform .32s cubic-bezier(.2,.8,.2,1); }
  .grabber { display: block; flex: none; height: 22px; cursor: pointer; }
  .grabber::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--ink); opacity: .35; margin: 9px auto 0; }
  #panel header { padding: 2px 16px 6px; }
  #panel .brand { font-size: 22px; }
  #panel .days { padding: 4px 16px 10px; }
  #panel .dayinfo { padding: 0 16px 10px; font-size: 13px; }
  .feed { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  #panel:not([data-sheet="full"]) .feed { overflow: hidden; }
  .feed li { padding: 10px 16px; }
  .town.village .name { display: none; }
  .party .bubble { max-width: 150px; font-size: 11.5px; }
}

/* comment rows: tap to open the post, pin to find the move on the map */
.feed li { position: relative; }
.feed li.link { cursor: pointer; }
.feed li.link:active { background: var(--paper-2); }
.feed li.move { padding-right: 56px; }
.feed .locate { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.feed .locate .ico { width: 16px; height: 16px; }
.feed .locate:active { background: var(--ink); color: var(--paper); }
.feed .who time { margin-left: auto; }

/* ── era switcher (top-left of the map) ── */
#eras { position: absolute; top: 12px; left: 12px; z-index: 1000001; display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(20,7,8,.72); backdrop-filter: blur(6px); }
#eras button { display: flex; align-items: baseline; gap: 6px; border: 0; background: transparent; color: #f7d6cb; font: 600 12px var(--display); padding: 6px 10px; border-radius: 10px; cursor: pointer; }
#eras button b { font-size: 13px; color: #fff4ec; }
#eras button.on { background: var(--paper); color: var(--ink); }
#eras button.on b { color: var(--red-deep); }
@media (max-width: 760px) {
  #eras { top: calc(env(safe-area-inset-top) + 10px); left: 10px; }
  #eras button span { display: none; }
  #eras button.on span { display: inline; }
}

/* ── sim: bands, profiles, landmarks ── */
.party .handle em { font-style: normal; color: #ffe08a; }
.label.landmark { font: 700 12px var(--display); color: #ffe08a; background: var(--ink); padding: 3px 9px; border-radius: 10px; border: 2px solid #ffe08a; white-space: nowrap; pointer-events: none; }
#panel .band { padding: 10px 18px; border-bottom: 2px solid var(--line); background: var(--paper-2); font-size: 13.5px; }
#panel .band .bh { font: 700 16px var(--display); }
#panel .band .bh span { color: var(--red-deep); }
#panel .band .crew { margin: 4px 0; color: var(--muted); }
#panel .band p { margin: 3px 0; }
#panel b.prof, .feed b.prof { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.explainer.profile .card { max-height: 82vh; overflow-y: auto; text-align: left; }
.explainer.profile h3 { font: 700 15px var(--display); margin: 12px 0 4px; }
.explainer.profile ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; }
.explainer.profile .w { color: var(--red-deep); font-weight: 600; } .explainer.profile .l { color: var(--muted); }
#panel .acts { display: flex; gap: 8px; margin: 8px 0 2px; flex-wrap: wrap; }
#panel .act { font: 700 13px var(--display); padding: 8px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--ink); color: #ffe08a; cursor: pointer; text-decoration: none; }
#panel .act.replay { background: transparent; color: var(--ink); }
.explainer.episode .card { padding: 10px; max-width: min(420px, 92vw); }
.explainer.episode video { display: block; width: 100%; max-height: 78vh; border-radius: 12px; background: #000; }
.explainer.episode .close { margin-top: 8px; width: 100%; }
