/* Realm of Luna. One screen: a brass-ruled star chart with a reading panel beside it (below it on a phone). */
:root {
  color-scheme: dark;
  --void: #070a13;
  --plate: #0c111d;
  --line: #232b3d;
  --ink: #ebe6d8;
  --dim: #a2a8b8;
  --brass: #d0aa5c;
  --display: "Marcellus", "Palatino Linotype", Georgia, serif;
  --body: "Albert Sans", "Segoe UI", system-ui, sans-serif;
  --data: "Azeret Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--void); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }
button, a { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }

.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 28px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--plate); }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; min-width: 0; }
.brand h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: 0.04em; color: var(--brass); }
.brand p { margin: 0; color: var(--dim); }
.readouts { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 0; }
.readouts div { display: flex; flex-direction: column; gap: 1px; }
.readouts dt { font-family: var(--data); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.readouts dd { margin: 0; font-family: var(--data); font-size: 13px; font-variant-numeric: tabular-nums; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 372px; min-height: 0; }

.stage { position: relative; overflow: hidden; min-height: 340px; background: var(--void); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.tags { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; min-height: 34px; padding: 4px 9px 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: var(--plate); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; white-space: nowrap; will-change: transform; }
.tag b { font-family: var(--data); font-weight: 500; line-height: 1.2; }
.tag span { font-family: var(--data); font-size: 11px; color: var(--dim); }
.tag i { font-style: normal; font-family: var(--data); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); }
.tag i { display: none; }
.tag:hover i, .tag:focus-visible i, .tag[aria-pressed="true"] i { display: block; }
.tag { transition: opacity 0.15s; }
.tag.hid { opacity: 0; pointer-events: none; }
.tag b { font-size: 13px; }
.tag.outer { border-style: dashed; }
.tag.outer b { color: var(--dim); }
.tag.ghost b { color: var(--dim); font-style: italic; }
.tag:hover { border-color: var(--dim); }
.tag[aria-pressed="true"] { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass); }
.mark { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; font-family: var(--data); font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; }
.mark { transition: opacity 0.15s; }
.mark.hid { opacity: 0; }
.mark.court { font-family: var(--display); font-size: 18px; letter-spacing: 0.04em; text-transform: none; color: var(--brass); text-align: center; }
.mark small { display: block; font-family: var(--body); font-size: 12px; letter-spacing: 0; font-style: normal; text-transform: none; color: var(--dim); }
.mark.deep { font-family: var(--display); font-size: 16px; letter-spacing: 0.06em; text-transform: none; font-style: italic; color: var(--dim); text-align: center; }

.dock { position: absolute; display: flex; align-items: center; gap: 8px; }
.dock.tl { left: 16px; top: 14px; }
.dock.br { right: 16px; bottom: 14px; }
.dock.bl { left: 16px; bottom: 14px; color: var(--dim); font-size: 13px; max-width: calc(100% - 200px); }
.dock button { min-width: 44px; min-height: 44px; padding: 0 12px; background: var(--plate); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; font-family: var(--data); font-size: 14px; }
.dock button:hover { border-color: var(--dim); }
.dock label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--plate); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; font-size: 14px; }
.dock input { accent-color: var(--brass); width: 16px; height: 16px; margin: 0; }
.nogl { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--dim); }

.panel { min-width: 0; overflow-y: auto; padding: 24px 24px 28px; border-left: 1px solid var(--line); background: var(--plate); display: flex; flex-direction: column; gap: 22px; }
.head { display: flex; flex-direction: column; gap: 8px; }
.eyebrow { margin: 0; font-family: var(--data); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.panel h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.08; text-wrap: balance; overflow-wrap: anywhere; }
.about { margin: 0; font-size: 14px; color: var(--dim); }
.pair { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-family: var(--data); font-size: 13px; }
.pair span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.stats { margin: 0; display: flex; flex-direction: column; }
.stats div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.stats div:last-child { border-bottom: 1px solid var(--line); }
.stats dt { font-weight: 500; font-size: 16px; }
.stats dt small { display: block; font-weight: 400; font-size: 13px; color: var(--dim); }
.stats dd { margin: 0; font-family: var(--data); font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.stats dd.live { color: var(--ink); }
.acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.acts a { min-height: 56px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; text-align: center; border: 1px solid var(--brass); border-radius: 2px; }
.acts a b { font-size: 16px; }
.acts a span { font-size: 12px; }
.acts a.go { background: var(--brass); color: var(--void); }
.acts a.alt span { color: var(--dim); }
.acts a:hover { filter: brightness(1.12); }
.note { margin: 0; font-size: 13px; color: var(--dim); }
.note a { color: var(--brass); }
.panel h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--brass); }
.key { margin: 0; display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.key dt { font-weight: 700; }
.key dd { margin: 0; color: var(--dim); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list h4 { margin: 6px 0 0; font-family: var(--data); font-weight: 400; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 40px; padding: 0 10px; background: none; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; font-family: var(--data); font-size: 12px; }
.chips button.ghost { border-style: dashed; color: var(--dim); }
.chips button:hover { border-color: var(--dim); }
.chips button[aria-pressed="true"] { border-color: var(--brass); color: var(--brass); }

@media (max-width: 860px) {
  html, body { height: auto; }
  .app { height: auto; display: block; }
  .bar { padding: 12px 16px; }
  .main { display: block; }
  .stage { height: 64vh; min-height: 360px; }
  .stage canvas { touch-action: pan-y; }
  .panel { border-left: 0; border-top: 1px solid var(--line); padding: 22px 16px 28px; overflow: visible; }
  .dock.bl { display: none; }
}
