.brand-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.invite-small {
  display: none;
}
@media (min-width: 761px) {
  :root {
    --bar: 60px;
    --rail: clamp(280px, 26vw, 366px);
    --gutter: clamp(14px, 2vw, 28px);
  }
  header {
    height: var(--bar);
  }
  .header-inner,
  main {
    width: min(
      calc(100% - 32px),
      calc(100dvh - var(--bar) - 58px + var(--rail) + var(--gutter))
    );
  }
  .layout {
    margin-top: 13px;
    grid-template-columns: minmax(0, 1fr) var(--rail);
    gap: var(--gutter);
  }
  aside {
    max-height: calc(100dvh - var(--bar) - 21px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    gap: 10px;
    padding-bottom: 4px;
  }
  .board-footer {
    margin: 10px 0 4px;
  }
}
@media (max-width: 760px) {
  header {
    height: 56px;
  }
  .header-inner,
  main {
    width: min(650px, calc(100% - 20px));
  }
  .layout {
    margin-top: 10px;
  }
  .brand-identity {
    gap: 6px;
  }
  .header-right {
    gap: 8px;
  }
}
@media (max-width: 620px) {
  .brand-identity {
    position: relative;
    display: grid;
    gap: 0;
  }
  .brand-identity .brand {
    font-size: 23px;
  }
  .brand-identity .room-tag {
    position: absolute;
    bottom: -5px;
    left: 39px;
    font-size: 8px;
    white-space: nowrap;
    background: transparent;
    border: 0;
    padding: 0;
    gap: 4px;
  }
  .brand-identity .brand > span:last-child {
    transform: translateY(-4px);
  }
  .invite-small {
    display: inline;
  }
  .invite-large {
    display: none;
  }
  .header-right .rules-button {
    font-size: 0;
    gap: 0;
    padding: 6px;
  }
  .header-right .divider {
    display: none;
  }
}
.action-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.action-dock button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 2px;
  background: #fcfcf5;
  border: 1px solid #c8d1c3;
  border-radius: 8px;
  font: 650 13px var(--sans);
  white-space: nowrap;
}
.action-dock button:hover,
.history-link:hover,
.outline-action:hover {
  background: #e6edde;
}
.action-dock button.has-incoming {
  border-color: #ac8150;
  background: #fff3d7;
}
.action-dock b {
  background: #a44131;
  color: #fff;
  font: 700 10px/17px var(--sans);
  min-width: 17px;
  border-radius: 12px;
  text-align: center;
}
.action-dock b[hidden],
#olderRows[hidden] {
  display: none;
}
.seat-color {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--seat);
  margin-right: 5px;
  box-shadow: inset 0 0 0 1px #0002;
}
.player-row.active:before {
  background: var(--seat);
}
.player-name {
  gap: 4px;
}
.mini-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.mini-deed {
  font: 700 9px/10px var(--sans);
  color: #334b3e;
  text-align: center;
  min-width: 14px;
  border: 1px solid #bbc3b3;
  border-top: 4px solid var(--color);
  border-radius: 2px;
  background: #fffdf1;
  box-shadow: 0 1px 0 #26382c12;
}
.empty-assets {
  font: 400 11px var(--sans);
  color: #637067;
}
.history-link {
  border: 0;
  background: transparent;
  border-radius: 5px;
  padding: 5px;
  color: var(--green);
  font: 650 12px var(--sans);
}
.history-panel .panel-head {
  padding-block: 10px;
}
dialog[data-kind="trades"],
dialog[data-kind="payment"] {
  width: min(550px, calc(100% - 20px));
}
dialog select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 10px;
  border: 1px solid #bfcab8;
  border-radius: 7px;
  background: #fffef8;
}
.trade-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
}
.trade-side {
  min-width: 0;
  border: 1px solid #ccd2c2;
  border-radius: 8px;
  background: #f3f3e8;
  padding: 8px 10px 11px;
  margin: 0;
}
.trade-side legend {
  font: 700 17px var(--serif);
  padding: 0 4px;
}
.trade-choices {
  max-height: 148px;
  overflow: auto;
  scrollbar-width: thin;
  padding: 2px;
  min-height: 32px;
}
label.trade-estate {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  margin: 0;
  padding: 6px 1px;
  cursor: pointer;
}
.trade-estate input {
  appearance: auto;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--green);
}
.trade-estate > i {
  width: 5px;
  height: 16px;
  background: var(--color);
  flex: none;
  border-radius: 3px;
}
.trade-estate small {
  margin-left: auto;
  font-size: 10px;
}
.trade-estate:has(:checked) {
  color: #104a31;
  background: #e0ebd9;
}
.money-label {
  display: flex;
  justify-content: space-between;
}
.money-label small {
  font-weight: 400;
  color: var(--muted);
}
.trade-side input[type="number"] {
  padding: 7px 9px;
}
dialog .trade-hint,
.muted-note,
.recent-deal small {
  font-size: 13px;
}
.trade-hint {
  margin: 10px 0 3px;
}
.offer-card,
.recent-deal,
.bill {
  border: 1px solid #bdcbb4;
  background: #edf2e3;
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
}
.offer-card h3 {
  font: 700 20px var(--serif);
}
.offer-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 13px;
}
.offer-card dt {
  color: var(--muted);
}
.offer-card dd {
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.offer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fill-action,
.outline-action {
  border: 1px solid #afc0ac;
  border-radius: 6px;
  background: #fcfbf0;
  font: 650 13px var(--sans);
  padding: 8px 12px;
}
.fill-action {
  color: white;
  background: var(--green);
  border-color: var(--green);
}
.recent-deal {
  font-size: 13px;
  padding: 9px 12px;
}
.recent-deal small {
  display: block;
  color: #536654;
  margin-top: 4px;
}
.room-messages {
  min-height: 195px;
  height: min(47dvh, 400px);
  overflow: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 7px 5px 10px 1px;
  overscroll-behavior: contain;
}
.chat-message {
  align-self: flex-start;
  flex-shrink: 0;
  max-width: 88%;
  background: #eeeede;
  padding: 7px 11px;
  border-radius: 10px 10px 10px 2px;
}
.chat-message.mine {
  align-self: flex-end;
  background: #dfeeda;
  border-radius: 10px 10px 2px 10px;
}
.chat-message div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-message b {
  color: var(--ink);
  font-size: 12px;
  border-left: 3px solid var(--pc);
  padding-left: 4px;
}
.chat-message time {
  color: #667665;
  margin-left: auto;
  font-size: 10px;
}
.chat-message p {
  font-size: 14px;
  color: #293e30;
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-empty {
  align-self: center;
  text-align: center;
  margin: auto;
  font-size: 14px;
}
.chat-empty svg {
  display: block;
  margin: 0 auto 8px;
}
#chatForm.chat-compose {
  display: flex;
  align-items: stretch;
  gap: 5px;
  border: 1px solid #becbb9;
  background: #fffef9;
  margin-top: 12px;
  border-radius: 8px;
  padding: 4px;
}
#chatForm.chat-compose button {
  border-radius: 5px;
  background: var(--green);
  color: white;
}
#chatForm.chat-compose button:disabled {
  opacity: 0.45;
}
.history-scroll {
  max-height: min(63dvh, 530px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.history-scroll h3 {
  font: 700 16px var(--serif);
  margin: 10px 0 5px;
  background: #eaf0e1;
  border-radius: 5px;
  padding: 5px 8px;
}
.history-scroll .log-row p {
  margin: 0;
}
.dialog-feedback {
  background: #fff0d6;
  color: #79421e;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
}
.street-photo {
  margin: 0 0 10px;
}
.street-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1.95;
  object-fit: cover;
  border: 1px solid #bfbba6;
  border-radius: 6px;
}
.street-photo figcaption {
  font: 10px/1.4 var(--sans);
  color: #66715e;
  text-align: right;
  margin-top: 3px;
}
.street-photo summary {
  cursor: pointer;
}
.street-photo a {
  color: inherit;
  text-decoration: underline;
}
.street-photo + .deed-plate {
  display: none;
}
.bill {
  border-top: 4px solid #a87739;
}
.bill strong {
  font: 700 28px var(--serif);
}
.bill small {
  display: block;
  color: var(--muted);
}
.bill p {
  margin: 6px 0;
  font-size: 14px;
}
.finance-list {
  display: grid;
  gap: 6px;
}
.finance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.finance-item > span {
  min-width: 0;
}
.finance-item small {
  display: block;
  color: var(--muted);
}
.finance-item button {
  flex: none;
}
.payment-note {
  padding: 8px 10px;
  background: #e9efdf;
  border-radius: 6px;
  font-size: 13px;
  margin: 9px 0 0;
}
.money-status {
  font: 600 11px var(--sans);
  color: #715139;
}
@media (max-width: 420px) {
  dialog[data-kind="trades"],
  dialog[data-kind="payment"] {
    padding: 15px;
  }
  .trade-sides {
    gap: 6px;
  }
  .trade-side {
    padding: 7px;
  }
  .trade-estate {
    font-size: 12px;
  }
  .money-label small {
    display: block;
  }
  .header-right {
    gap: 5px;
  }
  .action-dock button {
    padding: 11px 3px;
  }
}

.rent-table {
  margin: 9px 0;
  border: 1px solid #c9c9b3;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 12px;
}
.rent-table summary {
  font-weight: 650;
  cursor: pointer;
}
.rent-table > div {
  display: flex;
  justify-content: space-between;
  padding-top: 5px;
}
.estate-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 11px;
}
.trade-estate:has(:disabled) {
  opacity: 0.65;
}
.turn-card .payment-note {
  color: #224737;
}
.bill + .facts {
  margin: 10px 0;
}

#estateConfirm {
  width: min(390px, calc(100% - 28px));
  border-top-color: #a97f43;
}
#estateConfirm h2 {
  font: 700 26px/1.1 var(--serif);
}
.confirm-slip {
  display: grid;
  gap: 5px;
  background: #edf0e1;
  border-block: 1px solid #d3d8c4;
  padding: 12px 14px;
  margin: 16px 0 8px;
}
.confirm-deed {
  font: 700 19px var(--serif);
}
.confirm-amount {
  font: 650 14px var(--sans);
}
#estateConfirm p {
  font-size: 14px;
  margin: 12px 0 15px;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 9px;
}
.confirm-actions button {
  margin: 0;
}
#moneyNotices {
  position: fixed;
  inset: auto 18px 18px auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: min(305px, calc(100vw - 28px));
  overflow: visible;
  pointer-events: none;
  z-index: 110;
}
#moneyNotices:empty {
  display: none;
}
.cash-receipt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  align-items: center;
  padding: 12px 14px;
  margin-top: 6px;
  border-radius: 9px;
  border: 1px solid #b1bda7;
  border-left: 4px solid #9e804e;
  background: #fcfbef;
  box-shadow: 0 5px 21px #23362e30;
  animation: cash-arrives 0.24s ease-out;
}
.cash-receipt strong {
  font: 650 14px var(--sans);
  overflow-wrap: anywhere;
}
.cash-receipt b {
  font: 700 18px var(--serif);
  white-space: nowrap;
}
.cash-receipt span {
  grid-column: 1/-1;
  font: 13px var(--sans);
  color: #536553;
}
.player-row .balance {
  position: relative;
}
.cash-delta {
  display: block;
  color: #236346;
  font: 700 11px var(--sans);
  text-align: right;
  line-height: 1.1;
}
.player-row[data-cash="out"] .cash-delta {
  color: #a2432a;
}
.player-row[data-cash="in"] {
  background: #e2eddf;
}
.player-row[data-cash="out"] {
  background: #f6e6dc;
}
@keyframes cash-arrives {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.fallback-cage {
  position: absolute;
  display: block;
  aspect-ratio: 1;
  transform: translate(-49%, -79%);
  filter: drop-shadow(1px 2px 1px #12212a55);
}
.fallback-cage[hidden] {
  display: none;
}
.fallback-cage i,
.fallback-cage b,
.fallback-cage em {
  position: absolute;
  display: block;
  border: 1.6px solid #384447;
}
.fallback-cage i {
  inset: 17% 18% 0 0;
  transform: skewY(7deg);
  background: repeating-linear-gradient(
    90deg,
    transparent 0 21%,
    #4a5456 22% 27%
  );
  box-shadow: inset 0 -2px #798184;
}
.fallback-cage b {
  inset: 9% 0 8% 81%;
  transform: skewY(-35deg);
  background: repeating-linear-gradient(
    90deg,
    transparent 0 38%,
    #545e60 40% 52%
  );
}
.fallback-cage em {
  inset: 0 8% 81% 7%;
  transform: skewX(-39deg) rotate(6deg);
  background: repeating-linear-gradient(
    90deg,
    transparent 0 24%,
    #586368 25% 29%
  );
}
.draw-event[data-kind="arrest"] {
  color: #fcf4dd;
  border-color: #c5a25a;
  background: #303c3d;
  box-shadow:
    0 6px 0 #172321,
    0 9px 23px #15242145;
}
.draw-event[data-kind="arrest"] .draw-stamp {
  display: none;
}
.draw-event[data-kind="arrest"] small {
  color: #e7c270;
}
.draw-event[data-kind="arrest"] p {
  color: #f0ebd9;
}
@media (max-width: 620px) {
  #moneyNotices {
    inset: 8px 8px auto auto;
    width: min(265px, calc(100% - 16px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .cash-receipt {
    animation: none;
  }
}

.appearance fieldset {
  border: 0;
  margin: 14px 0 0;
  padding: 0;
  min-width: 0;
}
.appearance legend {
  font: 700 15px var(--sans);
  margin-bottom: 7px;
}
.token-options,
.color-options {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.color-options {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
label.appearance-option {
  margin: 0;
  position: relative;
  cursor: pointer;
}
.appearance-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  padding: 0;
}
.appearance-option > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px;
  min-height: 40px;
  border: 1px solid #cdd2c2;
  border-radius: 7px;
  background: #fbfbef;
}
.appearance-option small {
  font: 600 12px var(--sans);
  line-height: 1.15;
}
.appearance-option img {
  width: 36px;
  height: 33px;
  object-fit: contain;
}
.color-options span {
  flex-direction: column;
}
.color-options small {
  font-size: 10px;
}
.appearance-option i {
  width: 18px;
  height: 18px;
  display: inline-block;
  border: 1px solid #0003;
  border-radius: 50%;
  background: var(--swatch);
}
.appearance-option input:checked + span {
  border-color: #316449;
  box-shadow: inset 0 0 0 1px #316449;
  background: #e7efdf;
}
.appearance-option input:focus-visible + span {
  outline: 3px solid #bc8a42;
}
.appearance-option input:disabled + span {
  opacity: 0.38;
  cursor: default;
}
@media (max-width: 450px) {
  .token-options span {
    flex-direction: column;
  }
  .color-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .color-options span {
    flex-direction: row;
  }
}
.cash-plus,
.cash-leg .cash-plus,
.cash-receipt .cash-plus,
.cash-delta .cash-plus {
  color: #177047;
}
.cash-minus,
.cash-leg .cash-minus,
.cash-receipt .cash-minus,
.cash-delta .cash-minus {
  color: #ad382b;
}
.cash-lines,
.cash-receipt .cash-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 5px;
}
.cash-leg,
.cash-receipt .cash-leg {
  display: grid;
  grid-template-columns: 1fr;
  min-width: 0;
  gap: 1px;
  padding: 3px 6px;
  border-radius: 4px;
  background: #f5e7dc;
}
.cash-leg:last-child,
.cash-receipt .cash-leg:last-child {
  background: #e4eedf;
}
.cash-leg > span,
.cash-receipt .cash-leg > span {
  font: 500 11px var(--sans);
  overflow-wrap: anywhere;
  color: #415248;
}
.cash-leg b,
.cash-receipt .cash-leg b {
  font: 700 15px var(--sans);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cash-receipt {
  display: block;
  padding: 10px 13px 12px;
  border-left-color: #3b7055;
  animation: ticket-arrives 0.48s cubic-bezier(0.2, 0.8, 0.24, 1);
}
.cash-receipt > strong {
  display: block;
  font: 700 17px var(--serif);
}
.cash-receipt > small {
  font: 700 10px var(--sans);
  letter-spacing: 0.1em;
  color: #42624e;
}
.cash-receipt.invoice-ticket {
  border-left-color: #ad7836;
}
.invoice-ticket > small {
  color: #835f29;
}
.bill > strong {
  font: 700 23px var(--serif);
}
.bill .cash-lines {
  margin-top: 10px;
}
.bill .cash-leg {
  padding: 7px 10px;
}
.bill .cash-leg b {
  font-size: 21px;
}
.payment-note .cash-leg {
  background: transparent;
  padding: 0;
}
.log-row .cash-leg b {
  font-size: 12px;
}
.log-row .cash-lines {
  margin-top: 4px;
}
.cash-delta b {
  font: inherit;
}
.player-row[data-cash="in"] .balance-value {
  color: #166944;
}
.player-row[data-cash="out"] .balance-value {
  color: #a43b2d;
}
.cash-delta {
  animation: cash-float 2.8s both;
  animation-delay: var(--cash-age, 0s);
  transform-origin: right center;
}
@keyframes cash-float {
  0% {
    opacity: 0;
    transform: translateY(9px) scale(0.85);
  }
  17% {
    opacity: 1;
    transform: translateY(-2px) scale(1.18);
  }
  30%,
  82% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-5px);
  }
}
@keyframes ticket-arrives {
  from {
    opacity: 0;
    transform: translateY(17px) rotate(-1.8deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cash-delta,
  .cash-receipt {
    animation: none;
  }
}

.place-button[hidden] {
  display: none;
}
.place-button {
  margin-left: auto;
  color: #285e40;
}
.board-footer {
  gap: 8px;
}
.tile.build-target {
  outline: 3px solid #398953;
  outline-offset: -3px;
  z-index: 3;
  box-shadow: inset 0 0 0 5px #cfdf9d;
  background: #edf5da;
}
.build-price {
  position: absolute;
  top: 50%;
  left: 2%;
  right: 2%;
  transform: translateY(-50%);
  z-index: 7;
  text-align: center;
  background: #215b3b;
  color: white;
  padding: 3px 0;
  font: 700 clamp(8px, 1.35cqw, 13px) var(--sans);
  border-radius: 3px;
}
@media (max-width: 520px) {
  .board-footer:has(.place-button:not([hidden])) > span {
    display: none;
  }
}

.wallet {
  flex: none;
  position: relative;
  border-left: 1px solid #cdd5c5;
  padding-left: 12px;
  display: grid;
  gap: 1px;
}
.wallet[hidden] {
  display: none;
}
.wallet > small {
  color: #5e715f;
  font: 600 10px var(--sans);
}
.wallet .balance {
  font: 700 17px var(--serif);
  white-space: nowrap;
  margin: 0;
}
.wallet .cash-delta {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fcfbef;
  border-radius: 4px;
  padding: 1px 4px;
  z-index: 8;
}
.wallet[data-cash="in"] .balance-value {
  color: #177047;
}
.wallet[data-cash="out"] .balance-value {
  color: #ad382b;
}
@media (max-width: 760px) {
  .wallet {
    padding-left: 6px;
  }
  .wallet .balance {
    font-size: 14px;
  }
  .wallet > small {
    font-size: 9px;
  }
}
@media (max-width: 405px) {
  .brand-identity .brand {
    font-size: 19px;
  }
  .header-inner {
    gap: 5px;
  }
  .header-right .rules-button {
    padding: 3px;
  }
  .wallet {
    padding: 0;
    border: 0;
  }
  .header-right {
    gap: 3px;
  }
}

.cash-receipt .cash-leg {
  grid-column: auto;
}
