:root {
  font-family: Inter, ui-sans-serif, system-ui, "Microsoft YaHei", sans-serif;
  color: #fff7fb;
  background: #090512;
  font-synthesis: none;
  --muted: #b0a3c4;
  --purple: #b566ff;
  --pink: #ff4fa3;
  --coral: #ff9168;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
a {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  border: 1px solid #b8a0db3d;
  border-radius: 9px;
  background: #2a2039e8;
  color: #e9def9;
  padding: 10px 15px;
  min-height: 42px;
}
button:hover {
  background: #4d3967;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: #b9a3f1;
  color: #20152f;
  border-color: #d8c5ff;
}
.primary:hover {
  background: #d4bfff;
}
input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #837096;
  background: #1b1425;
  color: #eee2fc;
  margin: 8px 0 15px;
  min-width: 0;
}
label {
  font-size: 12px;
  color: var(--muted);
}
:focus-visible {
  outline: 2px solid #e7caff;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.game {
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 20%, #ff4fa31f, transparent 23%),
    linear-gradient(145deg, #090512, #1b0a29 60%, #2a102c);
}
.game::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    #ff5bae0b,
    transparent 20%,
    transparent 82%,
    #8e4cff16
  );
  box-shadow: inset 0 0 150px #050208;
  transition:
    background 900ms ease,
    box-shadow 900ms ease;
}
.game.restored::after {
  background:
    radial-gradient(circle at 50% 48%, #d16cff42, transparent 34%),
    linear-gradient(180deg, #ff8cc41f, transparent 30%, #ff9b6c12);
  box-shadow: inset 0 0 70px #6f2c9138;
}
.game.restored #headline {
  color: #fff;
  text-shadow:
    0 0 18px #ff73bd,
    0 0 52px #9f5dff;
}
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
header {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  pointer-events: none;
}
header > * {
  pointer-events: auto;
}
.broadcast {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  padding: 8px 12px;
  color: #d9cce8;
  border: 1px solid #ff5ba03d;
  background: #100719b8;
  backdrop-filter: blur(14px);
  font-size: 8px;
  letter-spacing: 1.5px;
  white-space: nowrap;
}
.broadcast i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff4f92;
  box-shadow: 0 0 14px #ff4f92;
  animation: live-pulse 1.3s ease-in-out infinite;
}
.broadcast b {
  color: #ff78b3;
}
.broadcast em {
  margin-left: 8px;
  padding-left: 12px;
  color: #c8b6d8;
  border-left: 1px solid #ff5ba03d;
  font-style: normal;
}
@keyframes live-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}
.brand {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 3px;
  display: flex;
  gap: 20px;
  align-items: center;
  text-shadow: 0 0 26px #c05cff80;
}
.brand span {
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 2px;
  color: #b5a2ce;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}
.badge {
  font-size: 10px;
  color: #d5c5ea;
  border: 1px solid #9c7cc44d;
  border-radius: 20px;
  padding: 8px 12px;
  background: #21172e99;
}
.header-actions button {
  font-size: 11px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2.5px;
  color: #ff82c0;
}
.objective {
  position: fixed;
  left: 28px;
  top: 110px;
  width: 220px;
  pointer-events: none;
}
h1 {
  font-size: 40px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: -1.8px;
  margin: 17px 0;
  text-shadow: 0 0 35px #ad4dff42;
}
.objective p {
  font-size: 11px;
  line-height: 1.9;
  color: #b6a9c7;
}
.objective button {
  pointer-events: auto;
  margin-top: 16px;
  font-size: 11px;
}
#goals {
  font-size: 11px;
  line-height: 2;
  color: #bdaccf;
  margin-top: 25px;
}
.goal-done {
  color: #e6d1ff;
}
.meters {
  position: fixed;
  right: 28px;
  top: 110px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.meters > div {
  min-width: 116px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  background: #120a20b8;
  border: 1px solid #ff67b733;
  border-radius: 3px;
  backdrop-filter: blur(14px);
}
.meters span {
  font-size: 10px;
  color: #b5a6c7;
}
.meters b {
  font-size: 21px;
  font-weight: 500;
}
.activity {
  display: none;
}
.activity ol {
  padding: 0;
  list-style: none;
  font-size: 10px;
  line-height: 1.7;
  color: #b9a5cd;
}
.activity li {
  margin: 8px 0;
  padding: 7px 0;
  border-bottom: 1px solid #bfa0df20;
}
.activity a {
  pointer-events: auto;
  text-decoration: underline;
  color: #d5b5ff;
}
#message {
  position: fixed;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 18px;
  background: #241a35e8;
  border: 1px solid #bca3db30;
  border-radius: 24px;
  font-size: 11px;
  text-align: center;
  pointer-events: none;
}
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 44px 28px 14px;
  background: linear-gradient(transparent, #100818f7 22%);
  z-index: 1;
}
.crew-console {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 1.25fr);
  gap: 12px;
  width: min(920px, 100%);
  margin: 0 auto;
}
#crews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
#crews button {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  text-align: left;
  border-color: #a984dc3d;
  background: #140b21e8;
}
#crews button b {
  font-size: 10px;
  letter-spacing: 1.4px;
}
#crews button span {
  color: #a998b9;
  font-size: 9px;
}
#crews button[aria-pressed="true"] {
  border-color: #ff67b7a1;
  background: linear-gradient(145deg, #4c174a, #2a1643);
  box-shadow: inset 0 0 24px #d654c421, 0 0 24px #9f4cff1f;
}
#crews button[aria-pressed="true"] span {
  color: #f1d9ed;
}
.quick-action {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  overflow: hidden;
  min-height: 76px;
  padding: 14px 20px;
  text-align: left;
  color: #160c20;
  border: 1px solid #ffd5f0;
  background: linear-gradient(115deg, #fff0fa, #ff75bd 50%, #ae75ff);
  box-shadow: 0 10px 34px #b03aff42;
}
.quick-action::after {
  content: "↗";
  grid-column: 2;
  grid-row: 1 / 3;
  font-size: 32px;
  font-weight: 300;
}
.quick-action small {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.7px;
  opacity: 0.62;
}
.quick-action strong {
  font-size: 20px;
  line-height: 1.2;
}
.quick-action span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.65;
}
.quick-action:hover:not(:disabled) {
  color: #0d0613;
  background: linear-gradient(115deg, #fff, #ff99ce 50%, #c29aff);
  transform: translateY(-1px);
}
.quick-action:disabled {
  color: #c4b4cd;
  border-color: #8069944f;
  background: #2b2037e8;
  box-shadow: none;
}
#manual-tools {
  width: min(920px, 100%);
  margin: 10px auto 0;
}
#palette {
  display: flex;
  justify-content: center;
  gap: 8px;
}
#palette button {
  min-width: 106px;
  text-align: left;
  padding: 12px;
  font-size: 11px;
  background: #2b213ce8;
}
#palette button[aria-pressed="true"] {
  background: #baa3ee;
  color: #22162f;
  border-color: #e0cdff;
}
#palette small {
  display: block;
  font-size: 9px;
  margin-top: 7px;
  opacity: 0.7;
}
.bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  margin-top: 12px;
}
.bottom button {
  font-size: 10px;
  padding: 7px 10px;
  min-height: 33px;
}
.bottom b {
  font-size: 12px;
  color: #dec7ff;
}
.bottom > span {
  color: #ad9abe;
}
.bottom + small {
  display: block;
  text-align: center;
  font-size: 9px;
  color: #9e8eaf;
  margin-top: 10px;
}
#rotate,
#download,
#provenance {
  display: none;
}
.action-sheet {
  position: fixed;
  left: 50%;
  bottom: 180px;
  transform: translateX(-50%);
  width: 310px;
  max-width: calc(100% - 30px);
  padding: 24px;
  background: #2a1f3df5;
  border: 1px solid #b99bd477;
  border-radius: 14px;
  z-index: 3;
}
.action-sheet h2 {
  font-size: 21px;
  font-weight: 500;
  margin: 12px 0;
}
.action-sheet p {
  color: #bdaacc;
  font-size: 11px;
  line-height: 1.8;
}
.action-sheet > .primary {
  width: 100%;
  margin-top: 10px;
}
.close {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 0;
  width: 32px;
  min-height: 32px;
  font-size: 22px;
  border: 0;
  background: transparent;
  color: #b7a0cb;
}
dialog {
  width: 430px;
  max-width: calc(100% - 24px);
  max-height: 88dvh;
  overflow: auto;
  color: #eee3fa;
  background: #281d38;
  border: 1px solid #b696d366;
  border-radius: 16px;
  padding: 30px;
}
dialog::backdrop {
  background: #100a1dd9;
  backdrop-filter: blur(9px);
}
dialog h2 {
  font-size: 25px;
  font-weight: 500;
  margin: 16px 0;
}
dialog p {
  color: #b8a6c9;
  font-size: 12px;
  line-height: 1.8;
}
dialog a {
  font-size: 11px;
  text-decoration: underline;
  display: block;
  margin-top: 14px;
}
dialog hr {
  border: 0;
  border-top: 1px solid #c5a3e52c;
  margin: 24px 0;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
dialog .dialog-actions button {
  font-size: 11px;
}
dialog details {
  margin-top: 20px;
  font-size: 11px;
  color: #b5a1c9;
}
dialog summary {
  cursor: pointer;
}
.briefing {
  width: 520px;
  padding: 34px;
  background:
    radial-gradient(circle at 100% 0%, #ff4f9224, transparent 34%),
    linear-gradient(145deg, #12091e, #281337);
  border-color: #ff74b45c;
  box-shadow: 0 30px 90px #050208cc;
}
.briefing h2 {
  margin: 0 0 8px;
  font-size: 38px;
  font-weight: 850;
  letter-spacing: -1px;
}
.briefing .briefing-lead {
  margin: 0;
  color: #e5d8ec;
  font-size: 14px;
}
.briefing-count {
  margin: 18px 0 -4px;
  color: transparent;
  background: linear-gradient(120deg, #fff, #ff6eb5 46%, #a769ff);
  background-clip: text;
  -webkit-background-clip: text;
  font-size: 128px;
  font-weight: 950;
  line-height: 0.86;
  letter-spacing: -10px;
}
.briefing-count span {
  margin-left: 12px;
  font-size: 18px;
  letter-spacing: 2px;
}
.briefing-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 14px;
  padding: 15px 18px;
  background: #0d0717a8;
  border: 1px solid #d16bff2e;
  font-size: 13px;
}
.briefing-flow i {
  color: #ff6eb5;
  font-style: normal;
}
.briefing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}
.briefing-steps li {
  min-height: 150px;
  padding: 16px;
  background: #0d0717a8;
  border: 1px solid #d16bff2e;
}
.briefing-steps li > b {
  display: block;
  margin-bottom: 18px;
  color: #ff78b3;
  font-size: 24px;
}
.briefing-steps strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 13px;
}
.briefing-steps span {
  color: #bba9c8;
  font-size: 11px;
  line-height: 1.7;
}
.mission-rule {
  display: block;
  margin: 0;
  padding: 14px 16px;
  text-align: center;
  color: #b7a4c4;
  background: #ff4f920d;
  border-left: 2px solid #ff5fa9;
  font-size: 10px;
}
.briefing-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.briefing-actions button {
  flex: 1;
}
.briefing > small {
  display: block;
  margin-top: 14px;
  color: #8e7b9c;
  font-size: 9px;
}
#qr svg,
#wall-qr svg {
  width: 100%;
  height: auto;
  display: block;
}
#qr {
  background: #fff;
  padding: 12px;
  max-width: 240px;
  margin: 20px auto;
}
#share-url {
  font-size: 10px;
}
#wall-invite {
  position: fixed;
  right: 28px;
  top: 110px;
  width: 235px;
  text-align: center;
}
#wall-invite h2 {
  font-size: 17px;
  font-weight: 500;
}
#wall-qr {
  padding: 12px;
  background: #fff;
  border-radius: 6px;
}
#wall-url {
  font-size: 10px;
  overflow-wrap: anywhere;
  color: #baabcc;
}
#wall-source {
  font-size: 10px;
  color: #baa4d5;
}
.wall .meters {
  right: auto;
  left: 28px;
  top: auto;
  bottom: 55px;
  flex-direction: row;
}
.wall footer,
.wall .activity,
.wall #message {
  display: none;
}
.wall .objective {
  top: 100px;
}
.wall #scene {
  pointer-events: none;
}
.walking .objective h1,
.walking .objective p,
.walking #goals {
  display: none;
}
#dpad {
  display: none;
}
.walking #dpad {
  display: none;
}
@media (max-width: 760px) {
  .broadcast {
    display: none;
  }
  .briefing {
    padding: 24px 18px;
  }
  .briefing h2 {
    font-size: 27px;
  }
  .briefing-count {
    font-size: 96px;
  }
  .briefing-steps {
    grid-template-columns: 1fr;
  }
  .briefing-steps li {
    display: grid;
    grid-template-columns: 38px 1fr;
    min-height: 0;
  }
  .briefing-steps li > b {
    margin: 0;
  }
  .briefing-actions {
    flex-direction: column;
  }
  header {
    padding: 15px;
  }
  .brand {
    font-size: 17px;
    letter-spacing: 2px;
  }
  .brand span,
  .header-actions .badge {
    display: none;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions button {
    font-size: 10px;
    padding: 7px 9px;
    min-height: 35px;
  }
  .objective {
    top: 78px;
    left: 15px;
    width: 170px;
  }
  .objective h1 {
    font-size: 25px;
    margin: 12px 0;
  }
  .objective p {
    font-size: 10px;
  }
  .objective .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  #goals {
    font-size: 9px;
    margin-top: 14px;
  }
  .objective button {
    font-size: 10px;
    padding: 7px 10px;
    min-height: 34px;
  }
  .meters {
    right: 14px;
    top: 80px;
    gap: 5px;
  }
  .meters > div {
    min-width: 90px;
    padding: 8px 10px;
    gap: 10px;
  }
  .meters b {
    font-size: 16px;
  }
  .meters span {
    font-size: 9px;
  }
  .activity {
    display: none;
  }
  footer {
    padding: 38px 10px 10px;
  }
  .crew-console {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  #crews {
    gap: 5px;
  }
  #crews button {
    min-height: 46px;
    padding: 7px 9px;
  }
  #crews button b {
    font-size: 8px;
    letter-spacing: 0.7px;
  }
  #crews button span {
    font-size: 8px;
  }
  .quick-action {
    min-height: 62px;
    padding: 10px 15px;
  }
  .quick-action strong {
    font-size: 17px;
  }
  #palette {
    overflow-x: auto;
    justify-content: flex-start;
    padding: 5px 0;
  }
  #palette button {
    min-width: 93px;
    font-size: 10px;
    padding: 9px;
  }
  #palette small {
    font-size: 9px;
  }
  .bottom {
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 8px;
  }
  .bottom button {
    font-size: 9px;
    padding: 6px 8px;
  }
  .bottom + small {
    font-size: 8px;
    line-height: 1.5;
  }
  #message {
    bottom: 246px;
    font-size: 10px;
    width: max-content;
  }
  .action-sheet {
    bottom: 245px;
  }
  #dpad button {
    min-height: 40px;
    padding: 0;
    touch-action: none;
  }
  .walking #dpad {
    display: grid;
    position: fixed;
    bottom: 240px;
    left: 18px;
    grid-template-columns: repeat(3, 40px);
    gap: 4px;
    z-index: 2;
  }
  #dpad [data-move="w"] {
    grid-column: 2;
  }
  #dpad [data-move="a"] {
    grid-column: 1;
    grid-row: 2;
  }
  #dpad [data-move="s"] {
    grid-column: 2;
    grid-row: 2;
  }
  #dpad [data-move="d"] {
    grid-column: 3;
    grid-row: 2;
  }
  .wall #wall-invite {
    right: 15px;
    top: 290px;
    width: 120px;
  }
  .wall .meters {
    left: 15px;
    bottom: 25px;
    gap: 5px;
  }
  .wall .meters > div {
    min-width: 85px;
  }
  .wall .meters > div:nth-child(n + 4) {
    display: none;
  }
  .wall #wall-invite h2 {
    font-size: 12px;
  }
  .wall #wall-url {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

@media (max-width: 760px) {
  .header-actions .badge {
    display: block;
    position: fixed;
    left: 15px;
    top: 57px;
    max-width: 220px;
    padding: 4px 8px;
    font-size: 8px;
  }
  .round-clock b {
    font-variant-numeric: tabular-nums;
  }
}

/* Broadcast console visual contract — docs/DESIGN_SYSTEM.md. */
:root {
  --stage: #080808;
  --console: #111110;
  --console-2: #181816;
  --ink: #f2efe7;
  --quiet: #98968f;
  --rule: #3b3a35;
  --monad: #836ef9;
  --signal: #f0ff66;
}
html { color-scheme: dark; }
button {
  border-color: var(--rule);
  border-radius: 2px;
  background: var(--console-2);
  color: var(--ink);
}
button:hover { background: #292925; }
.primary {
  color: #080808;
  border-color: var(--signal);
  background: var(--signal);
}
.primary:hover { background: #fff; }
.game { background: var(--stage); }
.game::after {
  background: linear-gradient(180deg, #00000040, transparent 28% 72%, #0000008c);
  box-shadow: inset 0 0 120px #000;
}
.game.restored::after {
  background: linear-gradient(180deg, #836ef91f, transparent 32% 72%, #0000008c);
  box-shadow: inset 0 0 70px #836ef926;
}
header {
  padding: 18px 24px;
  border-bottom: 1px solid #ffffff17;
  background: #080808b8;
}
.brand {
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 3px;
  text-shadow: none;
}
.brand span { color: var(--quiet); }
.broadcast {
  top: 17px;
  color: var(--ink);
  border-color: var(--rule);
  border-radius: 0;
  background: var(--console);
  backdrop-filter: none;
}
.broadcast i { background: var(--signal); box-shadow: none; }
.broadcast b, .eyebrow { color: var(--signal); }
.broadcast em { color: var(--quiet); border-left-color: var(--rule); }
.badge {
  color: var(--ink);
  border-color: var(--rule);
  border-radius: 2px;
  background: var(--console);
}
.objective { width: 250px; }
.objective h1 {
  color: var(--ink);
  font-size: 44px;
  letter-spacing: -.06em;
  text-shadow: none;
}
.objective p, #goals { color: var(--quiet); }
.goal-done { color: var(--signal); }
.meters { gap: 0; border: 1px solid var(--rule); }
.meters > div {
  min-width: 132px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: var(--console);
  backdrop-filter: none;
}
.meters > div:last-child { border-bottom: 0; }
.meters span {
  color: var(--quiet);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.meters b {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
#message {
  color: var(--ink);
  border-color: var(--rule);
  border-radius: 2px;
  background: var(--console);
}
footer {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  background: #080808f2;
}
#crews button {
  border-radius: 2px;
  background: var(--console);
}
#crews button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--monad);
  background: var(--monad);
  box-shadow: none;
}
#crews button[aria-pressed="true"] span { color: #ded9ff; }
.quick-action {
  color: #080808;
  border-color: var(--signal);
  border-radius: 2px;
  background: var(--signal);
  box-shadow: none;
}
.quick-action:hover:not(:disabled) { color: #080808; background: #fff; }
.quick-action:disabled {
  color: #77756f;
  border-color: var(--rule);
  background: var(--console);
}
.action-sheet, dialog {
  color: var(--ink);
  border-color: var(--rule);
  border-radius: 2px;
  background: var(--console);
  box-shadow: 0 24px 80px #000;
}
dialog::backdrop { background: #000000d9; backdrop-filter: none; }
.briefing {
  background: var(--console);
  border-color: var(--monad);
  box-shadow: 0 24px 100px #000;
}
.briefing-count {
  color: var(--ink);
  background: none;
  background-clip: initial;
  -webkit-background-clip: initial;
}
.briefing-flow, .mission-rule {
  border-color: var(--rule);
  background: #080808;
}
.briefing-flow i { color: var(--signal); }
.mission-rule { border-left-color: var(--monad); }
#wall-qr, #qr { border-radius: 0; }
.game.restored #headline { color: var(--signal); text-shadow: none; }
@media (max-width: 760px) {
  header { padding: 13px 14px; }
  .objective h1 { font-size: 27px; }
  .meters { border: 0; gap: 3px; }
  .meters > div { border: 1px solid var(--rule); }
  footer { padding-top: 10px; }
  .briefing-count { font-size: 92px; }
}
