@property --solar {
  syntax: "<number>";
  inherits: true;
  initial-value: 0.5;
}

:root {
  --bg: #dedede;
  --panel: #ffffff;
  --ink: #03050b;
  --muted: #555555;
  --line: #c1c1c1;
  --accent: #ffd24a;
  --on-accent: var(--ink);
  --danger: #d32f2f;
  --warn: #e39b2d;
  --close: #ec0d0d;
  --close-hover: #ff3333;
  --btn-positive: var(--accent);
  --btn-positive-ink: var(--on-accent);
  --btn-positive-fill: color-mix(in srgb, var(--accent) 55%, white);
  --btn-negative: #c4453c;
  --btn-negative-ink: #ffffff;
  --btn-negative-fill: #e08a84;
  --btn-neutral: var(--line);
  --btn-neutral-ink: var(--ink);
  --btn-neutral-fill: #a8a8a8;
  --chrome: color-mix(in srgb, var(--bg) 94%, transparent);
  --chip-well: #cfcfcf;
  --chip-well-civic: color-mix(in srgb, var(--ink) 32%, var(--chip-well));
  --chip-fill: color-mix(in srgb, var(--accent) 30%, var(--chip-well));
  --chip-fill-work: color-mix(in srgb, var(--accent) 52%, var(--chip-well));
  --dim: color-mix(in srgb, var(--ink) 28%, transparent);
  --shadow: 0 8px 24px color-mix(in srgb, var(--ink) 12%, transparent);
  --news-selected: color-mix(in srgb, var(--accent) 12%, transparent);
  --scroll: color-mix(in srgb, var(--ink) 22%, transparent);
  --scroll-hover: color-mix(in srgb, var(--ink) 38%, transparent);
  --font: system-ui, "Segoe UI", sans-serif;
  --float-width: 720px;
  --chat-dock-tablet: 456px;
  --chat-list: 140px;
  --chat-thread: 500px;
  --chat-dock-landscape: calc(var(--chat-list) + var(--chat-thread));
  --panel-pad: 16px;
  --panel-enter-ms: 400;
  --panel-leave-ms: 200;
  --panel-enter-ease: cubic-bezier(0.87, 0, 0.13, 1); /* inOutExpo */
  --panel-leave-ease: cubic-bezier(0.55, 0.055, 0.675, 0.19);
  --badge-hang: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  color-scheme: light;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  user-select: none;
  -webkit-user-select: none;
  /* iOS ignores user-scalable=no; this stops double-tap zoom. */
  touch-action: manipulation;
}

input[type="range"] {
  touch-action: none;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

#play-veil {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--chat-inset);
  z-index: var(--z-veil);
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms linear;
}

#play-veil.is-on {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  #play-veil {
    transition-duration: 0s;
  }
}

.city-travel-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-mid);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: #000;
  color: #fff;
  pointer-events: auto;
}

.city-travel-overlay-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.city-travel-overlay-countdown {
  font-variant-numeric: tabular-nums;
  color: var(--muted, #aaa);
}

.screen-play:not(.city-moving) .city-travel-overlay,
.screen-play.map-open .city-travel-overlay {
  display: none;
}

.screen-play.city-moving .city-play-btns,
.screen-play.city-moving .city-sheet,
.screen-play.city-moving .city-find-modal,
.screen-play.city-moving .city-family-sheet,
.screen-play.city-moving .city-editor,
.screen-play.city-visiting .city-play-btns,
.screen-play.city-visiting .top-bar,
.screen-play.city-visiting .city-family-sheet,
.screen-play.city-visiting .city-family-bubbles,
.screen-play.city-visiting .city-sheet-collect,
.screen-play.city-visiting .city-sheet-manage,
.screen-play.city-visiting .city-sheet-cancel,
.screen-play.city-visiting .menu-bar-row > button:not(#visit-home-btn) {
  display: none;
}

.city-canvas,
.world-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: var(--z-canvas);
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

.city-names {
  position: absolute;
  inset: 0;
  z-index: var(--z-names);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition-property: opacity;
  transition-timing-function: linear;
}

.city-ask {
  position: absolute;
  inset: 0;
  z-index: var(--z-names);
  overflow: hidden;
  pointer-events: none;
}

.city-names.is-on {
  opacity: 1;
}

.city-ask-board,
.city-names-board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.map-pins {
  position: absolute;
  inset: 0;
  z-index: var(--z-names);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition-property: opacity;
  transition-timing-function: linear;
}

.map-pins.is-on {
  opacity: 1;
}

.map-pin {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chip-well);
  color: var(--gold-200);
  visibility: hidden;
  opacity: 0;
  transition-property: opacity;
  transition-timing-function: linear;
}

.map-pin.is-on {
  opacity: 1;
}

.screen-play .map-pin .i {
  width: 62%;
  height: 62%;
  filter: none;
}

.map-pin-hub,
.map-pin-spoke {
  color: var(--gold-ink);
}

.map-pin-hub {
  background: #eb8c1f;
}

.map-pin-spoke {
  background: #ffd133;
}

.map-pin-ally {
  background: #4aa3d9;
  color: var(--text);
}

@font-face {
  font-family: Cinzel;
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("./cinzel-900.e96f6ae075e7.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./source-sans-3-400.03271590a466.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./source-sans-3-500.731b2f524fd7.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./source-sans-3-600.7f8a222a36af.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./barlow-condensed-600.4644bc787687.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./barlow-condensed-700.2cbc6cbed0a8.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./barlow-semi-condensed-400.fdb8bfadfbe8.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./barlow-semi-condensed-500.133868cbef58.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./barlow-semi-condensed-600.f795a82ac0eb.woff2") format("woff2");
}

.title-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.title-canvas[hidden],
.designer-canvas[hidden] {
  display: none !important;
}

.designer-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

#ui {
  position: relative;
  z-index: 1;
  height: 100%;
  pointer-events: none;
}

.screen {
  pointer-events: auto;
}

.screen[hidden],
[hidden] {
  display: none !important;
}

.screen-form {
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

html.title-live .screen-form {
  background: transparent;
}

.screen-title {
  position: relative;
  /* Visible height, so the bottom menu box rides above the phone keyboard. */
  height: var(--vv-height, 100dvh);
  pointer-events: auto;
  --z-panels: 2;
}

.title-wordmark {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--float-width), 100%);
  z-index: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  container-type: inline-size;
  font-family: Cinzel, "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-weight: 900;
  line-height: 0.95;
  text-align: center;
  color: var(--ink);
  text-shadow: 0 0 14px var(--bg), 0 0 2px var(--bg);
  pointer-events: none;
  --wordmark-line-em: 9.167; /* COMMANDER in Cinzel 900 at letter-spacing 0.18em */
}

.aspect-portrait .title-wordmark {
  width: calc(100% - 48px);
}

.title-wordmark > span {
  font-size: calc(100cqi / var(--wordmark-line-em));
  letter-spacing: 0.18em;
}

.title-loading {
  position: absolute;
  left: 50%;
  bottom: max(32px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(360px, calc(100% - 48px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1;
}

.title-actions,
.title-create,
.title-login {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-actions {
  max-height: 50vh;
  overflow-y: auto;
}

.title-actions button,
.title-form-actions button {
  width: 100%;
}

.title-resume,
.title-account-row {
  min-height: calc((1.2em + 16px) * 2);
}

.title-account-row {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.title-last-played {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.7rem;
  line-height: 1.2;
  text-align: center;
}

.title-create .status:empty,
.title-login .status:empty {
  display: none;
}

.title-form-actions {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 8px;
}

.title-progress {
  position: relative;
  height: 8px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  overflow: hidden;
}

.title-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  animation: title-progress-pulse 1.2s ease-in-out infinite;
}

.title-progress::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42%;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, #ffffff 55%, transparent),
    transparent
  );
  animation: title-progress-sheen 1.2s linear infinite;
  pointer-events: none;
}

@keyframes title-progress-sheen {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(280%);
  }
}

@keyframes title-progress-pulse {
  50% {
    filter: brightness(1.2);
  }
}

#blackout {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms linear;
}

.blackout-load {
  position: absolute;
  left: 50%;
  bottom: max(32px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(360px, calc(100% - 48px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blackout-status {
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: 0.85rem;
}

#blackout.is-on {
  opacity: 1;
  pointer-events: auto;
}

.intertitle {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #fff;
  font-family: "Cinzel", serif;
  font-size: 1.35rem;
  line-height: 1.5;
  text-align: center;
}

.intertitle-copy {
  margin: 0;
  max-width: var(--float-width, 28rem);
  white-space: pre-wrap;
}

.intertitle-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  #blackout {
    transition-duration: 0s;
  }

  .title-progress-fill,
  .title-progress::after {
    animation: none;
  }
}

@media (pointer: coarse), (hover: none) {
  .screen-form {
    align-items: flex-start;
    padding-top: max(16px, env(safe-area-inset-top));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.box h1,
.panel h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 600;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

input,
textarea {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px 10px;
  font: inherit;
  /* iOS zooms the page when the focused field is under 16px, and does not reset. */
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
}

select {
  font: inherit;
  font-size: 16px;
}

.password-field {
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--line);
}

.password-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
}

.password-field .password-show {
  flex-shrink: 0;
  background: none;
  color: var(--muted);
  padding: 8px 10px;
}

button {
  font: inherit;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 8px 12px;
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ink) 28%, transparent);
  outline-offset: 2px;
}

button:active:not(:disabled):not([aria-disabled="true"]) {
  filter: brightness(1.16);
}

button.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  text-align: center;
}

button.btn.confirm-hold {
  touch-action: none;
}

button.btn.positive {
  background: var(--btn-positive);
  color: var(--btn-positive-ink);
  border: 0;
}

button.btn.negative {
  background: var(--btn-negative);
  color: var(--btn-negative-ink);
  border: 0;
}

button.btn.neutral {
  background: var(--btn-neutral);
  color: var(--btn-neutral-ink);
  border: 0;
}

.panel-body button.btn.positive,
.panel-body button.btn.negative,
.panel-body button.btn.neutral {
  border: 0;
}

.panel-body button.btn.positive {
  background: var(--btn-positive);
  color: var(--btn-positive-ink);
}

.panel-body button.btn.negative {
  background: var(--btn-negative);
  color: var(--btn-negative-ink);
}

.panel-body button.btn.neutral {
  background: var(--btn-neutral);
  color: var(--btn-neutral-ink);
}

button.btn.processing:disabled {
  opacity: 1;
}

.btn-fill {
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
  z-index: 0;
}

button.btn.positive .btn-fill {
  background: var(--btn-positive-fill);
}

button.btn.negative .btn-fill {
  background: var(--btn-negative-fill);
}

button.btn.neutral .btn-fill {
  background: var(--btn-neutral-fill);
}

button.btn.armed .btn-fill {
  animation: btn-drain 3s linear forwards;
}

@keyframes btn-drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.btn-label {
  position: relative;
  z-index: 1;
}

button.btn.holding,
.panel-body button.btn.negative.holding {
  --btn-shake-x: 0.4px;
  --btn-shake-y: 0.4px;
  --btn-shake-rot: 0.25deg;
  transform-origin: 50% 50%;
  transform-box: border-box;
  background: var(--btn-hold-bg, var(--btn-negative));
  animation: btn-shake 0.1s linear infinite;
}

@keyframes btn-shake {
  0%,
  100% {
    transform: rotate(0deg) translate(0, 0);
  }
  20% {
    transform: rotate(var(--btn-shake-rot)) translate(var(--btn-shake-x), calc(-1 * var(--btn-shake-y)));
  }
  40% {
    transform: rotate(calc(-1 * var(--btn-shake-rot))) translate(calc(-1 * var(--btn-shake-x)), var(--btn-shake-y));
  }
  60% {
    transform: rotate(calc(-0.5 * var(--btn-shake-rot))) translate(var(--btn-shake-x), var(--btn-shake-y));
  }
  80% {
    transform: rotate(var(--btn-shake-rot)) translate(calc(-1 * var(--btn-shake-x)), calc(-1 * var(--btn-shake-y)));
  }
}

button.link {
  background: none;
  color: var(--accent);
  padding: 0;
}

.tabs {
  margin: 0;
  color: var(--muted);
}

.status {
  margin: 0;
  color: var(--danger);
  min-height: 1.2em;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-list button {
  text-align: left;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

.screen-play {
  position: relative;
  min-height: 0;
  height: var(--vv-height, 100dvh);
  display: grid;
  /* Docked chat is column 1 at full height. HUD lives in the remaining column. */
  grid-template-columns: var(--chat-inset) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "dock top"
    "dock mid"
    "dock menu";
  pointer-events: none;
  --chat-inset: 0px;
  --z-canvas: 0;
  --z-names: 1;
  --z-mid: 2;
  --z-chrome: 3;
  --z-top: 4;
  --z-panels: 5;
  --z-notifications: 6;
  --z-veil: 8;
  --z-chat: 9;
  --z-toasts: 10;
}

html.aspect-portrait .screen-play:has(> #chat-host:not([hidden])) > .play-top-row > .top-bar {
  display: none;
}

html.aspect-tablet .screen-play:has(> #chat-host:not([hidden])) {
  --chat-inset: var(--chat-dock-tablet);
}

html.aspect-landscape .screen-play:has(> #chat-host:not([hidden])) {
  --chat-inset: var(--chat-dock-landscape);
}

.screen-play .chrome {
  pointer-events: auto;
}

.screen-play:has(.panels:not([hidden])) :is(.play-top-hud, .city-play-btns) {
  display: none;
}

/* The account and morale row stacks with the top row, above the top panel's box and dim. The
   panel opens where the row hangs, so the row steps aside. */
.screen-play:has(.top-panel:not([hidden])) .play-top-hud {
  display: none;
}

/* The corner clock hides behind an open panel. The wide-row band turns it back on. */
.screen-play:has(.panels:not([hidden])) .play-top-controls {
  display: none;
}

@property --top-band {
  syntax: "yes | no";
  inherits: false;
  initial-value: no;
}

.play-top-row {
  position: relative;
  grid-area: top;
  z-index: var(--z-notifications);
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 12px;
  container: play-top / inline-size;
}

/* Wide rows join the clock to the resources. Portrait keeps it in the corner.
   Once the row can hold that band, the row and the chip row under it stay at
   --play-top-band and sit in the middle of the play column. */
html:not(.aspect-portrait) .play-top-row {
  --top-band: yes;
  width: min(100%, var(--play-top-band));
  justify-self: center;
}


.top-bar {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--chrome);
  overscroll-behavior: none;
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.chips.locked {
  cursor: default;
}

.chip {
  flex: 1;
  min-width: 72px;
  max-width: 128px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
}

.chip-name {
  font-size: 14px;
  text-align: left;
  line-height: 1.2;
  overflow: hidden;
}

.chip-well {
  position: relative;
  height: 32px;
  background: var(--chip-well);
}

.chip-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  background: var(--chip-fill);
}

.chip-fill-work {
  background: var(--chip-fill-work);
}

.chip-qty {
  position: relative;
  z-index: 1;
  height: 32px;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

/* The account and morale row hangs under the top row. Where the clock and tools float in the
   corner, the cluster stops short of them; the wide band pulls them into the row and frees it. */
.play-top-hud {
  position: absolute;
  top: calc(100% + 8px);
  left: var(--play-top-inset);
  right: var(--play-top-inset);
  z-index: var(--z-chrome);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.play-top-hud .play-left-cluster {
  margin-right: calc(var(--icon-control-size) + 8px + var(--corner-clock-reserve));
}

.play-top-hud .play-left-cluster,
.play-top-controls .play-right {
  pointer-events: none;
}

.play-top-controls {
  position: absolute;
  top: calc(100% + 8px);
  right: var(--play-top-inset);
  z-index: var(--z-chrome);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.play-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.day-clock {
  pointer-events: none;
}

.debug-stack {
  position: fixed;
  top: 50%;
  right: var(--play-top-inset, 12px);
  transform: translateY(-50%);
  z-index: var(--z-chrome);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.debug-chip {
  padding: 8px 12px;
  background: var(--chrome);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: pre;
  text-align: right;
  pointer-events: auto;
}

.debug-transfers {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.debug-transfer-reset,
.debug-map-cache-drop,
.debug-people-cache-drop,
.debug-rebake-ground,
.debug-ground-catchup,
.debug-clear-local,
.debug-find-trunk,
.debug-noon-midnight {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  line-height: 1;
}

.debug-transfer-reset {
  width: 20px;
  height: 20px;
  padding: 0;
}

.debug-ground-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.debug-map-cache-drop,
.debug-people-cache-drop,
.debug-rebake-ground,
.debug-ground-catchup,
.debug-clear-local,
.debug-find-trunk,
.debug-noon-midnight {
  display: block;
  margin-left: auto;
  padding: 3px 6px;
  pointer-events: auto;
}

.debug-ground-row .debug-rebake-ground,
.debug-ground-row .debug-ground-catchup {
  margin-left: 0;
}

.debug-puddle-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
  width: 168px;
  color: var(--muted);
}

.debug-panel {
  width: 200px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--chrome);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  pointer-events: auto;
}

.debug-panel[hidden] {
  display: none;
}

.debug-pester {
  width: auto;
  max-width: min(92vw, 520px);
  max-height: 40vh;
  overflow: auto;
  white-space: pre;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.35;
}

.debug-ground-maps {
  width: 156px;
  max-height: min(32vh, 240px);
  overflow: auto;
  gap: 4px 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 6px 8px;
}

.debug-ground-map-title {
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.1;
}

.debug-ground-maps > .debug-ground-map-title {
  grid-column: 1 / -1;
}

.debug-ground-map-host canvas {
  display: block;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  background: #2a2a2a;
  cursor: pointer;
}

.debug-panel label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.settings-btn,
.debug-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 18px;
  line-height: 1;
}

.settings-btn.active,
.debug-btn.active {
  border-color: var(--accent);
}

.play-left-cluster {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.play-left-cluster > * {
  pointer-events: auto;
}

.account-chip,
.morale-chip,
.morale-progress {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.account-chip {
  flex-shrink: 0;
}

.morale-chip {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.morale-progress {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--chip-well);
}

.morale-progress .chip-fill {
  left: 0;
}

.morale-chip-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 0 8px;
  pointer-events: none;
}

.morale-chip-face {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}

.morale-chip-label {
  min-width: 0;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.morale-chip.active {
  border-color: var(--accent);
}

.morale-chip[hidden],
.morale-progress[hidden] {
  display: none;
}

.menu-bar {
  position: relative;
  grid-area: menu;
  z-index: var(--z-notifications);
  min-width: 0;
  display: flex;
  justify-content: center;
  padding: 8px;
  background: var(--chrome);
}

html.keyboard-open .menu-bar {
  display: none;
}

html.keyboard-open .screen-play {
  padding-bottom: 12px;
}

.menu-bar-row {
  display: flex;
  width: var(--float-width);
  max-width: 100%;
  gap: 6px;
}

.aspect-portrait .menu-bar-row {
  width: 100%;
}

.menu-bar button {
  position: relative;
  overflow: visible;
  flex: 1;
  min-width: 64px;
  min-height: 48px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.menu-bar button.active {
  border-color: var(--accent);
}

.badge {
  position: absolute;
  top: calc(-1 * var(--badge-hang));
  right: calc(-1 * var(--badge-hang));
  z-index: 1;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 999px;
  background: var(--danger);
  pointer-events: none;
}

.play-middle {
  position: relative;
  grid-area: mid;
  min-width: 0;
  min-height: 0;
}

.chat-host {
  position: absolute;
  inset: 0;
  grid-area: dock;
  z-index: var(--z-chat);
  display: flex;
  pointer-events: none;
}

.chat-dock {
  pointer-events: auto;
  display: flex;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.aspect-portrait .chat-host {
  display: block;
  grid-area: mid;
  z-index: var(--z-chat);
}

.aspect-portrait .chat-dock {
  position: absolute;
  inset: 0;
  width: auto;
  border-right: 0;
}

.aspect-landscape .chat-list-pane {
  width: var(--chat-list);
  flex: 0 0 var(--chat-list);
}

.aspect-landscape .chat-thread-pane {
  width: var(--chat-thread);
  flex: 0 0 var(--chat-thread);
}

.chat-list-pane,
.chat-thread-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.aspect-portrait .chat-host.thread-open .chat-list-pane,
.aspect-tablet .chat-host.thread-open .chat-list-pane {
  display: none;
}

.aspect-portrait .chat-host:not(.thread-open) .chat-thread-pane,
.aspect-tablet .chat-host:not(.thread-open) .chat-thread-pane {
  display: none;
}

.aspect-portrait .chat-list-pane,
.aspect-portrait .chat-thread-pane,
.aspect-tablet .chat-list-pane,
.aspect-tablet .chat-thread-pane {
  width: 100%;
  flex: 1 1 auto;
}

.aspect-landscape .chat-rooms-back {
  display: none !important;
}

.chat-thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-thread-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.chat-rooms-back {
  position: relative;
  overflow: visible;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 4px 10px;
}

.chat-leave {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 8px;
  margin-left: auto;
}

.chat-rooms {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.chat-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.chat-room.selected {
  background: var(--news-selected);
}

.chat-room-unread {
  position: relative;
}

.chat-thread {
  --chat-stack-gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--chat-stack-gap);
}

.chat-msg {
  --chat-avatar: 32px;
  --chat-msg-gap: 8px;
  display: flex;
  align-items: flex-start;
  gap: var(--chat-msg-gap);
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.chat-msg.continued {
  padding-left: calc(var(--chat-avatar) + var(--chat-msg-gap));
  margin-top: calc(-1 * var(--chat-stack-gap));
}

.chat-msg:has(+ .chat-msg.continued) .chat-bubble {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-width: 0;
}

.chat-msg.continued .chat-bubble {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top-style: dashed;
}

.chat-msg.system {
  justify-content: center;
}

.chat-bubble.system {
  background: color-mix(in srgb, var(--muted) 16%, var(--panel));
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
  font-style: italic;
}

.chat-avatar {
  flex: 0 0 var(--chat-avatar);
  width: var(--chat-avatar);
  height: var(--chat-avatar);
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--chip-well);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.chat-bubble {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble.mine {
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
}

.chat-bubble-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.chat-bubble-name,
.chat-bubble-body {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-bubble-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

.chat-bubble-age {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
}

.chat-msg.continued .chat-bubble-top {
  margin-bottom: 0;
}

.chat-bubble.redacted {
  color: var(--muted);
  font-style: italic;
}

.chat-react-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chat-react-chips:empty {
  display: none;
}

.chat-host button.chat-react-chip {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  min-width: 0;
  padding: 0 5px;
  font-size: 0.85rem;
  line-height: 1.6;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  box-shadow: none;
}

.chat-host button.chat-react-chip.mine {
  background: color-mix(in srgb, var(--ink) 16%, transparent);
}

.chat-react-menu {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  max-width: calc(100% - 8px);
  padding: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-host .chat-react-menu button {
  min-height: 28px;
  min-width: 28px;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
}

.chat-host .chat-react-menu button:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.chat-host button.chat-react-chip:active,
.chat-host .chat-react-menu button:active {
  filter: none;
}

.chat-typing {
  margin: 0;
  padding: 4px 12px 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-composer {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

.chat-composer input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
}

.chat-composer button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 12px;
}

.chat-composer.is-locked input,
.chat-composer.is-locked button {
  opacity: 0.5;
}

.top-panel {
  --top-pad: 8px;
  position: absolute;
  inset: 0;
  z-index: var(--z-top);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: var(--top-pad);
  pointer-events: none;
  overflow: visible;
}

.top-panel-dim {
  position: fixed;
  inset: 0;
  left: var(--chat-inset);
  background: var(--dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity calc(var(--panel-enter-ms) * 1ms) linear;
}

.top-panel.is-modal .top-panel-dim {
  pointer-events: auto;
}

.top-panel.is-open.is-modal .top-panel-dim {
  opacity: 1;
}

.top-panel.is-leaving.is-modal .top-panel-dim {
  opacity: 0;
  transition-duration: calc(var(--panel-leave-ms) * 1ms);
}

.top-panel-box {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  width: var(--float-width);
  max-width: 100%;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
  transform: translate3d(0, calc(-100% - var(--top-pad, 8px)), 0);
  transition: transform calc(var(--panel-enter-ms) * 1ms) var(--panel-enter-ease);
}

.top-panel.is-close .top-panel-box {
  max-height: 100%;
  min-height: 0;
}

.top-panel.is-open .top-panel-box {
  transform: none;
}

.top-panel.is-leaving .top-panel-box {
  transform: translate3d(0, calc(-100% - var(--top-pad, 8px)), 0);
  transition-timing-function: var(--panel-leave-ease);
  transition-duration: calc(var(--panel-leave-ms) * 1ms);
}

.top-panel.is-entering .top-panel-box,
.top-panel.is-leaving .top-panel-box {
  pointer-events: none;
}

.aspect-portrait .top-panel {
  --top-pad: 0px;
}

.aspect-portrait .top-panel-box {
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
}

.top-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  overflow: visible;
}

.top-panel-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 600;
  white-space: normal;
  overflow: visible;
}

.top-panel-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.top-panel.is-close .top-panel-body {
  flex: 1 1 auto;
}

.top-panel.is-collapsed .top-panel-body {
  display: none;
}

.top-panel-dismiss {
  position: relative;
  z-index: 2;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.top-panel.is-close .top-panel-dismiss {
  background: var(--close);
  color: #ffffff;
  border: 0;
  font-weight: 700;
}

.top-panel.is-close .top-panel-dismiss:hover {
  background: var(--close-hover);
}

html:not(.aspect-portrait) .top-panel-dismiss {
  position: absolute;
  right: 28px;
  bottom: 24px;
  transform: translate(33px, 30px);
}

.build-short {
  margin: 0 0 10px;
}

@media (prefers-reduced-motion: reduce) {
  .top-panel-box,
  .top-panel-dim {
    transition-duration: 0s;
  }
}

.city-play-btns {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: var(--z-chrome);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.city-play-btns button {
  position: relative;
  overflow: visible;
  background: var(--btn-neutral);
  color: var(--btn-neutral-ink);
  border: 0;
}

#dialogue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-chrome);
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}

#dialogue[hidden] {
  display: none;
}

/* The floating menu bar's transparent padding would leave a gap under the bust. */
html:not(.aspect-portrait) .screen-play:not(.city-editing):not(.find-open) #dialogue {
  bottom: -8px;
}

.dialogue-strip {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: min(var(--float-width), 100%);
}

.dialogue-strip.is-right {
  flex-direction: row-reverse;
}

.dialogue-bust {
  position: relative;
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  overflow: hidden;
  transform: translateY(100%);
}

.dialogue-bust.is-up {
  transform: none;
}

.dialogue-bubble {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  pointer-events: none;
  visibility: hidden;
}

/* Speech tail toward the bust. */
.dialogue-bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 20px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}

.dialogue-strip.is-right .dialogue-bubble::before {
  left: auto;
  right: -7px;
  border-left: 0;
  border-bottom: 0;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.dialogue-bubble.is-shown {
  visibility: visible;
}

.dialogue-bust.is-clickable,
.dialogue-bust.is-clickable .royal-plate,
.dialogue-bubble.is-clickable {
  pointer-events: auto;
  cursor: pointer;
}

.dialogue-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.dialogue-line {
  white-space: pre-wrap;
}

.dialogue-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.city-sheet,
.map-cell-sheet {
  position: absolute;
  left: 0;
  top: 0;
  z-index: var(--z-mid);
  min-width: 160px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

html.is-pointer-guard .city-sheet,
html.is-pointer-guard .city-sheet *,
html.is-pointer-guard .map-cell-sheet,
html.is-pointer-guard .map-cell-sheet * {
  pointer-events: none;
}

.city-find-modal {
  position: absolute;
  inset: 0;
  z-index: var(--z-mid);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.city-find-modal:not([hidden]) {
  display: flex;
}

.city-find-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.city-find-sheet {
  position: relative;
  left: auto;
  top: auto;
  z-index: 1;
  min-width: 220px;
}

.screen-play.find-open .play-top-row,
.screen-play.find-open .play-top-hud,
.screen-play.find-open .city-play-btns,
.screen-play.find-open .menu-bar,
.screen-play.find-open .notifications,
.screen-play.find-open #chat-host,
.screen-play.find-open .top-panel,
.screen-play.find-open .city-family-sheet,
.screen-play.find-open #city-sheet {
  display: none;
}

.city-find-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  pointer-events: none;
}

.city-find-panel[hidden] {
  display: none;
}

.city-find-stage {
  position: relative;
  width: 100%;
  height: clamp(360px, 64vh, 560px);
  max-height: calc(100dvh - 24px);
  touch-action: none;
  pointer-events: auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 70%, #030909 0 12%, transparent 37%),
    radial-gradient(ellipse at 50% 44%, #354640, #172323 48%, #0c1416 85%);
  border-block: 1px solid #82948c24;
}

.city-find-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

button.city-find-leave {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  min-width: 44px;
  min-height: 44px;
  pointer-events: auto;
}

button.city-find-leave[hidden] {
  display: none;
}

.city-find-deal {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.city-find-cards {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.city-find-cards[hidden] {
  display: none;
}

button.city-find-card {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f3e4c6;
  perspective: 900px;
  cursor: pointer;
  pointer-events: auto;
  transition: filter 220ms ease;
  -webkit-tap-highlight-color: transparent;
}

button.city-find-card:disabled {
  opacity: 1;
  filter: none;
  pointer-events: none;
  cursor: default;
}

.city-find-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: translate 160ms ease;
}

.city-find-card:not(:disabled):hover .city-find-card-inner,
.city-find-card:focus-visible .city-find-card-inner {
  translate: 0 -6px;
}

.city-find-card.is-up .city-find-card-inner {
  transform: rotateY(180deg);
}

.city-find-card-back,
.city-find-card-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #b69e67;
  border-radius: 6px;
  box-shadow: 0 12px 22px #0008, inset 0 0 0 3px #172120, inset 0 0 0 4px #b69e6745;
  backface-visibility: hidden;
}

.city-find-card-back {
  background:
    repeating-linear-gradient(45deg, transparent 0 5px, #d3ba7906 5px 6px),
    radial-gradient(ellipse at 50% 30%, #42514a, #1a2927);
  color: #d4bc82;
}

.city-find-card-stamp {
  width: 64px;
  height: 64px;
  padding: 6px;
  border: 1px solid #c8b27555;
  border-radius: 50%;
  box-sizing: border-box;
}

.city-find-card-sealed {
  margin-top: 8px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 3px;
}

.city-find-card-front {
  background: radial-gradient(ellipse at 50% 20%, color-mix(in srgb, var(--find-item) 18%, #1b2827), #14201f 85%);
  border-color: var(--find-item);
  transform: rotateY(180deg);
  overflow: hidden;
}

.city-find-card-front::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 35%, #fff7 49%, transparent 62%);
  translate: -100% 0;
  pointer-events: none;
}

.city-find-card.is-up .city-find-card-front::after {
  animation: find-card-sheen 700ms 220ms ease-out both;
}

.city-find-card-icon {
  width: 62px;
  height: 62px;
  color: var(--find-item);
  filter: drop-shadow(0 2px 8px color-mix(in srgb, var(--find-item) 30%, transparent));
}

.screen-play .city-find-card-icon .i,
.screen-play .city-find-card-stamp .i {
  width: 100%;
  height: 100%;
  filter: none;
}

.city-find-card-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.city-find-card-qty {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #fff3d9;
}

.city-find-card::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid var(--find-item);
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
}

.city-find-card.is-up::after {
  animation: find-card-burst 520ms 240ms ease-out;
}

/* Rare and epic: the back matches every other card; only the face tells. */
.city-find-card.is-rare,
.city-find-spark.is-rare {
  --tier-deep: #7a5410;
  --tier-mid: #c8861a;
  --tier-lit: #ffe28a;
  --tier-pale: #fff4c2;
  --tier-fill: #5b4516;
  --tier-glow: #ffc24a;
  --tier-ink: #2a1a04;
}

.city-find-card.is-epic,
.city-find-spark.is-epic {
  --tier-deep: #4a1d7a;
  --tier-mid: #9a4dff;
  --tier-lit: #dcb3ff;
  --tier-pale: #f6eaff;
  --tier-fill: #3b2258;
  --tier-glow: #b46cff;
  --tier-ink: #1c0833;
}

.city-find-card.is-tier .city-find-card-front {
  border: 2px solid transparent;
  background:
    radial-gradient(ellipse at 50% 20%, var(--tier-fill), #16131b 85%) padding-box,
    conic-gradient(from var(--tier-spin, 0deg), var(--tier-deep), var(--tier-lit), var(--tier-mid), var(--tier-pale), var(--tier-deep)) border-box;
  box-shadow: 0 12px 22px #0008, 0 0 16px color-mix(in srgb, var(--tier-glow) 40%, transparent);
}

.city-find-card.is-tier.is-up .city-find-card-front {
  animation: find-tier-spin 2.4s linear infinite, find-tier-glow 1.6s ease-in-out infinite alternate;
}

.city-find-card-tag {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg) translateZ(1px);
  backface-visibility: hidden;
  pointer-events: none;
}

.city-find-card-badge {
  position: absolute;
  top: 0;
  left: 75%;
  translate: -50% -50%;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(var(--tier-lit), var(--tier-mid));
  color: var(--tier-ink);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 0 0 2px #0d1212, 0 0 10px color-mix(in srgb, var(--tier-glow) 60%, transparent);
}

.city-find-cards.is-spotlight .city-find-card:not(.is-spotlit) {
  filter: brightness(.4) saturate(.5);
  pointer-events: none;
}

.city-find-card.is-spotlit { z-index: 2; }

.city-find-card.is-tier.is-up::after { animation: none; }

.city-find-card.is-tier.is-landed::after {
  border-color: var(--tier-lit);
  animation: find-tier-burst 700ms ease-out;
}

.city-find-spark {
  position: absolute;
  width: 3px;
  height: 12px;
  margin: -6px 0 0 -1.5px;
  border-radius: 2px;
  background: linear-gradient(#fff, var(--tier-lit) 40%, var(--tier-mid));
  box-shadow: 0 0 6px var(--tier-glow);
  pointer-events: none;
}

.city-find-cards::before {
  content: "FOUND IN THE WRECK";
  position: absolute;
  bottom: calc(100% + 22px);
  left: 50%;
  translate: -50% 0;
  width: max-content;
  color: #e5d5b4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-shadow: 0 2px 8px #000;
}

.city-find-cards::after {
  content: "Tap each card to reveal";
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  translate: -50% 0;
  width: max-content;
  font-size: 12px;
  color: #c5c9bf;
}

.city-find-cards.is-revealed::after { content: none; }

.city-find-deal:has(.city-find-cards:not([hidden])) {
  background: #061010a6;
  animation: find-reveal-in 350ms ease-out both;
}

html.dim-blur .city-find-deal:has(.city-find-cards:not([hidden])) {
  backdrop-filter: blur(3px);
}

.city-find-trunk-heading {
  position: absolute;
  top: 28px;
  left: 50%;
  translate: -50% 0;
  width: max-content;
  max-width: 65%;
  color: #d7d4bf;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  pointer-events: none;
}

.city-find-trunk-hint {
  position: absolute;
  bottom: 26px;
  left: 12px;
  right: 12px;
  color: #eee0bf;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}

.city-find-trunk-target {
  position: absolute;
  width: 40px;
  height: 40px;
  translate: -50% -50%;
  border: 1px solid #f1cf87b3;
  border-radius: 50%;
  box-shadow: 0 0 20px #e9b96722, inset 0 0 12px #e9b96722;
  pointer-events: none;
}

.city-find-trunk-target::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid #f1cf8740;
  border-radius: 50%;
}

.city-find-stage:not([data-phase="idle"]) .city-find-trunk-target { display: none; }
.city-find-stage[data-phase="armed"] canvas { cursor: ns-resize; }
.city-find-stage[data-phase="idle"] canvas { cursor: crosshair; }

.city-find-trunk-force {
  position: absolute;
  bottom: 13px;
  left: 50%;
  translate: -50% 0;
  width: 140px;
  height: 3px;
  background: #b0bba329;
  opacity: 0;
  pointer-events: none;
}

.city-find-trunk-force span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #b4bd96, #f5c15f, #ff8051);
  box-shadow: 0 0 10px #e99c6266;
  transform-origin: left;
}

.city-find-stage[data-phase="armed"] .city-find-trunk-force,
.city-find-stage[data-phase="committed"] .city-find-trunk-force { opacity: 1; }
.city-find-stage[data-phase="opening"] .city-find-trunk-hint { animation: find-crack 350ms ease-out both; }

@keyframes find-crack {
  0% { scale: 1.4; opacity: 0; letter-spacing: 5px; }
  40% { scale: .95; opacity: 1; }
  100% { scale: 1; opacity: 1; }
}
@keyframes find-card-burst {
  0% { opacity: .9; transform: scale(.8); }
  100% { opacity: 0; transform: scale(1.3); }
}
@keyframes find-card-sheen {
  to { translate: 100% 0; }
}
@keyframes find-reveal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@property --tier-spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@keyframes find-tier-spin {
  to { --tier-spin: 360deg; }
}
@keyframes find-tier-glow {
  from { box-shadow: 0 12px 22px #0008, 0 0 10px color-mix(in srgb, var(--tier-glow) 27%, transparent); }
  to { box-shadow: 0 12px 22px #0008, 0 0 28px color-mix(in srgb, var(--tier-glow) 67%, transparent); }
}
@keyframes find-tier-burst {
  0% { opacity: 1; transform: scale(.9); box-shadow: 0 0 30px var(--tier-glow); }
  100% { opacity: 0; transform: scale(1.6); box-shadow: 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .city-find-card.is-up::after,
  .city-find-card.is-up .city-find-card-front::after,
  .city-find-deal:has(.city-find-cards:not([hidden])),
  .city-find-stage[data-phase="opening"] .city-find-trunk-hint,
  .city-find-card.is-tier.is-landed::after { animation: none; }
  .city-find-card.is-tier.is-up .city-find-card-front { animation: find-tier-glow 1.6s ease-in-out infinite alternate; }
  .city-find-card-inner { transition: none; }
}

button.city-find-close {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  min-width: 140px;
  min-height: 44px;
  pointer-events: auto;
  color: #14211e;
  background: #e2c182;
  border: 1px solid #f6daa2;
  box-shadow: 0 4px 24px #0006;
  transform: translate(-50%, 28px);
}

button.city-find-close[hidden] {
  display: none;
}

.city-sheet-title,
.map-cell-sheet-title {
  font-weight: 600;
}

.city-family-sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.city-family-sheet-look {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  background: #f6f1e5;
}

.city-family-bubbles {
  position: absolute;
  inset: 0;
  z-index: var(--z-names);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition-property: opacity;
  transition-timing-function: linear;
}

.city-family-bubbles.is-on {
  opacity: 1;
}

.city-family-bubble {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #f6f1e5;
  pointer-events: auto;
  box-shadow: var(--shadow);
  transform-origin: 50% 100%;
}

.city-family-bubble::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  border: 1px solid #000;
  pointer-events: none;
}

.city-family-bubble canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.screen-play.city-editing .city-family-bubbles {
  display: none;
}

.city-sheet-sub,
.city-sheet-row {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: pre-line;
}

.city-sheet-energy-track {
  height: 8px;
  margin-top: 6px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}

.city-sheet-energy-fill {
  height: 100%;
  width: 0;
}

.city-sheet-energy-fill.green {
  background: #16a34a;
}

.city-sheet-energy-fill.orange {
  background: #ea580c;
}

.city-sheet-energy-fill.red {
  background: #dc2626;
}

.city-sheet-craft-out {
  font-weight: 600;
  margin: 6px 0 4px;
}

#plant-detail {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#plant-panel.panel-pane {
  overflow: hidden;
}

#plant-slider {
  width: 100%;
  margin: 6px 0;
}

#plant-start.blocked {
  opacity: 0.5;
}

.plant-detail-actions {
  justify-content: space-between;
}

#plant-back,
#plant-start {
  flex: 0 0 auto;
}

.city-sheet-collect,
.city-sheet-manage,
.city-sheet-cancel,
.map-cell-sheet-prospect,
.map-cell-sheet-construct,
.map-cell-sheet-mine,
.map-cell-sheet-summon,
.map-cell-sheet-move-city,
.map-cell-sheet-recall,
.map-cell-sheet-recall-all,
.map-cell-sheet-view {
  width: 100%;
  margin-top: 8px;
}

.map-cell-sheet-patch {
  white-space: pre-wrap;
}

.map-cell-sheet-leave-text {
  font-size: 0.85rem;
  margin-top: 8px;
}

.map-cell-sheet-leave-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.map-cell-sheet-leave-row button {
  flex: 1;
  min-width: 0;
}

.mine-status,
.mine-stock,
.mine-occupancy,
.mine-construct-stock {
  color: var(--muted);
  font-size: 0.85rem;
}

.mine-prefs {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.mine-pref,
.panel-body button.mine-pref {
  flex: 1;
  min-width: 0;
}

.mine-error {
  color: var(--danger);
  font-size: 0.85rem;
}

.mine-construct-costs-line {
  flex: 1;
}

.mine-construct-cost.is-short {
  color: var(--danger);
}

.mine-construct-error {
  color: var(--danger);
  font-size: 0.85rem;
}

.mine-construct-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.mine-construct-field input[type="range"] {
  flex: 1;
}

.map-cell-sheet-error,
.map-cell-sheet-yield,
.map-cell-sheet-patch,
.map-cell-sheet-block,
.map-cell-sheet-family,
.map-cell-sheet-status,
.map-cell-sheet-city-name {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.map-cell-sheet-occupants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.map-cell-sheet-royal {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-cell-sheet-bust {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  overflow: hidden;
  background: #f6f1e5;
}

.map-cell-sheet-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.map-cell-sheet-name {
  font-weight: 600;
}

.map-cell-sheet-skel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.map-cell-sheet-skel-line {
  height: 12px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
  animation: map-cell-skel 1s ease-in-out infinite;
}

.map-cell-sheet-skel-line.short {
  width: 55%;
}

@keyframes map-cell-skel {
  50% { opacity: 0.45; }
}

.city-sheet-collect.blocked {
  opacity: 0.5;
}

.upgrade-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 8px 6px;
  margin: 0 -8px;
}

.upgrade-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}

.upgrade-table td {
  width: 50%;
  vertical-align: top;
}

.upgrade-table.is-single td {
  width: 100%;
}

.upgrade-table tr.staff button {
  min-width: 2.75rem;
  margin-left: 8px;
}

.upgrade-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--panel) 50%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--line) 50%, var(--panel));
  font-size: 0.9rem;
}

.upgrade-cell.short {
  background: color-mix(in srgb, var(--btn-negative) 50%, var(--panel));
  color: var(--ink);
  border-color: color-mix(in srgb, var(--btn-negative) 50%, var(--panel));
}

.upgrade-cell-text {
  flex: 1;
  min-width: 0;
}

.upgrade-check {
  margin-left: auto;
  flex: none;
}

.morale-tail {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.morale-tail .upgrade-check {
  margin-left: 0;
}

.morale-delta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upgrade-go {
  margin-left: auto;
  flex: none;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: var(--on-accent);
}

#upgrade-start,
#field-expand-start {
  width: 100%;
  margin-top: 12px;
}

#upgrade-start.blocked,
#field-expand-start.blocked,
#build-start.blocked,
#manage-reserve-go.blocked {
  opacity: 0.5;
}

.manage-reserve {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-reserve-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manage-reserve-head .upgrade-cell {
  flex: 1 1 auto;
  min-width: 0;
}

#manage-reserve-go {
  flex: 0 0 10rem;
  width: 10rem;
}

#manage-reserve-go.is-idle {
  visibility: hidden;
  pointer-events: none;
}

.manage-reserve input[type="range"] {
  width: 100%;
}

.screen-play .manage-depleted {
  margin: 0;
  padding: 8px 11px;
  border: 1.5px solid var(--alert);
  border-radius: 8px;
  background: color-mix(in srgb, var(--alert) 12%, transparent);
  color: var(--alert);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
}

.build-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#build-back {
  flex: 0 0 auto;
}

#build-start {
  flex: 1 1 auto;
}

.screen-play.city-editing .city-sheet,
.screen-play.city-editing .city-find-modal,
.screen-play.city-editing .city-family-sheet {
  display: none;
}

.notifications {
  position: absolute;
  left: var(--chat-inset, 0px);
  right: 0;
  z-index: var(--z-toasts);
  display: flex;
  justify-content: center;
  padding: 0 var(--notification-side, 12px);
  pointer-events: none;
}

.notification {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  max-width: var(--notification-max, 440px);
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  transform: translate3d(0, calc(-100% - var(--notification-pad, 8px)), 0);
  opacity: 0;
  transition: transform calc(var(--panel-enter-ms) * 1ms) var(--panel-enter-ease), opacity 200ms ease;
}

.notifications.is-open .notification {
  opacity: 1;
  transform: none;
}

.notifications.is-leaving .notification {
  transform: translate3d(12px, 110px, 0) rotate(7deg);
  opacity: 0;
  transition-timing-function: cubic-bezier(.4, 0, 1, 1);
  transition-duration: var(--notification-leave-ms);
}

.notifications.is-entering .notification,
.notifications.is-leaving .notification {
  pointer-events: none;
}

.notification.positive {
  background: var(--btn-positive);
  color: var(--btn-positive-ink);
}

.notification.neutral {
  background: var(--btn-neutral);
  color: var(--btn-neutral-ink);
}

.notification.negative {
  background: var(--btn-negative);
  color: var(--btn-negative-ink);
}

.notification-fill {
  position: absolute;
  inset: 0;
  transform: scaleX(1);
  transform-origin: left center;
  pointer-events: none;
  z-index: 0;
}

.notification.positive .notification-fill {
  background: var(--btn-positive-fill);
}

.notification.neutral .notification-fill {
  background: var(--btn-neutral-fill);
}

.notification.negative .notification-fill {
  background: var(--btn-negative-fill);
}

.notification.is-holding .notification-fill {
  animation: notification-drain var(--notification-hold-ms, 3000ms) linear forwards;
}

@keyframes notification-drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.notification-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification.is-shake {
  animation: notification-shake var(--notification-shake-ms, 250ms) ease-in;
}

@keyframes notification-shake {
  0%,
  100% {
    translate: 0 0;
  }
  20% {
    translate: var(--notification-shake, 5.5px) 0;
  }
  40% {
    translate: calc(-1 * var(--notification-shake, 5.5px)) 0;
  }
  60% {
    translate: calc(0.6 * var(--notification-shake, 5.5px)) 0;
  }
  80% {
    translate: calc(-0.4 * var(--notification-shake, 5.5px)) 0;
  }
}

.notification-text {
  flex: 1 1 auto;
  min-width: 0;
}

.notification-count {
  flex: 0 0 auto;
  font-weight: 600;
}

.notification-action {
  flex: 0 0 auto;
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: 600;
}

.city-editor {
  position: absolute;
  inset: 0;
  z-index: var(--z-mid);
  pointer-events: none;
}

.city-editor-bar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: var(--z-chrome);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.screen-play.city-editing .top-bar,
.screen-play.city-editing .menu-bar,
.screen-play.city-editing .play-left-cluster,
.screen-play.city-editing .account-chip,
.screen-play.city-editing .city-play-btns,
.screen-play.city-editing .day-clock {
  display: none;
}

.screen-play.map-open .city-play-btns,
.screen-play.map-open .city-sheet,
.screen-play.map-open .city-find-modal,
.screen-play.map-open .city-family-sheet,
.screen-play.map-open .city-family-bubbles,
.screen-play.map-open .city-editor {
  display: none;
}

.screen-play:not(.map-open) .map-cell-sheet {
  display: none;
}

.build-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  padding-top: var(--badge-hang);
  padding-right: var(--badge-hang);
}

.build-tab {
  position: relative;
  overflow: visible;
  flex: 1;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.build-tab[aria-selected="true"] {
  border-color: var(--accent);
}

.build-list {
  --build-hover-room: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  /* Rows keep their height; a short list does not stretch to fill the panel. */
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: calc(var(--badge-hang) + var(--build-hover-room));
  padding-right: calc(var(--badge-hang) + var(--build-hover-room));
  padding-bottom: var(--build-hover-room);
  padding-left: var(--build-hover-room);
}

.aspect-portrait .build-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aspect-portrait .build-tile {
  --tile-stock: 22px;
}

.aspect-portrait .build-tile-stock {
  font-size: 11px;
}

.build-tile {
  --tile-stock: 32px;
  position: relative;
  display: block;
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: visible;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  z-index: 0;
  transform: translate3d(0, 0, 0);
  transition:
    transform 240ms cubic-bezier(0.34, 1.25, 0.64, 1),
    border-color 140ms linear,
    box-shadow 240ms ease,
    opacity 140ms linear;
}

.build-tile-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.build-tile.blocked {
  opacity: 0.55;
}

.build-tile-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

@media (hover: hover) {
  button.build-tile:hover {
    z-index: 2;
    border-color: var(--accent);
    transform: translate3d(0, -5px, 0);
    box-shadow: var(--shadow);
  }

  /* The lift would pull the tile out from under a pointer at its bottom
     edge: hover would end, the tile drop back, and hover start again. This
     strip fills the gap the lift leaves, so the hover holds. */
  button.build-tile:hover::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 6px;
  }

  button.build-tile.blocked:hover {
    opacity: 0.8;
  }

  /* Tile stays put. */
  #plant-list button.build-tile:hover {
    transform: none;
    box-shadow: none;
  }
}

button.build-tile:active:not(:disabled):not([aria-disabled="true"]) {
  z-index: 2;
  transform: translate3d(0, 0, 0) scale(0.98);
}

#plant-list button.build-tile:active:not(:disabled):not([aria-disabled="true"]) {
  transform: translate3d(0, 0, 0);
}

#inventory-list.build-list {
  --build-hover-room: 0px;
  padding: 0;
}

/* Without round() these resolve to nothing and the tiles collapse, so older WebViews keep square tiles. */
@supports (width: round(down, 100%, 1px)) {
  /* Whole-pixel columns. A fractional track puts the 1px border on a half pixel. */
  /* Rows hold each tile's full height, so a short panel scrolls the list
     instead of squeezing the seed strip and name plate out of the tiles. */
  #plant-list.build-list {
    --plant-cols: 4;
    --plant-gap: 8px;
    gap: var(--plant-gap);
    justify-content: start;
    grid-auto-rows: max-content;
    grid-template-columns: repeat(
      var(--plant-cols),
      round(down, (100% - (var(--plant-cols) - 1) * var(--plant-gap)) / var(--plant-cols), 1px)
    );
  }

  .aspect-portrait #plant-list.build-list {
    --plant-cols: 3;
  }

  /* Seed strip, a square picture, then the name plate, stacked in flow.
     The plate sits below the art, so text never lands on the white picture. */
  /* Flex, not block: a button centres block content, which opens a gap above the art. */
  #plant-list .build-tile {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    aspect-ratio: auto;
    width: round(down, 100%, 1px);
  }

  #plant-list .build-tile-face {
    display: flex;
    flex-direction: column;
  }

  #plant-list .build-tile-face,
  #plant-list .build-tile-stock,
  #plant-list .build-tile-copy {
    position: relative;
    inset: auto;
  }

  /* The seed strip sits above the picture. */
  #plant-list .build-tile-stock {
    order: -1;
  }

  #plant-list .build-tile-copy {
    border-top: 1px solid var(--line);
  }
}

/* A solid name plate under the picture. */
#plant-list .build-tile-copy {
  gap: 1px;
  padding: 6px 8px 7px;
  background: var(--panel);
}

#plant-list .build-tile-name {
  font-size: 0.9rem;
}

#plant-list .build-tile-sub {
  font-weight: 600;
  font-size: 0.76rem;
}

#plant-list .build-tile.is-short .build-tile-glyph,
#plant-list .build-tile.is-locked .build-tile-glyph {
  filter: grayscale(1) brightness(0.6);
}

/* A recipe's picture is its line icon, centred in the square. */
#plant-list .build-tile-glyph {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--text);
}

#plant-list .build-tile-glyph .i {
  width: 58%;
  height: auto;
  aspect-ratio: 1;
}

#plant-list .build-tile.is-short .build-tile-sub {
  color: var(--danger);
}

#plant-list .build-tile.is-locked .build-tile-sub {
  color: var(--accent);
}

/* A machine's few recipes list as full-width rows. The left square is the
   recipe's picture with its name inside, along the top. The right is the
   formula, the inputs beside the outputs, then the warning.
   Each side wraps its own terms, so the yield never drops onto a row of its
   own. */
#plant-list.build-list.is-rows {
  grid-template-columns: minmax(0, 1fr);
}

#plant-list.is-rows .build-tile {
  display: block;
  aspect-ratio: auto;
  width: 100%;
}

#plant-list.is-rows .build-tile-face {
  --row-pic: 6.5rem;
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: var(--row-pic) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "art formula"
    "art sub";
  border-radius: inherit;
}

.aspect-portrait #plant-list.is-rows .build-tile-face {
  --row-pic: 4.5rem;
}

/* The copy's lines sit on the row's grid: the name in the picture's square. */
#plant-list.is-rows .build-tile-copy {
  display: contents;
}

#plant-list.is-rows .build-tile-glyph {
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-right: 1px solid var(--line);
}

/* In a row, the icon is lowered to leave the name room along the top. */
#plant-list.is-rows .build-tile-glyph {
  grid-area: art;
  aspect-ratio: auto;
  min-height: var(--row-pic);
  padding-top: 1.6rem;
}

#plant-list .build-tile.is-short .build-tile-glyph,
#plant-list .build-tile.is-locked .build-tile-glyph {
  color: var(--muted);
  opacity: 0.6;
}

#plant-list.is-rows .build-tile-name {
  grid-area: art;
  align-self: start;
  z-index: 1;
  padding: 8px 6px 0;
  text-align: center;
  white-space: normal;
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.15;
}

#plant-list.is-rows .build-tile-formula {
  grid-area: formula;
  padding: 10px 12px;
}

#plant-list.is-rows .build-tile-sub {
  grid-area: sub;
  padding: 0 12px 10px;
  font-size: 0.8rem;
}

/* The outputs are as wide as their widest term; the inputs get the rest. */
.build-tile-formula {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
}

.formula-side {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.formula-side.is-out {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

/* A phone-width row has no quarter wide enough for the yield, so the
   sides stack. */
.aspect-portrait .build-tile-formula {
  grid-template-columns: minmax(0, 1fr);
}

.aspect-portrait .formula-side.is-out {
  padding: 10px 0 0;
  border-left: none;
  border-top: 1px solid var(--line);
}

.formula-term {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 8px;
  background: var(--chip-well);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* A term's note is a band across the pill's foot, flush with its edges. */
.formula-note {
  grid-column: 1 / -1;
  margin: 3px -10px -3px -3px;
  padding: 2px 8px 3px;
  border-radius: 0 0 8px 8px;
  background: color-mix(in srgb, var(--danger) 70%, #000);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.formula-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.formula-icon .i {
  width: 22px;
  height: 22px;
}

.formula-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.formula-qty {
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.formula-name {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.formula-term.is-out {
  background: color-mix(in srgb, var(--ok) 16%, var(--chip-well));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 55%, transparent);
}

.formula-term.is-out .formula-icon {
  color: var(--ok-text);
}

.formula-term.is-short {
  background: color-mix(in srgb, var(--danger) 12%, var(--chip-well));
  box-shadow: inset 0 0 0 1px var(--danger);
}

.formula-term.is-short .formula-qty,
.formula-term.is-short .formula-icon {
  color: var(--danger);
}

.build-tile-stock {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  height: var(--tile-stock);
  padding: 0 8px;
  background: var(--chip-well);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.build-tile-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: linear-gradient(to top, color-mix(in srgb, var(--panel) 92%, transparent), transparent);
  pointer-events: none;
}

.build-tile-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.8rem;
}

.build-tile-sub {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.panels {
  position: absolute;
  inset: 0;
  z-index: var(--z-panels);
  overflow: visible;
}

.panels.is-entering,
.panels.is-leaving {
  overflow: hidden;
}

.dim {
  position: fixed;
  inset: 0;
  left: var(--chat-inset);
  background: var(--dim);
  opacity: 0;
  pointer-events: auto;
  transition: opacity calc(var(--panel-enter-ms) * 1ms) linear;
}

.panels.is-open .dim {
  opacity: 1;
}

.panels.is-leaving .dim {
  opacity: 0;
  transition-duration: calc(var(--panel-leave-ms) * 1ms);
}

:is(.top-panel-dim, .dim) {
  transition:
    opacity calc(var(--panel-enter-ms) * 1ms) linear,
    backdrop-filter calc(var(--panel-enter-ms) * 1ms) ease-out;
}

html.dim-blur:not(.aspect-portrait) :is(.top-panel-dim, .dim) {
  backdrop-filter: blur(0px);
}

html.dim-blur:not(.aspect-portrait) .top-panel.is-open.is-modal .top-panel-dim,
html.dim-blur:not(.aspect-portrait) .panels.is-open .dim {
  backdrop-filter: blur(3px);
}

html.aspect-portrait :is(.top-panel-dim, .dim) {
  transition-property: opacity;
}

@media (prefers-reduced-motion: reduce) {
  :is(.top-panel-dim, .dim) {
    transition-duration: 0s;
  }
}

.bottom-panel,
.menu-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--panel-pad) 0;
  pointer-events: none;
  overflow: visible;
}

.aspect-portrait .bottom-panel,
.aspect-portrait .menu-box {
  padding: 0;
  --panel-pad: 0px; /* unitless 0 makes calc(100% + var(--panel-pad)) invalid */
}

.bottom-panel.panel-fill .panel {
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  pointer-events: auto;
  position: relative;
  width: var(--float-width);
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
  transform: translate3d(0, calc(100% + var(--panel-pad) + var(--panel-exit-clearance, 0px)), 0);
  transition: transform calc(var(--panel-enter-ms) * 1ms) var(--panel-enter-ease);
}

.panels.is-open .panel {
  transform: none;
}

.panels.is-leaving .panel {
  transform: translate3d(0, calc(100% + var(--panel-pad) + var(--panel-exit-clearance, 0px)), 0);
  transition-timing-function: var(--panel-leave-ease);
  transition-duration: calc(var(--panel-leave-ms) * 1ms);
}

.panels.is-entering .panel,
.panels.is-leaving .panel {
  pointer-events: none;
}

.panels.is-snap .dim,
.panels.is-snap .panel {
  transition-duration: 0s;
}

.aspect-portrait .panel {
  width: 100%;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
}

.panel-close {
  position: relative;
  z-index: 2;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--close);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.panel-close:hover {
  background: var(--close-hover);
}

@media (prefers-reduced-motion: reduce) {
  .dim,
  .panel,
  .designer-step,
  .designer-step.is-in {
    transition-duration: 0s;
  }

  .build-tile {
    transition: none;
  }

  button.build-tile:hover,
  button.build-tile:active:not(:disabled):not([aria-disabled="true"]),
  #plant-list button.build-tile:hover,
  #plant-list button.build-tile:active:not(:disabled):not([aria-disabled="true"]) {
    transform: none;
    box-shadow: none;
  }
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

#build-panel .panel-body,
#manage-panel .panel-body {
  flex: 1 1 auto;
}

#account-panel .panel-body,
#account-view-panel .panel-body,
#alliance-view-panel .panel-body {
  overflow: visible;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-actions > * {
  flex: 1;
  min-width: 0;
}

.account-view-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.account-name-link {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-align: left;
}

.panel-body button {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

.news-body-col {
  flex: 1;
  min-height: 0;
}

.news-article {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
  color: var(--ink);
  border-radius: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-article h3,
#news-headline {
  margin: 0;
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 700;
}

.news-summary {
  margin: 0;
  color: var(--muted);
}

.news-md {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.news-md h1,
.news-md h2,
.news-md h3 {
  margin: 0.4em 0 0.2em;
  color: var(--ink);
  font-weight: 700;
}

.news-md h1 {
  font-size: 22px;
  color: var(--accent);
}

.news-md h2 {
  font-size: 20px;
}

.news-md h3 {
  font-size: 18px;
}

.news-md p,
.news-md ul,
.news-md ol,
.news-md blockquote {
  margin: 0 0 0.6em;
}

.news-md ul,
.news-md ol {
  padding-left: 1.4em;
}

.news-md blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  font-style: italic;
}

.news-md code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

.news-md a {
  color: var(--accent);
}

.news-list-scroll {
  height: 220px;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 0 0 220px;
  /* The list sits at the bottom of the sheet; the open article takes whatever is above it. */
  margin-top: auto;
}

.news-article,
.news-list-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}

.news-article::-webkit-scrollbar,
.news-list-scroll::-webkit-scrollbar {
  width: 8px;
}

.news-article::-webkit-scrollbar-track,
.news-list-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.news-article::-webkit-scrollbar-thumb,
.news-list-scroll::-webkit-scrollbar-thumb {
  background: var(--scroll);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

.news-article::-webkit-scrollbar-thumb:hover,
.news-list-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--scroll-hover);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 8px;
}

.news-row {
  display: block;
  width: 100%;
  min-height: 56px;
  text-align: left;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.news-row.selected {
  background: var(--news-selected);
  border-color: var(--accent);
}

.news-row-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.news-row-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.title-mark {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  flex: 0 0 10px;
  border-radius: 8px;
  background: var(--close);
}

.news-row-title {
  flex: 1;
  min-width: 0;
}

.news-row-age {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.news-row-sub {
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#alliance-panel .panel-body {
  flex: 1 1 auto;
  overflow: auto;
}

.alliance-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

#alliance-out {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#alliance-create-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#alliance-create-wrap[hidden] {
  display: none;
}

.alliance-create {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alliance-create[hidden] {
  display: none;
}

.alliance-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.alliance-actions-end {
  justify-content: flex-end;
}

.alliance-actions .btn {
  flex: 0 0 auto;
  width: auto;
}

#alliance-preview-actions {
  margin-top: auto;
}

#alliance-preview-actions[hidden] {
  display: none;
}

.alliance-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alliance-row {
  display: block;
  width: 100%;
  min-height: 48px;
  text-align: left;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.alliance-row-title {
  font-weight: 600;
}

.alliance-row-sub,
.alliance-role,
.alliance-count,
.alliance-member-role,
.alliance-names {
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alliance-view-member {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.alliance-view-member .account-name-link {
  color: var(--ink);
}

.alliance-view-role {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.alliance-heading {
  font-weight: 600;
}

#alliance-in {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-tabs {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  overflow: visible;
}

.panel-tabs[hidden] {
  display: none;
}

.panel-tab {
  position: relative;
  overflow: visible;
  flex: 1;
  min-width: 0;
}

.panel-tab[hidden] {
  display: none;
}

.panel-tab[aria-selected="true"] {
  border-color: var(--accent);
}

.panel-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-pane[hidden] {
  display: none;
}

.alliance-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alliance-edit[hidden] {
  display: none;
}

#alliance-notices-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#alliance-notices-view[hidden] {
  display: none;
}

#alliance-notice-create-open {
  align-self: flex-start;
  width: auto;
}

.alliance-notice-article {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
  color: var(--ink);
  border-radius: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 44px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alliance-notice-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#alliance-notice-headline {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

#alliance-notice-headline .account-name-link {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: none;
}

.alliance-notice-age {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.alliance-notice-md {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.alliance-notice-md h1,
.alliance-notice-md h2,
.alliance-notice-md h3 {
  margin: 0.4em 0 0.2em;
  color: var(--ink);
  font-weight: 700;
}

.alliance-notice-md h1 {
  font-size: 22px;
}

.alliance-notice-md h2 {
  font-size: 20px;
}

.alliance-notice-md h3 {
  font-size: 18px;
}

.alliance-notice-md p,
.alliance-notice-md ul,
.alliance-notice-md ol,
.alliance-notice-md blockquote {
  margin: 0 0 0.6em;
}

.alliance-notice-md ul,
.alliance-notice-md ol {
  padding-left: 1.4em;
}

.alliance-notice-md blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  font-style: italic;
}

.alliance-notice-md code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

.alliance-notice-md a {
  color: var(--accent);
}

.alliance-notice-delete,
.panel-body button.alliance-notice-delete,
.panel-body button.btn.negative.alliance-notice-delete {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  font-size: 18px;
  line-height: 1;
}

.alliance-notice-list-scroll {
  height: auto;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 0 1 auto;
}

.alliance-notice-article,
.alliance-notice-list-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}

.alliance-notice-article::-webkit-scrollbar,
.alliance-notice-list-scroll::-webkit-scrollbar {
  width: 8px;
}

.alliance-notice-article::-webkit-scrollbar-track,
.alliance-notice-list-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.alliance-notice-article::-webkit-scrollbar-thumb,
.alliance-notice-list-scroll::-webkit-scrollbar-thumb {
  background: var(--scroll);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

.alliance-notice-article::-webkit-scrollbar-thumb:hover,
.alliance-notice-list-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--scroll-hover);
}

.alliance-notice-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 8px;
}

.alliance-notice-row {
  display: block;
  width: 100%;
  min-height: 56px;
  text-align: left;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.alliance-notice-row.selected {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
}

.alliance-notice-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alliance-notice-row-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alliance-notice-row-title {
  flex: 1;
  min-width: 0;
}

.alliance-notice-row-sub {
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#alliance-notice-form.alliance-notice-compose {
  flex: 1 1 auto;
  min-height: 0;
}

#alliance-notice-form.alliance-notice-compose label {
  flex: 1 1 auto;
  min-height: 0;
}

#alliance-notice-body {
  flex: 1 1 auto;
  min-height: 12em;
}

#alliance-panel.alliance-notices-read .panel,
#alliance-panel.alliance-notices-read .alliance-body,
#alliance-panel.alliance-notices-read #alliance-in,
#alliance-panel.alliance-notices-read #alliance-tab-notices,
#alliance-panel.alliance-notices-read #alliance-notices-view,
#alliance-panel.alliance-notices-read .alliance-notice-article {
  flex: 0 1 auto;
}

#alliance-panel.alliance-notices-read .panel-body {
  overflow: hidden;
}

#alliance-panel.alliance-notices-read #alliance-tab-notices {
  overflow: hidden;
}

#alliance-panel.alliance-notices-read .alliance-notice-list-scroll {
  height: 220px;
  max-height: 220px;
  flex: 0 0 220px;
}

#alliance-panel.alliance-notices-compose .panel,
#alliance-panel.alliance-notices-compose .alliance-body,
#alliance-panel.alliance-notices-compose #alliance-in,
#alliance-panel.alliance-notices-compose #alliance-tab-notices,
#alliance-panel.alliance-notices-compose #alliance-notice-form {
  flex: 1 1 auto;
}

#alliance-panel.alliance-notices-compose .panel-body {
  overflow: hidden;
}

#alliance-panel.alliance-notices-compose #alliance-tab-notices {
  overflow: hidden;
}

.alliance-profile,
.alliance-roster {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alliance-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.alliance-member-copy {
  min-width: 0;
}

.alliance-member-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.alliance-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alliance-feed-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.alliance-feed-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alliance-feed-who {
  flex: 1;
  min-width: 0;
}

.alliance-feed-when {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.alliance-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.alliance-matrix-table th,
.alliance-matrix-table td {
  padding: 4px 6px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.alliance-matrix-table th:first-child,
.alliance-matrix-table td:first-child {
  text-align: left;
}

html.aspect-portrait,
html.aspect-portrait body {
  font-size: 14px;
}

.aspect-portrait .top-bar {
  padding: 4px 8px 6px;
}

.aspect-portrait .chips {
  width: 100%;
  gap: 4px;
}

.aspect-portrait .chip {
  min-width: 0;
  max-width: none;
  gap: 1px;
}

.aspect-portrait .chip .chip-name {
  font-size: 11px;
}

.aspect-portrait .chip .chip-well,
.aspect-portrait .chip .chip-qty {
  height: 22px;
  font-size: 11px;
}

.aspect-portrait .chip .chip-qty {
  padding-left: 4px;
}

.aspect-portrait .screen-play {
  --corner-clock-width: 160px;
}

.aspect-portrait .play-top-hud {
  top: calc(100% + 4px);
  left: 8px;
}

.aspect-portrait .debug-chip {
  padding: 4px 8px;
  font-size: 11px;
}

.aspect-portrait .debug-panel {
  width: 168px;
  padding: 8px 10px;
  font-size: 11px;
}

.aspect-portrait .debug-ground-maps {
  width: 140px;
}

.aspect-portrait .dialogue-bust {
  width: 128px;
  height: 128px;
  flex-basis: 128px;
}

@media (prefers-reduced-motion: reduce) {
  .dialogue-bust {
    transform: none;
  }
}

.aspect-portrait .settings-btn,
.aspect-portrait .debug-btn {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.aspect-portrait .account-chip {
  padding: 4px 8px;
  font-size: 13px;
}

.aspect-portrait .morale-chip {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.aspect-portrait .morale-progress {
  height: 32px;
}

.aspect-portrait .morale-chip-face {
  font-size: 16px;
}

.aspect-portrait .morale-chip-label {
  font-size: 11px;
}

.aspect-portrait .menu-bar {
  padding: 6px;
}

.aspect-portrait .menu-bar button {
  min-height: 40px;
  padding: 6px 10px;
}

#turn-phone {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  margin: 0;
  background: var(--ink);
  color: var(--panel);
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  pointer-events: auto;
}

html.phone-landscape #turn-phone {
  display: flex;
}

.screen-designer {
  min-height: 100%;
  height: 100dvh;
  pointer-events: none;
  background: transparent;
}

.screen-designer .panels {
  pointer-events: none;
}

.screen-designer .panel {
  pointer-events: auto;
}

button.secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.royal-slot {
  position: relative;
  width: 180px;
  height: 260px;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 auto;
  background: #f6f1e5;
}

.royal-plate {
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: pixelated;
  pointer-events: none;
}

.designer-tabs {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  width: var(--float-width);
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 12px;
  pointer-events: auto;
}

.aspect-portrait .designer-tabs {
  width: 100%;
  padding: 0 16px 12px;
}

.designer-tab {
  flex: 1;
}

.designer-editors {
  display: grid;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.designer-pane {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  overflow: hidden;
}

.designer-pane.is-off {
  visibility: hidden;
  pointer-events: none;
}

.designer-actions {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 8px;
  flex: 0 0 auto;
  padding-top: 8px;
}

.designer-actions button {
  width: 100%;
}

.screen-designer .designer-step {
  transition: transform 500ms ease-in;
}

.screen-designer .designer-step.is-out {
  transform: translate3d(0, calc(100% + var(--panel-pad)), 0);
}

.screen-designer .designer-step.is-in {
  transform: none;
  transition-duration: 300ms;
  transition-timing-function: ease-out;
}

.designer-lead-q,
.designer-names-lead {
  margin: 0;
  text-align: center;
  font-size: 1.15rem;
}

.designer-lead-picks {
  margin: 8px 0 4px;
}

.designer-names-line {
  margin: 8px 0 0;
  text-align: center;
  line-height: 1.55;
}

.panel-body button.designer-name {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: #1565c0;
  text-decoration: underline;
  cursor: pointer;
}

.designer-name-input {
  display: inline;
  width: auto;
  max-width: 14rem;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid #1565c0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: #1565c0;
}

.designer-child-controls {
  --designer-check: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin: 12px auto 0;
}

.child-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}

.child-sex {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.child-sex .btn {
  flex: 0 0 auto;
  min-height: var(--designer-check);
  box-sizing: border-box;
}

.child-toolbar #child-reroll {
  flex: 0 0 auto;
  margin-left: auto;
  width: auto;
}

.child-inherit {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.child-inherit-label {
  width: 13rem;
}

.child-inherit-pick {
  width: calc((100% - 13rem) / 5);
}

.child-inherit th,
.child-inherit td {
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}

.child-inherit thead th {
  font-weight: 500;
}

.child-inherit thead th:first-child,
.child-inherit .child-inherit-who {
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

input:where([type="checkbox"]) {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--bg);
  vertical-align: middle;
  cursor: pointer;
}

input:where([type="checkbox"]:checked) {
  background: var(--accent);
}

input:where([type="checkbox"]:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:where([type="checkbox"]:disabled) {
  cursor: not-allowed;
}

input:where([type="checkbox"])::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -2px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
}

input:where([type="checkbox"]:checked)::after {
  transform: rotate(45deg) scale(1);
}

.child-inherit input[type="checkbox"] {
  width: var(--designer-check);
  height: var(--designer-check);
  margin: 0 auto;
}

.child-inherit input[type="checkbox"]::after {
  width: 9px;
  height: 16px;
  margin-top: -3px;
  border-width: 0 3px 3px 0;
}

.trait-col {
  width: 100%;
  max-width: 100%;
  flex: 0 1 auto;
  overflow-x: hidden;
  overflow-y: visible;
}

.trait-table {
  --trait-control-h: 32px;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.trait-table th {
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  width: 7.25rem;
  padding: 5px 12px 5px 0;
  vertical-align: middle;
}

.trait-table td {
  padding: 5px 0;
  vertical-align: middle;
}

.trait-pair {
  display: flex;
  gap: 8px;
  align-items: center;
}

.trait-pair > * {
  flex: 1;
  min-width: 0;
}

.trait-pair .trait-swatches {
  flex: 0 0 auto;
}

.trait-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.trait-stack .trait-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
}

.trait-stack .trait-swatches {
  width: 100%;
  min-width: 0;
}

.trait-stack .trait-swatches-wide .trait-swatch,
.panel-body .trait-stack .trait-swatches-wide .trait-swatch {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.trait-table tr:has(.trait-stack) th {
  vertical-align: top;
}

.trait-swatches {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: stretch;
  height: var(--trait-control-h);
}

.trait-swatches-fill {
  width: 100%;
}

.trait-swatch,
.panel-body .trait-swatch {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  height: var(--trait-control-h);
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, #000 22%, var(--swatch, var(--line)));
  border-radius: 3px;
  background: var(--swatch, var(--bg));
  color: inherit;
  display: grid;
  place-content: center;
  cursor: pointer;
}

.trait-swatches-fill .trait-swatch,
.panel-body .trait-swatches-fill .trait-swatch {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.trait-swatches-wide .trait-swatch,
.panel-body .trait-swatches-wide .trait-swatch {
  flex: 0 0 auto;
  width: calc(2 * var(--trait-control-h));
}

.trait-swatch:checked::after,
.panel-body .trait-swatch:checked::after {
  content: "✓";
  font-size: calc(var(--trait-control-h) * 0.62);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  border: 0;
  transform: none;
  width: auto;
  height: auto;
  margin: 0;
}

.trait-swatch:checked,
.panel-body .trait-swatch:checked {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.trait-picks {
  display: flex;
  gap: 6px;
  width: 100%;
}

.trait-picks .trait-pick {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
}

.trait-table input,
.trait-table select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.trait-table input[type="range"] {
  --track: 6px;
  --thumb: 28px;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--thumb);
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  min-width: 0;
  max-width: 100%;
}

.trait-table input[type="range"]::-webkit-slider-runnable-track {
  height: var(--track);
  border: 0;
  border-radius: 99px;
  background: var(--line);
}

.trait-table input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2);
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.trait-table input[type="range"]::-moz-range-track {
  height: var(--track);
  border: 0;
  border-radius: 99px;
  background: var(--line);
}

.trait-table input[type="range"]::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.trait-table select {
  height: var(--trait-control-h);
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0 8px;
}

#family-panel .panel-body,
#inventory-panel .panel-body,
#morale-panel .panel-body,
#settings-panel .panel-body {
  flex: 1 1 auto;
  min-height: 0;
}

#family-panel .panel-body,
#inventory-panel .panel-body,
#morale-panel .panel-body {
  overflow: auto;
  overscroll-behavior: contain;
}

#morale-title {
  margin: 0;
}

#settings-panel .panel-pane {
  overscroll-behavior: contain;
}

.settings-body {
  gap: 12px;
}

.settings-card {
  border: 1px solid var(--line);
  background: var(--bg);
}

.settings-report {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-form,
.report-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-form h3 {
  margin: 0;
}

.report-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Reports tab: one list of followed tickets, each card tinted by status. */
.report-filter {
  display: flex;
  flex-direction: row;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.report-filter[hidden] {
  display: none;
}

.report-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-card {
  --status: #8a8f98;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 8px 10px 8px 12px;
  text-align: left;
  border-radius: 8px;
  color: var(--ink);
}

/* Beats the sheet's plain button look. */
.panel-body button.report-card {
  border: 0;
  border-left: 4px solid var(--status);
  background: color-mix(in srgb, var(--status) 18%, transparent);
}

.report-accepted {
  --status: #3d8bd9;
}

.report-in_progress {
  --status: var(--warn);
}

.report-pending_release {
  --status: #3fae5a;
}

.report-released {
  --status: #1fa58f;
}

.report-rejected,
.report-withdrawn {
  --status: var(--btn-negative);
}

.report-card-title {
  font-weight: 400;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 14px;
}

.report-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.report-card.is-stamped .report-card-title,
.report-card.is-stamped .report-card-meta {
  padding-right: 104px;
}

/* A done ticket's rubber stamp: tilted, outlined in the status color, a little worn. */
.report-stamp {
  position: absolute;
  top: 50%;
  right: 22px;
  padding: 2px 8px;
  border: 3px double var(--status);
  border-radius: 6px;
  color: var(--status);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
  opacity: 0.85;
  transform: translateY(-50%) rotate(-12deg);
  mix-blend-mode: screen;
  pointer-events: none;
}

.report-stamp.is-new {
  animation: report-stamp-slam 360ms cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes report-stamp-slam {
  from {
    opacity: 0;
    transform: translateY(-50%) rotate(-24deg) scale(2.2);
  }
  to {
    opacity: 0.85;
    transform: translateY(-50%) rotate(-12deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .report-stamp.is-new {
    animation: none;
  }
}

.report-card-dot {
  position: absolute;
  top: 8px;
  right: 8px;
}

.report-sent {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.report-sent p {
  margin: 0;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
}

.settings-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
}

#settings-audio-reset {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 12px;
}

.settings-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 14px;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.settings-title {
  font-size: 0.9rem;
}

.settings-row .settings-title {
  flex: 1 1 8rem;
  min-width: 8rem;
}

.settings-fps-readout {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.settings-card input[type="range"],
.debug-panel input[type="range"],
#debug-chip input[type="range"] {
  --fill: 0%;
  --track: 6px;
  --thumb: 16px;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--thumb);
  margin: 4px 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0;
  line-height: 0;
}

.settings-card input[type="range"]::-webkit-slider-runnable-track,
.debug-panel input[type="range"]::-webkit-slider-runnable-track,
#debug-chip input[type="range"]::-webkit-slider-runnable-track {
  height: var(--track);
  border: 0;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) var(--fill),
    var(--line) var(--fill)
  );
}

.settings-card input[type="range"]::-webkit-slider-thumb,
.debug-panel input[type="range"]::-webkit-slider-thumb,
#debug-chip input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2);
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.settings-card input[type="range"]::-moz-range-track,
.debug-panel input[type="range"]::-moz-range-track,
#debug-chip input[type="range"]::-moz-range-track {
  height: var(--track);
  border: 0;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) var(--fill),
    var(--line) var(--fill)
  );
}

.settings-card input[type="range"]::-moz-range-thumb,
.debug-panel input[type="range"]::-moz-range-thumb,
#debug-chip input[type="range"]::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.settings-check-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(40px, auto));
  grid-auto-flow: column;
  gap: 8px 10px;
  margin-top: 4px;
}

.settings-check-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 55%, var(--bg));
  font-size: 0.9rem;
  cursor: pointer;
}

.settings-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.settings-check:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-check:has(input:disabled) {
  cursor: not-allowed;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-language-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#settings-langs button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 55%, var(--bg));
}

#settings-langs button::after {
  content: "✓";
  font-weight: 700;
  visibility: hidden;
}

#settings-langs button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

#settings-langs button[aria-pressed="true"]::after {
  visibility: visible;
}

#settings-langs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-dead {
  opacity: 0.45;
}

.settings-janky {
  color: #8b5a2b;
}

.settings-sexy,
.settings-maxed {
  color: #b44cff;
}

.settings-muted {
  color: #e05050;
}

.inv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.family-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.family-detail {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.family-detail-title {
  font-weight: 650;
}

.family-detail-body {
  color: var(--muted);
  margin-top: 4px;
}

.aspect-portrait .royal-slot {
  width: min(180px, 28vw);
  height: calc(min(180px, 28vw) * 260 / 180);
}

.morale-scale {
  margin: 0 0 12px;
}

.morale-scale-track {
  position: relative;
  display: flex;
  gap: 2px;
  min-height: 47px;
  padding-top: 8px;
  overflow: visible;
}

.morale-seg,
.panel-body button.morale-seg {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  font-size: 18px;
  line-height: 1;
  background: var(--chip-well);
  color: var(--ink);
  border: 1px solid var(--line);
  overflow: visible;
}

.morale-seg.is-current,
.panel-body button.morale-seg.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.morale-caret {
  position: absolute;
  top: -6px;
  z-index: 1;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid var(--ink);
  transform: translateX(-50%);
  pointer-events: none;
}

.morale-impacts-title {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.morale-impacts {
  margin: 4px 0 8px;
  padding-left: 1.2em;
}

.morale-cols {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.morale-col {
  flex: 1 1 0;
  min-width: 0;
}

.morale-col h3,
.morale-improve h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.morale-col-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.morale-improve {
  margin-top: 12px;
}

/* Play chrome. Tokens stay on .screen-play so title, login, and the designer keep the paper set. */
.screen-play {
  --float-width: 640px;
  /* Non-portrait caps the resource row and the chip row here and centers them.
     The clock query below matches this same 960px with a literal. */
  --play-top-band: 960px;
  --play-top-inset: 12px;
  /* The clock holds this width so the account and morale row can stop short of it. */
  --corner-clock-width: 184px;
  --corner-clock-reserve: 0px;
  --panel-fixed-max: 745px;
  --panel-inset: 14px;
  --control-height: 32px;
  --compact-control-height: 24px;
  --icon-control-size: 30px;
  --control-text-size: 14px;
  --panel-title-size: 24px;
  --surface-0: #141c22;
  --surface-1: #1b262d;
  --surface-2: #24323c;
  --surface-3: #2e3e4a;
  --play-line: rgba(181, 204, 215, 0.22);
  --play-line-strong: rgba(192, 209, 214, 0.48);
  --text: #f4f7f8;
  --text-dim: #d5dee4;
  --text-mute: #b3c9dc;
  --gold-200: #ffe18a;
  --gold-400: #f4c75f;
  --gold-500: #d4a44a;
  --gold-700: #c49238;
  --gold-ink: #1c1408;
  --olive: #3c3624;
  --olive-line: #c6a45a;
  --info: #78d5fa;
  --info-deep: #4a92dc;
  --alert: #ff858c;
  --alert-ink: #1a0a0c;
  --ok: #3dbe78;
  --ok-bg: #173d2c;
  --ok-text: #b2f3d5;
  --track: #2a3b45;
  --shadow-card: 0 2px 5px #0009, inset 0 0 0 2px #0b151944, inset 0 1px 0 #ffffff20;
  --shadow-sheet: 0 3px 9px #0009, inset 0 0 0 2px #0b151944, inset 0 1px 0 #ffffff15;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Barlow Semi Condensed", "Segoe UI", system-ui, sans-serif;
  --bg: var(--surface-0);
  --panel: var(--surface-1);
  --ink: var(--text);
  --muted: var(--text-mute);
  --line: var(--play-line);
  --accent: var(--gold-400);
  --on-accent: var(--gold-ink);
  --danger: var(--alert);
  --chrome: #19272df5;
  --chip-well: #1b2b34;
  --chip-fill: #71603c;
  --chip-fill-work: #94804b;
  --btn-positive: var(--gold-500);
  --btn-positive-ink: var(--gold-ink);
  --btn-positive-fill: #ffdf813d;
  --btn-negative: #b84d56;
  --btn-negative-ink: var(--text);
  --btn-negative-fill: #ff858c33;
  --btn-neutral: var(--surface-2);
  --btn-neutral-ink: var(--text);
  --btn-neutral-fill: #bad8ef20;
  --scroll: #b5ccd738;
  --scroll-hover: #b5ccd760;
  --news-selected: #f4c75f18;
  --shadow: 0 4px 16px #0007;
  --ms-turn: 1400ms;
  --chat-dock-tablet: min(380px, 38vw);
  --chat-list: 120px;
  --chat-thread: clamp(280px, 25vw, 380px);
  --chat-dock-landscape: calc(var(--chat-list) + var(--chat-thread));
  color-scheme: dark;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
}

.screen-play .i {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
  filter: drop-shadow(0 2px 1px #000a);
}

.screen-play button:focus-visible {
  outline: none;
}

.screen-play .btn,
.screen-play .tab,
.screen-play .trait,
.screen-play .dest-item,
.screen-play .tool,
.screen-play .res,
.screen-play .clock,
.screen-play .pill,
.screen-play .member-meta,
.screen-play .xp-line,
.screen-play .card-meta,
.screen-play .card-line,
.screen-play .card-status,
.screen-play .menu-bar button,
.screen-play .city-play-btns button {
  font-family: var(--font-ui);
}

.screen-play button.btn {
  gap: 6px;
  min-height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--play-line-strong);
  border-radius: 5px;
  font-weight: 600;
  font-size: var(--control-text-size);
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 1px 1px #ffffff24, 0 1px 2px #0005;
}

.screen-play button.btn.positive {
  background-color: var(--gold-500);
  background-image: linear-gradient(#f6d16e, #c9963c);
  color: var(--gold-ink);
  border-color: #f4d780;
}

.screen-play button.btn.neutral {
  background-color: #1e2e3a;
  background-image: linear-gradient(#2a3c48, #192832);
  color: var(--text);
  text-shadow: 0 2px 2px #000b;
}

.screen-play button.btn.negative {
  background-color: #e15a62;
  background-image: linear-gradient(#f07078, #e15a62);
  color: var(--alert-ink);
  border-color: #b43e46;
}

.screen-play button.btn:disabled,
.screen-play button.btn[aria-disabled="true"] {
  opacity: 1;
  filter: saturate(0.35) brightness(0.85);
}

.screen-play button.btn.compact {
  min-height: var(--compact-control-height);
  padding: 0 10px;
  font-size: 13px;
}

.screen-play .icon-btn {
  width: var(--icon-control-size);
  height: var(--icon-control-size);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--play-line-strong);
  background: linear-gradient(#29393e, #17252b);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.screen-play .icon-btn .i {
  width: 20px;
  height: 20px;
}

.screen-play .hud-bar,
.screen-play .top-bar {
  padding: 6px 10px;
  background: linear-gradient(105deg, #283637f5, #16252bf5);
  border: 1px solid var(--play-line-strong);
  border-radius: 9px;
  box-shadow: inset 0 1px 2px #ffffff18, 0 2px 4px #0004;
  color: var(--text);
}

.screen-play .top-bar {
  flex: 1;
  margin: 8px var(--play-top-inset) 0;
}

/* 960px matches --play-top-band. A container query does not resolve var().
   Under that width the clock stays in the corner. The row's own width is the measure, so an
   open radio dock can drop the clock back out. The clock fills the row so it reads as one band
   with the resource bar. Only the bar and the clock set the row's height: the tools stack and
   the debug stack are overlays, so an open debug panel or the dev debug button cannot stretch
   the bar. */
@container play-top style(--top-band: yes) and (min-width: 960px) {
  .play-top-row > .top-bar {
    margin: 8px 0 0 var(--play-top-inset);
  }

  /* The band joins the clock and tools to the resource bar. Before the first resource the bar
     is hidden and they stay in the corner, beside the account and morale row. */
  .play-top-row:has(> .top-bar:not([hidden])) > .play-top-controls {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    align-items: stretch;
    margin: 8px var(--play-top-inset) 0 0;
    padding-right: calc(var(--icon-control-size) + 8px);
  }

  .screen-play:has(.panels:not([hidden])) > .play-top-row:has(> .top-bar:not([hidden])) > .play-top-controls {
    display: flex;
  }

  .play-top-row:has(> .top-bar:not([hidden])) > .play-top-hud .play-left-cluster {
    margin-right: 0;
  }

  .play-top-row:has(> .top-bar:not([hidden])) > .play-top-controls > .hud-tools {
    position: absolute;
    top: 0;
    right: 0;
  }

  .play-top-row:has(> .top-bar:not([hidden])) .play-right {
    position: relative;
    align-self: stretch;
    gap: 0;
  }

  .play-top-row:has(> .top-bar:not([hidden])) .play-right > .clock {
    flex: 1 1 auto;
  }
}

.screen-play .chips {
  justify-content: space-between;
  gap: 12px;
}

.screen-play .res {
  --res-icon-size: 24px;
  flex: 1;
  display: grid;
  grid-template-columns: var(--res-icon-size) minmax(0, 1fr);
  align-items: center;
  gap: 0 5px;
  min-width: 0;
  color: var(--gold-200);
  pointer-events: none;
}

.screen-play .res .i {
  grid-column: 1;
  grid-row: 1;
  width: var(--res-icon-size);
  height: var(--res-icon-size);
}

.screen-play .res-copy {
  display: contents;
}

.screen-play .res-name {
  grid-column: 2;
  grid-row: 1;
  color: #d1dfeb;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.screen-play .res-line {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text);
  white-space: nowrap;
}

.screen-play .res-val {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.screen-play .res-flag {
  font-weight: 500;
  font-size: 12px;
  color: var(--gold-200);
}

/* Sky clock. The lens is the phase and the weather in one picture; the copy is hudClock().
   hud.js paints data-phase, data-weather, data-lamps, --solar, and is-turning for --ms-turn. */
.screen-play .clock {
  width: var(--corner-clock-width);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px 0 0;
  --clock-line: var(--play-line-strong);
  border: 1px solid var(--clock-line);
  border-radius: 8px;
  background-color: #22302f;
  background-image: linear-gradient(120deg, #ffffff12, #00000045);
  /* The same shadow as .hud-bar beside it, not the heavier card shadow. */
  box-shadow: inset 0 1px 2px #ffffff18, 0 2px 4px #0004;
  color: var(--text);
  text-align: left;
  transition: background-color var(--ms-turn) ease, border-color var(--ms-turn) ease;
}

.screen-play:has(.day-clock:not([hidden])) {
  --corner-clock-reserve: calc(var(--corner-clock-width) + 8px);
}

.screen-play .clock[hidden] {
  display: none;
}

.screen-play .clock[data-phase="night"] {
  background-color: #141c30;
  --clock-line: #7b8fc599;
}

.screen-play .clock-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 5px 0;
}

.screen-play .clock.is-turning .clock-copy {
  animation: clock-copy-swap var(--ms-turn) ease;
}

.screen-play .clock-time {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.screen-play .clock-sub {
  /* The width of "daybreak in 18m 00s", its longest value, so the box holds still. */
  min-width: 17ch;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-dim);
}

.screen-play .clock-sky {
  --lens: 48px;
  --r: calc(var(--lens) * 0.36);
  --ang: calc((var(--solar) - 0.25) * 1turn);
  position: relative;
  flex: none;
  align-self: stretch;
  width: var(--lens);
  min-height: var(--lens);
  border-radius: 7px 0 0 7px;
  border-right: 1px solid var(--clock-line);
  overflow: hidden;
  box-shadow: inset -1px 0 0 #0007;
  background: #4aa3e6;
  background-clip: padding-box;
  isolation: isolate;
  transition: --solar 400ms linear;
}

.screen-play .clock.is-turning .clock-sky {
  transition-duration: var(--ms-turn);
  transition-timing-function: cubic-bezier(0.5, 0, 0.3, 1);
}

.screen-play .clock-sky > :where(span) {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen-play .sky-day {
  background: linear-gradient(#3f9be3, #9fd3f2 58%, #e6cf8e);
}

.screen-play .sky-night {
  background: linear-gradient(#070c22, #16234b 60%, #2a3a66);
  opacity: 0;
  transition: opacity var(--ms-turn) ease;
}

.screen-play .clock[data-phase="night"] .sky-night {
  opacity: 1;
}

.screen-play .sky-stars {
  background:
    radial-gradient(1.4px 1.4px at 18% 22%, #fff 95%, transparent),
    radial-gradient(1px 1px at 38% 12%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 62% 30%, #fff, transparent),
    radial-gradient(1px 1px at 80% 16%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 72% 44%, #fff, transparent),
    radial-gradient(1px 1px at 28% 46%, #fff, transparent),
    radial-gradient(1px 1px at 50% 36%, #fffb, transparent),
    radial-gradient(1px 1px at 12% 40%, #fffb, transparent);
  opacity: 0;
  transition: opacity calc(var(--ms-turn) * 0.6) ease calc(var(--ms-turn) * 0.4);
}

.screen-play .clock[data-phase="night"] .sky-stars {
  opacity: 1;
  animation: clock-twinkle 3.2s ease-in-out infinite alternate;
}

.screen-play .sky-sun,
.screen-play .sky-moon {
  inset: auto;
  left: 50%;
  top: 64%;
  border-radius: 50%;
}

.screen-play .sky-sun {
  width: calc(var(--lens) * 0.3);
  height: calc(var(--lens) * 0.3);
  margin: calc(var(--lens) * -0.15);
  background: radial-gradient(circle at 40% 40%, #fff8d6, #ffd65e 55%, #f0a640);
  box-shadow: 0 0 calc(var(--lens) * 0.18) #ffcf5a99;
  transform: translate(calc(cos(var(--ang)) * var(--r)), calc(sin(var(--ang)) * var(--r) * -1));
}

.screen-play .sky-moon {
  --ang-m: calc(var(--ang) + 0.5turn);
  width: calc(var(--lens) * 0.24);
  height: calc(var(--lens) * 0.24);
  margin: calc(var(--lens) * -0.12);
  background: radial-gradient(circle at 35% 35%, #ffffff, #d9e2f5 60%, #a9b8dc);
  box-shadow: 0 0 calc(var(--lens) * 0.16) #bcd0ff66, inset calc(var(--lens) * -0.06) calc(var(--lens) * -0.04) 0 0 #5f6f9e;
  transform: translate(calc(cos(var(--ang-m)) * var(--r)), calc(sin(var(--ang-m)) * var(--r) * -1));
}

.screen-play .sky-dusk {
  background: linear-gradient(transparent 25%, #ff7a3a99 62%, #ffc76e 78%);
  opacity: 0;
  mix-blend-mode: screen;
}

.screen-play .clock.is-turning .sky-dusk {
  animation: clock-dusk-band var(--ms-turn) ease-in-out;
}

.screen-play .sky-ground {
  top: 62%;
  background: linear-gradient(#324a37, #1b291f);
  clip-path: polygon(0 34%, 10% 34%, 10% 18%, 20% 18%, 20% 30%, 28% 30%, 28% 4%, 33% 0, 38% 4%, 38% 26%, 47% 26%, 47% 14%, 55% 14%, 55% 30%, 64% 30%, 64% 20%, 72% 20%, 72% 32%, 82% 32%, 82% 24%, 90% 24%, 90% 34%, 100% 34%, 100% 100%, 0 100%);
  transition: filter var(--ms-turn) ease;
}

.screen-play .clock[data-phase="night"] .sky-ground {
  filter: brightness(0.35) saturate(0.5);
}

/* Windows follow the city's bulbs (lampGlow), 72s after dusk and off 72s before dawn. */
.screen-play .sky-windows {
  top: 62%;
  background:
    radial-gradient(1.4px 1.4px at 14% 60%, #ffd27a, transparent),
    radial-gradient(1.4px 1.4px at 31% 30%, #ffd27a, transparent),
    radial-gradient(1.4px 1.4px at 34% 52%, #ffe39a, transparent),
    radial-gradient(1.4px 1.4px at 51% 44%, #ffd27a, transparent),
    radial-gradient(1.4px 1.4px at 68% 56%, #ffd27a, transparent),
    radial-gradient(1.4px 1.4px at 86% 58%, #ffe39a, transparent);
  opacity: 0;
  transition: opacity 500ms ease;
}

.screen-play .clock[data-lamps="on"] .sky-windows {
  opacity: 1;
}

.screen-play .sky-cloud {
  inset: auto;
  top: 26%;
  left: 0;
  width: 58%;
  height: 20%;
  border-radius: 999px;
  background: #eef4f9;
  box-shadow: inset 0 calc(var(--lens) * -0.05) calc(var(--lens) * 0.06) #9db2c5aa;
  opacity: 0;
  transition: opacity 600ms ease, filter var(--ms-turn) ease;
  animation: clock-cloud-drift 18s linear infinite;
}

.screen-play .sky-cloud::before {
  content: "";
  position: absolute;
  left: 24%;
  top: -60%;
  width: 44%;
  height: 140%;
  border-radius: 50%;
  background: inherit;
  box-shadow: inherit;
}

.screen-play .sky-cloud.c2 { top: 44%; width: 44%; height: 16%; animation-duration: 26s; animation-delay: -9s; }
.screen-play .sky-cloud.c3 { top: 10%; width: 52%; height: 18%; animation-duration: 21s; animation-delay: -14s; }
.screen-play .sky-cloud.c4 { top: 34%; width: 62%; height: 20%; animation-duration: 17s; animation-delay: -5s; }
.screen-play .sky-cloud.c5 { top: 20%; width: 40%; height: 15%; animation-duration: 29s; animation-delay: -20s; }
.screen-play .sky-cloud.c6 { top: 50%; width: 56%; height: 17%; animation-duration: 23s; animation-delay: -11s; }

.screen-play .clock:is([data-weather="cloud"], [data-weather="rain"], [data-weather="storm"]) .sky-cloud {
  opacity: 0.95;
}

.screen-play .clock:not([data-weather="storm"]) .sky-cloud.storm-only {
  opacity: 0;
}

.screen-play .clock[data-weather="storm"] .sky-cloud {
  filter: brightness(0.5) saturate(0.6);
}

.screen-play .clock[data-phase="night"] .sky-cloud {
  filter: brightness(0.45);
}

.screen-play .clock[data-phase="night"][data-weather="storm"] .sky-cloud {
  filter: brightness(0.3);
}

.screen-play .sky-rain {
  --p1: 14px;
  --p2: 19px;
  --x2: 5px;
  inset: -20%;
  transform: skewX(-12deg);
  background-image:
    radial-gradient(0.6px 4.5px at 4.5px 7px, #f0f8ffcc 0, #f0f8ff66 45%, transparent 100%),
    radial-gradient(0.6px 3.5px at 6px 9px, #f0f8ff99 0, #f0f8ff44 45%, transparent 100%);
  background-size: 9px var(--p1), 12px var(--p2);
  background-position: 0 0, var(--x2) 0;
  mask-image: linear-gradient(transparent 22%, #000 42%, #000 72%, transparent 88%);
  opacity: 0;
  transition: opacity 400ms ease;
  animation: clock-rain-fall 0.7s linear infinite;
}

.screen-play .clock:is([data-weather="rain"], [data-weather="storm"]) .sky-rain {
  opacity: 0.5;
}

.screen-play .clock[data-weather="storm"] .sky-rain {
  opacity: 0.65;
  animation-duration: 0.38s;
}

.screen-play .sky-shade {
  background: #1d2c3d;
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 600ms ease;
}

.screen-play .clock[data-weather="cloud"] .sky-shade { opacity: 0.3; }
.screen-play .clock[data-weather="rain"] .sky-shade { opacity: 0.5; }
.screen-play .clock[data-weather="storm"] .sky-shade { opacity: 0.68; }

.aspect-portrait .screen-play .clock {
  gap: 8px;
  min-height: 36px;
  padding: 0 8px 0 0;
  border-radius: 6px;
}

.aspect-portrait .screen-play .clock-copy {
  padding: 3px 0;
}

.aspect-portrait .screen-play .clock-sky {
  --lens: 36px;
  border-radius: 5px 0 0 5px;
}

.aspect-portrait .screen-play .clock-time {
  font-size: 16px;
}

.aspect-portrait .screen-play .clock-sub {
  font-size: 11px;
}

@keyframes clock-copy-swap {
  0%, 100% { opacity: 1; transform: none; }
  40% { opacity: 0; transform: translateY(3px); }
  55% { opacity: 0; transform: translateY(-3px); }
}

@keyframes clock-dusk-band {
  0%, 100% { opacity: 0; }
  45% { opacity: 1; }
}

@keyframes clock-twinkle {
  from { filter: brightness(0.55); }
  to { filter: brightness(1); }
}

@keyframes clock-cloud-drift {
  from { transform: translateX(-110%); }
  to { transform: translateX(190%); }
}

@keyframes clock-rain-fall {
  to { background-position: 0 var(--p1), var(--x2) var(--p2); }
}

.screen-play .menu-bar {
  background: transparent;
}

.screen-play .menu-bar-row {
  padding: 0;
  background: linear-gradient(#293639f5, #18262df5);
  border: 1px solid var(--play-line-strong);
  border-radius: 9px;
  box-shadow: var(--shadow-card);
  gap: 0;
  overflow: visible;
}

.screen-play .menu-bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  min-width: 0;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-right-color: var(--play-line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-shadow: 0 2px 2px #000;
}

.screen-play .menu-bar button .i {
  width: 22px;
  height: 22px;
  color: #d5e0f2;
}

.screen-play .menu-bar button.active,
.screen-play .menu-bar button[aria-current="page"] {
  color: #fff4c7;
  background: linear-gradient(110deg, #89744255, #51452788);
  border-color: var(--gold-400);
  box-shadow: inset 0 0 12px #f3ce6430;
}

.screen-play .menu-bar button.active .i,
.screen-play .menu-bar button[aria-current="page"] .i {
  color: var(--gold-200);
}

html.aspect-portrait .screen-play .menu-bar {
  padding: 0;
}

html.aspect-portrait .screen-play .top-bar {
  margin: 0;
  padding: 4px 8px 5px;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

html.aspect-portrait .screen-play .chips {
  gap: 6px;
}

html.aspect-portrait .screen-play .res {
  --res-icon-size: 18px;
  gap: 0 3px;
}

html.aspect-portrait .screen-play .res-name {
  font-size: 12px;
}

html.aspect-portrait .screen-play .res-line {
  gap: 3px;
}

html.aspect-portrait .screen-play .res-val {
  font-size: 16px;
}

html.aspect-portrait .screen-play .res-flag {
  font-size: 10px;
}

html.aspect-portrait .screen-play .menu-bar-row {
  width: 100%;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

html.aspect-portrait .screen-play .menu-bar button {
  flex-direction: column;
  gap: 3px;
  min-height: 50px;
  padding: 5px 4px;
  font-size: 12px;
}

.screen-play .city-play-btns button,
.screen-play .tool {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--control-height);
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--play-line-strong);
  background: linear-gradient(#2e3c3eec, #17252dee);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow-card);
  text-shadow: 0 2px 2px #000;
}

.screen-play .settings-btn {
  width: var(--icon-control-size);
  height: var(--icon-control-size);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--play-line-strong);
  background: linear-gradient(#2e3c3eec, #17252dee);
  color: #bccce5;
  box-shadow: var(--shadow-card);
}

.screen-play .debug-btn {
  width: 24px;
  height: 24px;
  align-self: flex-end;
}

.screen-play .debug-btn.active {
  border-color: #80a8b4;
  background: linear-gradient(#304955, #1b3038);
}

.screen-play .settings-btn .i {
  width: 22px;
  height: 22px;
}

.screen-play .panel.sheet {
  padding: 8px 14px 10px;
  background: linear-gradient(115deg, #283638f5, #19272df7 70%);
  border: 1px solid var(--play-line-strong);
  border-radius: 9px;
  box-shadow: var(--shadow-sheet);
  color: var(--text);
}

.screen-play .panel h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--panel-title-size);
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 2px 2px #000a;
}

html.aspect-portrait .screen-play .panel.sheet {
  width: 100%;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.screen-play .panel-close {
  flex-basis: var(--icon-control-size);
}

.screen-play .bottom-panel {
  padding-top: calc(var(--panel-pad) + var(--icon-control-size) + 12px);
}

/* Bottom panels hold one height whatever tab or content is showing: the space between the
   top row and the menu bar, capped at --panel-fixed-max. The tab strip stays put when the pane changes. */
.screen-play .bottom-panel .panel {
  flex: 0 0 auto;
  height: min(100%, var(--panel-fixed-max));
}

/* One inset around whatever a bottom sheet holds. The tabline and the close button are
   absolutely positioned, so the padding only moves the content. */
.screen-play .bottom-panel .panel.sheet {
  padding: var(--panel-inset);
}

/* Every tab pane scrolls the same way: the pane is the scroller, with a thin bar that
   keeps its gutter so rows sit at the same width whether or not the pane overflows. */
.screen-play .panel-pane {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.screen-play #alliance-panel:not(.alliance-notices-read) .alliance-notice-list-scroll {
  overflow: visible;
  flex: 0 0 auto;
}

.screen-play .alliance-notice-list {
  padding-right: 0;
}

.screen-play .bottom-panel .panel > .panel-close {
  position: absolute;
  top: calc(-1 * (var(--icon-control-size) + 12px));
  right: 0;
  transform: none;
}

.screen-play .member-copy {
  min-width: 0;
}

.screen-play .account-chip,
.screen-play .debug-btn,
.screen-play .chat-rooms-back,
.screen-play .chat-leave {
  background: linear-gradient(#2a3c48, #192832);
  color: var(--text);
  border: 1px solid var(--play-line-strong);
  border-radius: 5px;
}

.screen-play .menu-bar button:first-child { border-radius: 8px 0 0 8px; }
.screen-play .menu-bar button:last-child { border-radius: 0 8px 8px 0; }

.screen-play .member {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  padding: 6px 3px;
  margin: 0;
  border-top: 1px solid var(--play-line);
  color: var(--text);
}

.screen-play .look {
  position: relative;
  width: 80px;
  height: 82px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: #575b4b;
  overflow: hidden;
  color: inherit;
}

.screen-play .look:disabled { opacity: 1; filter: none; }

.screen-play .look canvas,
.screen-play .look img {
  width: 100%;
  height: 100%;
  display: block;
}

.screen-play .member-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.screen-play .member-name {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 2px 2px #0009;
}

.screen-play .member-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  order: 0;
  flex-wrap: wrap;
}

.screen-play .member-meta {
  margin-left: auto;
  order: 1;
  color: var(--text-mute);
  font-size: 14px;
  white-space: nowrap;
}

.screen-play .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--compact-control-height);
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid #52997766;
  background: linear-gradient(#28543cbb, #173d2c99);
  color: var(--ok-text);
  font-size: 13px;
  white-space: nowrap;
}

.screen-play .xp-line {
  margin: 2px 0;
  color: #c4dbef;
  font-size: 14px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.screen-play .traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.screen-play .trait {
  flex: 1 1 auto;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  min-height: var(--compact-control-height);
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--play-line);
  background: linear-gradient(110deg, #21343d, #1c2c35);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.screen-play .trait::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--fill, 0) * 100%);
  background: linear-gradient(#8e743c99, #67532a99);
  z-index: -1;
  pointer-events: none;
}

.screen-play .trait[data-tone="alert"]::before {
  background: color-mix(in srgb, var(--alert) 30%, transparent);
}

.screen-play .trait.is-locked {
  color: var(--text-mute);
}

.screen-play .meter {
  height: 10px;
  border-radius: 999px;
  border: 1px solid #6c818866;
  background: linear-gradient(#19272d, #24333b);
  box-shadow: inset 0 1px 3px #0005;
  overflow: hidden;
}

.screen-play .meter > span {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  border-radius: inherit;
  background: linear-gradient(#ffe998, #f5bc43 70%, #efb640);
  box-shadow: inset 0 1px 2px #ffffddbb;
  transition: width 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen-play .meter[data-tone="info"] > span {
  background: linear-gradient(#9ce8ff, #56b8ed 60%, #589ddb);
}

.screen-play .meter[data-tone="alert"] > span {
  background: linear-gradient(#ffb1b5, #d96c77);
}

.screen-play .card,
.screen-play .city-sheet.card,
.screen-play .map-cell-sheet {
  background: linear-gradient(120deg, #29393deb, #18262def 65%);
  border: 1.5px solid var(--play-line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  color: var(--text);
}

.screen-play .city-sheet.card {
  width: max-content;
  min-width: 180px;
  max-width: calc(100% - 24px);
  padding: 8px 12px 8px;
}

.screen-play .card[data-tone="info"] { --tone: var(--info); border-color: var(--tone); }
.screen-play .card[data-tone="ready"] { --tone: var(--gold-200); border-color: var(--tone); }
.screen-play .card[data-tone="alert"] { --tone: var(--alert); border-color: var(--tone); }
.screen-play .card[data-tone="warn"] { --tone: var(--warn); border-color: var(--tone); }
.screen-play .card[data-tone="ok"] { --tone: var(--ok); border-color: var(--tone); }

.screen-play .production-orbit { display: none; }

.screen-play .card[data-producing] > .production-orbit {
  display: block;
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.screen-play .production-orbit::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 45deg, transparent 0deg 275deg, #78d5fa20 300deg, #a5e8ff80 330deg, #e3faffcc 345deg, transparent 360deg);
  animation: production-orbit 8s linear infinite;
}

.screen-play .card[data-producing] .meter > span {
  position: relative;
  overflow: hidden;
}

.screen-play .card[data-producing] .meter > span::after,
.screen-play button.btn.processing::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, #ffffff4d, transparent);
  transform: translateX(-150%) skewX(-20deg);
  opacity: 0;
  pointer-events: none;
  animation: activity-shimmer 5.5s ease-in-out infinite;
}

.screen-play button.btn.processing::after {
  animation-duration: 2s;
  animation-delay: -.8s;
}

.screen-play button.btn.processing:disabled { filter: none; }

.screen-play button.btn.holding {
  background: var(--btn-hold-bg);
}

.screen-play button.btn.holding .btn-fill {
  transform: scaleX(var(--btn-hold-t));
}

@keyframes production-orbit { to { transform: rotate(360deg); } }

@keyframes activity-shimmer {
  0%, 38% { transform: translateX(-150%) skewX(-20deg); opacity: 0; }
  46%, 68% { opacity: 1; }
  78%, 100% { transform: translateX(400%) skewX(-20deg); opacity: 0; }
}

.screen-play .card-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px -12px 5px;
  padding: 4px 12px 4px 6px;
  border-bottom: 1px solid var(--tone, var(--play-line));
  background: color-mix(in srgb, var(--tone, var(--info)) 10%, transparent);
  border-radius: 9px 9px 0 0;
  color: var(--tone, var(--text));
  font-weight: 500;
  font-size: 14px;
  line-height: 18px;
}

.screen-play .card[data-tone="ok"] .card-status {
  color: var(--ok-text);
}

/* The head's badge is the building's pip, opened up: it keeps the pip's tone. */
.screen-play .card-pip {
  display: flex;
  flex: none;
  color: var(--tone);
}

.screen-play .card-title,
.screen-play .city-sheet-title,
.screen-play .map-cell-sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 2px 2px #000;
}

.screen-play .city-sheet-title {
  width: max-content;
  white-space: nowrap;
}

.screen-play .card-meta,
.screen-play .city-sheet-sub {
  margin: 4px 0 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.1;
  color: var(--text-dim);
}

.screen-play .card-line {
  margin: 3px 0 5px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.screen-play .city-sheet .meter {
  height: 12px;
}

/* Site card: a bar per carried resource, then state and ETA. Low bars run
   short before the site finishes; out bars have nothing left to carry.
   Columns: name, tag, meter, quantity. The footer's state spans the first
   three so the ETA right-aligns with the quantities. */
.screen-play .city-sheet-site {
  display: grid;
  grid-template-columns: max-content auto 1fr max-content;
  align-items: center;
  gap: 5px 8px;
  min-width: 220px;
  margin: 6px 0 2px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.1;
}

.screen-play .city-sheet-site[hidden] {
  display: none;
}

.screen-play :is(.site-bars, .site-bar, .site-foot) {
  display: contents;
}

.screen-play .site-bar-name {
  color: var(--text);
}

.screen-play .city-sheet .site-bar-meter {
  height: 8px;
}

.screen-play .site-bar-qty {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.screen-play .site-bar-tag {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Low runs short; coming waits for crews to bring more. Both read as amber. */
.screen-play .site-bar:is([data-outlook="low"], [data-outlook="coming"]) .site-bar-meter > span {
  background: linear-gradient(#ffd58a, var(--warn));
}

.screen-play .site-bar:is([data-outlook="low"], [data-outlook="coming"]) :is(.site-bar-qty, .site-bar-tag) {
  color: var(--warn);
}

/* Out: the unfilled track is hatched, so the missing part reads as stuck. */
.screen-play .site-bar[data-outlook="out"] .site-bar-meter {
  border-color: color-mix(in srgb, var(--alert) 60%, transparent);
  background: repeating-linear-gradient(135deg, #3a2328 0 4px, #24333b 4px 8px);
}

.screen-play .site-bar[data-outlook="out"] .site-bar-meter > span {
  background: linear-gradient(#ffb1b5, #d96c77);
}

.screen-play .site-bar[data-outlook="out"] :is(.site-bar-name, .site-bar-qty, .site-bar-tag) {
  color: var(--alert);
}

.screen-play .site-foot-state {
  grid-column: 1 / 4;
  color: var(--text-dim);
}

.screen-play .site-foot-eta {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.screen-play .site-foot-eta[data-never="true"] {
  color: var(--alert);
}

.screen-play .city-sheet .card-actions,
.screen-play #city-sheet-craft {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.screen-play .city-sheet button,
.screen-play .map-cell-sheet button {
  width: 100%;
  min-height: var(--control-height);
}

.screen-play .city-sheet .card-actions button {
  margin-top: 0;
}

.screen-play .city-sheet-manage,
.screen-play .city-sheet-cancel { margin-top: 6px; }

.screen-play .chat-host,
.screen-play .chat-dock {
  background: linear-gradient(110deg, #213035, #162127);
  color: var(--text);
}

.screen-play .chat-thread-header h2,
.screen-play .chat-room,
.screen-play .chat-bubble-name,
.screen-play .chat-bubble-body,
.screen-play .chat-bubble-age {
  font-family: var(--font-body);
  color: var(--text);
}

.screen-play .chat-bubble-name {
  font-weight: 600;
  font-size: 14px;
}

.screen-play .chat-bubble-body {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.48;
}

.screen-play .chat-bubble-age {
  color: var(--text-dim);
  font-size: 13px;
}

.screen-play .chat-thread {
  --chat-inset: 12px;
  padding: 10px 0;
}

.screen-play .chat-msg {
  --chat-avatar: 38px;
  padding: 0 var(--chat-inset) 8px;
  border-bottom: 1px solid var(--play-line);
}

.screen-play .chat-msg:has(+ .chat-msg.continued) {
  padding-bottom: 0;
  border-bottom: 0;
}

.screen-play .chat-msg.continued {
  padding-left: calc(var(--chat-inset) + var(--chat-avatar) + var(--chat-msg-gap));
}

.screen-play .chat-avatar {
  width: var(--chat-avatar);
  height: 50px;
  flex-basis: var(--chat-avatar);
  border-radius: 0;
  border: 0;
  background: #8c3a3a;
  color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%);
  font-family: var(--font-display);
  font-weight: 700;
}

.screen-play .chat-bubble,
.screen-play .chat-bubble.mine,
.screen-play .chat-bubble.system {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 4px 0;
  color: var(--text);
}

.screen-play .chat-composer input {
  min-height: var(--control-height);
  border-radius: 6px;
  border: 1px solid var(--play-line);
  background: #19252b;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}

.screen-play .chat-composer button {
  min-width: 76px;
  min-height: var(--control-height);
}

.screen-play .tab,
.screen-play .build-tab,
.screen-play .panel-tab {
  min-height: var(--control-height);
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--play-line-strong);
  background: linear-gradient(#2a3a40, #1b2a30);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--control-text-size);
  font-weight: 500;
  box-shadow: inset 0 1px 1px #ffffff0b, 0 1px 2px #0003;
}

.screen-play .tab:hover,
.screen-play .build-tab:hover {
  background: linear-gradient(#35474d, #22343b);
}

.screen-play .tab[aria-selected="true"],
.screen-play .build-tab[aria-selected="true"],
.screen-play .panel-tab[aria-selected="true"] {
  color: #fff3c4;
  background: linear-gradient(#71613c77, #51462b88);
  border-color: var(--gold-400);
  box-shadow: inset 0 0 9px #f4cc6330, 0 2px 3px #0005;
}

.screen-play .bottom-panel {
  --panel-tabline-height: 54px;
}

.screen-play .bottom-panel:has(.panel-tabs:not([hidden])) {
  padding-top: calc(var(--panel-pad) + var(--panel-tabline-height) + 12px);
}

.screen-play .panel-tabline {
  --panel-tab-selected-height: 40px;
  position: absolute;
  top: calc(-1 * var(--panel-tabline-height));
  left: 0;
  right: 0;
  height: var(--panel-tabline-height);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.screen-play .panel-tabline:has(.panel-tabs[hidden]) {
  top: calc(-1 * (var(--icon-control-size) + 12px));
  left: auto;
  right: 0;
  height: var(--icon-control-size);
}

.screen-play .panel-tabs {
  flex: 1;
  height: var(--panel-tabline-height);
  gap: 0;
  margin-left: 14px;
  align-items: flex-end;
  pointer-events: auto;
}

.screen-play .panel-tabs[hidden] {
  display: none;
}

.screen-play .panel-tab {
  position: relative;
  z-index: 0;
  height: 32px;
  border-radius: 8px 8px 0 0;
  background: transparent;
  pointer-events: auto;
}

.screen-play .panel-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(140deg, #30444bd9, #1b2d35d9);
  backdrop-filter: blur(12px) saturate(.75);
  pointer-events: none;
}

.screen-play .panel-tab:hover::before {
  background: linear-gradient(140deg, #3b5057e6, #223740e6);
}

.screen-play .panel-tab:not([hidden]) ~ .panel-tab:not([hidden]) {
  margin-left: -1px;
}

.screen-play .panel-tab[aria-selected="true"] {
  z-index: 1;
  height: var(--panel-tab-selected-height);
  border-bottom-color: #263638;
  border-radius: 8px 8px 0 0;
}

.screen-play .panel-tab[aria-selected="true"]::before {
  background: linear-gradient(140deg, #59573fdc, #3b402fdc);
}

.screen-play .panel-tab[aria-selected="true"]:hover::before {
  background: linear-gradient(140deg, #666348e6, #464b36e6);
}

.screen-play .panel-tab:has(.badge:not([hidden])) {
  z-index: 3;
}

.screen-play .panel-tab:has(.badge:not([hidden])) ~ .panel-tab {
  z-index: 2;
}

.screen-play .badge {
  z-index: 2;
  background: #ff3340;
}

.screen-play .panel-tabline > .panel-close {
  flex: 0 0 var(--icon-control-size);
  width: var(--icon-control-size);
  height: var(--icon-control-size);
  transform: none;
  pointer-events: auto;
}

.screen-play .panel-tabs:not([hidden]) + .panel-close {
  align-self: flex-end;
  margin-bottom: calc(var(--panel-tab-selected-height) - var(--icon-control-size));
}

.screen-play input[type="text"],
.screen-play input[type="search"],
.screen-play input:not([type]),
.screen-play textarea {
  background: #19252b;
  color: var(--text);
  border-color: var(--play-line);
  font-family: var(--font-body);
}

.screen-play .notification {
  border: 1px solid var(--text-mute);
  border-radius: 8px;
  background: linear-gradient(120deg, #2b3f4c, #19272d 85%);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.screen-play .notification.positive {
  border-color: #8cdfb6;
  background: linear-gradient(120deg, #23483c, #19272d 85%);
}

.screen-play .notification.negative {
  border-color: var(--alert);
  background: linear-gradient(120deg, #4b2c32, #19272d 85%);
}

@media (max-width: 600px) {
  .screen-play {
    --control-height: 28px;
    --icon-control-size: 28px;
    --control-text-size: 14px;
    --panel-title-size: 24px;
  }
  .screen-play .panel.sheet { padding: 8px 10px; }
  .screen-play .member { grid-template-columns: 60px minmax(0, 1fr); gap: 8px; }
  .screen-play .look { width: 60px; height: 66px; }
  .screen-play .member-actions { flex-basis: 100%; order: 2; }
  .screen-play .member-top { gap: 6px; }
  .screen-play .member-meta { font-size: 13px; }
  .screen-play .xp-line { margin: 4px 0; font-size: 14px; }
  .screen-play .traits { gap: 5px; }
  .screen-play .trait { padding: 0 6px; font-size: 13px; }
  .screen-play .pill { padding: 0 6px; font-size: 13px; }
  .screen-play .clock { gap: 8px; min-height: 36px; padding: 0 8px 0 0; border-radius: 6px; }
  .screen-play .clock-copy { padding: 3px 0; }
  .screen-play .clock-sky { --lens: 36px; border-radius: 5px 0 0 5px; }
  .screen-play .clock-time { font-size: 16px; }
  .screen-play .clock-sub { font-size: 11px; }
}

.screen-play .panel button:not(.btn):not(.icon-btn):not(.trait):not(.look):not(.build-tab):not(.panel-tab):not(.morale-seg),
.screen-play .map-cell-sheet button:not(.btn) {
  background-color: #1e2e3a;
  background-image: linear-gradient(#2a3c48, #192832);
  color: var(--text);
  border: 1px solid var(--play-line-strong);
  border-radius: 5px;
  font-family: var(--font-ui);
  font-weight: 600;
  min-height: var(--control-height);
}

@media (prefers-reduced-motion: reduce) {
  .notifications .notification,
  .notifications.is-open .notification,
  .notifications.is-leaving .notification {
    transform: none;
    transition: none;
  }
  .notification.is-shake { animation: none; }
  .screen-play button.btn.processing::after { animation: none; }
  .screen-play button.btn.holding {
    animation: none;
  }

  .screen-play .clock,
  .screen-play .clock-sky,
  .screen-play .sky-night,
  .screen-play .sky-stars,
  .screen-play .sky-ground,
  .screen-play .sky-windows,
  .screen-play .sky-cloud,
  .screen-play .sky-rain,
  .screen-play .sky-shade {
    transition-duration: 200ms;
    transition-delay: 0s;
    animation: none;
  }
  .screen-play .clock.is-turning .clock-sky {
    transition-duration: 0s;
  }
  .screen-play .clock.is-turning .clock-copy,
  .screen-play .clock.is-turning .sky-dusk {
    animation: none;
  }

  .screen-play .production-orbit,
  .screen-play .production-orbit::before,
  .screen-play .card[data-producing] .meter > span::after,
  .screen-play .meter > span {
    animation: none;
    transition: none;
  }
}

/* Battle device knobs (debug mode, while a battle is joined). */
.battle-debug {
  position: absolute;
  left: 12px;
  bottom: 96px;
  z-index: 40;
  display: grid;
  gap: 6px;
  padding: 8px 12px;
  background: var(--chrome);
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
}

.battle-debug-title {
  font-weight: 600;
}

.battle-debug-row {
  display: grid;
  grid-template-columns: 4.5em 8em 4em;
  align-items: center;
  gap: 6px;
}

.battle-debug-buttons {
  display: flex;
  gap: 6px;
}

.battle-debug-buttons button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  padding: 2px 8px;
}

/* Walker playground (/#walker) */
.walker-playground {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #c9ccd0;
}

.walker-playground canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.walker-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 240px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: var(--chrome);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font: 13px var(--font);
  color: var(--ink);
}

.walker-panel label,
.walker-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: inherit;
}

.walker-panel input {
  padding: 0;
  min-width: 0;
}

.walker-panel select {
  font-size: inherit;
}

.walker-panel button {
  padding: 4px 10px;
}

.walker-panel label:has(input[type="range"]) {
  display: grid;
  grid-template-columns: 64px 1fr 36px;
}

.walker-panel output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.walker-legs {
  display: flex;
  gap: 4px;
}

.walker-legs button[aria-pressed="true"] {
  background: var(--accent);
}

.walker-ui-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.walker-bare .walker-panel {
  display: none;
}

.walker-bare .walker-ui-toggle {
  opacity: 0.35;
}

.walker-bare .walker-ui-toggle:hover {
  opacity: 1;
}

.walker-readout,
.walker-hint {
  margin: 0;
  color: var(--muted);
}

/* Kitbash playground (/#kitbash): the main panel and the spec panel stack
   down the left; the spec panel scrolls. */
.kit-side {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.kit-right {
  left: auto;
  right: 12px;
}

.kit-lines {
  white-space: pre-line;
}

.kit-side > .walker-panel {
  position: static;
  width: auto;
  max-height: none;
  pointer-events: auto;
}

.kit-side > .walker-panel:not(.kit-spec) {
  flex: none;
}

.kit-spec {
  min-height: 0;
  overflow-y: auto;
}

.kit-spec details {
  display: grid;
  gap: 6px;
}

.kit-spec details[open] {
  padding-bottom: 6px;
}

.kit-spec summary {
  cursor: pointer;
  font-weight: 600;
}

.kit-spec .walker-row select {
  flex: 1;
  min-width: 0;
}

.kit-places,
.kit-gear {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kit-gear .walker-row {
  flex: 1;
}

.kit-share .kit-code {
  display: grid;
  gap: 4px;
}

.kit-share textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font: 11px/1.3 ui-monospace, monospace;
  word-break: break-all;
}

.kit-share input[type="text"],
.kit-share select {
  flex: 1;
  min-width: 0;
  font-size: inherit;
}
