.game {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 system-ui, sans-serif;
}
.game a { color: var(--accent); }
.game :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* The location trail (design step 4): one line. On a narrow screen the parts before the current page shrink first
   and end in an ellipsis; each part keeps its whole name as a tooltip. */
.game-trail {
  padding: .6rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.game-trail[hidden] { display: none; }
.game-trail ol { display: flex; align-items: baseline; min-width: 0; margin: 0; padding: 0; list-style: none; }
.game-trail li { display: flex; min-width: 2.5em; flex: 0 100 auto; white-space: nowrap; }
.game-trail li:first-child { flex-shrink: 0; }
.game-trail li:last-child { min-width: 0; flex: 0 1 auto; }
/* The separator is decoration: the empty alternative text keeps it out of the accessible name. */
.game-trail li + li::before { content: "\203A"; content: "\203A" / ""; padding: 0 .45rem; color: var(--dim, inherit); }
.game-trail :is(a, span) { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.game-trail [aria-current=page] { font-weight: 600; }
.screen-card {
  width: min(100% - 2rem, 48rem);
  margin: clamp(1.5rem, 8vh, 4rem) auto;
}
.screen-card h1 {
  font: 500 clamp(2rem, 6vw, 4.25rem)/1.1 Georgia, serif;
  margin: 0 0 1.5rem;
}
.screen-card .tagline {
  font: italic 400 clamp(1.05rem, 2.4vw, 1.5rem)/1.3 Georgia, serif;
  margin: -1rem 0 1.75rem;
  color: var(--dim, inherit);
}
.screen-card h2 { font: 500 1.8rem Georgia, serif; }
.main-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: .6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-menu a, .main-menu span {
  display: block;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: .25rem;
}
.main-menu span { color: var(--dim); }
/* The title screen: three verbs and a settings cog in its top corner. */
.title-screen { position: relative; }
.title-screen h1 { padding-inline-end: 3.5rem; }
.title-screen .main-menu { grid-template-columns: minmax(0, 22rem); }
.title-screen .main-menu a { padding: .8rem 1rem; font-size: 1.15rem; }
.settings-cog {
  position: absolute; top: 0; right: 0;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border: 1px solid var(--line); border-radius: 50%;
}
.game .settings-cog { color: var(--ink); }  /* beats `.game a`, so the gear is not link-coloured */
.settings-cog:hover { color: var(--accent); border-color: var(--accent); }
/* Learn and My work. */
.hub-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .6rem; }
.hub-list li { padding: .7rem 1rem; border: 1px solid var(--line); border-radius: .4rem; }
.hub-list a { font-size: 1.15rem; }
.hub-list p { margin: .2rem 0 0; }
.screen-card label { display: block; margin-block: .9rem; }
.screen-card :is(button, select) { font: inherit; }
/* Settings: World detail's note under its menu; Start over and Reset settings, each behind a question. */
#world-detail-note { margin: -.6rem 0 .9rem; max-width: 40rem; }
.start-over { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.start-over h2 { font-size: 1.1rem; }
.start-over .confirm { margin: .6rem 0 1rem; padding: .6rem .8rem; border: 1px solid var(--accent); border-radius: .4rem; }
.start-over .confirm p { margin: 0 0 .5rem; }
.game .viewer { height: calc(100dvh - 3rem); min-height: 26rem; }
.encounter-frame {
  display: block;
  width: 100%;
  height: max(24rem, calc(100dvh - 9rem));
  border: 0;
}
.frame-heading { width: min(100% - 2rem, 72rem); margin: clamp(1rem, 4vh, 2rem) auto .75rem; }
.frame-heading h1 { font: 500 clamp(2rem, 6vw, 3.25rem)/1.1 Georgia, serif; margin: 0 0 .5rem; }
.frame-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }

/* shared screen pieces */
.screen-card .kicker {
  margin: 0 0 .35rem; color: var(--dim);
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
}
.screen-card .lede { font-size: 1.05rem; max-width: 46rem; }
.screen-card code { font: .9em ui-monospace, Consolas, monospace; }

/* raids */
.raids-screen.screen-card, .raid-board.screen-card { width: min(100% - 2rem, 62rem); }
.raid-tile {
  padding: 1.1rem 1.25rem; margin-block: 1.25rem;
  border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: .5rem;
}
.raid-tile h2 { margin: 0 0 .5rem; }
.raid-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: .6rem; margin: 1rem 0 .75rem;
}
.raid-stats > div { padding: .6rem .75rem; border: 1px solid var(--line); border-radius: .4rem; }
.raid-stats dt { font-size: .8rem; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.raid-stats dd { margin: 0; }
.raid-stats dd:first-of-type { font: 600 1.5rem/1.25 Georgia, serif; }
.raid-stats dd.dim { font-size: .8rem; line-height: 1.3; }
.land-bar { display: flex; height: .6rem; margin-block-end: 1rem; overflow: hidden; border-radius: .3rem; background: var(--line); }
.land-bar .land { background: var(--good); }
.land-bar .assumed { flex: 1; min-width: 3px; background: var(--accent); }
.raid-board h2 { font: 500 1.4rem Georgia, serif; margin: 1.75rem 0 .5rem; }
.raid-board ol[aria-label="Quests by impact"] { list-style: none; padding: 0; display: grid; gap: .6rem; }
.raid-quest {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1rem; align-items: center;
  padding: .8rem 1rem; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: .5rem;
}
.raid-quest[data-ready="true"] { border-inline-start: 4px solid var(--good); }
.raid-quest > :first-child { grid-column: 1; font: 600 1.05rem ui-monospace, Consolas, monospace; }
.raid-quest > .dim, .raid-quest > .raid-facts, .raid-quest > .impact-bar { grid-column: 1; }
.raid-quest > button { grid-column: 2; grid-row: 1 / span 3; font-size: .85rem; padding: .35rem .7rem; }
.raid-quest > [role="status"] { grid-column: 1 / -1; }
.raid-quest > [role="status"]:empty { display: none; }
.raid-facts { font-size: .85rem; color: var(--dim); }
.impact-bar { display: block; height: .35rem; max-width: 18rem; border-radius: .2rem; background: var(--line); }
.impact-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
@media (max-width: 34rem) {
  .raid-quest { grid-template-columns: minmax(0, 1fr); }
  .raid-quest > button { grid-column: 1; grid-row: auto; justify-self: start; }
}
.critical-path { list-style: none; padding: 0; margin: .5rem 0 0; }
.critical-path li {
  position: relative; display: flex; flex-direction: column; padding: .2rem 0 .9rem 1.5rem; overflow-wrap: anywhere;
}
.critical-path li::before {
  content: ""; position: absolute; left: .3rem; top: .55rem; width: .6rem; height: .6rem;
  border: 2px solid var(--accent); border-radius: 50%; background: var(--bg);
}
.critical-path li:not(:last-child)::after {
  content: ""; position: absolute; left: .62rem; top: 1.3rem; bottom: 0; border-inline-start: 2px solid var(--line);
}
.path-name { font: 600 1rem ui-monospace, Consolas, monospace; }
.screen-card .proof-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.raid-quest > button { color: var(--accent); background: transparent; border: 1px solid var(--accent); border-radius: .3rem; cursor: pointer; }
.raid-quest > button:disabled { color: var(--good); border-color: var(--good); cursor: default; }

/* The map with its tools drawer beside it. */
.viewer-layout { display: flex; height: calc(100dvh - 3rem); min-height: 26rem; }
.viewer-layout > .viewer { flex: 1; min-width: 0; height: auto; }
.tools-drawer {
  flex: 0 0 min(36rem, 42vw);
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--bg);
  padding: .5rem 1rem 1.5rem;
}
.tools-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tools-head h2 { margin: .25rem 0; font: 500 1.4rem Georgia, serif; }
.tools-drawer button { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: .25rem; padding: .2rem .6rem; cursor: pointer; }
.tools-drawer [role=tablist] { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.tools-drawer [role=tab] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.tools-drawer [role=tab][aria-selected=true] { border-bottom-color: var(--accent); color: var(--accent); }
#tools-toggle[aria-pressed=true] { border-color: var(--accent); color: var(--accent); }
/* The drawer is narrow, so the workbench's side-by-side panes stack. */
.tools-drawer :is(.workbench-notes, .argument-pane) { grid-template-columns: 1fr; }
@media (max-width: 900px) {
  .tools-drawer { position: fixed; z-index: 20; right: 0; top: 3rem; bottom: 0; width: min(100%, 36rem);
    box-shadow: -8px 0 24px #0004; }
}

/* The atlas marks the worlds that have a raid, in words (design step 2), and links the index of raids. */
.viewer .atlas-raids { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-top: .25rem; }
.viewer .atlas-raids ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0; padding: 0; }
.viewer .atlas-raids a { color: var(--accent); }
.viewer .atlas-raids > a { font-weight: 700; }
.raid-mark[data-state="conquered"] { color: var(--good); }
.glossary dt { font-weight: 700; margin-top: .5rem; }
.glossary dd { margin: 0 0 0 1rem; }
.title-screen .title-mark { display: block; margin: 0 0 .75rem; }
.title-screen .studio-line { display: flex; align-items: center; gap: .5rem; margin-top: 1.5rem; color: var(--muted, inherit); font-size: .9rem; }
.title-screen .studio-line img { flex: none; }

/* Stories and frames (stories.js): one card per measured story; invariant cards and frame cards differ by their edge. */
.story-cards { display: grid; gap: .75rem; }
.story-card { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: .6rem .8rem; }
.story-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.story-card p { margin: .25rem 0; }
.story-card.invariant { border-left-color: #6FA86F; }
.story-card.frame { border-left-color: #C9A04A; }
.story-kind { font-weight: 600; }

.game-console {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 45vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); border-top: 1px solid var(--line);
  font: 14px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.game-console[hidden] { display: none; }
.game-console-log { overflow-y: auto; padding: .5rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.game-console form { display: flex; gap: .5rem; align-items: center; padding: .4rem 1rem .6rem; border-top: 1px solid var(--line); }
.game-console input { flex: 1; min-width: 0; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); padding: .3rem .5rem; }
