:root {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #eee1c9;
  background: #101827;
  font-synthesis: none;
  --gold: #d8b67f;
  --ink: #16212d;
  --line: #c2b29635;
  --muted: #c1b9ac;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}
button,
input,
select {
  font: inherit;
}
button,
select,
input {
  color: inherit;
}
button {
  cursor: pointer;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #28313dd9;
  padding: 11px 17px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #45505b;
}
button:active {
  transform: scale(0.97);
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #f7cc8d;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
.gold {
  background: #d5b580;
  color: #1c2632;
  border-color: #e6cba0;
  font-weight: 650;
}
.gold:hover {
  background: #edce9e;
}
.quiet {
  background: transparent;
}
.small {
  font-size: 12px;
  min-height: 36px;
  padding: 7px 12px;
}
.danger {
  border-color: #bb7985;
  color: #f2b7c0;
}
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 55% 45%,
    transparent 28%,
    #080f19aa 100%
  );
  box-shadow: inset 0 0 90px #090c1766;
}
#app {
  position: fixed;
  inset: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  pointer-events: none;
}
#app > * {
  pointer-events: auto;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 650;
}
.brand {
  position: absolute;
  left: 42px;
  top: 29px;
  font-size: 11px;
  letter-spacing: 3px;
}
.version {
  position: absolute;
  bottom: 22px;
  left: 42px;
  color: #c4c1b4;
  font-size: 10px;
  letter-spacing: 1px;
}
.menu {
  position: absolute;
  left: 6.5%;
  top: 14%;
  width: 420px;
  max-width: 45vw;
  text-shadow: 0 2px 25px #080e17;
}
.menu h1 {
  font:
    400 clamp(40px, 5.4vw, 74px)/0.96 Georgia,
    serif;
  margin: 20px 0 23px;
  color: #f1dfbd;
  letter-spacing: -2px;
}
.menu h1 em {
  font-weight: 400;
  color: #d6b57f;
}
.menu p {
  font-size: 14px;
  line-height: 1.75;
  color: #d1cabb;
  max-width: 355px;
}
.menu .buttons {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.menu .buttons button:first-child {
  min-width: 185px;
}
.menu .fine {
  font-size: 11px;
  color: #c1b7a7;
  letter-spacing: 0.3px;
}
.menu-bg {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
  background: linear-gradient(
    90deg,
    #0c1422e8 0%,
    #101827b5 33%,
    transparent 68%
  );
}
.selection {
  position: absolute;
  right: 32px;
  bottom: 46px;
  width: min(54vw, 660px);
  padding: 21px 24px;
  background: #13202ce8;
  border: 1px solid var(--line);
  border-radius: 11px;
  backdrop-filter: blur(12px);
}
.selection .toys {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}
.toy-card {
  flex: 1;
  padding: 9px 3px;
  min-width: 0;
  text-align: center;
  background: #28313b9c;
  font-size: 11px;
  border: 1px solid transparent;
}
.toy-card.selected {
  border-color: #d9bb85;
  background: #65533e66;
}
.toy-card svg {
  width: 48px;
  height: 52px;
  display: block;
  margin: 0 auto 5px;
}
.toy-card strong {
  font-size: 10px;
  display: block;
  color: #9facaa;
}
.options {
  display: flex;
  gap: 13px;
  align-items: end;
  flex-wrap: wrap;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: #cbc0ae;
}
.field select,
.field input {
  background: #1d2b38;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px;
  min-height: 42px;
  max-width: 100%;
}
.story-note {
  position: absolute;
  top: 35px;
  right: 38px;
  font:
    italic 15px Georgia,
    serif;
  color: #d4c5ab;
}
.hud {
  position: absolute;
  inset: 20px 25px auto;
  display: flex;
  align-items: start;
  justify-content: space-between;
  pointer-events: none !important;
}
.hud > * {
  pointer-events: auto;
}
.panel {
  background: #13202de8;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px 21px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px #070d1533;
}
.status {
  width: 255px;
}
.status h2 {
  font: 400 20px Georgia;
  margin: 7px 0 10px;
}
.progress {
  height: 5px;
  background: #b19e7a22;
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
}
.progress span {
  display: block;
  height: 100%;
  background: #c8ad79;
  border-radius: 3px;
}
.ledger {
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}
.ledger li {
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  color: #bfb8a9;
  line-height: 2.1;
}
.ledger li.current {
  color: #f5dfb0;
}
.clock {
  text-align: center;
  min-width: 150px;
  padding: 13px 25px;
}
.clock b {
  font: 400 28px Georgia;
  color: #eddbb9;
}
.clock .eyebrow {
  font-size: 9px;
  margin-bottom: 5px;
}
.hud-right {
  display: flex;
  gap: 8px;
}
.role {
  font-size: 11px;
  margin-top: 9px;
  color: #d5bc96;
}
.location {
  position: absolute;
  top: 118px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none !important;
}
.location h2 {
  font: italic 22px Georgia;
  margin: 0;
  color: #e2d4bd;
}
.location span {
  font-size: 9px;
  letter-spacing: 2px;
  color: #acafa9;
}
.controls-hint {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 1px;
  color: #c2bfb1;
  white-space: nowrap;
}
.actions {
  position: absolute;
  right: 25px;
  bottom: 50px;
  display: flex;
  gap: 9px;
  align-items: end;
}
.actions button {
  min-width: 78px;
  background: #1e2b38ef;
}
.actions button.primary {
  min-width: 140px;
  border-color: #c6ad7c;
  background: #c6ad7c;
  color: #1d2934;
}
.actions .key {
  display: block;
  font-size: 10px;
  opacity: 0.6;
  margin-top: 3px;
}
.joystick {
  position: absolute;
  left: 27px;
  bottom: 55px;
  width: 126px;
  height: 126px;
  border: 1px solid #e7d4ab55;
  border-radius: 50%;
  background: #18243275;
  touch-action: none;
  display: none;
}
.stick {
  position: absolute;
  width: 50px;
  height: 50px;
  left: 37px;
  top: 37px;
  border-radius: 50%;
  background: #deccab55;
  border: 1px solid #d8c8ac99;
  pointer-events: none;
}
.veil {
  position: absolute;
  inset: 0;
  background: #090f19aa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  backdrop-filter: blur(4px);
}
.modal {
  width: min(650px, 95vw);
  max-height: 90dvh;
  overflow: auto;
  touch-action: pan-y;
}
.modal h2 {
  font: 400 33px Georgia;
  margin: 8px 0 13px;
}
.modal p {
  line-height: 1.7;
  font-size: 13px;
  color: #c7c0b1;
}
.modal .row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin: 15px 0;
}
.modal h3 {
  font: 400 19px Georgia;
}
.modal label {
  font-size: 12px;
}
.modal input[type="range"] {
  accent-color: #dbb881;
}
.modal input[type="checkbox"] {
  accent-color: #dbb881;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}
.close {
  float: right;
}
.task-panel {
  position: absolute;
  right: 25px;
  top: 130px;
  width: min(390px, calc(100vw - 35px));
  max-height: calc(100dvh - 210px);
  overflow: auto;
  touch-action: pan-y;
}
.task-panel h2 {
  font: 400 25px Georgia;
  margin: 8px 0;
}
.task-panel p {
  font-size: 12px;
  line-height: 1.6;
  color: #c9c1b2;
}
.task-grid {
  display: flex;
  gap: 9px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 22px 0;
}
.track {
  width: 70px;
  height: 70px;
  padding: 3px;
  background: #51473d;
}
.track svg {
  height: 100%;
  width: 100%;
  transition: transform 0.12s;
}
.task-piece {
  width: 80px;
  height: 68px;
  font-size: 30px;
  border: 2px solid #c7b08266;
}
.task-piece.picked {
  border-color: #f2d49a;
  background: #64563f;
}
.socket {
  border: 2px dashed #e6cda25c;
  width: 85px;
  height: 85px;
  font-size: 30px;
  background: #172733;
}
.socket.fitted {
  background: #51736a77;
  border-style: solid;
}
.dial {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  position: relative;
  font-size: 28px;
  border: 3px solid #b59662;
}
.dial::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 25px;
  background: #f0d29e;
  top: 7px;
  left: 37px;
  transform-origin: 50% 31px;
  transform: rotate(var(--rotation));
}
.crank {
  width: 155px;
  height: 155px;
  border-radius: 50%;
  border: 9px solid #b39360;
  font-size: 44px;
  background: radial-gradient(circle, #897344, #2a3336);
  touch-action: none;
}
.push-bar {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin: 25px 0;
}
.push-bar button {
  width: 115px;
  height: 88px;
  font-size: 28px;
}
.meeting-toys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.meeting-toys button {
  height: 116px;
  text-align: center;
}
.meeting-toys svg {
  display: block;
  width: 45px;
  height: 50px;
  margin: auto;
}
.claim {
  font-size: 11px;
  padding: 8px;
  border-left: 2px solid #b99a71;
  background: #b19e7b10;
  margin: 7px 0;
}
.cinema {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 90px 20px 100px;
  pointer-events: none !important;
  background: linear-gradient(
    #080b13bb 0%,
    transparent 25%,
    transparent 62%,
    #080b13e8 100%
  );
  border-top: 45px solid #080d16;
  border-bottom: 45px solid #080d16;
}
.cinema .caption {
  text-align: center;
  max-width: 650px;
}
.cinema h2 {
  font: 400 42px Georgia;
  color: #f1ddb6;
  margin: 8px 0 13px;
}
.cinema p {
  font-size: 14px;
  line-height: 1.7;
  color: #d4cab9;
}
.cinema button {
  pointer-events: auto;
  margin-top: 15px;
}
.cinema .skip {
  position: absolute;
  right: 30px;
  bottom: 20px;
}
.banner {
  position: absolute;
  bottom: 185px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  max-width: 460px;
  font-size: 13px;
  color: #eee0bc;
  background: #152230dd;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 20px;
}
.ribbon-modes {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.ribbon-modes button {
  font-size: 12px;
}
.results-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 18px 0;
}
.results-list div {
  font-size: 11px;
  padding: 9px;
  background: #ffffff07;
  border-radius: 4px;
}
.results-list .mis {
  color: #f2b5bf;
}
.shelf {
  display: flex;
  gap: 10px;
  justify-content: center;
  background: linear-gradient(
    transparent 78%,
    #73533a 78%,
    #73533a 86%,
    transparent 86%
  );
  height: 135px;
}
.shelf button {
  background: transparent;
  border: 0;
  width: 120px;
  font-size: 36px;
}
.room-code {
  font: 400 36px Georgia;
  letter-spacing: 7px;
  color: #f1d7a0;
}
.lobby-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
#toast {
  position: fixed;
  z-index: 20;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  background: #ead6ac;
  color: #24303a;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2;
}
#toast.show {
  opacity: 1;
}
#fatal {
  position: fixed;
  inset: 20%;
  background: #182634;
  color: #f1dfbd;
  padding: 30px;
  z-index: 50;
}
.mapgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mapgrid button {
  height: 100px;
  text-align: left;
  position: relative;
}
.mapgrid .you {
  border-color: #e7c98e;
}
.mapgrid small {
  display: block;
  font-size: 10px;
  color: #b3ad9f;
  margin-top: 7px;
}
.mapgrid b {
  font-size: 12px;
}
#recording {
  display: none;
}
button svg {
  pointer-events: none;
}
.connection {
  font-size: 10px;
  letter-spacing: 1px;
  color: #c0c4b4;
}
.tutorial {
  position: absolute;
  left: 25px;
  bottom: 80px;
  max-width: 290px;
  font-size: 12px;
  line-height: 1.7;
}
.toy-swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 5px;
}
@media (pointer: coarse) {
  .joystick {
    display: block;
  }
  .controls-hint {
    bottom: 15px;
    font-size: 9px;
  }
  .actions {
    bottom: 60px;
  }
  .actions button {
    min-height: 66px;
  }
  .tutorial {
    bottom: 200px;
  }
  .status {
    width: 195px;
    padding: 12px;
  }
  .ledger {
    display: none;
  }
  .status h2 {
    font-size: 17px;
  }
  .task-panel {
    top: 110px;
  }
  .hud {
    inset: 14px 16px auto;
  }
  .clock {
    min-width: 125px;
    padding: 10px;
  }
  .location {
    top: 100px;
  }
}
@media (max-width: 750px) {
  .brand {
    left: 22px;
    top: 22px;
  }
  .story-note {
    display: none;
  }
  .menu {
    left: 25px;
    top: 10%;
    max-width: none;
    width: calc(100vw - 50px);
  }
  .menu h1 {
    font-size: 48px;
    margin: 15px 0;
  }
  .menu p {
    max-width: 340px;
    font-size: 12px;
  }
  .menu .buttons {
    margin: 15px 0;
  }
  .selection {
    left: 20px;
    right: 20px;
    bottom: 37px;
    width: auto;
    padding: 12px 15px;
  }
  .selection .toys {
    gap: 4px;
    margin: 10px 0;
  }
  .toy-card svg {
    width: 36px;
    height: 38px;
  }
  .toy-card {
    font-size: 10px;
    padding: 5px 1px;
  }
  .toy-card strong {
    display: none;
  }
  .options {
    gap: 10px;
  }
  .field {
    font-size: 10px;
  }
  .field select {
    min-height: 36px;
    padding: 6px;
    font-size: 11px;
  }
  .version {
    left: 22px;
    bottom: 12px;
    font-size: 9px;
  }
  .menu .fine {
    display: none;
  }
  .menu-bg {
    background: linear-gradient(90deg, #0c1422e0, #10182775);
  }
  .hud .status {
    width: 160px;
    padding: 10px;
  }
  .status .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .status h2 {
    font-size: 16px;
  }
  .ledger {
    display: none;
  }
  .clock {
    min-width: 98px;
    padding: 9px;
  }
  .clock b {
    font-size: 22px;
  }
  .hud-right {
    flex-direction: column;
  }
  .hud-right button {
    padding: 6px;
    min-height: 34px;
    font-size: 10px;
  }
  .role {
    font-size: 9px;
  }
  .progress {
    margin: 7px 0;
  }
  .location {
    top: 110px;
    width: 100%;
  }
  .location h2 {
    font-size: 19px;
  }
  .actions {
    right: 15px;
    bottom: 55px;
    gap: 6px;
  }
  .actions button {
    padding: 10px;
    min-width: 60px;
    font-size: 12px;
  }
  .actions button.primary {
    min-width: 105px;
  }
  .joystick {
    left: 15px;
    width: 110px;
    height: 110px;
  }
  .stick {
    left: 29px;
    top: 29px;
  }
  .task-panel {
    right: 12px;
    top: 142px;
    max-height: calc(100dvh - 290px);
    padding: 14px;
  }
  .task-panel h2 {
    font-size: 22px;
  }
  .task-panel p {
    font-size: 11px;
  }
  .task-grid {
    margin: 12px 0;
    gap: 5px;
  }
  .track {
    width: 60px;
    height: 60px;
  }
  .modal {
    padding: 20px;
  }
  .modal h2 {
    font-size: 28px;
  }
  .meeting-toys button {
    height: 100px;
    font-size: 11px;
  }
  .cinema h2 {
    font-size: 32px;
  }
  .cinema {
    padding-bottom: 110px;
  }
  .banner {
    bottom: 190px;
    width: 80%;
    font-size: 11px;
  }
  .tutorial {
    left: 15px;
    bottom: 185px;
    max-width: 250px;
    padding: 12px;
  }
  .crank {
    width: 120px;
    height: 120px;
  }
  .mapgrid button {
    height: 90px;
    padding: 10px;
  }
  .results-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-height: 650px) and (min-width: 751px) {
  .menu {
    top: 12%;
  }
  .menu h1 {
    font-size: 49px;
    margin: 14px 0;
  }
  .menu p {
    font-size: 12px;
  }
  .menu .buttons {
    margin: 13px 0;
  }
  .selection {
    bottom: 38px;
    padding: 14px 18px;
  }
  .selection .toys {
    margin: 9px 0;
  }
  .toy-card svg {
    height: 40px;
  }
  .task-panel {
    top: 110px;
    max-height: calc(100dvh - 190px);
  }
  .task-grid {
    margin: 10px 0;
  }
  .cinema h2 {
    font-size: 32px;
  }
  .cinema {
    padding-bottom: 45px;
  }
  .location {
    top: 100px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* ---- v0.3.0 additions ---- */
button,
.joystick {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.joystick {
  touch-action: none;
}
.objective {
  position: absolute;
  top: 182px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(460px, calc(100vw - 40px));
  padding: 7px 14px;
  border-radius: 999px;
  background: #16202bcc;
  border: 1px solid #c6ad7c55;
  color: #f0e2c6;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.objective .eyebrow {
  display: inline;
  margin-right: 8px;
  color: #c6ad7c;
}
.keys-hint {
  font-size: 10px !important;
  letter-spacing: 0.6px;
  color: #a9a597 !important;
  margin-top: 10px;
}
.solved-note {
  color: #bfe3b4 !important;
  font-weight: 600;
}
.task-panel.solved {
  border-color: #9fd18e;
  box-shadow: 0 0 0 1px #9fd18e55, 0 0 36px #9fd18e33;
}
.task-panel.shake {
  animation: mt-shake 0.38s ease;
}
@keyframes mt-shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -7px 0; }
  40% { translate: 6px 0; }
  60% { translate: -4px 0; }
  80% { translate: 2px 0; }
}
.actions .cap {
  text-transform: capitalize;
}
.storage-note {
  position: absolute;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  font-size: 11px;
  color: #f2c58f;
  background: #16202bdd;
  padding: 6px 12px;
  border-radius: 8px;
}
@media (max-width: 750px) {
  .objective {
    top: auto;
    bottom: 205px;
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .task-panel.shake {
    animation: none;
    outline: 2px solid #e0a070;
  }
}

/* v0.3.0 touch layout: keyboard hints are noise on phones; keep the action row on one line. */
@media (pointer: coarse) {
  .controls-hint {
    display: none;
  }
  .actions {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: calc(100vw - 190px);
  }
  .actions button {
    min-width: 64px;
    min-height: 58px;
    padding: 8px 10px;
  }
  .actions button.primary {
    min-width: 112px;
  }
  .actions .key {
    display: none;
  }
  .joystick {
    left: max(18px, env(safe-area-inset-left));
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
  }
  .task-panel button,
  .push-bar button,
  .meeting-toys button {
    min-height: 52px;
  }
}

@media (max-width: 750px) {
  .location {
    top: 186px;
  }
  .location span {
    display: none;
  }
  .location h2 {
    font-size: 18px;
    text-shadow: 0 1px 6px #000c;
  }
}

/* ---- v0.4.0 ------------------------------------------------------------ */
/* Bell circle: on wide screens the panel docks to the right so the 3D circle stays visible. */
.veil.meeting-veil {
  background: linear-gradient(90deg, transparent 0%, transparent 38%, #090f19cc 62%);
  backdrop-filter: none;
  justify-content: flex-end;
}
.veil.meeting-veil .modal {
  width: min(540px, 52vw);
}
.voted-badge {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 1px;
  color: #a9e2b0;
  text-transform: uppercase;
}
.verdict-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 16px 16px;
  background: linear-gradient(#080b13cc 0%, transparent 45%, transparent 80%, #080b13aa 100%);
}
.verdict-card {
  pointer-events: auto;
  width: min(460px, 94vw);
  background: #121b29e8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: 0 18px 50px #0009;
  text-align: center;
}
.verdict-card h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  margin: 4px 0 10px;
}
.tally {
  display: grid;
  gap: 6px;
  text-align: left;
}
.tally-row {
  display: grid;
  grid-template-columns: 1fr auto 26px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  background: #ffffff0a;
  min-height: 38px;
}
.tally-row.hidden {
  opacity: 0.35;
}
.tally-row.pop {
  animation: tally-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.tally-row.hit {
  background: #e6c27a2b;
  outline: 1px solid #e6c27a88;
}
.tally-row.abst {
  color: var(--muted);
}
.tally-row .who {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tally-row .who svg {
  width: 26px;
  height: 28px;
}
.tally-row .pips i {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px #ffd99a88;
}
.tally-row .pips em {
  font-size: 11px;
  opacity: 0.6;
}
.verdict-line {
  margin: 12px 0 8px;
  font-size: 15px;
  animation: tally-pop 0.5s ease-out;
}
.small-note {
  font-size: 11px;
  opacity: 0.7;
  margin: 6px 0 0;
}
@keyframes tally-pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (max-width: 750px) {
  /* Phones: the bell circle becomes a bottom sheet, leaving the toys visible above it. */
  .veil.meeting-veil {
    align-items: flex-end;
    justify-content: center;
    padding: 8px;
    background: linear-gradient(transparent 0%, transparent 30%, #090f19dd 55%);
  }
  .veil.meeting-veil .modal {
    width: 100%;
    max-height: 66dvh;
  }
  .veil.meeting-veil .meeting-toys button {
    height: 84px;
  }
  .verdict-reveal {
    padding-top: max(56px, env(safe-area-inset-top));
  }
}
@media (prefers-reduced-motion: reduce) {
  .tally-row.pop,
  .verdict-line {
    animation: none;
  }
}
@media (max-width: 750px) {
  .veil.meeting-veil .modal {
    max-height: 56dvh;
    padding-top: 12px;
  }
  .veil.meeting-veil .modal > p:first-of-type {
    display: none;
  }
  .veil.meeting-veil .modal h2 {
    font-size: 22px;
    margin: 2px 0 6px;
  }
  .veil.meeting-veil .claim {
    margin: 4px 0;
    padding: 5px 8px;
  }
  .veil.meeting-veil .meeting-toys button {
    height: 72px;
  }
  .veil.meeting-veil .meeting-toys svg {
    width: 32px;
    height: 36px;
  }
}

/* ---------- v0.5.0 story nights, toy album, HUD chips ---------- */
.story-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 60px 20px 56px;
  background: linear-gradient(#080b13cc 0%, transparent 22%, transparent 55%, #080b13f0 100%);
  border-top: 38px solid #080d16;
  border-bottom: 38px solid #080d16;
  z-index: 30;
}
.story-head {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
  color: var(--gold);
  white-space: nowrap;
}
.beat-count { font-size: 11px; color: var(--muted); }
.story-card {
  display: flex;
  gap: 18px;
  align-items: center;
  width: min(720px, 100%);
  padding: 18px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1b2432f2, #141a26f2);
  border: 1px solid #d8b67f66;
  box-shadow: 0 18px 50px #000a, inset 0 0 0 4px #d8b67f12;
  animation: beatIn 0.45s ease-out;
}
.story-scene.narration .story-card { justify-content: center; text-align: center; background: #0e1420e6; }
.story-scene.narration .story-card p { font: italic 400 19px/1.6 Georgia, serif; }
.story-portrait svg {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(#2c3a4e, #17202d);
  border: 2px solid var(--gold);
  padding: 6px;
  flex-shrink: 0;
}
.story-name { font: 700 13px/1 ui-sans-serif, system-ui; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin-bottom: 7px; }
.story-text p { margin: 0; font: 400 17px/1.55 Georgia, serif; color: #f1e6d0; }
.story-buttons { display: flex; gap: 10px; margin-top: 14px; }
@keyframes beatIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.story-menu {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(120deg, #2a1f3acc, #1b2533cc);
  border: 1px solid #d8b67f55;
}
.story-menu p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.stars .star { color: #6b6658; font-size: 15px; }
.stars .star.on { color: #ffd27a; text-shadow: 0 0 8px #ffb84a; }
.night-stars { margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: #2a1f3a88; border: 1px solid #d8b67f44; }
.night-stars .stars .star { font-size: 26px; }
.night-stars ul { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.night-stars li.done { color: #f6e3b4; }
.chips { position: absolute; top: 216px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: min(620px, calc(100vw - 30px)); pointer-events: none; }
.chip { padding: 4px 10px; border-radius: 999px; font-size: 11px; background: #16202bcc; border: 1px solid #c6ad7c44; color: #e8dcc2; }
.note-chip { border-color: #9ad4ff88; color: #cfe9ff; }
.cat-chip.alert { border-color: #ffb36b; color: #ffd8a8; background: #3a2414cc; }
.freeze-chip { border-color: #ff8a8a; color: #ffd0d0; background: #3a1414dd; font-weight: 700; }
.quirk-chip { opacity: 0.85; }
.toy-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 12px 0; }
.toy-page { padding: 12px; border-radius: 14px; background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 22%, #17202d), #141b27); border: 1px solid color-mix(in srgb, var(--tint) 55%, transparent); }
.toy-page-head { display: flex; gap: 10px; align-items: center; }
.toy-page-head svg { width: 58px; height: 58px; border-radius: 50%; background: #0e1520; padding: 4px; }
.toy-page h3 { margin: 0; font: 400 20px Georgia; }
.toy-page p { font-size: 12px; line-height: 1.5; margin: 8px 0; }
.toy-page .quirk { font-size: 12px; padding: 6px 8px; border-radius: 8px; background: #0008; }
.toy-page .quirk b { color: var(--gold); margin-right: 4px; }
.voice-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.voice-row button { font-size: 10px !important; padding: 4px 7px !important; }
.npc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.npc { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: #1b2432; }
.npc svg { width: 56px; height: 56px; flex-shrink: 0; }
.npc p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
@media (max-width: 750px) {
  .story-scene { padding: 40px 10px 40px; border-width: 22px; }
  .story-card { padding: 12px; gap: 10px; }
  .story-portrait svg { width: 60px; height: 60px; }
  .story-text p { font-size: 15px; }
  .story-menu { flex-direction: column; align-items: stretch; }
  .chips { top: auto; bottom: 168px; }
}
@media (prefers-reduced-motion: reduce) { .story-card { animation: none; } }
/* hide the play HUD behind a story scene */
#app:has(.story-scene) .hud,
#app:has(.story-scene) .location,
#app:has(.story-scene) .controls,
#app:has(.story-scene) .chips { visibility: hidden; }

/* ---------- v0.6.0 talents, mini-games, shop events ---------- */
button.talent { border-color: #9ad4ff88 !important; }
button.talent.ready { box-shadow: 0 0 0 2px #9ad4ff55, 0 0 18px #9ad4ff44; animation: talentReady 2.4s ease-in-out infinite; }
button.talent.active { background: linear-gradient(#3a5a7a, #24384e) !important; }
button.talent.cooling { opacity: 0.6; }
.talent-ic { font-size: 15px; }
@keyframes talentReady { 50% { box-shadow: 0 0 0 3px #9ad4ff88, 0 0 26px #9ad4ff66; } }
.melody { display: flex; gap: 10px; justify-content: center; margin: 8px 0 12px; }
.mnote { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #0006; border: 2px solid #ffffff22; font-size: 16px; opacity: 0.55; }
.mnote.next { opacity: 1; border-color: var(--gold); animation: beatIn 0.9s ease-in-out infinite alternate; }
.mnote.done { opacity: 1; background: #d8b67f33; border-color: #d8b67f; }
.b0 { color: #fff1b0; } .b1 { color: #bfe3ff; } .b2 { color: #f6b0c4; } .b3 { color: #c9f0c4; }
.bells button.bell { width: 64px; height: 64px; border-radius: 50% 50% 40% 40%; font-size: 24px; background: radial-gradient(circle at 40% 30%, #fff6d8, #c9a35a 60%, #7a5a2a); color: #3a2a10; }
.task-grid.paint { gap: 18px; }
.patch-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.swatch { width: 40px; height: 14px; border-radius: 4px; border: 2px solid #fff8; }
button.patch { width: 64px; height: 64px; border-radius: 14px; border: 3px dashed #fff6; }
button.patch.match { border: 3px solid #fff; box-shadow: 0 0 14px #fff8; }
.event-chip { border-color: #ffd27a; color: #fff1c0; background: #3a2a14dd; font-weight: 700; }
.event-chip.flicker { border-color: #8ea2ff; color: #d8deff; background: #141a3add; }
.event-chip.draft { border-color: #bfe3ff; color: #e6f2ff; background: #14283add; }
.toy-page .talent-line { margin-top: 6px; background: #12304a99; }
.toy-page .talent-line b { color: #9ad4ff; }
/* v0.7.0: four story nights as compact chips, locks, per-night collectible chips */
.story-eyebrow{margin-top:12px}
.story-nights{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:6px;max-width:640px}
.night-chip{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:7px 9px;border-radius:10px;border:1px solid rgba(243,220,166,.35);background:rgba(30,22,40,.72);color:#f3e6c8;font-size:12px;text-align:left;line-height:1.15;cursor:pointer;min-height:0}
.night-chip b{font-size:12.5px}
.night-chip .night-num{font-size:9.5px;letter-spacing:1.5px;text-transform:uppercase;color:#e7c777}
.night-chip .stars{font-size:11px}
button.night-chip:hover,button.night-chip:focus-visible{border-color:#f3dca6;background:rgba(60,42,60,.85)}
.night-chip.locked{opacity:.5;cursor:default}
.night-lock{font-size:10.5px;color:#e9d7b5;white-space:nowrap}
.note-chip.footprint{border-color:#ff9fc0}.note-chip.page{border-color:#9fd0ff}.note-chip.letter{border-color:#ffe08a}
@media (max-width:720px){.story-nights{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-height:820px){.menu .fine{display:none}}
/* v0.8.0: progression: friendship, memories, badges, outfits */
.progress-note{margin:10px 0;padding:10px 12px;border-radius:12px;background:rgba(255,220,170,.08);border:1px solid rgba(243,220,166,.3);animation:pnIn .6s ease-out both}
.progress-note .hearts{color:#ff8fae;font-size:18px;letter-spacing:2px}.progress-note .hearts span{color:#f3e6c8;font-size:13px;letter-spacing:0}
.level-up{margin-top:6px;color:#ffe3a0;font-size:13px}
.badge-new{margin-top:8px;display:flex;gap:8px;align-items:center;font-size:13px;padding:6px 8px;border-radius:10px;background:linear-gradient(100deg,rgba(255,227,160,.14),rgba(255,227,160,.02) 40%,rgba(255,255,255,.18) 50%,rgba(255,227,160,.02) 60%);background-size:300% 100%;animation:shine 2.4s ease-in-out infinite}
.badge-new span{opacity:.8}
.badge-icon{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff3cf,#d9a441);color:#3a2a20;font-size:16px;flex:none;box-shadow:0 0 12px rgba(255,210,122,.5)}
.badges{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:6px;margin:6px 0}
.badge{display:grid;grid-template-columns:30px 1fr;column-gap:8px;align-items:center;padding:6px 8px;border-radius:10px;border:1px solid rgba(243,220,166,.18);opacity:.45;font-size:12px}
.badge small{grid-column:2;opacity:.75;font-size:10.5px;line-height:1.25;display:block;margin-top:2px}
.badge b{line-height:1.15}
.badge.on{opacity:1;border-color:rgba(243,220,166,.55);background:rgba(255,220,170,.06)}
.badge:not(.on) .badge-icon{background:#3a3346;color:#9c93ad;box-shadow:none}
.outfits button.locked{opacity:.5}
.memories{margin-top:8px}.memories ol{margin:4px 0 0;padding-left:18px;font-size:12px;line-height:1.35}
.memories li{margin:3px 0;font-style:italic}.memories li.locked{opacity:.5;font-style:normal}
.friend-bar{height:6px;border-radius:4px;background:rgba(255,255,255,.1);overflow:hidden;margin-bottom:4px}.friend-bar span{display:block;height:100%;background:linear-gradient(90deg,#ff8fae,#ffe3a0)}
@keyframes pnIn{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
@keyframes shine{0%{background-position:100% 0}100%{background-position:-100% 0}}
@media (prefers-reduced-motion:reduce){.progress-note,.badge-new{animation:none}}

/* v0.9.0: finale, epilogue, accessibility and phone polish */
.epilogue{margin-top:10px;max-width:560px;font-size:12.5px;line-height:1.4;color:#f3e6c8;padding:8px 10px;border-left:3px solid #e7c777;background:rgba(30,22,40,.6);border-radius:0 8px 8px 0}
.note-chip.strand{border-color:#e05a7a}
html.big-text{font-size:118%}
html.big-text .story-text p,html.big-text .toast,html.big-text #toast{font-size:1.12em}
html.big-text .chip{font-size:13px}
html.high-contrast .panel,html.high-contrast .modal,html.high-contrast .story-card{background:#05070c!important;border-color:#ffe3a0!important}
html.high-contrast body,html.high-contrast .panel p,html.high-contrast .chip{color:#fff!important}
html.high-contrast button{border:2px solid #ffe3a0!important}
html.high-contrast .vignette{opacity:.35}
html.reduced-motion *{animation-duration:.01ms!important;transition-duration:.01ms!important}
button:focus-visible{outline:3px solid #ffe3a0;outline-offset:2px}
button,[data-act]{touch-action:manipulation}
@supports (padding:env(safe-area-inset-top)){.hud{padding-top:env(safe-area-inset-top)}.hud-right{margin-right:env(safe-area-inset-right)}.status{margin-left:env(safe-area-inset-left)}}
@media (pointer:coarse){.night-chip{min-height:52px}.story-buttons button{min-height:48px;min-width:96px}.settings-row input[type=checkbox]{width:26px;height:26px}}
@media (max-width:720px){.story-nights{grid-template-columns:repeat(3,minmax(0,1fr))}}
/* v0.9.0 phone: status chips stay on one line under the objective (they used to wrap up into it) */
@media (max-width:750px){.chips{flex-wrap:nowrap;justify-content:flex-start;overflow:hidden;max-width:calc(100vw - 20px);-webkit-mask-image:linear-gradient(90deg,#000 88%,transparent);mask-image:linear-gradient(90deg,#000 88%,transparent)}.chips .chip{flex:none}.chips .quirk-chip{display:none}}
html.high-contrast select,html.high-contrast input[type=range]{background:#05070c;color:#fff;border:2px solid #ffe3a0}
html.high-contrast option{background:#05070c;color:#fff}
