/*
 * The interface's look, in tokens a game's theme (content `ui`) sets:
 * colours, three font stacks and an ornament for the panel borders. The
 * defaults here are the engine's plain look; src/browser/ui/theme.ts writes a
 * game's own values over them on #game.
 */
:root {
  --ui-ink: #121b1f;
  --ui-panel: #1b282d;
  --ui-paper: #ece4d0;
  --ui-ink-text: #2b2118;
  --ui-text: #f1e9d6;
  --ui-dim: #c3bba6;
  --ui-accent: #9c4a36;
  --ui-gold: #d1b072;
  --ui-jade: #7ea38c;
  --ui-ally: #d8b46a;
  --ui-foe: #c4574b;
  --ui-font-display: 'Songti SC', 'STSong', 'Noto Serif CJK SC', serif;
  --ui-font-heading: 'Songti SC', 'STSong', serif;
  --ui-font-body: ui-sans-serif, system-ui, 'PingFang SC', sans-serif;
}
#game {
  --ui-line: color-mix(in srgb, var(--ui-gold) 58%, transparent);
  --ui-line-soft: color-mix(in srgb, var(--ui-gold) 26%, transparent);
  --ui-glass: color-mix(in srgb, var(--ui-ink) 93%, transparent);
  --ui-glass-2: color-mix(in srgb, var(--ui-panel) 95%, transparent);
  --ui-shade: color-mix(in srgb, var(--ui-ink) 70%, transparent);
  /* Ornaments, drawn black and coloured through a mask. A corner is drawn for the top left; the others mirror it. */
  --orn-cloud-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='black' stroke-linecap='round'%3E%3Cpath d='M1.5 31V9Q1.5 1.5 9 1.5H31' stroke-width='1.5'/%3E%3Cpath d='M5.5 31V15C5.5 9 9 5.5 15 5.5H31' stroke-width='1'/%3E%3Cpath d='M10 24C10 16 14 10.5 19.5 10.5C23.5 10.5 25 14 23 16.3C21.2 18.2 17.8 17.6 17.8 15.2C17.8 13.7 19.3 13.1 20.2 14' stroke-width='1.5'/%3E%3C/svg%3E");
  --orn-cloud-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='black' stroke-linecap='round'%3E%3Cg transform='matrix(-1 0 0 1 32 0)'%3E%3Cpath d='M1.5 31V9Q1.5 1.5 9 1.5H31' stroke-width='1.5'/%3E%3Cpath d='M5.5 31V15C5.5 9 9 5.5 15 5.5H31' stroke-width='1'/%3E%3Cpath d='M10 24C10 16 14 10.5 19.5 10.5C23.5 10.5 25 14 23 16.3C21.2 18.2 17.8 17.6 17.8 15.2C17.8 13.7 19.3 13.1 20.2 14' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E");
  --orn-cloud-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='black' stroke-linecap='round'%3E%3Cg transform='matrix(1 0 0 -1 0 32)'%3E%3Cpath d='M1.5 31V9Q1.5 1.5 9 1.5H31' stroke-width='1.5'/%3E%3Cpath d='M5.5 31V15C5.5 9 9 5.5 15 5.5H31' stroke-width='1'/%3E%3Cpath d='M10 24C10 16 14 10.5 19.5 10.5C23.5 10.5 25 14 23 16.3C21.2 18.2 17.8 17.6 17.8 15.2C17.8 13.7 19.3 13.1 20.2 14' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E");
  --orn-cloud-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='black' stroke-linecap='round'%3E%3Cg transform='matrix(-1 0 0 -1 32 32)'%3E%3Cpath d='M1.5 31V9Q1.5 1.5 9 1.5H31' stroke-width='1.5'/%3E%3Cpath d='M5.5 31V15C5.5 9 9 5.5 15 5.5H31' stroke-width='1'/%3E%3Cpath d='M10 24C10 16 14 10.5 19.5 10.5C23.5 10.5 25 14 23 16.3C21.2 18.2 17.8 17.6 17.8 15.2C17.8 13.7 19.3 13.1 20.2 14' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E");
  /* 回纹: one key of a fret band, repeated along an edge. */
  --orn-meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 8' fill='none' stroke='black' stroke-width='1.1'%3E%3Cpath d='M0 7.4H6.6V0.6H1.4V5H4.6V2.8H3.2M8 7.4H14.6V0.6H9.4V5H12.6V2.8H11.2'/%3E%3C/svg%3E");
  /* 五铢: a round coin with a square hole. */
  --orn-coin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 1 0 18a9 9 0 1 1 0-18zM10 3a7 7 0 1 0 0 14a7 7 0 1 0 0-14zM6.6 6.6h6.8v6.8H6.6zM8.2 8.2v3.6h3.6V8.2z'/%3E%3C/svg%3E");
  font-family: var(--ui-font-body);
  color: var(--ui-text);
}
#game button {
  font-family: var(--ui-font-heading);
  color: var(--ui-text);
  background: var(--ui-glass-2);
  border: 1px solid var(--ui-line-soft);
  border-radius: 2px;
}
#game button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ui-accent) 55%, var(--ui-panel));
  border-color: var(--ui-line);
}
#game button:focus-visible,
#game a:focus-visible {
  outline: 1px solid var(--ui-gold);
  outline-offset: 3px;
}
#game kbd {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1;
  color: var(--ui-ink-text);
  background: color-mix(in srgb, var(--ui-paper) 88%, transparent);
  border: 0;
  border-bottom: 2px solid color-mix(in srgb, var(--ui-ink-text) 45%, var(--ui-paper));
  border-radius: 2px;
  padding: 3px 5px 2px;
  margin: 0 3px;
}

/* A lacquered panel: a gold line, a band of ink, a fine inner line in the accent. */
.panel {
  position: relative;
  background: radial-gradient(130% 150% at 50% 0%, var(--ui-glass-2), var(--ui-glass) 70%), var(--ui-glass);
  border: 1px solid var(--ui-line);
  box-shadow:
    inset 0 0 0 4px var(--ui-glass),
    inset 0 0 0 5px color-mix(in srgb, var(--ui-accent) 62%, transparent),
    0 16px 46px #0009;
}
.panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: var(--ui-gold);
  opacity: 0.9;
  mask: none;
  display: none;
}
#game[data-ornament='cloud'] .panel::before {
  display: block;
  inset: -5px;
  mask:
    var(--orn-cloud-tl) top left / 30px 30px no-repeat,
    var(--orn-cloud-tr) top right / 30px 30px no-repeat,
    var(--orn-cloud-bl) bottom left / 30px 30px no-repeat,
    var(--orn-cloud-br) bottom right / 30px 30px no-repeat;
}
#game[data-ornament='meander'] .panel::before {
  display: block;
  inset: -1px 10px auto;
  height: 7px;
  top: -4px;
  mask: var(--orn-meander) left center / 14px 7px repeat-x;
}

/* The top of the screen: the game's seal, where we are, and a few buttons. */
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  padding: 18px 26px;
  gap: 18px;
  background: linear-gradient(var(--ui-shade), transparent);
  pointer-events: none;
}
.brand {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  text-decoration: none;
  font-family: var(--ui-font-display);
  font-size: 24px;
  line-height: 1;
  color: #f7eddc;
  background: var(--ui-accent);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, #f7eddc 22%, transparent),
    0 3px 10px #0007;
  pointer-events: auto;
}
.brand b {
  font-weight: normal;
}
.brand span {
  display: none;
}
#location {
  font-family: var(--ui-font-heading);
  font-size: 16px;
  letter-spacing: 4px;
  padding: 3px 0 3px 16px;
  border-left: 1px solid var(--ui-line);
  text-shadow: 0 2px 6px #000a;
}
.top-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
#game .top-actions button {
  font-size: 12px;
  letter-spacing: 2px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--ui-ink) 72%, transparent);
}

/* 行旅札记: the objective, on a slip of paper. */
#quest {
  position: absolute;
  top: 78px;
  left: 26px;
  width: 268px;
  padding: 10px 14px 11px 16px;
  color: var(--ui-ink-text);
  background: linear-gradient(
    100deg,
    var(--ui-paper),
    color-mix(in srgb, var(--ui-paper) 86%, var(--ui-gold))
  );
  border-left: 3px solid var(--ui-accent);
  box-shadow: 0 6px 18px #0007;
}
#quest small {
  display: inline-block;
  font-family: var(--ui-font-heading);
  font-size: 12px;
  letter-spacing: 3px;
  color: #f7eddc;
  background: var(--ui-accent);
  padding: 2px 6px 2px 8px;
  border-radius: 2px;
}
#quest p {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.7;
}
/* Read once, the slip draws back to a line under the place's name; a hand over it opens it again. */
#quest {
  transition:
    background 0.6s,
    box-shadow 0.6s,
    color 0.6s,
    border-color 0.6s,
    padding 0.6s;
}
@media (min-height: 501px) {
  #quest.settled:not(:hover) {
    top: 66px;
  }
}
#quest.settled:not(:hover) {
  padding: 2px 14px 3px 12px;
  color: var(--ui-text);
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-ink) 58%, transparent), transparent);
  border-left-color: var(--ui-line);
  box-shadow: none;
}
#quest.settled:not(:hover) small {
  display: none;
}
#quest.settled:not(:hover) p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  text-shadow: 0 1px 4px #000c;
}

/* What belongs to the scene goes dark with the picture and comes up with it (a change of place,
   a script's blackout): the page says how dark in --scene-veil. A filter, so it multiplies what
   the rules below make of opacity. The words being said, menus and notices stay lit. */
#game[data-veiled] #world-labels,
#game[data-veiled] header,
#game[data-veiled] footer,
#game[data-veiled] #quest,
#game[data-veiled] #party,
#game[data-veiled] #minimap,
#game[data-veiled] #banter,
#game[data-veiled] #place-card,
#game[data-veiled] #battle {
  filter: opacity(calc(1 - var(--scene-veil, 0)));
}
/* What is round the picture goes by the moment: a story has the screen to itself, a fight keeps what it needs. */
header,
footer,
#minimap,
.top-actions,
#controls,
#battle-controls,
#location {
  transition: opacity 0.3s ease;
}
#game[data-moment='story'] header,
#game[data-moment='story'] footer {
  opacity: 0;
  transition-delay: 0.12s;
}
/* The buttons are still there for a hand that goes to them. */
#game[data-moment='story'] header:has(.top-actions:hover) {
  opacity: 1;
  transition-delay: 0s;
}
/* A finger cannot hover: the buttons stay faintly there. */
@media (pointer: coarse) {
  #game[data-moment='story'] header {
    opacity: 0.55;
  }
  #game[data-moment='story'] #location {
    opacity: 0;
  }
}
#game[data-moment='battle'] #location {
  opacity: 0;
}
/* A menu is all there is while it is open. */
#game[data-menu] header,
#game[data-menu] footer,
#game[data-menu] #quest,
#game[data-menu] #party,
#game[data-menu] #banter {
  opacity: 0;
  pointer-events: none;
}
#game[data-moment='battle'] .top-actions,
#game[data-moment='world'] .top-actions {
  opacity: 0.72;
}
#game .top-actions:hover,
#game .top-actions:focus-within {
  opacity: 1;
}
/* The keys say their piece and go; a hand at the foot of the screen brings them back. */
#game[data-keys-known] #controls,
#game[data-orders-known] #battle-controls {
  opacity: 0;
}
#game footer:hover #controls,
#game footer:hover #battle-controls {
  opacity: 1;
}

/* 风物志, at the foot of the journal. */
.lore-head {
  margin: 8px 0 0;
}
.lore-set {
  margin: 2px 0;
  font-size: 13px;
  opacity: 0.8;
}
.lore-entry {
  padding: 8px 14px;
  background: color-mix(in srgb, var(--ui-ink) 36%, transparent);
  border-left: 2px solid var(--ui-line);
}
.lore-entry b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  letter-spacing: 2px;
}
.lore-entry p {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ui-dim);
}

/* 人物志: who has been met, a list beside the one being read. */
.menu-people .people-wrap {
  display: grid;
  grid-template-columns: minmax(150px, 210px) 1fr;
  gap: 22px;
  align-items: start;
}
.menu-people .people-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.menu-people .people-kind {
  margin: 8px 0 2px;
  font-family: var(--ui-font-heading);
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 4px;
  color: var(--ui-gold);
}
.menu-people .person-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 8px;
  text-align: left;
  font: inherit;
  font-family: var(--ui-font-heading);
  letter-spacing: 2px;
  color: var(--ui-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
}
.menu-people .person-entry:hover,
.menu-people .person-entry:focus-visible,
.menu-people .person-entry.open {
  background: color-mix(in srgb, var(--ui-ink) 50%, transparent);
  border-color: var(--ui-line-soft);
}
.menu-people .person-entry.open {
  border-left: 2px solid var(--ui-accent);
}
.menu-people .person-thumb {
  width: 34px;
  height: 34px;
  flex: none;
  object-fit: cover;
  object-position: 50% 12%;
  image-rendering: pixelated;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ui-ink) 60%, transparent);
}
/* Someone with no picture yet is their seal: the first of their name, white on cinnabar. */
.menu-people .seal {
  display: grid;
  place-items: center;
  font-family: var(--ui-font-display);
  line-height: 1;
  color: #fbefd8;
  background: #9a2416;
  box-shadow:
    inset 0 0 0 2px #fbefd838,
    inset 0 0 0 4px #9a2416,
    inset 0 0 0 5px #fbefd828;
}
.menu-people .person-thumb.seal {
  font-size: 19px;
}
.menu-people .person-page {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  gap: 22px;
  align-items: start;
  /* The one being read stays in sight as a long list scrolls by. */
  position: sticky;
  top: 0;
}
.menu-people .person-face {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  object-position: bottom;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 14px #000a);
}
.menu-people .person-face.seal {
  width: 76%;
  margin: 12% auto 0;
  font-size: clamp(44px, 7vw, 84px);
  border-radius: 4px;
}
.menu-people .person-words p {
  margin: 0;
}
.menu-people .person-name b {
  font-family: var(--ui-font-display);
  font-size: 28px;
  font-weight: normal;
  letter-spacing: 6px;
}
.menu-people .person-name small {
  margin-left: 12px;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--ui-gold);
}
.menu-people .person-title {
  margin-top: 4px !important;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--ui-dim);
}
.menu-people .person-line {
  margin: 12px 0 10px !important;
  padding-left: 12px;
  border-left: 2px solid var(--ui-accent);
  font-family: var(--ui-font-heading);
  letter-spacing: 1px;
}
.menu-people .person-bio {
  margin-top: 6px !important;
  font-size: 14px;
  line-height: 1.8;
  color: color-mix(in srgb, var(--ui-text) 86%, var(--ui-dim));
}
.menu-people .person-moods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.menu-people .person-moods figure {
  margin: 0;
  text-align: center;
}
.menu-people .person-moods img {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: cover;
  object-position: 50% 15%;
  image-rendering: pixelated;
  background: color-mix(in srgb, var(--ui-ink) 50%, transparent);
  border: 1px solid var(--ui-line-soft);
}
.menu-people .person-moods figcaption {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ui-dim);
}
@media (max-width: 760px) {
  .menu-people .people-wrap {
    grid-template-columns: 130px 1fr;
    gap: 12px;
  }
  .menu-people .person-page {
    grid-template-columns: 90px 1fr;
    gap: 12px;
  }
}

/* Someone first met: their name by the top corner on a band of ink, a seal beside it, for a few seconds. */
#name-card {
  position: absolute;
  z-index: 13;
  /* Below the corner where the task slip is, above where the speakers' faces rise. */
  top: calc(22% + env(safe-area-inset-top, 0px));
  left: calc(28px + env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 72px 14px 18px;
  pointer-events: none;
  background: linear-gradient(90deg, #0b0907e8, #0b0907b8 62%, #0b090700);
  border-left: 2px solid var(--ui-gold);
  animation: name-card-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}
#name-card[hidden] {
  display: none;
}
#name-card.leaving {
  opacity: 0;
  transform: translateX(-14px);
}
@keyframes name-card-in {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: none;
  }
}
#name-card .card-seal {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  font-family: var(--ui-font-display);
  font-size: 32px;
  line-height: 1;
  color: #fbefd8;
  background: #9a2416;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 2px #fbefd840,
    inset 0 0 0 5px #9a2416,
    inset 0 0 0 6px #fbefd830,
    0 4px 12px #0008;
}
#name-card .card-words p {
  margin: 0;
}
#name-card .card-kind {
  font-size: 12px;
  letter-spacing: 5px;
  color: var(--ui-gold);
}
#name-card .card-name b {
  font-family: var(--ui-font-display);
  font-size: 30px;
  font-weight: normal;
  letter-spacing: 6px;
  color: #f6ead2;
  text-shadow: 0 2px 8px #000;
}
#name-card .card-name small {
  margin-left: 12px;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--ui-gold);
}
#name-card .card-title {
  margin-top: 2px !important;
  font-size: 14px;
  letter-spacing: 2px;
  color: #e8dcc4c8;
}
#name-card .card-line {
  margin-top: 7px !important;
  padding-top: 6px;
  border-top: 1px solid #d1b07240;
  font-family: var(--ui-font-heading);
  font-size: 15px;
  letter-spacing: 1px;
  color: #f4eadb;
}

/* 支线: each quest on its own slip. */
.quest-card {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--ui-ink) 44%, transparent);
  border-left: 3px solid var(--ui-gold);
}
.quest-card.done,
.quest-card.failed {
  opacity: 0.62;
  border-left-color: var(--ui-line);
}
.quest-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.quest-head b {
  font-family: var(--ui-font-heading);
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 3px;
}
.quest-head small {
  color: var(--ui-dim);
  font-size: 12px;
}
.quest-card p {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.6;
}
.quest-about {
  color: var(--ui-dim);
}
/* Over the head of someone with a quest to give, or one the quest says to go to. */
#world-labels .float-label.quest-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-family: var(--ui-font-body);
  font-size: 17px;
  font-weight: bold;
  line-height: 1;
  color: #2a1608;
  border: 2px solid #2a1608;
  border-radius: 50%;
  box-shadow: 0 2px 6px #000a;
  text-shadow: none;
  animation: quest-bob 1.6s ease-in-out infinite;
}
#world-labels .float-label.quest-marker.give {
  background: #ffb24a;
}
#world-labels .float-label.quest-marker.turn {
  background: #8ff0db;
}
@keyframes quest-bob {
  0%,
  100% {
    margin-top: 0;
  }
  50% {
    margin-top: -4px;
  }
}

/* The map, upper right, on the same paper as the objective. */
#minimap {
  position: absolute;
  top: 78px;
  right: 26px;
  width: 184px;
  height: 136px;
  image-rendering: pixelated;
  /* Where nobody has been is dark silk, not a blank sheet. */
  background: color-mix(in srgb, var(--ui-ink) 74%, transparent);
  border: 2px solid color-mix(in srgb, var(--ui-ink) 86%, var(--ui-gold));
  outline: 1px solid var(--ui-line);
  box-shadow: 0 6px 18px #0007;
  cursor: pointer;
}
#minimap[hidden] {
  display: none;
}

/* The party on the march, lower left; all well, it keeps quiet. */
#game[data-cinematic] #party,
#game[data-cinematic] #minimap {
  opacity: 0;
  pointer-events: none;
}
#party {
  position: absolute;
  left: 26px;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: opacity 0.4s;
}
#party.calm {
  opacity: 0.82;
}
#party:hover {
  opacity: 1;
}
.member {
  display: grid;
  grid-template-columns: 76px 104px;
  gap: 10px;
  align-items: center;
  padding: 6px 12px 7px;
  font-size: 12px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ui-ink) 82%, transparent),
    color-mix(in srgb, var(--ui-ink) 58%, transparent)
  );
  border-left: 2px solid var(--ui-gold);
}
.member > span {
  font-family: var(--ui-font-heading);
  font-size: 14px;
  letter-spacing: 1px;
}
.member .lv {
  display: block;
  font-family: var(--ui-font-body);
  font-style: normal;
  font-size: 12px;
  color: var(--ui-gold);
}
.member small {
  display: block;
  font-family: var(--ui-font-body);
  color: color-mix(in srgb, var(--ui-text) 78%, var(--ui-dim));
  font-size: 12px;
  margin-top: 3px;
}
.bar {
  height: 4px;
  background: color-mix(in srgb, var(--ui-ink) 80%, #555);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-jade) 80%, #000), var(--ui-jade));
}

/* A party banter on offer: a bubble above the party's names. */
#game #banter {
  position: absolute;
  left: 26px;
  bottom: 184px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  font-size: 14px;
  letter-spacing: 1px;
  background: var(--ui-glass);
  border: 1px solid var(--ui-line);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 6px 16px #0008;
  animation: banter-bob 2.4s ease-in-out infinite;
}
#banter b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-family: var(--ui-font-display);
  font-weight: normal;
  color: #f8eedb;
  background: var(--ui-accent);
  border-radius: 50%;
}
@keyframes banter-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}
/* The dialogue: a lacquered box, the speaker's name on a seal, a coin that waits for the reader. */
#dialogue {
  position: absolute;
  z-index: 12;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 56px));
  min-height: 146px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: 26px 40px 22px 34px;
}
#portrait {
  width: 0;
}
/* A speaker with a portrait: the bust sits inside the box, in a framed square at its left, head and shoulders. */
#dialogue.with-portrait {
  padding-left: 158px;
}
#dialogue.with-portrait #speaker {
  left: 158px;
}
#dialogue #portrait:not([hidden]) {
  position: absolute;
  left: 22px;
  top: 16px;
  width: 116px;
  height: 116px;
  overflow: hidden;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--ui-gold) 45%, transparent);
  border-radius: 2px;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--ui-gold) 12%, transparent), transparent 70%);
  box-shadow: inset 0 0 0 1px #0007;
}
/* Every drawing fills the square from its top, whatever its proportions: the same head and shoulders show, never
   more of one figure than another, never over the box's edge. */
#portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  image-rendering: pixelated;
}
.dialogue-body {
  min-width: 0;
}
#speaker {
  position: absolute;
  top: -15px;
  left: 30px;
  padding: 4px 14px 5px 16px;
  font-family: var(--ui-font-heading);
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 4px;
  color: #f8eedb;
  background: var(--ui-accent);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, #f8eedb 20%, transparent),
    0 4px 12px #0008;
}
#speaker:empty {
  display: none;
}
#speech {
  margin: 4px 0 0;
  min-height: 3.6em;
  font-size: 20px;
  line-height: 1.85;
  letter-spacing: 0.5px;
  white-space: pre-wrap;
  text-shadow: 0 1px 2px #0008;
}
#continue {
  position: absolute;
  right: 18px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  font-size: 12px;
}
#game #continue {
  background: transparent;
  border: 0;
  color: var(--ui-dim);
}
#continue .coin {
  width: 16px;
  height: 16px;
  background: var(--ui-gold);
  mask: var(--orn-coin) center / contain no-repeat;
  animation: coin-wait 1.6s ease-in-out infinite;
}
#dialogue.typing #continue {
  visibility: hidden;
}
@keyframes coin-wait {
  0%,
  100% {
    transform: translateY(0) rotateY(0);
  }
  50% {
    transform: translateY(3px) rotateY(180deg);
  }
}
/* A line nobody speaks: narration, written across a band of shade rather than in a box. The band
   stands where the box stands and is as tall, so going from one to the other nothing jumps; the
   words sit in its middle. */
#dialogue.narration {
  background: linear-gradient(90deg, transparent, var(--ui-glass) 18%, var(--ui-glass) 82%, transparent);
  border: 0;
  border-block: 1px solid var(--ui-line-soft);
  box-shadow: none;
  grid-template-columns: 1fr;
  align-items: center;
}
#dialogue.narration::before {
  display: none;
}
#dialogue.narration #speech {
  min-height: 0;
  text-align: center;
  font-size: 19px;
  letter-spacing: 2px;
  color: color-mix(in srgb, var(--ui-text) 88%, var(--ui-gold));
}
/* What of the line has not come up yet: laid out, so nothing moves as it comes, but not seen. */
#speech .unshown {
  visibility: hidden;
}
/* The box (or the band) comes up as it appears; the line waits for it (dialogue.ts ARRIVE_MS). */
#dialogue.arriving {
  animation: dialogue-arrive 180ms ease-out both;
}
@keyframes dialogue-arrive {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
#dialogue.narration #continue {
  bottom: 8px;
}
/* Choices: tablets, numbered, picked by number, arrows or the pointer. */
#choices {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  justify-items: stretch;
}
#choices.many {
  grid-template-columns: repeat(3, 1fr);
}
#choices:empty {
  display: none;
}
#game #choices button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: var(--ui-font-body);
  font-size: 17px;
  padding: 8px 14px 8px 10px;
  background: color-mix(in srgb, var(--ui-panel) 80%, transparent);
  border: 1px solid var(--ui-line-soft);
  border-left: 3px solid transparent;
}
#game #choices button .numeral {
  font-family: var(--ui-font-display);
  font-size: 15px;
  color: var(--ui-gold);
  min-width: 1.4em;
}
#game #choices button:hover,
#game #choices button.focused {
  background: color-mix(in srgb, var(--ui-accent) 38%, var(--ui-panel));
  border-color: var(--ui-line);
  border-left-color: var(--ui-gold);
}

/* Where we have come: the place's name, written large for a moment on arrival. */
#place-card {
  position: absolute;
  z-index: 11;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 110px 30px;
  pointer-events: none;
  opacity: 0;
}
#place-card .region {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--ui-font-heading);
  font-size: 15px;
  letter-spacing: 6px;
  color: var(--ui-gold);
  text-shadow:
    0 1px 2px #000,
    0 1px 8px #000;
}
#place-card .region::before,
#place-card .region::after {
  content: '';
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ui-line));
}
#place-card .region::after {
  transform: scaleX(-1);
}
#place-card .region:empty {
  display: none;
}
#place-card.part .name {
  font-size: 30px;
  letter-spacing: 8px;
  margin-right: -8px;
}
#place-card.part .region {
  font-size: 12px;
  letter-spacing: 4px;
}
#place-card .name {
  font-family: var(--ui-font-display);
  font-size: 52px;
  line-height: 1.1;
  letter-spacing: calc(12px + 10px * var(--spread, 0));
  margin-right: calc(-12px - 10px * var(--spread, 0));
  color: #f8efdc;
  text-shadow:
    0 1px 2px #000,
    0 2px 10px #000,
    0 4px 28px #000c,
    0 0 26px color-mix(in srgb, var(--ui-gold) 30%, transparent);
  filter: blur(calc(var(--spread, 0) * 3px));
}

/* Along a road to another map: over the ink, where the road goes and a line of the way; late in coming
   up, the region too, a little map of the road and how far its files have come. */
#journey-card {
  position: absolute;
  z-index: 44;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(92vw, 640px);
  pointer-events: none;
  opacity: 0;
}
#journey-card .region {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--ui-font-heading);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--ui-gold);
}
#journey-card .region::before,
#journey-card .region::after {
  content: '';
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ui-line));
}
#journey-card .region::after {
  transform: scaleX(-1);
}
#journey-card .region:empty {
  display: none;
}
#journey-card .name {
  font-family: var(--ui-font-display);
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: 12px;
  margin-right: -12px;
  color: #f4ead6;
  text-shadow: 0 0 22px color-mix(in srgb, var(--ui-gold) 24%, transparent);
}
#journey-card .words {
  font-family: var(--ui-font-heading);
  font-size: 16px;
  letter-spacing: 4px;
  color: var(--ui-dim);
}
#journey-card .words:empty {
  display: none;
}
#journey-route {
  position: relative;
  width: min(80vw, 340px);
  aspect-ratio: 2.6;
  margin: 8px 0 0;
  border-top: 1px solid color-mix(in srgb, var(--ui-gold) 28%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--ui-gold) 28%, transparent);
}
#journey-route svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
#journey-route .river {
  fill: none;
  stroke: #6f8f9a66;
  stroke-width: 2;
}
#journey-route .road {
  fill: none;
  stroke: #d1b07255;
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
}
#journey-route .road.taken {
  stroke: var(--ui-gold);
  stroke-width: 2;
  stroke-dasharray: none;
}
#journey-route .spot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 2px;
  font-family: var(--ui-font-heading);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ui-dim);
  white-space: nowrap;
}
#journey-route .spot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ui-dim);
}
#journey-route .spot.to {
  color: #f4ead6;
}
#journey-route .spot.to i {
  background: var(--ui-gold);
  box-shadow: 0 0 10px var(--ui-gold);
  animation: journey-goal 1.2s ease-in-out infinite alternate;
}
@keyframes journey-goal {
  to {
    box-shadow: 0 0 2px var(--ui-gold);
  }
}
#journey-track {
  width: min(60vw, 220px);
  overflow: hidden;
}
#journey-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--ui-accent), var(--ui-gold));
  transition: width 0.2s;
}
/* Building, not fetching: how far is not known, so the light goes along the track. */
#journey-track.building #journey-bar {
  width: 30%;
  animation: journey-along 1.1s ease-in-out infinite alternate;
}
@keyframes journey-along {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(233%);
  }
}
@media (max-height: 500px) {
  #journey-card .name {
    font-size: 36px;
  }
  #journey-card .words {
    font-size: 14px;
  }
  #journey-route {
    width: min(60vw, 280px);
  }
}
@media (prefers-reduced-motion: reduce) {
  #journey-route .spot.to i,
  #journey-track.building #journey-bar {
    animation: none;
  }
}
/* A road's signpost, near enough to read: where the road goes. */
#world-labels .float-label.road-sign {
  font-family: var(--ui-font-heading);
  font-size: 13px;
  letter-spacing: 3px;
  color: #f4ead6;
  background: #2a1a10d9;
  border-color: color-mix(in srgb, var(--ui-gold) 55%, transparent);
}

/* A painting told over (a storyteller's scroll): the whole screen, under the lines, moving slowly. */
#picture {
  position: absolute;
  inset: 0;
  z-index: 11;
  overflow: hidden;
  background: #0b0907;
}
#picture[hidden] {
  display: none;
}
#picture .scroll {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  opacity: 1;
  transition: opacity 0.9s ease;
}
#picture .scroll.coming {
  opacity: 0;
}
#picture .scroll.leaving {
  opacity: 0;
}
#picture .scroll {
  box-shadow: 0 10px 50px #000c;
}
#picture .scroll img {
  display: block;
  width: 100%;
  height: 100%;
}
/* What moves in the painting (src/browser/ui/picture-motion.ts), laid exactly over it. */
#picture .scroll canvas.motion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#picture .marks {
  position: absolute;
  inset: 0;
}
/* Names written on a map: small paper slips laid on it, read but quiet, until the line names them and the slip
   turns to a cinnabar seal. */
#picture .mark {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 10px 4px 12px;
  font-family: var(--ui-font-display);
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 3px;
  white-space: nowrap;
  color: #3a2614;
  background: #f2e5c4e0;
  border: 1px solid #7a5a3666;
  border-radius: 2px;
  box-shadow: 0 2px 6px #0006;
  opacity: 0.78;
  transition:
    opacity 0.6s ease,
    color 0.6s ease,
    background-color 0.6s ease,
    border-color 0.6s ease,
    transform 0.6s ease,
    box-shadow 0.6s ease;
}
#picture .mark.lit {
  opacity: 1;
  color: #fff3df;
  background: #9a2416;
  border-color: #f3d9a4b0;
  transform: translate(-50%, -50%) scale(1.14);
  box-shadow:
    0 0 0 3px #9a241638,
    0 4px 14px #000a,
    0 0 22px #d0503080;
}
/* The edges of the painting fall into shade, as a lamp lights the middle of a scroll. */
#picture::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(125% 105% at 50% 42%, transparent 58%, #0b090790 100%);
}
#picture-skip {
  position: absolute;
  z-index: 3;
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: calc(22px + env(safe-area-inset-right, 0px));
  zoom: var(--ui-size, 1);
  padding: 6px 12px;
  border: 1px solid #f4eadb40;
  border-radius: 4px;
  background: #0008;
  color: #f4eadbcc;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
#picture-skip:hover,
#picture-skip:focus-visible {
  color: #f4eadb;
  border-color: #f4eadb90;
}
/* While a picture is told over, the game's own panels step back and the lines read as a storyteller's. */
#game.showing-picture > header,
#game.showing-picture #quest,
#game.showing-picture #party,
#game.showing-picture #widgets,
#game.showing-picture #minimap,
#game.showing-picture #banter {
  visibility: hidden;
}
/* The storyteller's lines: across the foot of the screen on a band of shade, no box over the painting. */
#game.showing-picture #dialogue.panel {
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: auto;
  min-height: 0;
  grid-template-columns: 1fr;
  padding: 70px max(56px, calc((100% - 940px) / 2)) calc(38px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #0b090700, #0b090799 38%, #0b0907e0);
  border: 0;
  box-shadow: none;
}
#game.showing-picture #dialogue.panel::before {
  display: none;
}
#game.showing-picture #speech {
  min-height: 0;
  text-align: center;
  /* The storyteller writes in the game's title hand (a brush face where the game has one). */
  font-family: var(--ui-font-display);
  font-size: 24px;
  line-height: 1.8;
  letter-spacing: 3px;
  color: #f4eadb;
  text-shadow:
    0 2px 8px #000,
    0 0 2px #000;
}
#game.showing-picture #continue {
  right: max(28px, calc((100% - 940px) / 2 - 40px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}
/* On a touch screen the thumb's big buttons stand in the lower corners: the line keeps between them. */
#game[data-device='touch'].showing-picture #dialogue.panel {
  padding-inline: 190px;
}

/* A new chapter, on black. */
#chapter-card {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
  background: radial-gradient(70% 60% at 50% 48%, color-mix(in srgb, var(--ui-panel) 70%, #000), #050403);
  pointer-events: none;
}
#chapter-card[hidden] {
  display: none;
}
#chapter-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--ui-font-heading);
  font-size: 20px;
  letter-spacing: 12px;
  margin-right: -12px;
  color: var(--ui-gold);
}
#chapter-title::before,
#chapter-title::after {
  content: '';
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ui-line));
}
#chapter-title::after {
  transform: scaleX(-1);
}
#chapter-name {
  margin: 0;
  font-family: var(--ui-font-display);
  font-size: 92px;
  line-height: 1.1;
  letter-spacing: 30px;
  margin-right: -30px;
  color: #f4eadb;
  text-shadow: 0 6px 40px color-mix(in srgb, var(--ui-gold) 22%, transparent);
}

#chapter-recap {
  margin: 10px 0 0;
  max-width: 640px;
  font-size: 17px;
  line-height: 1.9;
  letter-spacing: 1px;
  color: color-mix(in srgb, var(--ui-text) 75%, var(--ui-gold));
}
#chapter-tally {
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0.65;
}
#chapter-tally:empty {
  display: none;
}
#chapter-recap:empty {
  display: none;
}
.journal-recap {
  margin: 0;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1.85;
  color: color-mix(in srgb, var(--ui-text) 85%, var(--ui-gold));
}
/* The end of what there is: the chapter, the closing words, back to the title. */
#end-card {
  position: absolute;
  inset: 0;
  z-index: 31;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 0 calc(10 * var(--vw));
  text-align: center;
  background: radial-gradient(
    70% 60% at 50% 48%,
    color-mix(in srgb, var(--ui-panel) 80%, transparent),
    #050403f2
  );
}
#end-actions {
  display: flex;
  gap: 16px;
}
#end-card[hidden] {
  display: none;
}
#end-title {
  margin: 0;
  font-family: var(--ui-font-heading);
  font-size: 20px;
  letter-spacing: 10px;
  color: var(--ui-gold);
}
#end-head {
  margin: 0;
  font-family: var(--ui-font-display);
  font-size: 64px;
  letter-spacing: 18px;
  margin-right: -18px;
  color: #f4eadb;
}
#end-words {
  margin: 0;
  max-width: 720px;
  font-size: 19px;
  line-height: 1.9;
  letter-spacing: 1px;
  color: color-mix(in srgb, var(--ui-text) 85%, var(--ui-gold));
}
#game #end-to-title,
#game #end-go-on,
#game #end-load-latest,
#game #end-load {
  margin-top: 14px;
  padding: 9px 26px;
  font-size: 16px;
  letter-spacing: 4px;
}
/* The bottom of the screen: keys, the thing to do here, a short note. */
footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  background: linear-gradient(transparent, var(--ui-shade));
  font-size: 12px;
  color: var(--ui-dim);
  pointer-events: none;
}
footer > * {
  pointer-events: auto;
}
#controls,
#battle-controls {
  display: flex;
  gap: 18px;
}
/* A word that comes and goes. */
#tip {
  color: var(--ui-dim);
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.5s;
}
#tip.shown {
  opacity: 1;
}
#game #interact {
  position: absolute;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  font-size: 15px;
  letter-spacing: 3px;
  padding: 8px 18px 8px 20px;
  background: var(--ui-glass);
  border-color: var(--ui-line);
  box-shadow: 0 6px 18px #0008;
}
#toast {
  position: absolute;
  z-index: 40;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 22px;
  font-family: var(--ui-font-heading);
  letter-spacing: 2px;
  background: var(--ui-glass);
  border: 1px solid var(--ui-line);
  box-shadow: 0 8px 22px #0008;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#toast.visible {
  opacity: 1;
}
/* What only makes sense on a keyboard and mouse, while a pad is in the player's hands. */
#game[data-device='pad'] .keys-only {
  display: none;
}
#menu-body h4,
#title-panel-body h4 {
  margin: 14px 0 2px;
  color: var(--ui-gold);
  font-family: var(--ui-font-heading);
  letter-spacing: 3px;
}
/* Something the game cannot go on from, or waits on: over everything, and it says what can be done. */
#fault {
  position: absolute;
  z-index: 90;
  inset: 0;
  display: grid;
  place-content: center;
  background: #0009;
}
#fault[hidden] {
  display: none;
}
#fault > div {
  display: grid;
  gap: 12px;
  max-width: 460px;
  padding: 20px 28px;
  background: var(--ui-glass);
  border: 1px solid color-mix(in srgb, var(--ui-foe) 60%, transparent);
  color: var(--ui-text);
}
#fault small {
  color: var(--ui-dim);
  overflow-wrap: anywhere;
}
#fault nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* An achievement just had: a moment in the corner, over whatever is happening. */
#achievement {
  position: absolute;
  z-index: 41;
  /* Under the menu's closing cross, which is at the top of the same corner. */
  top: 96px;
  right: 18px;
  display: grid;
  gap: 2px;
  max-width: 280px;
  padding: 10px 16px;
  background: var(--ui-glass);
  border: 1px solid var(--ui-line);
  border-left: 3px solid var(--ui-gold);
  box-shadow: 0 8px 22px #0008;
  animation: achievement-in 3.6s ease both;
  pointer-events: none;
}
#achievement small {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--ui-gold);
}
#achievement b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  letter-spacing: 2px;
}
#achievement span {
  font-size: 12px;
  color: var(--ui-dim);
}
#achievement[hidden] {
  display: none;
}
@keyframes achievement-in {
  0% {
    opacity: 0;
    transform: translateX(14px);
  }
  8%,
  88% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}
.achievement-count {
  margin: 0 0 10px;
  color: var(--ui-dim);
}
.achievement {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--ui-line-soft);
  opacity: 0.55;
}
.achievement.had {
  border-color: var(--ui-line);
  border-left: 3px solid var(--ui-gold);
  opacity: 1;
}
.achievement b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  letter-spacing: 2px;
}
.achievement span {
  grid-column: 1;
  font-size: 12px;
  color: var(--ui-dim);
}
.achievement small {
  grid-column: 2;
  grid-row: 1;
  font-size: 12px;
  color: var(--ui-dim);
}

/* Until the game starts only the stage and the title screen show. */
#game.on-title > :not(#stage, #cover, #toast) {
  visibility: hidden;
}
/* The title screen: the game's title over its own scene, drawn live, and a column of choices. */
#cover {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  /* Loading, the same warm dark the title then comes up out of (not the page's slate showing through). */
  background: radial-gradient(
    80% 70% at 50% 40%,
    color-mix(in srgb, var(--ui-ink) 86%, var(--ui-text)),
    var(--ui-ink)
  );
}
#cover.live {
  background:
    radial-gradient(70% 60% at 50% 38%, transparent, color-mix(in srgb, var(--ui-ink) 72%, transparent) 78%),
    linear-gradient(transparent 55%, color-mix(in srgb, var(--ui-ink) 85%, transparent));
}
/* The title arrives: its words over the dark first, then its scene comes up behind them, then the choices. */
#cover.live::before {
  content: '';
  position: absolute;
  inset: 0;
  /* The loading screen's own dark, lifting. */
  background: radial-gradient(
    80% 70% at 50% 40%,
    color-mix(in srgb, var(--ui-ink) 86%, var(--ui-text)),
    var(--ui-ink)
  );
  pointer-events: none;
  animation: cover-dawn 1.9s ease-in-out 0.35s both;
}
#cover .cover-content {
  position: relative;
  z-index: 1;
}
/* Its name over its own dark as soon as the game is known; the scene comes up behind when its files are in (live). */
#cover.named .eyebrow,
#cover.named #game-title,
#cover.named #subtitle {
  animation: cover-words 1.3s ease-out both;
}
#cover.named #subtitle {
  animation-delay: 0.35s;
}
#cover.named #title-menu {
  animation: cover-choices 0.7s ease-out 0.8s both;
}
@keyframes cover-dawn {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes cover-words {
  from {
    opacity: 0;
    translate: 0 8px;
    filter: blur(3px);
  }
  to {
    opacity: 1;
    translate: 0 0;
    filter: none;
  }
}
@keyframes cover-choices {
  from {
    opacity: 0;
    translate: 0 10px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #cover.live::before,
  #cover.named .eyebrow,
  #cover.named #game-title,
  #cover.named #subtitle,
  #cover.named #title-menu,
  .tip-card.turn {
    animation-duration: 0.01s;
    animation-delay: 0s;
  }
}
.cover-content {
  display: grid;
  justify-items: center;
  width: min(720px, calc(88 * var(--vw)));
  margin-top: calc(-6 * var(--vh));
  text-align: center;
}
.eyebrow {
  margin: 0;
  font-family: var(--ui-font-heading);
  font-size: 13px;
  letter-spacing: 8px;
  margin-right: -8px;
  color: var(--ui-gold);
  text-shadow: 0 2px 8px #000c;
}
.eyebrow:empty {
  display: none;
}
#game-title {
  margin: 14px 0 10px;
  font-family: var(--ui-font-display);
  font-weight: normal;
  font-size: clamp(56px, 8.4vw, 120px);
  line-height: 1.05;
  letter-spacing: 0.22em;
  margin-right: -0.22em;
  color: #f7eedc;
  text-shadow:
    0 4px 30px #000,
    0 0 40px color-mix(in srgb, var(--ui-gold) 28%, transparent);
}
#subtitle {
  margin: 0;
  font-family: var(--ui-font-body);
  font-size: 17px;
  letter-spacing: 6px;
  color: color-mix(in srgb, var(--ui-text) 85%, var(--ui-gold));
  text-shadow: 0 2px 10px #000;
}
#loading {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 40px;
  letter-spacing: 3px;
  color: var(--ui-dim);
}
.loading-track {
  width: 220px;
  height: 3px;
  background: color-mix(in srgb, var(--ui-dim) 25%, transparent);
}
#loading-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--ui-accent), var(--ui-gold));
  transition: width 0.2s;
}
/* How much has come, by size, under the bar. */
#loading-so-far {
  font-size: 11px;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  min-height: 1em;
}
/* A line about the game while it comes (ui.loading.tips): who, where, how to fight. Pressed, the next. */
.tip-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  width: min(460px, calc(80 * var(--vw)));
  margin: 22px auto 0;
  padding: 12px 16px;
  text-align: left;
  color: var(--ui-text);
  background: color-mix(in srgb, var(--ui-ink) 70%, transparent);
  border: 1px solid var(--ui-line);
  cursor: pointer;
}
.tip-card .tip-face {
  width: 56px;
  height: 56px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid var(--ui-line);
}
.tip-card .tip-face[hidden] + .tip-words {
  grid-column: 1 / -1;
}
.tip-card .tip-words {
  display: grid;
  gap: 4px;
  min-width: 0;
}
#game .tip-card b {
  font-family: var(--ui-font-heading);
  color: var(--ui-gold);
  letter-spacing: 2px;
  font-size: 14px;
}
#game .tip-card span {
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.5px;
}
.tip-card.turn {
  animation: tip-turn 0.5s ease-out both;
}
@keyframes tip-turn {
  from {
    opacity: 0;
    translate: 0 4px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
/* Files a place needs still coming: the game waits, and says how far they have come. */
#loading-page {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  background: #000;
  color: var(--ui-dim);
  letter-spacing: 3px;
}
#loading-page .loading-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
}
#loading-place {
  margin: 0;
  font-family: var(--ui-font-heading);
  color: var(--ui-text);
  letter-spacing: 4px;
}
#loading-amount {
  margin: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#loading-page-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--ui-accent), var(--ui-gold));
  transition: width 0.2s;
}
#loading.failed {
  padding: 18px 26px;
  background: var(--ui-glass);
  border: 1px solid color-mix(in srgb, var(--ui-foe) 60%, transparent);
  color: var(--ui-text);
}
#loading.failed small {
  max-width: 420px;
  letter-spacing: 0;
  color: var(--ui-dim);
}
#title-menu {
  display: grid;
  gap: 8px;
  margin-top: 46px;
  min-width: 230px;
}
#game #title-menu button {
  position: relative;
  padding: 10px 28px;
  font-size: 18px;
  letter-spacing: 6px;
  background: color-mix(in srgb, var(--ui-ink) 62%, transparent);
  border: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--ui-line), transparent) 1;
}
#game #title-menu button:hover,
#game #title-menu button:focus-visible {
  outline: none;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--ui-accent) 70%, transparent),
    transparent
  );
  color: #fff6e4;
}
#game #title-menu button:focus-visible::before,
#game #title-menu button:hover::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background: var(--ui-gold);
  mask: var(--orn-coin) center / contain no-repeat;
}
.cover-foot {
  position: absolute;
  bottom: 18px;
  right: 26px;
  margin: 0;
  display: flex;
  gap: 14px;
  font-size: 12px;
  letter-spacing: 4px;
  color: color-mix(in srgb, var(--ui-dim) 70%, transparent);
}
/* A panel over the title screen sits above the title's words (they are raised over the lifting dark,
   and would otherwise cover the panel and take its clicks), and while it is open the words step aside. */
#title-panel {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(92 * var(--vw)));
  max-height: calc(84 * var(--vh));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 30px 22px;
}
#cover:has(> #title-panel:not([hidden])) .cover-content {
  visibility: hidden;
}
#title-panel h2 {
  margin: 0;
  font-family: var(--ui-font-display);
  font-weight: normal;
  font-size: 26px;
  letter-spacing: 10px;
  color: var(--ui-gold);
}
#title-panel-body {
  overflow: auto;
}
#game #title-panel-close {
  align-self: flex-end;
  padding: 6px 16px;
}

/* The menu (Esc): a row of pages along the top, the open page below. */
#menu {
  position: absolute;
  z-index: 35;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, calc(94 * var(--vw)));
  height: min(640px, calc(88 * var(--vh)));
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 30px 16px;
}
#game #menu-close {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 14px;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--ui-line-soft);
}
#menu-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: -1px -30px 0;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--ui-line-soft);
}
#game #menu-tabs .tab {
  min-width: 0;
  padding: 9px 13px 10px;
  font-size: 17px;
  letter-spacing: 4px;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ui-dim);
}
#game #menu-tabs .tab.open {
  color: #fff3dc;
  border-bottom-color: var(--ui-accent);
  background: linear-gradient(transparent, color-mix(in srgb, var(--ui-accent) 22%, transparent));
}
/* 地图: the whole map as seen so far. */
#menu-body.menu-map {
  overflow: hidden;
  align-items: center;
}
.map-head {
  display: flex;
  align-self: stretch;
  align-items: baseline;
  gap: 16px;
}
.map-name {
  font-family: var(--ui-font-heading);
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 4px;
  white-space: nowrap;
}
.map-objective {
  color: var(--ui-dim);
  font-size: 13px;
}
.map-frame {
  position: relative;
  flex: none;
  line-height: 0;
  /* Where nobody has been: dark silk, the weave just showing. */
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 5px,
      color-mix(in srgb, var(--ui-gold) 7%, transparent) 5px 6px
    ),
    color-mix(in srgb, var(--ui-ink) 88%, #57462e);
  outline: 2px solid color-mix(in srgb, var(--ui-ink) 86%, var(--ui-gold));
}
.map-whole {
  display: block;
  image-rendering: pixelated;
}
.map-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 1px 5px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  color: #fbf1da;
  background: color-mix(in srgb, var(--ui-ink) 72%, transparent);
  border-radius: 2px;
  pointer-events: none;
}
.map-label.way {
  color: #fbeec6;
  font-size: 12px;
}
.map-label.service {
  color: #f6d9a0;
  font-size: 11px;
  transform: translate(-50%, 0);
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  font-size: 12px;
  color: var(--ui-dim);
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.map-legend i {
  width: 9px;
  height: 9px;
  outline: 1px solid #2a2118;
}

/* 舆图: the country, on a long sheet of paper. */
.map-pick {
  display: flex;
  align-self: flex-end;
  gap: 4px;
  margin-bottom: -6px;
}
#game .map-pick button {
  padding: 3px 12px;
  font-size: 12px;
  letter-spacing: 2px;
  background: transparent;
  color: var(--ui-dim);
}
#game .map-pick button.on {
  color: #fff3dc;
  background: color-mix(in srgb, var(--ui-accent) 40%, transparent);
}
.country {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  aspect-ratio: 3 / 2;
  color: #33261a;
  background:
    radial-gradient(closest-side, transparent 72%, #57462e66),
    color-mix(in srgb, var(--ui-paper) 84%, #57462e);
  outline: 2px solid color-mix(in srgb, var(--ui-ink) 86%, var(--ui-gold));
}
.country svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
}
.country .river {
  stroke: #6f9db0;
  stroke-width: 3;
  stroke-linejoin: round;
  opacity: 0.8;
}
.country .road {
  stroke: #6d5536;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}
.country .road.unknown {
  opacity: 0.4;
}
.country-region {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--ui-font-display);
  font-size: 26px;
  letter-spacing: 8px;
  color: #6d553666;
  white-space: nowrap;
  pointer-events: none;
}
.country-region.shut {
  color: #6d553633;
}
.country-place {
  position: absolute;
  transform: translate(-50%, -7px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}
.country-place i,
.country-key i {
  width: 10px;
  height: 10px;
  background: #4a3826;
  border: 1px solid #2a2118;
  border-radius: 50%;
}
.country-place.unknown {
  opacity: 0.6;
}
.country-place.post i,
.country-key.post i {
  border-radius: 1px;
  background: #b5873c;
}
.country-place.here {
  font-weight: bold;
}
.country-place.here i,
.country-key.here i {
  background: #fff6df;
  box-shadow: 0 0 0 3px #2a2118;
}
.country-place.goal i,
.country-key.goal i {
  background: #e8392c;
  box-shadow: 0 0 0 2px #ffcf5e;
  transform: rotate(45deg);
  border-radius: 1px;
}
.chapter-entry {
  display: flex;
  gap: 14px;
  align-items: baseline;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
}
.chapter-entry b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  letter-spacing: 3px;
}
/* A new journey's difficulty: the one the settings have now, lit. */
#game .journey-choice.on {
  color: #fff6e4;
  background: color-mix(in srgb, var(--ui-accent) 80%, var(--ui-panel));
  border-color: var(--ui-line);
}

#menu-body {
  overflow: auto;
  padding: 18px 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.menu-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--ui-line-soft);
  font-size: 12px;
  color: var(--ui-dim);
}
#game #to-title {
  margin-left: auto;
  padding: 5px 14px;
  font-size: 12px;
}
#game #to-quit {
  padding: 5px 14px;
  font-size: 12px;
}
#menu-body h2,
#menu-body h3 {
  margin: 4px 0 0;
  font-family: var(--ui-font-heading);
  font-weight: normal;
  letter-spacing: 4px;
  color: var(--ui-gold);
}
#menu-body h2 {
  font-size: 18px;
}
#menu-body h3 {
  font-size: 15px;
}
#menu-body .empty {
  margin: 0;
  color: var(--ui-dim);
}
#menu-body .bag-member,
#menu-body .bag-item {
  background: color-mix(in srgb, var(--ui-panel) 75%, transparent);
  border-left-color: var(--ui-gold);
}
#menu-body .bag-head b,
#menu-body .bag-item b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  font-size: 15px;
}

/* The bag inside the menu, in the theme's colours. */
#menu-body .bag-head .level,
#menu-body .bag-gold {
  color: var(--ui-gold);
}
#menu-body .bag-slot .slot,
#menu-body .bag-member small,
#menu-body .bag-item small {
  color: var(--ui-dim);
}
#menu-body .bar.exp i {
  background: var(--ui-gold);
}
/* A member at a glance: the face, how they stand, what they carry into a fight. */
#menu-body .bag-members {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}
#menu-body .bag-member {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 3px 12px;
  align-items: center;
  align-content: start;
  padding: 11px 12px 12px;
}
#menu-body .bag-member > * {
  grid-column: 2;
}
#menu-body .bag-member > .bag-face {
  grid-column: 1;
  grid-row: 1 / span 5;
  width: 76px;
  height: 76px;
  object-fit: cover;
  object-position: 50% 12%;
  background: radial-gradient(
    circle at 50% 30%,
    color-mix(in srgb, var(--ui-gold) 22%, var(--ui-panel)),
    var(--ui-ink)
  );
  border: 1px solid var(--ui-line);
}
#menu-body .bag-member > .bag-stats,
#menu-body .bag-member > .bag-slot {
  grid-column: 1 / -1;
}
#menu-body .bag-member .bar {
  height: 5px;
}
#menu-body .bag-member small {
  font-size: 12px;
}
#menu-body .bag-stats {
  display: flex;
  gap: 18px;
  margin: 7px 0 4px;
  padding: 5px 2px 4px;
  border-block: 1px solid var(--ui-line-soft);
}
#menu-body .bag-stats .stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
#menu-body .bag-stats b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  font-size: 16px;
  color: var(--ui-text);
}
#menu-body .bag-slot {
  min-height: 24px;
}
/* A thing carried, with its kind's small seal. */
#menu-body .bag-item {
  justify-content: flex-start;
  border-left: 0;
}
#menu-body .bag-item .about {
  flex: 1;
  min-width: 0;
}
/* An item's own picture, where it has one: in place of its seal, pixels kept square. */
.item-icon {
  flex: none;
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 2px #0009);
}
.good-head .item-icon {
  width: 26px;
  height: 26px;
  margin-right: -2px;
}
.good-head b {
  margin-right: auto;
}
.item-seal {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: var(--ui-font-display);
  font-style: normal;
  font-size: 15px;
  line-height: 1;
  color: #f7eddc;
  background: var(--seal, var(--ui-accent));
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #f7eddc 22%, transparent);
}
.item-seal.consumable {
  --seal: color-mix(in srgb, var(--ui-jade) 62%, #000);
}
.item-seal.armor {
  --seal: #4a5f78;
}
.item-seal.accessory {
  --seal: color-mix(in srgb, var(--ui-gold) 70%, #000);
}
.item-seal.material {
  --seal: #6e5a42;
}
.item-seal.keepsake {
  --seal: #6a4a78;
}
#menu-body,
#title-panel-body {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ui-gold) 55%, transparent) transparent;
}

/* Battle, in the theme: the turn bar, the two rosters, the orders, the timing button and what pops over the stage. */
#battle #turn-order {
  background: linear-gradient(90deg, transparent, var(--ui-glass) 14%, var(--ui-glass) 86%, transparent);
  border-block: 1px solid var(--ui-line-soft);
}
#battle #turn-order .round,
#battle .next-round {
  font-family: var(--ui-font-heading);
  color: var(--ui-gold);
}
#battle .chip {
  border-color: var(--ui-ally);
  background: radial-gradient(
    circle at 50% 35%,
    color-mix(in srgb, var(--ui-panel) 70%, #556),
    var(--ui-ink)
  );
}
#battle .chip.enemy {
  border-color: var(--ui-foe);
  background: radial-gradient(
    circle at 50% 35%,
    color-mix(in srgb, var(--ui-foe) 30%, var(--ui-panel)),
    var(--ui-ink)
  );
}
#battle .chip.now {
  border-color: var(--ui-gold);
  box-shadow: 0 0 12px color-mix(in srgb, var(--ui-gold) 45%, transparent);
}
#battle .chip-name {
  font-family: var(--ui-font-heading);
}
#battle .roster-title {
  font-family: var(--ui-font-heading);
  letter-spacing: 4px;
  color: var(--ui-foe);
}
#battle .card-head b,
#battle .command-head b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  letter-spacing: 1px;
}
#game #battle .foe {
  background: linear-gradient(100deg, color-mix(in srgb, var(--ui-foe) 16%, var(--ui-ink)), var(--ui-glass));
  border: 1px solid color-mix(in srgb, var(--ui-foe) 30%, transparent);
  border-left: 3px solid var(--ui-foe);
}
#game #battle .foe:hover:not(:disabled) {
  background: linear-gradient(100deg, color-mix(in srgb, var(--ui-foe) 28%, var(--ui-ink)), var(--ui-glass));
}
#game #battle .foe.selected {
  border-color: var(--ui-line);
  border-left-color: var(--ui-gold);
  background: linear-gradient(100deg, color-mix(in srgb, var(--ui-gold) 20%, var(--ui-ink)), var(--ui-glass));
}
#battle .ally {
  background: linear-gradient(100deg, var(--ui-glass), color-mix(in srgb, var(--ui-ink) 80%, transparent));
  border-left-color: color-mix(in srgb, var(--ui-ally) 45%, transparent);
}
#battle .ally.now {
  border-left-color: var(--ui-gold);
  background: linear-gradient(100deg, color-mix(in srgb, var(--ui-gold) 22%, var(--ui-ink)), var(--ui-glass));
}
#battle .ally-face {
  background: radial-gradient(
    circle at 50% 35%,
    color-mix(in srgb, var(--ui-panel) 70%, #556),
    var(--ui-ink)
  );
  border-color: var(--ui-line-soft);
}
#battle .hp {
  background: color-mix(in srgb, var(--ui-ink) 85%, #000);
}
#battle .hp i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-jade) 70%, #000), var(--ui-jade));
}
#battle .foe-hp i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-foe) 70%, #000), var(--ui-foe));
}
#battle .hp.low i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--ui-accent) 80%, #000), #e8a05e);
}
#battle .row-tag.front,
#battle .pointer,
#battle .skill-pip {
  color: var(--ui-gold);
}
#battle #combat-actions {
  background: var(--ui-glass);
  border: 1px solid var(--ui-line);
  box-shadow:
    inset 0 0 0 4px var(--ui-glass),
    inset 0 0 0 5px color-mix(in srgb, var(--ui-accent) 60%, transparent),
    0 16px 40px #0009;
}
#battle #combat-actions:empty,
#battle #combat-actions.result {
  background: none;
  border: 0;
  box-shadow: none;
}
#game #battle .command {
  background: color-mix(in srgb, var(--ui-panel) 82%, transparent);
  border: 1px solid var(--ui-line-soft);
}
#game #battle .command:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ui-accent) 45%, var(--ui-panel));
  border-color: var(--ui-gold);
}
#battle .command .numeral {
  font-family: var(--ui-font-display);
  font-weight: normal;
  color: var(--ui-gold);
}
#battle .command .label {
  font-family: var(--ui-font-heading);
}
/* An order's few words break between their parts, never inside one: Chinese and Japanese would break anywhere. */
#battle .command .note .part,
#battle .command .note.part {
  white-space: nowrap;
}
:root:lang(en) #battle .command .note .part,
:root:lang(en) #battle .command .note.part {
  white-space: normal;
}
#game #battle .command.skill {
  border-color: var(--ui-line);
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--ui-gold) 14%, var(--ui-panel)),
    var(--ui-panel)
  );
}
#game #battle .judge-button {
  font-family: var(--ui-font-heading);
  background: var(--ui-glass-2);
  border-color: var(--ui-line);
}
#game #battle .reaction {
  background: color-mix(in srgb, var(--ui-gold) 30%, var(--ui-panel)) !important;
  border-color: #f6efdd !important;
}
#game #battle .reaction.perfect {
  background: color-mix(in srgb, var(--ui-accent) 80%, var(--ui-gold)) !important;
  border-color: var(--ui-gold) !important;
}
#game #combat-actions .primary {
  font-family: var(--ui-font-heading);
  font-size: 18px;
  letter-spacing: 4px;
  background: color-mix(in srgb, var(--ui-accent) 70%, var(--ui-panel));
  border-color: var(--ui-gold);
}
#battle-banner .side,
#battle-banner .stripe {
  background: linear-gradient(90deg, transparent, var(--ui-glass) 20%, var(--ui-glass) 80%, transparent);
  border-color: var(--ui-line-soft);
}
#battle-banner .side b,
#battle-banner .stripe b,
#battle-banner .versus {
  font-family: var(--ui-font-display);
  font-weight: normal;
}
#battle-banner small {
  font-family: var(--ui-font-heading);
}
#game #combat-actions .spoils {
  display: block;
  margin-bottom: 10px;
  font-family: var(--ui-font-heading);
  font-size: 17px;
  letter-spacing: 3px;
  color: var(--ui-gold);
  text-align: center;
  text-shadow: 0 2px 8px #000;
}
.float-label.alert-marker.jump {
  color: #8ff0cf;
  font-family: var(--ui-font-display);
}
.float-label.alert-marker.dodge {
  color: #ff7a5c;
  font-family: var(--ui-font-display);
}
#game #battle .judge-button.jump {
  border-color: #8ff0cf;
}
#game #battle .judge-button.dodge {
  border-color: #ff7a5c;
}
.float-label.alert-marker.parry {
  color: #ffc94a;
  font-family: var(--ui-font-display);
}
#game #battle .judge-button.parry {
  border-color: #ffc94a;
}
/* Two ways to meet a blow, side by side: the parry (gold, lit only in its last ticks) and the dodge. */
#combat-actions .judge-pair {
  display: flex;
  justify-content: center;
  gap: 10px;
}
#game #battle .judge-button.parry-choice {
  border-color: color-mix(in srgb, #ffc94a 70%, var(--ui-line));
}
#game #battle .judge-button.dodge-choice {
  border-color: color-mix(in srgb, #9cc6d8 60%, var(--ui-line));
}
#combat-actions.timing.two .judge-button {
  min-width: 200px;
}
/* Three ways side by side: the guard (widest, a share comes through), the dodge, the parry. */
#game #battle .judge-button.guard-choice {
  border-color: color-mix(in srgb, #b9c2b0 60%, var(--ui-line));
}
#combat-actions.timing.three .judge-button {
  min-width: 150px;
}
#game #battle .command.finish {
  border-color: var(--ui-gold);
  background: color-mix(in srgb, var(--ui-accent) 55%, var(--ui-panel));
  animation: finish-ready 0.9s ease-in-out infinite alternate;
}
@keyframes finish-ready {
  to {
    box-shadow: 0 0 18px color-mix(in srgb, var(--ui-gold) 70%, transparent);
  }
}
#battle-banner.intro .stripe {
  padding-block: 18px;
}
#battle-banner.intro .stripe b {
  font-size: 52px;
  letter-spacing: 14px;
}
#battle .command-list.items {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
#game #battle .command-list.items .command {
  min-width: 0;
  padding: 6px 26px 6px 10px;
}
#battle .command-list.items .label {
  letter-spacing: 2px;
  white-space: nowrap;
}
#battle .command-list.items small {
  grid-column: 1 / -1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#battle #enemy-list.crowded .stance {
  display: none;
}
/* Still meeting the party's cards: the foes' cards keep only name and health (the selected one keeps what comes next). */
#battle #enemy-list.packed {
  gap: 3px;
}
#game #battle #enemy-list.packed .foe {
  gap: 2px;
  padding-top: 3px;
  padding-bottom: 3px;
}
#battle #enemy-list.packed .foe:not(.selected) .next-move,
#battle #enemy-list.packed .hp-num {
  display: none;
}
#combat-actions.timing.hushed {
  visibility: hidden;
}
.float-label.judge.finish-word {
  font-family: var(--ui-font-display);
  font-size: 92px;
  color: #fff;
  transform: translate(-50%, calc(-50% - var(--rise, 0px))) scale(var(--pop, 1));
  transform-origin: 50% 50%;
  text-shadow:
    0 0 2px #000,
    0 4px 18px #000,
    0 0 42px color-mix(in srgb, var(--ui-accent) 80%, transparent);
}
#battle .next-move {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ui-muted, #c9bda6);
}
#battle .next-move.winding {
  color: #ff7a5c;
}
/* What is new in a fight, through its first round: a line over the orders, not a panel of its own. */
#combat-actions .panel-hint {
  margin: 0 0 2px;
  max-width: min(620px, calc(70 * var(--vw)));
  justify-self: center;
  font-family: var(--ui-font-heading);
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--ui-gold);
  text-align: center;
  pointer-events: none;
}
/* A skill's name rides over its caller's head as a short plate, not a band across the screen. */
.float-label.skill-plate {
  padding: 3px 14px 4px;
  font-family: var(--ui-font-display);
  font-size: 26px;
  letter-spacing: 6px;
  white-space: nowrap;
  color: #fff3d0;
  background: linear-gradient(180deg, #2b2116f2, #120f0cf2);
  border: 1px solid #e3c07d99;
  box-shadow: 0 4px 14px #000a;
  transform: translate(-50%, calc(-100% - var(--rise, 0px)));
  transform-origin: 50% 100%;
}
.float-label.skill-plate.finish {
  font-size: 34px;
  border-color: color-mix(in srgb, var(--ui-accent) 70%, #e3c07d);
}
/* A fight keeps to what it needs: the seal, the travelling buttons and the key strip go (Esc still opens the menu). */
#game[data-moment='battle'] .brand,
#game[data-moment='battle'] .top-actions button:not(#pause),
#game[data-moment='battle'] footer {
  opacity: 0;
  pointer-events: none;
}
#battle .stance .gauge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
}
#battle .stance .gauge small {
  margin-right: 3px;
  color: var(--ui-accent);
  font-family: var(--ui-font-heading);
}
#battle .stance .gauge b {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 80%, #fff);
}
#battle .stance .gauge b.full {
  background: var(--ui-accent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--ui-accent) 70%, transparent);
}
#battle .stance .gauge.full b.full {
  background: #ff6a3d;
}
.float-label.judge.gauge-spent {
  font-size: 30px;
  color: #ff9a6b;
}
#battle img.painted {
  object-fit: cover;
  object-position: 50% 22%;
  image-rendering: pixelated;
}
#impact-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    60% 60% at 50% 50%,
    #fff8e6,
    color-mix(in srgb, var(--ui-gold) 40%, transparent) 60%,
    transparent
  );
  mix-blend-mode: screen;
}
#world-labels .float-label {
  font-family: var(--ui-font-heading);
  letter-spacing: 1px;
  background: var(--ui-glass);
  border-color: var(--ui-line-soft);
}
#world-labels .float-label.damage,
#world-labels .float-label.judge,
#world-labels .float-label.target-marker,
#world-labels .float-label.alert-marker,
#world-labels .float-label.intent-marker {
  background: none;
  border: 0;
  padding: 0;
}
.float-label.intent-marker {
  background: none;
  font-family: var(--ui-font-heading);
  font-size: 18px;
  color: #ffb7a4;
  transform: translate(-50%, calc(-100% + var(--bob, 0px)));
  text-shadow:
    0 0 2px #000,
    0 2px 8px #000;
}
/* What pops over the stage: numbers in the heading face, judgments written large in the display face. */
.float-label.damage {
  font-family: var(--ui-font-heading);
  font-weight: normal;
}
.float-label.judge {
  font-family: var(--ui-font-display);
  font-weight: normal;
  letter-spacing: 2px;
}
.float-label.judge.perfect {
  font-size: 40px;
  color: #ffe6a0;
  text-shadow:
    0 0 2px #000,
    0 3px 10px #000,
    0 0 24px color-mix(in srgb, var(--ui-gold) 80%, transparent);
}
.float-label.judge.break {
  font-size: 42px;
  color: #ff8a50;
}

/* 札记 */
.journal-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.journal-chapter {
  font-family: var(--ui-font-heading);
  font-size: 14px;
  letter-spacing: 4px;
  color: #f8eedb;
  background: var(--ui-accent);
  padding: 3px 10px;
  border-radius: 2px;
}
.journal-place {
  font-family: var(--ui-font-display);
  font-weight: normal;
  font-size: 30px;
  letter-spacing: 8px;
}
.journal-note {
  padding: 14px 18px;
  color: var(--ui-ink-text);
  background: var(--ui-paper);
  border-left: 3px solid var(--ui-accent);
}
.journal-note small {
  font-family: var(--ui-font-heading);
  letter-spacing: 4px;
  color: var(--ui-accent);
}
.journal-note p {
  margin: 6px 0 0;
  font-size: 17px;
  line-height: 1.7;
}
.journal-facts {
  display: grid;
  grid-template-columns: 5em 1fr;
  gap: 10px 14px;
  margin: 4px 0 0;
  font-size: 15px;
}
.journal-facts dt {
  font-family: var(--ui-font-heading);
  letter-spacing: 3px;
  color: var(--ui-gold);
}
.journal-facts dd {
  margin: 0;
}

/* 回看 */
.log-lines {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 16px;
  line-height: 1.7;
}
.log-lines li {
  display: grid;
  grid-template-columns: 6em 1fr;
  gap: 12px;
}
.log-lines b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  color: var(--ui-gold);
  text-align: right;
}
.log-lines li.narration span {
  grid-column: 2;
  color: var(--ui-dim);
}

/* 存档 */
.save-slot {
  display: grid;
  grid-template-columns: 3.2em 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--ui-panel) 75%, transparent);
  border: 1px solid var(--ui-line-soft);
}
.save-slot.empty {
  opacity: 0.7;
}
.save-name {
  display: grid;
  place-items: center;
  width: 2.2em;
  height: 2.2em;
  font-family: var(--ui-font-display);
  font-size: 20px;
  color: #f8eedb;
  background: var(--ui-accent);
  border-radius: 2px;
}
.save-slot.earlier .save-name {
  background: color-mix(in srgb, var(--ui-accent) 50%, var(--ui-panel));
}
.save-about {
  display: grid;
  gap: 4px;
}
.save-about b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  font-size: 17px;
  letter-spacing: 2px;
}
.save-about small {
  color: var(--ui-dim);
  font-size: 12px;
}
.save-actions {
  display: flex;
  gap: 8px;
}
#game .save-actions button {
  padding: 6px 16px;
}
.save-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ui-dim);
}

/* 设置 */
.setting {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui-line-soft);
}
.setting-name {
  display: grid;
  gap: 3px;
}
.setting-name b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  font-size: 17px;
  letter-spacing: 3px;
}
.setting-name small {
  font-size: 12px;
  color: var(--ui-dim);
}
.choices-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
#game .choices-row button {
  padding: 6px 14px;
  font-size: 14px;
}
#game .choices-row button.on {
  color: #fff6e4;
  background: color-mix(in srgb, var(--ui-accent) 80%, var(--ui-panel));
  border-color: var(--ui-line);
}
.volume {
  display: flex;
  align-items: center;
  gap: 10px;
}
#game .volume button {
  width: 32px;
  padding: 4px 0;
}
.pips {
  display: flex;
  gap: 3px;
}
.pips i {
  width: 10px;
  height: 16px;
  background: color-mix(in srgb, var(--ui-dim) 25%, transparent);
  transform: skewX(-12deg);
}
.pips i.lit {
  background: linear-gradient(var(--ui-gold), color-mix(in srgb, var(--ui-gold) 60%, var(--ui-accent)));
}
/* The latency setting: the value between − and +, a measuring button; measuring, a dot flashing on the beat. */
.latency-value {
  min-width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#game .volume.latency button:last-child {
  width: auto;
  padding: 4px 12px;
}
#game .latency-pad {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  padding: 8px 14px;
}
.latency-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ui-dim) 30%, transparent);
}
.latency-dot.lit {
  background: var(--ui-gold);
  box-shadow: 0 0 12px var(--ui-gold);
}

/* 制作名单 */
.credits {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 10px 0;
  font-size: 16px;
  letter-spacing: 2px;
}
.credits p {
  margin: 0;
}
.credits p.gap {
  height: 12px;
}

@media (max-width: 760px), (max-height: 500px) {
  header {
    padding: 12px 14px;
    gap: 10px;
  }
  .brand {
    width: 30px;
    height: 30px;
    font-size: 19px;
  }
  #location {
    font-size: 12px;
    padding-left: 10px;
    letter-spacing: 1px;
  }
  .top-actions {
    gap: 4px;
  }
  #game .top-actions button {
    padding: 6px;
    font-size: 12px;
    letter-spacing: 0;
  }
  #quest {
    left: 14px;
    top: 60px;
    width: 190px;
    padding: 7px 10px;
  }
  #minimap {
    top: 60px;
    right: 14px;
    width: 116px;
    height: 86px;
  }
  #quest p {
    font-size: 12px;
  }
  #party {
    left: 14px;
    bottom: 60px;
  }
  .member {
    grid-template-columns: 58px 70px;
    padding: 5px 8px;
    gap: 6px;
  }
  #dialogue {
    bottom: 58px;
    padding: 22px 20px 18px;
    width: calc(100% - 24px);
  }
  #speech {
    font-size: 16px;
  }
  #place-card {
    padding: 18px 40px;
  }
  #place-card .name {
    font-size: 34px;
  }
  #chapter-name {
    font-size: 54px;
    letter-spacing: 16px;
    margin-right: -16px;
  }
  #controls,
  #battle-controls {
    display: none;
  }
  footer {
    padding: 12px 14px;
  }
  #menu {
    padding: 0 14px 12px;
  }
  #menu-tabs {
    margin: -1px -14px 0;
    padding: 8px 6px 0;
    gap: 0;
  }
  #game #menu-tabs .tab {
    min-width: 0;
    padding: 7px 8px;
    font-size: 14px;
    letter-spacing: 1px;
  }
  .setting {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .choices-row {
    justify-content: flex-start;
  }
  #title-menu {
    margin-top: 28px;
  }
}
/* A phone held sideways: little height, so everything keeps to the corners. */
@media (max-height: 500px) {
  header {
    padding: 6px 14px;
  }
  #combat-actions .panel-hint {
    font-size: 12px;
    letter-spacing: 0;
  }
  .float-label.skill-plate {
    font-size: 18px;
    letter-spacing: 3px;
  }
  #battle .command-list.items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #game #battle .command-list.items .command {
    padding: 4px 8px;
  }
  #quest {
    top: 46px;
    width: 210px;
    padding: 5px 9px;
  }
  #quest small {
    display: none;
  }
  #quest p {
    margin: 0;
    line-height: 1.5;
  }
  #minimap {
    top: 46px;
  }
  #party {
    bottom: 8px;
    gap: 2px;
  }
  .member {
    padding: 2px 8px;
  }
  .member .lv,
  .member small {
    display: none;
  }
  #tip {
    display: none;
  }
  footer {
    padding: 8px 14px;
  }
  #dialogue {
    bottom: 6px;
    min-height: 84px;
    padding: 10px 16px;
    width: min(640px, calc(100% - 24px));
  }
  #speech {
    font-size: 15px;
  }
  #choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    margin-top: 6px;
  }
  #dialogue.with-portrait {
    padding-left: 92px;
  }
  #dialogue.with-portrait #speaker {
    left: 92px;
  }
  #dialogue #portrait:not([hidden]) {
    left: 12px;
    top: 10px;
    width: 64px;
    height: 64px;
  }
  #place-card {
    top: 8%;
    padding: 8px 30px;
  }
  #place-card .name {
    font-size: 28px;
  }
  #menu {
    height: calc(94 * var(--vh));
    padding-bottom: 6px;
  }
  #menu-body {
    padding: 8px 4px 6px;
    gap: 6px;
  }
  .cover-content {
    margin-top: 0;
  }
  #game-title {
    margin: 0 0 4px;
    font-size: 40px;
  }
  #subtitle {
    font-size: 13px;
    letter-spacing: 3px;
  }
  #title-menu {
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    margin-top: 14px;
    min-width: min(460px, calc(86 * var(--vw)));
  }
  #game #title-menu button {
    padding: 7px 10px;
    font-size: 15px;
    letter-spacing: 3px;
  }
  #title-panel {
    max-height: calc(94 * var(--vh));
    padding: 12px 18px 10px;
    gap: 8px;
  }
  #game #shop {
    padding: 12px 18px;
    gap: 8px;
    max-height: calc(94 * var(--vh));
    overflow: auto;
  }
  .menu-foot {
    justify-content: flex-end;
    padding-top: 2px;
  }
  .menu-foot span {
    display: none;
  }
  #game #menu-close {
    top: 6px;
    right: 8px;
    width: 26px;
    height: 26px;
  }
}
/* A phone is played sideways. */
#turn-phone {
  display: none;
}
@media (orientation: portrait) and (max-width: 760px) and (pointer: coarse) {
  #turn-phone {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-content: center;
    gap: 14px;
    justify-items: center;
    color: #f8efdc;
    background: #14100c;
    font-family: var(--ui-font-heading, serif);
    letter-spacing: 4px;
  }
  #turn-phone i {
    width: 44px;
    height: 76px;
    border: 3px solid #d8c08a;
    border-radius: 8px;
    transform: rotate(90deg);
    margin: 16px 0;
  }
}

/* The shop: what is on sale, each thing against what the party wears now. */
#game #shop {
  width: min(880px, calc(94 * var(--vw)));
  min-width: 0;
  max-height: calc(88 * var(--vh));
  padding: 18px 22px;
  gap: 10px;
  background: radial-gradient(130% 150% at 50% 0%, var(--ui-glass-2), var(--ui-glass) 70%), var(--ui-glass);
  border-color: var(--ui-line);
  box-shadow:
    inset 0 0 0 4px var(--ui-glass),
    inset 0 0 0 5px color-mix(in srgb, var(--ui-accent) 62%, transparent),
    0 16px 46px #0009;
}
#game #shop h2 {
  font-family: var(--ui-font-display);
}
#game #gold {
  color: var(--ui-gold);
}
#game #shop-ask {
  background: var(--ui-glass);
  border-color: var(--ui-line-soft);
}
#game .good-head .price {
  color: var(--ui-gold);
}
/* Only the shop while one is open. */
#game[data-moment='shop'] header,
#game[data-moment='shop'] footer,
#game[data-moment='shop'] #quest,
#game[data-moment='shop'] #party,
#game[data-moment='shop'] #banter {
  opacity: 0;
  pointer-events: none;
}
/* A fight decided: the banner and what was won; what the fight needed goes. */
#game[data-battle-over] #battle-controls,
#game[data-battle-over] #turn-order,
#game[data-battle-over] #enemy-list {
  opacity: 0;
  pointer-events: none;
}
#game #combat-actions .spoils {
  padding: 5px 18px;
  font-size: 14px;
  color: var(--ui-gold);
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--ui-ink) 82%, transparent) 18% 82%,
    transparent
  );
}
#game #minigame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  width: min(560px, calc(92 * var(--vw)));
  max-height: calc(92 * var(--vh));
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--ui-ink) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--ui-accent, #d8b46a) 60%, transparent);
  border-radius: 6px;
  user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}
#game #minigame[hidden] {
  display: none;
}
#mini-head {
  display: flex;
  width: 100%;
  align-items: baseline;
  gap: 14px;
}
#minigame #mini-name {
  margin: 0;
  flex: 1;
  font-size: 20px;
}
#mini-picture {
  height: min(calc(30 * var(--vh)), 200px);
  image-rendering: pixelated;
}
#mini-picture[hidden] {
  display: none;
}
#minigame #mini-marks {
  margin: 0;
  min-height: 1.3em;
  letter-spacing: 4px;
  color: #e9c867;
}
#minigame #mini-note {
  margin: 0;
  min-height: 1.3em;
  text-align: center;
}
#minigame #mini-hint {
  margin: 0;
  font-size: 13px;
  opacity: 0.7;
}
/* A small game has the screen: the world dims round its panel and what goes with walking about steps back. */
#game[data-moment='minigame'] header,
#game[data-moment='minigame'] footer,
#game[data-moment='minigame'] #quest,
#game[data-moment='minigame'] #party,
#game[data-moment='minigame'] #banter,
#game[data-moment='minigame'] #minimap {
  opacity: 0;
  pointer-events: none;
}
#game[data-moment='minigame'] #minigame {
  box-shadow:
    0 0 0 100vmax color-mix(in srgb, #0b0806 48%, transparent),
    0 18px 60px #000a;
}
/* The game's own things on the screen (its page side's widgets), in the corners the HUD leaves free, while walking about. */
#widgets > div {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
#widgets [data-corner='top-left'] {
  left: 26px;
  top: 150px;
}
#widgets [data-corner='top-right'] {
  right: 26px;
  top: 230px;
  align-items: flex-end;
}
#widgets [data-corner='bottom-left'] {
  left: 26px;
  bottom: 190px;
}
#widgets [data-corner='bottom-right'] {
  right: 26px;
  bottom: 70px;
  align-items: flex-end;
}
#game:not([data-moment='world']) #widgets,
#game[data-menu] #widgets,
#widgets .widget[hidden] {
  display: none;
}
/* The picture is the stage: what a kind of small game draws over it goes here (the game's own code/view.ts). */
#mini-stage {
  position: relative;
  line-height: 0;
}
#mini-stage.bare {
  display: none;
}
#mini-pop {
  position: absolute;
  pointer-events: none;
}
/* Below the picture, what a kind of small game draws there (a meter, the water): nothing when it draws none. */
#mini-strip {
  width: 100%;
}
#mini-strip:empty {
  display: none;
}
/* The word of a try, over the picture, coloured by how it went. */
#mini-pop {
  left: 50%;
  top: 6%;
  translate: -50% 0;
  white-space: nowrap;
  line-height: 1.2;
  font-family: var(--ui-font-display);
  font-size: 26px;
  font-weight: normal;
  letter-spacing: 4px;
  color: #f6efdd;
  text-shadow:
    0 2px 0 #000,
    0 0 12px #000c;
  opacity: 0;
}
#mini-pop.pop {
  animation: mini-pop 1.3s ease-out forwards;
}
#mini-pop.perfect {
  color: var(--ui-gold);
}
#mini-pop.miss {
  color: #b9b1a3;
}
@keyframes mini-pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  14% {
    opacity: 1;
    transform: scale(1.15);
  }
  26% {
    transform: scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@media (max-height: 500px) {
  #mini-picture {
    height: calc(22 * var(--vh));
  }
  #game #minigame {
    padding: 8px 14px;
    gap: 3px;
  }
}
#shop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
#shop #shop-head h2 {
  margin: 0;
}
#gold {
  margin: 0;
}
#shop-tabs {
  display: flex;
  gap: 6px;
}
#shop-tabs[hidden] {
  display: none;
}
#shop-tabs .tab {
  min-width: 64px;
  padding: 4px 12px;
}
#shop-tabs .tab.open {
  border-color: #dbc68c;
  color: #f4ecd8;
}
#shop-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #bb9a5e66;
  background: #0d181c;
}
#shop-ask[hidden] {
  display: none;
}
#shop-ask b {
  font-weight: 400;
  margin-right: 6px;
}
#shop-ask button small {
  margin-left: 6px;
  font-size: 12px;
}
#shop-items {
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 8px;
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
}
#shop-items .empty {
  grid-column: 1 / -1;
  margin: 12px 0;
  color: #c8cebc;
}
#shop-items button.good {
  padding: 7px 10px;
}
.good-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.good-head b {
  font-weight: 400;
}
.good-head .price {
  color: #dbc68c;
  white-space: nowrap;
}
#shop-items button:disabled .price {
  color: #a0604f;
}
.compare {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 3px;
  font-size: 12px;
}
.change.better {
  color: #a7d68f;
}
.change.worse {
  color: #dd9180;
}
.change.mixed {
  color: #e4cf8e;
}
.change.same {
  color: #99a093;
}
#menu-body .bag-item .actions button small {
  display: block;
  font-size: 12px;
}
.bag-group {
  grid-column: 1 / -1;
  margin: 8px 0 2px;
  font-weight: 400;
  color: #dbc68c;
  letter-spacing: 2px;
}
#shop-close kbd {
  margin-left: 6px;
  font-size: 12px;
}
/* Someone has gone up a level. */
#level-up {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 26px;
  text-align: center;
  background: var(--ui-glass);
  border: 1px solid var(--ui-line);
  box-shadow: 0 10px 40px #0007;
  pointer-events: none;
  animation: level-up 2.6s ease both;
  z-index: 30;
}
#level-up[hidden] {
  display: none;
}
#level-up b {
  display: block;
  font-family: var(--ui-font-heading);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 4px;
  color: #f0ddb1;
}
#level-up small {
  display: block;
  margin-top: 3px;
  color: #c8cebc;
  font-size: 12px;
}
@keyframes level-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  12%,
  82% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -4px);
  }
}
.bag-pages {
  display: flex;
  gap: 6px;
  margin: 12px 0 8px;
}
.bag-pages .tab {
  padding: 4px 14px;
}
.bag-pages .tab.open {
  border-color: #dbc68c;
  color: #f4ecd8;
}

/* The lineup (阵容): formations to choose among, the places in order, and a small map of them. */
#menu-body .lineup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(150px, 0.75fr);
  gap: 12px;
  align-items: start;
}
#menu-body .lineup-formations {
  display: grid;
  gap: 6px;
}
#menu-body .lineup .formation {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--ui-panel) 70%, transparent);
  border: 1px solid var(--ui-line-soft);
}
#menu-body .lineup .formation b {
  font-family: var(--ui-font-heading);
  font-weight: normal;
  font-size: 15px;
}
#menu-body .lineup .formation small {
  color: var(--ui-dim);
  font-size: 12px;
}
#menu-body .lineup .formation.open {
  border-color: var(--ui-gold);
  box-shadow: inset 3px 0 0 var(--ui-gold);
}
#menu-body .lineup .formation:disabled {
  opacity: 0.55;
}
#menu-body .lineup .formation .formation-how {
  color: var(--ui-gold);
}
#menu-body .lineup-places {
  display: grid;
  gap: 6px;
}
#menu-body .lineup-place {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: color-mix(in srgb, var(--ui-panel) 75%, transparent);
  border-left: 3px solid var(--ui-line-soft);
}
#menu-body .lineup-place b {
  white-space: nowrap;
  font-family: var(--ui-font-heading);
  font-weight: normal;
  font-size: 15px;
}
#menu-body .lineup-place .place-number {
  min-width: 1.2em;
  color: var(--ui-gold);
}
#menu-body .lineup-place .rank {
  font-size: 12px;
  padding: 0 6px;
  border: 1px solid var(--ui-line-soft);
}
#menu-body .lineup-place .rank.front {
  color: var(--ui-foe);
  border-color: color-mix(in srgb, var(--ui-foe) 60%, transparent);
}
#menu-body .lineup-place .rank.back {
  color: var(--ui-jade);
  border-color: color-mix(in srgb, var(--ui-jade) 60%, transparent);
}
#menu-body .lineup-place .actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
#menu-body .lineup-place .actions button {
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}
#menu-body .lineup-place.waiting {
  border-left-color: transparent;
  opacity: 0.85;
}
#menu-body .lineup-along {
  margin: 4px 0 0;
  color: var(--ui-dim);
  font-size: 12px;
}
#menu-body .lineup-map {
  margin: 0;
}
#menu-body .lineup-field {
  position: relative;
  aspect-ratio: 4 / 3;
  background: color-mix(in srgb, var(--ui-ink) 60%, transparent);
  border: 1px solid var(--ui-line-soft);
}
#menu-body .lineup-mark {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
#menu-body .lineup-mark i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ui-jade);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ui-ink) 70%, transparent);
}
#menu-body .lineup-mark.front i {
  background: var(--ui-foe);
}
#menu-body .lineup-mark small {
  font-size: 11px;
  color: var(--ui-text);
}
#menu-body .lineup-foe {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--ui-font-heading);
  color: var(--ui-foe);
  opacity: 0.8;
}
@media (max-width: 900px) {
  #menu-body .lineup {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  #menu-body .lineup-map {
    display: none;
  }
}
#party .meal {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: #e4cf8e;
}
.needs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 3px;
  font-size: 12px;
  color: #dbc68c;
}
.needs .short {
  color: #dd9180;
}
/* What cannot be had yet can still be read: what it would take is the point. */
#shop-items button.good:disabled {
  opacity: 0.74;
}

/*
 * A system with no font for the game's language: the game's fallback, for everything (see src/browser/ui/fonts.ts).
 * A game with typefaces of its own (own-faces) already writes its words in them; only what lies outside it falls back.
 */
.no-cjk:not(.own-faces),
.no-cjk:not(.own-faces) *,
.no-cjk.own-faces #turn-phone {
  font-family: 'Han Fallback', sans-serif !important;
}

/* In English the system's own letters will do; the fallback is only for the few words kept in their own script. */
:root:lang(en).no-cjk:not(.own-faces),
:root:lang(en).no-cjk:not(.own-faces) * {
  font-family: Georgia, 'DejaVu Serif', 'Liberation Serif', serif, 'Han Fallback' !important;
}

/*
 * Other languages. This page was tuned for Chinese: wide letter spacing, square characters,
 * short labels. Family names come from each system, and the last resort is plain serif.
 */
:root:lang(en) #game {
  --ui-font-display:
    'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif !important;
  --ui-font-heading:
    'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif !important;
  --ui-font-body: Georgia, 'Times New Roman', serif !important;
}
:root:lang(en) #game,
:root:lang(en) #game * {
  letter-spacing: normal !important;
  word-break: normal;
  overflow-wrap: break-word;
}
:root:lang(en) #game-title {
  margin-right: 0;
  font-size: clamp(30px, 4.6vw, 66px);
  letter-spacing: 0.03em !important;
  white-space: nowrap;
}
:root:lang(ja) #game {
  --ui-font-display:
    'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif CJK JP', 'Noto Serif JP', serif !important;
  --ui-font-heading:
    'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif CJK JP', 'Noto Serif JP', serif !important;
  --ui-font-body: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif CJK JP', 'Noto Serif JP', serif !important;
  line-break: strict;
}
:root:lang(ja) #game-title {
  font-size: clamp(48px, 7vw, 100px);
}

/* What gear goes where, in words that run longer. */
#menu-body .bag-slot .slot {
  width: auto;
  min-width: 2.6em;
  margin-right: 6px;
  white-space: nowrap;
}

/* The fighters' cards, in words that run longer: room for one line of gauges, and a long name gives way to what comes after it. */
#battle .stance small {
  white-space: nowrap;
}
#battle .card-head b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 761px) and (min-height: 501px) {
  :root:lang(en) #battle-party,
  :root:lang(ja) #battle-party {
    width: 296px;
  }
  :root:lang(ja) #battle .stance small {
    letter-spacing: 0;
    margin-right: 2px;
  }
}

/* The title on a window with room: the name written down the left side as a title is on a scroll, the choices
   beside its foot, and the scene itself clear on the right. (A phone keeps the column in the middle.) */
@media (min-width: 761px) and (min-height: 501px) {
  #cover {
    place-items: stretch;
  }
  #cover.live {
    background:
      linear-gradient(
        90deg,
        color-mix(in srgb, var(--ui-ink) 90%, transparent),
        color-mix(in srgb, var(--ui-ink) 62%, transparent) 26%,
        transparent 50%
      ),
      linear-gradient(transparent 74%, color-mix(in srgb, var(--ui-ink) 50%, transparent));
  }
  .cover-content {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: calc(2.4 * var(--vw));
    justify-items: start;
    align-self: stretch;
    width: auto;
    height: calc(100 * var(--vh));
    margin: 0;
    padding: calc(9 * var(--vh)) calc(4 * var(--vw)) calc(9 * var(--vh)) calc(7 * var(--vw));
    text-align: left;
  }
  #game-title {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    writing-mode: vertical-rl;
    margin: 0;
    font-size: clamp(72px, calc(15.5 * var(--vh)), 170px);
    letter-spacing: 0.08em;
  }
  .eyebrow {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    writing-mode: vertical-rl;
    margin: 0.4em 0 0;
    letter-spacing: 6px;
  }
  #subtitle {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    writing-mode: vertical-rl;
    margin: 0.4em 0 0;
    letter-spacing: 8px;
  }
  #loading {
    grid-column: 2 / -1;
    grid-row: 2;
    align-self: end;
    justify-items: start;
    margin: 0;
  }
  /* While the title's scene comes, how far it has come and a tip stand where it will come up: low on the right. */
  #cover.named #loading {
    position: fixed;
    right: calc(5 * var(--vw));
    bottom: calc(9 * var(--vh));
    justify-items: end;
  }
  #cover.named #loading-tip {
    position: fixed;
    right: calc(5 * var(--vw));
    bottom: calc(9 * var(--vh) + 72px);
    margin: 0;
  }
  #title-menu {
    grid-column: 2 / -1;
    grid-row: 2;
    align-self: end;
    gap: 2px;
    margin: 0;
    width: min(250px, calc(28 * var(--vw)));
  }
  #game #title-menu button {
    padding: 9px 20px 9px 30px;
    text-align: left;
    background: none;
    border-image: linear-gradient(90deg, var(--ui-line), transparent) 1;
    border-width: 0 0 1px;
    border-style: solid;
    text-shadow: 0 1px 6px #000;
  }
  #game #title-menu button:hover,
  #game #title-menu button:focus-visible {
    background: linear-gradient(90deg, color-mix(in srgb, var(--ui-accent) 78%, transparent), transparent);
  }
  /* A title in letters runs across, with what goes with it above and below. */
  :root:lang(en) .cover-content {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }
  :root:lang(en) #game-title {
    grid-column: 1;
    grid-row: 2;
    writing-mode: horizontal-tb;
    margin: 10px 0 8px;
    font-size: clamp(30px, 4.4vw, 62px);
  }
  :root:lang(en) .eyebrow {
    grid-column: 1;
    grid-row: 1;
    writing-mode: horizontal-tb;
    margin: 0;
  }
  :root:lang(en) #subtitle {
    grid-column: 1;
    grid-row: 3;
    writing-mode: horizontal-tb;
    margin: 0;
  }
  :root:lang(en) #loading,
  :root:lang(en) #title-menu {
    grid-column: 1;
    grid-row: 4;
  }
  :root:lang(ja) #game-title {
    font-size: clamp(64px, calc(13 * var(--vh)), 140px);
  }
  /* Its line runs longer; it has to stop short of the choices. */
  :root:lang(ja) #subtitle {
    font-size: 14px;
    letter-spacing: 2px !important;
  }
}

/* How big the player wants it: everything drawn over the picture, and the box the story is read in on top of that.
   (Zoom scales the window's own units as well: a box kept to a part of the window asks for it through these.) */
:root {
  --vh: 1vh;
  --vw: 1vw;
}
#game {
  --vh: calc(1vh / var(--ui-size, 1));
  --vw: calc(1vw / var(--ui-size, 1));
}
#game > :not(#stage, .vignette, #impact-flash, #world-labels, #dialogue, #picture) {
  zoom: var(--ui-size, 1);
}
#game > #dialogue {
  zoom: calc(var(--ui-size, 1) * var(--text-size, 1));
}

/* Who E would talk to or what it would use: a mark over them, the words once, in the prompt below. */
#world-labels .float-label.nearby-mark {
  width: 0;
  height: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  border: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--ui-gold);
  filter: drop-shadow(0 1px 1px #000c);
}
/* At night the slip and the map draw back into the dark, so that the lamps are the brightest there. */
#game[data-dark] #quest:not(.settled),
#game[data-dark] #minimap,
#game[data-dark] #place-card {
  filter: brightness(0.58) saturate(0.85);
}
#game[data-dark] #quest.settled,
#game[data-dark] .member {
  filter: brightness(0.85);
}
/* A fighter with stances (架势): the one it takes with this order, Q for the next. */
#game #battle .stance-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 2px 10px;
  font-family: var(--ui-font-heading);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--ui-gold);
  background: color-mix(in srgb, var(--ui-accent) 30%, transparent);
  border: 1px solid var(--ui-line);
}
#game #battle .stance-pick kbd {
  font-size: 12px;
}
/* After a fight: how the party fought, under the spoils. */
#game #combat-actions .fight-tally {
  display: block;
  margin-bottom: 8px;
  font-family: var(--ui-font-heading);
  font-size: 13px;
  letter-spacing: 2px;
  color: color-mix(in srgb, var(--ui-text) 80%, var(--ui-gold));
  text-align: center;
  text-shadow: 0 2px 6px #000;
}
/* A press judged: the button says how it went, bright (not as a button one cannot press). */
#game #battle .judge-button.judged:disabled {
  opacity: 1;
  color: #fff6e0;
  border-color: var(--ui-line);
  background: color-mix(in srgb, var(--ui-panel) 80%, transparent);
}
#game #battle .judge-button.judged.perfect:disabled {
  color: #fff3c4;
  border-color: var(--ui-gold);
  background: color-mix(in srgb, var(--ui-accent) 75%, var(--ui-gold));
  box-shadow: 0 0 18px color-mix(in srgb, var(--ui-gold) 60%, transparent);
}
#game #battle .judge-button.judged.good:disabled {
  border-color: #cfe3ec;
  background: color-mix(in srgb, #3c5a66 70%, var(--ui-panel));
}
#game #battle .judge-button.judged.miss:disabled {
  color: #f1c2b8;
  border-color: #b5524a;
  background: color-mix(in srgb, #5a2622 70%, var(--ui-panel));
}

/* Short marks painted at live controls. They stay outside the control's layout and focus order. */
.game-effect-mark {
  position: fixed;
  pointer-events: none;
  z-index: 75;
  box-sizing: border-box;
}
.game-effect-mark.fx-underline {
  background: currentColor;
}
.game-effect-mark.fx-ring,
.game-effect-mark.fx-outline,
.game-effect-mark.fx-seal {
  border: 2px solid currentColor;
}
.game-effect-mark.fx-ring {
  border-radius: 50%;
}
.game-effect-mark.fx-seal {
  outline: 1px solid currentColor;
  outline-offset: 1px;
}
.game-effect-mark.fx-seal::after {
  content: '';
  position: absolute;
  inset: 18%;
  border-left: 2px solid;
  border-bottom: 2px solid;
  transform: rotate(-45deg) scaleY(0.6);
}
.game-effect-mark.fx-cross {
  background:
    linear-gradient(45deg, transparent 43%, currentColor 44% 56%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, currentColor 44% 56%, transparent 57%);
}

/* The skill tree (技能树): whose tree, the points, the chosen node beside the tree, what is carried below. */
#menu-body .tree-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}
.tree-tabs {
  display: flex;
  gap: 6px;
}
.tree-tabs .tab {
  padding: 4px 14px;
  border-bottom: 2px solid transparent;
}
.tree-tabs .tab.open {
  border-bottom-color: var(--ui-gold);
  color: var(--ui-gold);
}
.tree-tabs .tree-dot {
  margin-left: 4px;
  font-style: normal;
  color: var(--ui-jade);
}
#menu-body .tree-points {
  margin-left: auto;
  color: var(--ui-gold);
  font-family: var(--ui-font-heading);
  font-size: 15px;
  letter-spacing: 2px;
}
.tree-reset {
  padding: 3px 10px;
  font-size: 12px;
}
#menu-body .tree-body {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
#menu-body .tree-board {
  position: relative;
  padding: 8px 6px 6px;
  background: color-mix(in srgb, var(--ui-panel) 70%, transparent);
  border: 1px solid var(--ui-line-soft);
  overflow-x: auto;
}
#menu-body .tree-branch-names {
  display: grid;
  text-align: center;
  margin-bottom: 2px;
}
#menu-body .tree-branch-names span {
  font-family: var(--ui-font-heading);
  color: var(--ui-gold);
  letter-spacing: 4px;
  font-size: 14px;
  border-bottom: 1px solid var(--ui-line-soft);
  margin: 0 6px;
  padding-bottom: 2px;
}
#menu-body .tree-grid {
  position: relative;
  display: grid;
  grid-template-rows: repeat(var(--tree-rows, 1), 66px);
}
#menu-body .tree-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#menu-body .tree-lines line {
  stroke: var(--ui-line-soft);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
#menu-body .tree-lines line.near {
  stroke: var(--ui-jade);
}
#menu-body .tree-lines line.had {
  stroke: var(--ui-gold);
  stroke-width: 2.5;
}
#menu-body .tree-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 6px 2px 0;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--ui-text);
  cursor: pointer;
}
#menu-body .tree-seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ui-line);
  background: var(--ui-ink);
  color: var(--ui-dim);
  font-style: normal;
  font-size: 12px;
  font-family: var(--ui-font-heading);
}
#menu-body .tree-node.art .tree-seal {
  border-radius: 4px;
  width: 30px;
  height: 30px;
  margin: 2px 0;
}
#menu-body .tree-node.root .tree-seal {
  width: 18px;
  height: 18px;
  margin: 8px 0;
  transform: rotate(45deg);
  border-radius: 2px;
}
#menu-body .tree-name {
  max-width: 76px;
  text-align: center;
  line-height: 1.2;
  font-size: 12px;
}
#menu-body .tree-node.learned .tree-seal {
  background: var(--ui-accent);
  border-color: var(--ui-gold);
}
#menu-body .tree-node.innate .tree-seal {
  background: color-mix(in srgb, var(--ui-gold) 45%, var(--ui-ink));
  border-color: var(--ui-gold);
  color: var(--ui-ink);
}
#menu-body .tree-node.open .tree-seal {
  border-color: var(--ui-jade);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-jade) 25%, transparent);
}
#menu-body .tree-node.open .tree-name {
  color: var(--ui-jade);
}
#menu-body .tree-node.level,
#menu-body .tree-node.first,
#menu-body .tree-node.points,
#menu-body .tree-node.book {
  opacity: 0.8;
}
#menu-body .tree-node.level .tree-name,
#menu-body .tree-node.first .tree-name,
#menu-body .tree-node.points .tree-name,
#menu-body .tree-node.book .tree-name {
  color: var(--ui-dim);
}
#menu-body .tree-node.chosen .tree-seal,
#menu-body .tree-node:focus-visible .tree-seal {
  outline: 2px solid var(--ui-gold);
  outline-offset: 3px;
}
#menu-body .tree-node:focus-visible {
  outline: none;
}
#menu-body .tree-node.chosen .tree-name {
  color: var(--ui-gold);
}
#menu-body .tree-born {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 6px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--ui-line-soft);
}
#menu-body .tree-born-title {
  align-self: center;
  margin-right: 6px;
  color: var(--ui-dim);
  font-size: 12px;
  letter-spacing: 2px;
}
#menu-body .tree-detail {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--ui-panel) 80%, transparent);
  border-left: 3px solid var(--ui-gold);
}
#menu-body .tree-detail h3 {
  margin: 0;
}
#menu-body .tree-kind,
#menu-body .tree-note {
  color: var(--ui-dim);
  font-size: 12px;
}
#menu-body .tree-doing {
  margin: 2px 0;
  line-height: 1.6;
}
#menu-body .tree-learn {
  padding: 6px 10px;
  border-color: var(--ui-jade);
  color: var(--ui-text);
  background: color-mix(in srgb, var(--ui-jade) 30%, transparent);
}
#menu-body .tree-state {
  color: var(--ui-dim);
  font-size: 13px;
}
#menu-body .tree-state.learned,
#menu-body .tree-state.innate {
  color: var(--ui-gold);
}
#menu-body .tree-carry {
  display: grid;
  gap: 2px;
  padding: 5px 10px;
  font-size: 13px;
}
#menu-body .tree-carry small {
  color: var(--ui-dim);
  font-size: 11px;
}
#menu-body .tree-carry-strip {
  margin-top: 12px;
}
#menu-body .tree-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
  margin: 4px 0;
}
#menu-body .tree-slot {
  padding: 6px 4px;
  text-align: center;
  font-size: 13px;
  border: 1px solid var(--ui-line);
  background: color-mix(in srgb, var(--ui-panel) 75%, transparent);
}
#menu-body .tree-slot.empty {
  border-style: dashed;
  border-color: var(--ui-line-soft);
  color: var(--ui-dim);
}
@media (max-width: 760px) {
  #menu-body .tree-body {
    grid-template-columns: minmax(0, 1fr);
  }
  #menu-body .tree-detail {
    order: 2;
  }
}
@media (max-height: 500px) {
  #menu-body.menu-skills > h2 {
    display: none;
  }
  #menu-body .tree-top {
    margin: 2px 0 6px;
  }
  #menu-body .tree-grid {
    grid-template-rows: repeat(var(--tree-rows, 1), 52px);
  }
  #menu-body .tree-node {
    padding-top: 2px;
  }
  #menu-body .tree-body {
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  }
  #menu-body .tree-seal {
    width: 28px;
    height: 28px;
  }
  #menu-body .tree-name {
    font-size: 11px;
  }
}

/* The stage owns gestures; scrollable lists keep native one-finger scrolling. */
@media (pointer: coarse) {
  html[data-toy],
  html[data-toy] body {
    overscroll-behavior: none;
  }
  #game #thumb button {
    min-width: 44px;
    min-height: 44px;
  }
  #game #title-menu button {
    min-height: 44px;
    touch-action: manipulation;
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* The highest combat button is centered 178px above its anchor, with radius 28px. */
  #game[data-device="touch"] #enemy-list {
    bottom: calc(
      32px + 206px * var(--touch-scale, 1) + env(safe-area-inset-bottom, 0px)
    );
    max-height: none;
    height: fit-content;
    max-block-size: max(
      44px,
      calc(
        100% - 78px - 206px * var(--touch-scale, 1) -
          env(safe-area-inset-bottom, 0px)
      )
    );
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: thin;
  }
  #game[data-device="touch"]:not([data-touch-layout="left"]) #enemy-list {
    right: max(10px, env(safe-area-inset-right, 0px));
  }
  #game[data-device="touch"][data-touch-layout="left"] #enemy-list {
    left: max(10px, env(safe-area-inset-left, 0px));
  }
  #game[data-device="touch"] #enemy-list .foe {
    min-height: 44px;
    flex-shrink: 0;
  }
  #game[data-device="touch"] #combat-actions {
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
}

/* Make the menu readable as soon as its buttons accept a tap. */
html[data-toy] #cover.named #title-menu,
html[data-toy] #cover.named #game-title,
html[data-toy] #cover.named .eyebrow,
html[data-toy] #cover.named #subtitle {
  animation-delay: 0s;
  animation-duration: 160ms;
}
