:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #f9ebc7;
  background: #202727;
  --text: #f9ebc7;
  --muted: #c2ceca;
  --gold: #efc576;
  --panel: #1c3738;
  --line: #8f724b;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button {
  border: 1px solid var(--line);
  background: #433029;
  color: var(--text);
  border-radius: 6px;
  padding: .66rem .95rem;
  min-height: 42px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.quiet { background: transparent; }
.primary { background: var(--gold); color: #271b15; border-color: #f2c77a; font-weight: 700; }
.account { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .65rem; font-size: .88rem; }
#connection { color: var(--muted); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: .035em; }
h2 { font-size: 1.04rem; }
p { color: var(--muted); font-size: .93rem; line-height: 1.6; }
.notice { margin-bottom: 1rem; border: 1px solid #936f41; color: #f8d995; background: #423025; border-radius: 7px; padding: .65rem .8rem; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 1.25rem; }
.login-form { display: flex; flex-direction: column; justify-content: center; gap: 1.1rem; padding: clamp(1.3rem, 4.5vw, 3rem); border: 0; border-radius: 0; }
.login-form h1 { white-space: nowrap; font-size: clamp(1.55rem, 3vw, 2.1rem); }
label { display: grid; gap: .45rem; color: var(--text); font-size: .91rem; }
input, select { width: 100%; min-height: 44px; background: #261b18; border: 1px solid var(--line); padding: .56rem .7rem; border-radius: 6px; color: var(--text); }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.columns { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 286px; }
.create { display: grid; gap: .85rem; align-content: start; }
.history { margin-top: 1rem; }
.resume { margin-bottom: 1rem; }
.rows > * { border-bottom: 1px solid var(--line); padding: .75rem 0; }
.rows > :last-child { border-bottom: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.row strong, .row small { display: block; }
small { color: var(--muted); font-size: .83rem; }
.prepare { max-width: 720px; }
.buttons { display: flex; flex-wrap: wrap; gap: .55rem; }
.match-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.board-frame { border: 1px solid #947247; background: #dfc69a; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 28px #120b0799; }
canvas { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 1.1rem; padding: .6rem 1rem; color: #594330; border-top: 1px solid #ac8d5f; font-size: .82rem; }
.controls h2, .events h2, .roster h2 { margin-bottom: .65rem; }
.phase { color: var(--gold); border: 1px solid #88643e; padding: .4rem .7rem; border-radius: 999px; font-size: .85rem; }
.player i { display: block; width: .72rem; height: .72rem; border-radius: 50%; background: var(--seat); }
.seat-0 { --seat: #bd5244; } .seat-1 { --seat: #246c72; } .seat-2 { --seat: #796099; } .seat-3 { --seat: #6d7131; }
.events ol { padding-left: 1.4rem; margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.events ol:empty { display: none; }
dialog { width: min(520px, calc(100% - 32px)); max-height: 80vh; background: var(--panel); color: var(--text); border: 0; padding: 0; border-radius: 10px; }
dialog::backdrop { background: #130c0aaf; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .55rem; margin-bottom: .7rem; }
.settings-grid label { display: grid; gap: .18rem; font-size: .86rem; }
#bot-settings fieldset { border: 1px solid var(--line); padding: .55rem; }
dialog form { display: grid; gap: 1rem; }
.history-mode { display: flex; align-items: center; gap: .45rem; }
.history-mode select { width: auto; }
.subtle { margin-block: .4rem; }
.account-settings form { gap: .45rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.account-settings form button { justify-self: start; }
#account-name-form, #account-title-form { grid-template-columns: 1fr auto; align-items: end; }
#account-name-form .account-feedback, #account-title-form .account-feedback { grid-column: 1 / -1; }
.password-fields { display: grid; gap: .45rem; }
@media (min-width: 500px) { .password-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.account-career, .account-feedback { color: var(--gold); }
.account-feedback:empty { display: none; }
#detail-events { margin-top: .4rem; padding-left: 1.4rem; line-height: 1.65; }
#match-result { width: min(1024px, calc(100vw - 22px)); max-height: 94vh; border-radius: 3px; }
.finish-panel { padding: 0; border-radius: 3px; color: #fff2c5; background: #172b28; }
.finish-stage { position: relative; background: radial-gradient(ellipse at 50% 70%, #625238, #232324 75%); }
#finish-scene { image-rendering: pixelated; }
.finish-heading { position: absolute; top: 0; inset-inline: 0; padding: clamp(.4rem, 2vw, 1rem); background: linear-gradient(#102322e8, #102322a0 70%, transparent); }
.finish-heading h2 { font-size: clamp(1.1rem, 2.3vw, 1.55rem); color: var(--gold); }
.finish-heading p { color: #fff2c5; }
#finish-scene[hidden] + .finish-heading { position: static; }
.finish-table { overflow-x: auto; }
.finish-table table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: .88rem; }
.finish-table th, .finish-table td { padding: .35rem .75rem; border-bottom: 1px solid #775d3c; }
.finish-table thead { background: #32413c; }
.finish-table tbody tr { background: #252c2a center / 100% 100% no-repeat; }
.finish-table tbody .finish-own { color: #ffe49a; background-color: #544228; }
.finish-table td img { display: block; width: 32px; height: auto; image-rendering: pixelated; }
.finish-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .65rem .8rem; }
.finish-footer p { flex: 1 1 13rem; color: var(--gold); }
@media (max-width: 530px) {
  .finish-table table { table-layout: fixed; white-space: normal; font-size: .75rem; }
  .finish-table th, .finish-table td { padding: .3rem .22rem; overflow-wrap: anywhere; }
  .finish-table th:first-child { width: 30%; }
  .finish-table th:nth-child(2), .finish-table th:nth-child(3) { width: 10%; }
  .finish-table td img { width: min(100%, 30px); }
}
#tutorial-dialog { width: min(475px, calc(100vw - 24px)); }
.tutorial-menu { display: grid; gap: .7rem; }
#tutorial-choices { display: grid; gap: .34rem; }
#tutorial-choices button { text-align: left; display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding: .35rem .68rem; }
#tutorial-choices small { white-space: nowrap; font-size: .73rem; }
#tutorial-choices button[aria-pressed="true"] { border-color: #e3c478; background: #3c523e; box-shadow: inset 3px 0 #e3c478; }
.tutorial-policy { font-size: .8rem; }
#guide-dialog { width: min(700px, calc(100vw - 24px)); }
.guide-panel .heading { margin-bottom: .35rem; }
.guide-source { font-size: .78rem; margin-bottom: .5rem; }
.guide-layout { display: grid; grid-template-columns: minmax(127px, 29%) minmax(0, 1fr); gap: .6rem; }
#guide-contents, #guide-article { overflow: auto; max-height: min(65dvh, 424px); scrollbar-gutter: stable; padding: .5rem; }
#guide-contents { border-right: 1px solid var(--line); }
.guide-nav-group { display: grid; gap: 4px; margin-bottom: .68rem; }
.guide-nav-group h3 { margin: .22rem 0; color: var(--gold); font-size: .85rem; }
.guide-nav-group button { min-height: 29px; padding: .28rem .45rem; text-align: left; font-size: .81rem; }
.guide-nav-group button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
#guide-article h3 { margin: .1rem 0 .6rem; font-size: 1rem; }
.guide-entry { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem .1rem; border-top: 1px solid #9d8950; }
.guide-entry h4 { margin: 0 0 .24rem; color: #ffe5a3; }
.guide-entry p { font-size: .85rem; white-space: pre-line; }
.guide-entry img { width: min(92px, 23%); height: 88px; object-fit: contain; image-rendering: pixelated; }
.guide-entry.wide { display: grid; }
.guide-entry.wide img { width: min(100%, 478px); height: auto; }
@media (min-width: 475px) and (min-height: 662px) {
  .original-guide .tutorial-menu { position: relative; display: block; aspect-ratio: 475 / 624; padding: 0; border: 0; background: #d9bc79 url('/art/tutorial-entry.png') center / 100% 100% no-repeat; box-shadow: none; }
  .original-guide .tutorial-menu h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .original-guide #tutorial-choices { position: absolute; inset: 14% 10.5% 45% 7%; align-content: start; }
  .original-guide #tutorial-summary, .original-guide .tutorial-policy { position: absolute; left: 11.4%; right: 10%; color: #37250c; }
  .original-guide #tutorial-summary { top: 65.5%; }
  .original-guide .tutorial-policy { top: 80.3%; }
  .original-guide .tutorial-menu .buttons { position: absolute; left: 7%; right: 5%; bottom: 4%; }
}
@media (min-width: 720px) and (min-height: 620px) {
  .original-guide .guide-panel { position: relative; display: block; height: 515px; border: 0; padding: 0; background: url('/art/guide-panel.png') center / 100% 100% no-repeat; box-shadow: none; }
  .original-guide .guide-panel h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .original-guide #close-guide { position: absolute; right: 2%; top: .8%; min-height: 27px; padding: .22rem .6rem; }
  .original-guide .guide-source { position: absolute; left: 35%; right: 3%; top: 9.4%; color: #fff5dc; text-shadow: 0 1px #342611; }
  .original-guide .guide-layout { position: absolute; inset: 13.5% 2.6% 8.8% 3.6%; grid-template-columns: 28.3% minmax(0, 1fr); gap: 5.45%; }
  .original-guide #guide-contents, .original-guide #guide-article { background: #201c14b8; border: 1px solid #b99145; border-radius: 3px; }
}
@media (max-width: 500px) {
  #tutorial-choices button { flex-wrap: wrap; }
  .guide-layout { grid-template-columns: 1fr; }
  #guide-contents { display: flex; gap: .38rem; max-height: 126px; border: 1px solid var(--line); }
  .guide-nav-group { flex: 1 0 auto; margin-bottom: 0; }
  #guide-article { max-height: 44dvh; }
}
#appearance-dialog { width: min(620px, calc(100% - 26px)); }
.appearance-layout { display: grid; grid-template-columns: minmax(120px, 165px) minmax(0, 1fr); gap: .9rem; }
.appearance-stage { align-self: start; display: grid; justify-items: center; gap: .45rem; border: 1px solid var(--line); padding: .5rem; background: radial-gradient(ellipse at center, #4a6757, #192a2a); }
.appearance-stage canvas { max-width: 160px; }
.appearance-stage button { min-height: 32px; padding: .25rem .65rem; }
.appearance-icons { min-height: 32px; display: flex; flex-wrap: wrap; justify-content: center; gap: .18rem; }
.appearance-icons canvas { width: 26px; }
.appearance-options, .appearance-colors, .appearance-equipment { display: grid; gap: .5rem; }
.appearance-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appearance-equipment { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#appearance-dialog select { padding-inline: .35rem; }
@media (max-width: 470px) {
  #appearance-dialog form { padding: .8rem; }
  .appearance-layout { grid-template-columns: 1fr; }
  .appearance-stage { grid-template-columns: 94px auto; align-items: center; }
  .appearance-stage canvas:first-child { grid-row: span 2; }
}
.panel { border-radius: 5px; box-shadow: inset 0 0 0 2px #141d1d; }
button { border-color: #718e84; background: linear-gradient(#336162, #1b383a 53%, #285150); }
.quiet { background: linear-gradient(#324c47, #223231 55%); }
.primary { color: #fff3d0; border-color: #d7a762; background: linear-gradient(#b36a37, #834322 52%, #a1542e); text-shadow: 0 1px #50250f; }
input, select { color: #fff3d0; background: #192728; min-height: 38px; }
.toggle { display: flex; align-items: center; }
.toggle input { width: 16px; min-height: 16px; margin: 0; }
.lobby-rooms, .lobby-presence, .lobby-side .create { padding: .65rem; }
.create-wide { grid-column: 1 / -1; }
.create-map-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .33rem; }
.create-map-field button { min-height: 38px; padding: .34rem .4rem; font-size: .78rem; }
.lobby-rooms .heading, .lobby-presence .heading { margin-bottom: .5rem; }
.lobby-rooms .heading { flex-wrap: wrap; gap: .4rem .7rem; }
.lobby-room-controls { display: flex; flex: 1 1 264px; justify-content: flex-end; align-items: center; gap: .45rem; min-width: 0; }
#lobby-room-search { flex: 1 1 auto; min-width: 0; max-width: 18rem; min-height: 32px; padding: .3rem .45rem; }
.lobby-room-controls .inline-field { flex: none; white-space: nowrap; }
.inline-field { display: flex; align-items: center; gap: .45rem; }
.inline-field select { width: auto; min-width: 0; min-height: 32px; padding: .28rem .4rem; }
.lobby-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 252px), 1fr)); gap: .38rem; }
.lobby-empty { grid-column: 1 / -1; padding: .75rem .2rem; }
.lobby-cards .lobby-card { display: grid; grid-template-columns: minmax(0, 29%) minmax(0, 1fr) auto; align-items: center; gap: .45rem; min-height: 92px; padding: .55rem .6rem; border: 1px solid #738b83; border-radius: 4px; background: #213737 center / 100% 100% no-repeat; }
.lobby-card.in-progress { border-color: #a58652; }
.lobby-card-picture { width: 100%; max-height: 70px; object-fit: contain; image-rendering: pixelated; }
.lobby-card-info { grid-column: 2; min-width: 0; padding: .24rem .35rem; border-radius: 3px; background: #101c1bd9; }
.lobby-card-info strong { overflow-wrap: anywhere; line-height: 1.25; }
.lobby-card-info small { font-size: .72rem; line-height: 1.35; }
.lobby-lock { width: 10px; vertical-align: middle; margin-right: .28rem; }
.lobby-card button { grid-column: 3; min-height: 32px; padding: .2rem .42rem; font-size: .8rem; }
.lobby-pages { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; margin-top: .45rem; }
.lobby-pages button { padding: .2rem .5rem; min-height: 32px; }
.settings-map-field { display: grid; gap: .24rem; align-content: start; }
#lobby-online { display: grid; margin: 0; padding: 0; list-style: none; max-height: 15.5rem; overflow: auto; }
.presence-player { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 1px .35rem; align-items: center; padding: .3rem .15rem; border-top: 1px solid #ffffff24; }
.presence-player strong, .presence-player small { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presence-player small { font-size: .72rem; }
.lobby-status-icon { grid-column: 1; grid-row: 1 / span 2; width: 16px; image-rendering: pixelated; }
.featured-nickname { color: #ffdfa4; text-shadow: 0 0 3px #d69567; animation: lobby-rainbow 3s linear infinite; }
@keyframes lobby-rainbow {
  0%, 100% { color: #ffada1; } 16.67% { color: #ffe48b; } 33.33% { color: #aef78d; }
  50% { color: #95e6ff; } 66.67% { color: #b1b9ff; } 83.33% { color: #ffb0ee; }
}
@media (prefers-reduced-motion: reduce) { .featured-nickname { animation: none; } }
.original-lobby #open-red-hall { padding-left: 36px; background: url('/art/lobby-red-icon.png') 6px center / 25px auto no-repeat, linear-gradient(#324c47, #223231 55%); }
#red-hall-dialog { width: min(455px, calc(100vw - 24px)); }
.original-lobby .red-hall-panel { background: linear-gradient(#222924c7, #174043ef), url('/art/lobby-red-panel.png') center / 100% 100%; }
#red-hall-count { color: var(--gold); }
#red-hall-list { margin: .35rem 0 .55rem; padding-left: 2rem; }
#red-hall-list li { padding: .32rem .58rem; border-bottom: 1px solid #ddbd763d; }
#lobby-map-dialog { width: min(655px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.lobby-map-panel { padding: .75rem; }
.original-lobby .lobby-map-panel { background: linear-gradient(#213333, #213333f5 12%, #123330ee), url('/art/lobby-map-panel.png') center / 100% 100%; }
.lobby-map-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: .65rem; margin-bottom: .6rem; }
.lobby-map-options { display: grid; gap: .16rem; max-height: min(48vh, 340px); overflow: auto; margin-top: .3rem; }
.lobby-map-options button { min-height: 31px; padding: .23rem .4rem; border-radius: 3px; text-align: left; }
.lobby-map-options button[aria-pressed="true"] { color: #ffe09a; border-color: #e2ba6d; background: #654a32; }
.original-lobby .lobby-map-options button[aria-pressed="true"] { background: linear-gradient(#705234de, #573c27ed), url('/art/lobby-map-picked.png') center / 100% 100%; }
.lobby-map-preview { display: grid; gap: .4rem; align-content: start; justify-items: center; text-align: center; padding: .4rem; background: #101e1c80; border: 1px solid #829286; }
.lobby-map-preview h3 { margin: 0; color: #ffe7aa; font-size: 1rem; }
.lobby-map-preview img { width: min(100%, 280px); max-height: 225px; object-fit: contain; image-rendering: pixelated; }
.match-heading { margin-bottom: 6px; }
.match-heading h1 { font-size: 1.35rem; }
#match { max-width: max(750px, calc((100dvh - 250px) * 1.57)); margin-inline: auto; }
.phase { background: #182727; border-color: #8b7753; border-radius: 4px; }
.match-grid { display: block; }
.board-frame { position: relative; border-radius: 3px; border-bottom: 2px solid #c7a46b; background: #465543; }
#match-pause-shade {
  position: absolute; inset: 0; z-index: 4; display: grid; justify-items: center; align-items: start;
  padding-top: min(18%, 92px); background: #10191c70; pointer-events: none;
}
#match-pause-shade.observer { background: none; }
#resume-on-board { display: none; }
@media (max-width: 1119px) {
  #match:not(.classic):not([data-tray="actions"]) #match-pause-shade:has(#resume-on-board:not([hidden])) {
    align-content: start; gap: 6px;
  }
  #match:not(.classic):not([data-tray="actions"]) #resume-on-board { display: block; pointer-events: auto; }
}
#match-pause-shade span {
  padding: .35rem .8rem; border-radius: 999px; color: #f5f8f6; background: #162a2ef2;
  font-size: .88rem; font-weight: 650;
}
#action-confirm {
  width: min(380px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0;
  border: 1px solid #6f8d85; border-radius: 14px; color: #f1f7f4; background: #17282b;
  box-shadow: 0 18px 56px #091012a0;
}
#action-confirm::backdrop { background: #10191c70; }
#action-confirm-form { display: grid; gap: 1.15rem; padding: 1.2rem; }
.confirm-message h2 { font-size: 1.2rem; }
.confirm-message p { margin-top: .5rem; color: #cad8d1; }
.confirm-buttons { display: flex; justify-content: end; flex-wrap: wrap; gap: .55rem; }
.confirm-buttons button { min-width: 88px; min-height: 42px; border-radius: 8px; }
#action-confirm-cancel { color: #dbe7e2; background: transparent; border-color: #718781; }
#action-confirm-accept { color: #112c26; background: #a4d9c3; border-color: #a4d9c3; }
#action-confirm button:hover { border-color: #e4fff1; }
#roll-panel {
  position: absolute; z-index: 2; left: 65.4%; top: 46.2%; width: clamp(105px, 10.94%, 112px);
  aspect-ratio: 112 / 122; border-radius: 14px; background: #1a2828ef; pointer-events: none;
}
#roll-panel.roll-art { background: url('/art/dice.png') center / 100% 100% no-repeat; image-rendering: pixelated; }
.roll-die {
  position: absolute; display: grid; place-items: center; width: 36.61%; aspect-ratio: 1;
  top: 11.48%; padding: 0; min-height: 0; color: #e9f1ea; font-size: 1.6rem;
}
#roll-first { left: 29.46%; }
#roll-panel.mounted #roll-first { left: 12.5%; }
#roll-second { left: 49.11%; border: 0; background: transparent; pointer-events: auto; }
#roll-second[aria-pressed="false"] { filter: grayscale(1) brightness(.68); }
#roll-second:disabled { opacity: 1; }
#roll-panel.roll-art .roll-die {
  color: transparent; background: url('/art/roll-rect.png') center / 100% 100% no-repeat;
}
#roll-panel.roll-art .roll-die::after {
  content: ""; position: absolute; inset: 4.88%; pointer-events: none;
  background: url('/art/roll-face.png') var(--roll-face, 0%) 0 / 600% 100% no-repeat;
}
#roll-button {
  position: absolute; left: 20.54%; top: 50.82%; width: 60.71%; height: 33.61%;
  min-height: 0; border: 1px solid #ffc6a0; border-radius: 99px; padding: 0;
  color: #ffefe2; background: #9b2727; font-weight: 700; pointer-events: auto;
}
#roll-panel.roll-art #roll-button {
  border: 0; box-shadow: none; text-shadow: none; color: transparent;
  background: url('/art/roll-go.png') left / 300% 100% no-repeat;
}
#roll-panel.roll-art #roll-button:hover:enabled { background-position-x: 50%; }
#roll-panel.roll-art #roll-button:active:enabled { background-position-x: 100%; }
#roll-shortcut { display: none; }
#roll-managed {
  position: absolute; z-index: 1; right: 3%; bottom: 8%; display: grid; place-items: center;
  width: min(162px, 42%); aspect-ratio: 162 / 49; border-radius: 6px; color: #ffe7a9;
  background: #23291eed; pointer-events: none;
}
#roll-managed.managed-art { color: transparent; background: url('/art/match-managed.png') center / 100% 100% no-repeat; }
@media (max-width: 600px) {
  #roll-panel { left: auto; right: 4%; top: auto; bottom: 6%; width: clamp(99px, 27vw, 112px); }
}
#round-clock { position: absolute; z-index: 1; inset: 0 0 auto; display: flex; align-items: start; pointer-events: none; color: #fff3c4; }
#round-clock-meter { position: relative; width: min(466px, calc(100% - 3.6rem)); height: 5px; background: #152725dd; }
#round-clock-fill { position: absolute; inset: 0; background: #d99837 var(--round-art-normal, none) left / 100% 100% no-repeat; image-rendering: pixelated; }
#round-clock-seconds { min-width: 3.6rem; padding: .18rem .35rem; color: inherit; background: #152725ef; border-radius: 0 0 0 4px; text-align: center; font-size: .75rem; font-variant-numeric: tabular-nums; }
#round-clock.urgent { color: #ffd795; }
#round-clock.urgent #round-clock-fill { background: #d85532 var(--round-art-low, none) left / 400% 100% no-repeat; animation: round-clock-flash .67s step-end infinite; }
#round-clock.frozen #round-clock-meter { opacity: .75; }
#round-clock.frozen #round-clock-fill { animation-play-state: paused; }
@keyframes round-clock-flash { 25% { background-position-x: 33.333%; } 50% { background-position-x: 66.667%; } 75% { background-position-x: 100%; } }
@media (prefers-reduced-motion: reduce) { #round-clock.urgent #round-clock-fill { animation: none; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
#match-hud { position: absolute; z-index: 1; inset: 23px 3px auto; display: flex; justify-content: space-between; gap: 5px; pointer-events: none; }
#match-wallet { position: relative; width: min(330px, 56%); }
#match-calendar { position: relative; width: min(229px, 42%); margin-inline-start: auto; }
#match-hud p:not(.visually-hidden) {
  width: max-content; max-width: 100%; padding: 3px 5px; margin: 0;
  border: 1px solid #ad9366; border-radius: 3px; color: #fff2cf; background: #122522ed;
  font-size: clamp(.68rem, 1.6vw, .85rem); line-height: 1.18;
}
#match-calendar p:not(.visually-hidden) { margin-inline-start: auto; }
@media (max-width: 600px) { #match-hud { inset-block-start: 19px; } }
canvas { image-rendering: pixelated; }
canvas.scrolling-map { cursor: grab; touch-action: none; }
canvas.scrolling-map:active { cursor: grabbing; }
canvas.targeting { cursor: crosshair; }
canvas.route-hover { cursor: pointer; }
#tile-details { position: absolute; z-index: 2; width: max-content; min-width: 96px; max-width: min(220px, calc(100% - 6px)); padding: 3px 8px 3px 10px; color: #fff5d7; background: #173135 center / 100% 100% no-repeat; border-radius: 4px; box-shadow: 1px 2px 5px #10140c90; font-size: 12px; line-height: 17px; }
#tile-details.property-tip { min-width: 120px; }
#tile-details.player-tip { min-width: 118px; }
#tile-details.god-tip { width: min(320px, calc(100% - 6px)); max-width: none; padding: 8px 12px; border: 1px solid #a89455; background-color: #122d2af5; }
#tile-details.god-tip strong { color: #ffe19a; margin-bottom: 4px; }
#tile-details-content > * { display: block; overflow-wrap: anywhere; }
#tile-details-content > strong { padding-right: 16px; font-weight: 600; }
#tile-details button { position: absolute; right: 2px; top: 0; padding: 0; width: 20px; min-height: 20px; border: 0; color: inherit; background: transparent; box-shadow: none; line-height: 1; }
.camera-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }
.scene-control { font-size: .79rem; min-height: 30px; padding: .25rem .55rem; }
.scene-control[aria-pressed="true"] { border-color: #d7a762; }
#minimap-toggle[aria-expanded="true"] { border-color: #d7a762; }
#minimap-toggle.minimap-art {
  display: grid; place-items: center; width: 39px; height: 34px; padding: 0; font-size: 0;
  background: #223332; box-shadow: none;
}
#minimap-toggle.minimap-art::before {
  content: ""; width: 32px; height: 30px; background: var(--minimap-image) left / 300% 100% no-repeat;
}
#minimap-toggle.minimap-art:hover::before { background-position-x: 50%; }
#minimap-toggle.minimap-art:active::before { background-position-x: 100%; }
#minimap-panel {
  position: absolute; z-index: 1; right: 1.4%; bottom: 2%; width: min(var(--minimap-width), 38%);
  background: #1a1a1a7f; box-shadow: 0 0 0 1px #e6e6e4;
}
#minimap.navigable { cursor: crosshair; touch-action: none; }
#minimap:focus-visible { outline: 2px solid #ffd691; }
#minimap-close {
  position: absolute; top: -3px; right: -3px; width: 28px; height: 28px; min-height: 0; padding: 0;
  border: 0; color: #fff7e2; background: transparent; box-shadow: none; line-height: 1;
}
#minimap-close.minimap-art { color: transparent; text-shadow: none; }
#minimap-close.minimap-art::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 11px; height: 11px;
  background: var(--minimap-image) left / 300% 100% no-repeat;
}
#minimap-close.minimap-art:hover::after { background-position-x: 50%; }
#minimap-close.minimap-art:active::after { background-position-x: 100%; }
@media (max-width: 600px) { #minimap-panel { left: 7px; right: auto; width: min(var(--minimap-width), 36%); } }
.legend { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); background: #182928ea; color: #fff2c9; border: 1px solid #9c865a; padding: .5rem; border-radius: 3px; pointer-events: none; }
.tutorial-hint { padding: .7rem .85rem; margin-bottom: .32rem; }
.tutorial-hint h2 { color: #ffe7a2; margin: .16rem 0 .35rem; }
.tutorial-hint > button { margin-top: .65rem; min-height: 32px; padding: .32rem .62rem; }
#match.training #match-chat-slot { display: none; }
#match.training .game-tray { grid-template-columns: repeat(auto-fit, minmax(min(265px, 100%), 1fr)); }
#match.training .items:has(#item-bar[hidden]):has(#market-actions:empty):has(#item-actions:empty) { display: none; }
#match.training .controls:has(#match-actions:empty) { display: none; }
#match.training .roll, #match.training .item-cell[data-pid="15"]:enabled,
#match.training #market-actions button:enabled, #match.training #item-actions button:enabled { border-color: #ffe396; }
.construction {
  position: absolute; z-index: 2; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(360px, calc(100% - 10px)); max-height: calc(100% - 8px); overflow: auto;
  padding: 4px; background: #203636f7;
}
.construction.original-construction { background: transparent; border: 0; box-shadow: none; }
.construction .heading {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center;
  gap: 4px; margin: 0 auto 8px; padding: 8px 5px; text-align: center;
}
.original-construction .heading {
  width: min(188px, 78%); min-height: 98px; align-content: center;
  background: var(--build-title) center / 100% 100% no-repeat; image-rendering: pixelated;
}
#construction-title { font-size: clamp(.85rem, 2.1vw, 1rem); color: #fff4d7; }
#construction-deadline { color: #ffe195; font-size: .78rem; font-variant-numeric: tabular-nums; }
#construction-choices { display: flex; justify-content: center; align-items: stretch; gap: clamp(4px, 1.3vw, 14px); }
.construction-choice {
  width: min(106px, 32%); min-width: 0; min-height: 159px;
  display: grid; grid-template-rows: 20px 66px minmax(61px, 1fr); justify-items: center; align-items: center;
  padding: 2px 4px; color: #fff5db; text-align: center;
}
.original-construction .construction-choice {
  border: 0; border-radius: 0; box-shadow: none; background: var(--build-choice) center / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.original-construction .construction-choice:hover:enabled { filter: brightness(1.2); }
.construction-choice:focus-visible { outline: 2px solid #ffe196; }
.construction-choice:disabled { opacity: .77; }
.construction-name { font-size: .82rem; font-weight: 600; }
.construction-preview { width: min(54px, 100%); }
.construction-preview img, .construction-preview canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.construction-description { display: grid; gap: 2px; align-content: center; font-size: .7rem; line-height: 1.13; }
.construction-description span { overflow-wrap: anywhere; text-align: left; }
.construction-price { color: #ffe195; font-size: inherit; }
.construction-footer { display: flex; justify-content: center; align-items: center; gap: 5px; margin: 6px auto 0; }
.construction-footer:has(#skip-construction[hidden]):has(#construction-status:empty) { display: none; }
#construction-status { width: fit-content; padding: 3px 6px; color: #ffe7a0; font-size: .74rem; }
.original-construction #construction-status { background: var(--build-tip, #213331) center / 100% 100% no-repeat; }
#construction-status:empty { display: none; }
#skip-construction { min-height: 24px; padding: 2px 8px; font-size: .78rem; }
#skip-construction.build-skip-art { width: 70px; border: 0; font-size: 0; background: var(--build-skip) 0 / 400% 100% no-repeat; }
#skip-construction.build-skip-art:hover:enabled { background-position-x: 33.333%; }
#skip-construction.build-skip-art:active:enabled { background-position-x: 66.667%; }
#skip-construction.build-skip-art:disabled { background-position-x: 100%; opacity: .77; }
@media (max-width: 600px) {
  .board-frame:has(.construction:not([hidden])) #match-hud { visibility: hidden; }
  .construction .heading { gap: 1px; min-height: 37px; margin-bottom: 4px; padding: 2px 4px; }
  .construction-choice { min-height: 108px; grid-template-rows: 15px 46px minmax(46px, 1fr); padding: 1px 3px; }
  .construction-name, #construction-status { font-size: .71rem; }
  .construction-preview { width: min(38px, 100%); }
  .construction-description { font-size: .61rem; }
  .construction-footer { margin-top: 3px; }
}
.game-tray { display: grid; grid-template-columns: 1fr minmax(295px, 1.5fr) minmax(155px, .65fr); gap: 4px; margin-top: 4px; }
.game-tray .panel { padding: .45rem .58rem; min-height: 105px; }
.game-tray h2 { font-size: .86rem; margin: 0 0 .32rem; }
.prepare { display: grid; gap: .55rem; grid-template-columns: 1fr auto; padding: .7rem; }
.prepare h2 { align-self: center; }
.prepare-preview img { display: block; width: 112px; height: 68px; object-fit: contain; image-rendering: pixelated; }
.prepare-seats, #room-actions { grid-column: 1 / -1; }
.prepare-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 116px), 1fr)); gap: .35rem; }
.prepare-seats .prepare-seat { min-width: 0; display: grid; align-content: start; justify-items: center; gap: .2rem; padding: .4rem; border: 1px solid #777866; border-bottom: 3px solid var(--seat); border-radius: 3px; background: #203332; text-align: center; }
.prepare-seat.is-ready { background: #333a2c; }
.prepare-seat.empty-seat { color: #aaa99a; border-bottom-color: #515b54; }
.prepare-portrait { position: relative; display: grid; width: 100%; height: 108px; place-items: center; background: radial-gradient(ellipse at 50% 90%, #85634253, #182624 70%); }
.prepare-portrait img, .prepare-portrait canvas { object-fit: contain; max-height: 108px; image-rendering: pixelated; }
.prepare-seat strong { overflow-wrap: anywhere; }
.prepare-status { padding: .05rem .35rem; border: 1px solid #77897a; border-radius: 2px; }
.is-ready .prepare-status { color: #ffe4a0; border-color: #988f60; }
.original-lobby #room-actions { padding: .35rem; background: linear-gradient(#1a2b27cb, #152827e8), url('/art/lobby-room-base.png') center / 100% 100%; }
button.prepare-art-button { position: relative; min-height: 42px; padding: 0; overflow: hidden; }
.prepare-art-button img { display: block; max-width: 128px; max-height: 48px; image-rendering: pixelated; }
.prepare-portrait .seat-chat { top: 0; left: 0; z-index: 1; }
.character-select { display: flex; align-items: center; }
.character-select select { width: auto; }
.game-tray .controls button, #item-actions button { min-height: 29px; padding: .24rem .48rem; font-size: .8rem; }
.game-tray .controls .match-action-art {
  width: 66px; min-height: 29px; padding: 0; border: 0; box-shadow: none; color: transparent;
  background: var(--match-action-image) center / contain no-repeat;
}
.game-tray .controls .match-action-art:hover:enabled { filter: brightness(1.24); }
.game-tray .controls .match-action-icon { display: inline-flex; gap: 4px; align-items: center; padding-block: 0; }
.match-action-icon::before {
  content: ""; width: 24px; height: 24px;
  background: var(--match-action-image) left / 300% 100% no-repeat;
}
.match-action-icon:hover:enabled::before { background-position-x: 50%; }
.match-action-icon:active:enabled::before { background-position-x: 100%; }
.match-votes { align-self: center; color: #ffe19c; font-size: .74rem; }
.game-tray .buttons { gap: .26rem; }
#junction-actions { margin-bottom: .32rem; }
#match-players { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 3px; max-width: 394px; }
.player { min-width: 0; font-size: .74rem; }
.player.seat-1 { --seat: #5b9c54; }
.player.seat-3 { --seat: #9572aa; }
.player-portrait { position: relative; height: clamp(46px, 6.5vw, 71px); display: grid; place-items: end center; }
.player-portrait img { image-rendering: pixelated; }
.player-head {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  display: block; width: auto; height: auto; max-width: 100%; max-height: 72%; object-fit: contain;
}
.player.turn .player-head { max-height: 100%; }
.player-team, .player-badges, .team-label { position: absolute; bottom: 2px; left: 2px; }
.player-team { width: 15px; }
.player-badges { left: auto; right: 2px; display: flex; gap: 1px; align-items: end; }
.player-badges img { width: clamp(10px, 1.4vw, 16px); height: auto; }
.player-badge-label { background: #14292a; padding: 1px; color: #fcf2df; font-size: .62rem; }
.player-ledger {
  min-height: 51px; display: grid; grid-template-rows: 16px 16px minmax(19px, auto);
  align-items: center; padding-inline: 3px; border: 1px solid #605f50; border-radius: 3px;
  border-bottom-color: var(--seat, #605f50); color: #fcf2df; background: #242d2c; text-align: center;
}
.player-ledger.original-ledger {
  border: 0; background: var(--player-frame) center / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.player.turn .player-ledger { outline: 1px solid #d2ad68; }
.player:not(.turn) .player-ledger strong { color: #fff5dd; }
.player.empty-seat .player-ledger:not(.original-ledger) { grid-template-rows: 1fr; color: #afa99c; }
.player-ledger small { color: inherit; white-space: nowrap; font-size: clamp(.63rem, 1.2vw, .73rem); font-variant-numeric: tabular-nums; }
.original-ledger small { padding-left: 28%; text-align: left; }
.player-ledger strong { overflow-wrap: anywhere; padding: 1px 0; line-height: 1.12; }
.player-notes { display: grid; gap: 2px; padding-top: 3px; text-align: center; }
#match:not(.show-details) .player-notes .detail-state,
#match:not(.show-details) .player-notes:not(:has(small:not(.detail-state))) { display: none; }
#system-form fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 5px; padding: .75rem; }
#system-form legend { color: var(--gold); padding: 0 .35rem; }
#system-form label { display: flex; align-items: center; }
#system-form input[type="checkbox"] { width: 1.1rem; min-height: 0; height: 1.1rem; accent-color: var(--gold); }
#system-form .slider { display: grid; width: 100%; grid-template-columns: auto 1fr 4em; }
#system-form input[type="range"] { width: 100%; min-width: 0; padding: 0; min-height: 30px; accent-color: var(--gold); }
#system-form output { text-align: right; font-variant-numeric: tabular-nums; }
#system-feedback:empty { display: none; }
.original-details #match-details-toggle { display: inline-flex; align-items: center; gap: 4px; }
.original-details #match-details-toggle::before { content: ""; width: 22px; height: 22px; background: url('/art/match-details.png') left center / auto 22px no-repeat; }
.original-details #match-details-toggle:hover::before { background-position-x: center; }
.original-details #match-details-toggle:active::before { background-position-x: right; }
.original-settings #system-dialog { width: min(372px, calc(100% - 24px)); background: #353e38; border-radius: 5px; }
.original-settings #system-form {
  position: relative; background: #353e38; border: solid transparent;
  border-width: 34px 10px 13px; border-image: url('/art/system-frame.png') 34 10 13 stretch;
  padding: 10px 10px 12px;
}
.original-settings #system-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.original-settings #system-form fieldset { border-color: #768173; }
.original-settings #system-form .buttons { justify-content: space-between; }
.original-settings #system-form .buttons button { padding-inline: .65rem; }
#nickname-prompt { width: min(380px, calc(100% - 28px)); }
#nickname-prompt .buttons { justify-content: end; margin-top: 1rem; }
.player-notes small { font-size: .68rem; overflow-wrap: anywhere; }
.seat-0 { --seat: #c94a3e; } .seat-1 { --seat: #d1ab49; } .seat-2 { --seat: #3479aa; } .seat-3 { --seat: #5b9c54; }
.item-bar-tabs { display: flex; gap: 2px; margin-bottom: 4px; }
.item-bar-tabs button { width: 64px; min-height: 32px; padding: 0; font-size: .82rem; }
.item-bar-tabs [aria-selected="true"] { background-color: #6b4e24; }
.item-bar-tabs .item-sprite { color: transparent; border-color: transparent; background: var(--tab-off) center/100% auto no-repeat; }
.item-bar-tabs .item-sprite[aria-selected="true"] { background: var(--tab-on) center/100% auto no-repeat; }
.item-bar-tabs .item-sprite:hover { filter: brightness(1.22); }
.item-slots { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.item-slots.seven { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.item-slot, .shop-card { min-width: 0; display: grid; }
.item-cell {
  position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; align-items: center;
  min-height: 60px; min-width: 0; font-size: .67rem; line-height: 1.1; padding: 3px 2px;
  text-align: center; overflow: hidden; color: #ffefd0; border: 1px solid #8e734f; border-radius: 2px;
  background: linear-gradient(#283131, #162122);
}
.item-cell img, .item-cell canvas, .shop-goods img {
  display: block; width: 38px; max-width: 100%; height: 38px; margin: 0 auto; object-fit: contain; image-rendering: pixelated;
}
.shop-goods img { width: 29px; height: 29px; margin-bottom: 2px; }
.item-cell-name { grid-row: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-cell-count { position: absolute; right: 3px; top: 4px; color: #fff; font-size: .82rem; text-shadow: 1px 1px #000; }
.item-cell.empty { background: repeating-linear-gradient(45deg, #1b2624, #1b2624 2px, #21302c 2px, #21302c 3px); border-color: #62633e; }
#item-bar.item-sprite .item-slots {
  gap: 0; background: var(--item-slot-art) 0 0 / 12.5% 100% repeat-x; image-rendering: pixelated;
}
#item-bar.item-sprite .item-slots.seven { background-size: calc(100% / 7) 100%; }
#item-bar.item-sprite .item-cell { background: transparent; color: #fff; border-color: transparent; }
#item-bar.item-sprite button.item-cell:disabled { opacity: .72; filter: grayscale(1); }
#item-bar.item-sprite button.item-cell:hover:enabled { border-color: var(--gold); }
.item-cell.selected { outline: 2px solid #f4ce6f; outline-offset: -2px; background: #5a492e; }
.item-slot > button:disabled, .shop-card > button:disabled { pointer-events: none; }
.pet-bar-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(29px, 1fr); }
#item-pet-pagination, .item-bar-end { background: var(--item-pager-art, #192828) center / 100% 100% no-repeat; }
#item-pet-pagination, .item-bar-end { display: grid; align-content: space-between; justify-items: center; }
.item-bar-end::before, .item-bar-end::after {
  content: ''; width: 26px; height: 26px; opacity: .5;
  background: var(--item-page-up) left center / 300% 100% no-repeat;
}
.item-bar-end::after { background-image: var(--item-page-down); }
#item-pet-pagination button { width: 28px; min-height: 29px; padding: 0; font-size: .7rem; }
#item-pet-pagination .item-sprite { position: relative; color: transparent; border-color: transparent; background: transparent; }
#item-pet-pagination .item-sprite::before {
  content: ''; position: absolute; inset: 50% auto auto 50%; width: 26px; height: 26px; translate: -50% -50%;
  background: var(--item-page-arrow) left center / 300% 100% no-repeat;
}
#item-pet-pagination .item-sprite:hover:enabled::before { background-position-x: center; }
#item-pet-pagination .item-sprite:active:enabled::before { background-position-x: right; }
.item-pet-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-top: 4px; font-size: .72rem; }
#manage-pets { min-height: 30px; padding: .23rem .48rem; font-size: .8rem; }
@media (pointer: coarse) {
  .item-bar-tabs button, #manage-pets { min-height: 42px; }
  #item-pet-pagination button { width: 100%; min-height: 35px; }
}
.item-tip {
  position: fixed; z-index: 30; inset: auto; margin: 0; width: min(330px, calc(100vw - 12px)); min-height: 127px;
  padding: 10px 11px; color: #fff; border: 1px solid #868986; border-radius: 5px;
  background: #101010ef center / 100% 100% no-repeat; pointer-events: none;
  font-size: .76rem; line-height: 1.4;
}
.item-tip.original { border-color: transparent; background-color: #0a0a0a; }
.item-tip strong { display: block; font-size: .87rem; color: #f9fa39; margin-bottom: 3px; }
.item-tip dl { display: grid; grid-template-columns: 5em 1fr; margin: 0; gap: 3px .45rem; }
.item-tip dt { color: #70bfbb; font-weight: 600; }
.item-tip dd { margin: 0; }
.item-tip small { display: block; margin-top: 4px; color: #ffcb85; }
#item-actions { margin-top: 4px; }
#item-feedback { margin: .35rem 0 0; font-size: .8rem; }
#card-choice { width: min(696px, calc(100vw - 20px)); padding: 0; border: 0; border-radius: 6px; }
#card-choice::backdrop { background: #101b204d; }
#card-choice-panel { position: relative; padding: .8rem; }
#card-choice-title { margin: 0 0 .4rem; font-size: .95rem; }
#close-card-choice { margin: .45rem 0 0 auto; display: block; min-height: 28px; padding: .24rem .55rem; }
#card-choice-status { color: #ffdfa2; font-size: .83rem; margin: 0; padding: .32rem .6rem; background: #202928; }
#card-choice[data-mode="dice"] { width: min(269px, calc(100vw - 18px)); background: #182528; }
#card-choice[data-mode="dice"]::backdrop { background: transparent; }
#card-choice[data-mode="dice"] #card-choice-panel { padding: .5rem; }
.card-dice-faces { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.card-dice-faces button { padding: 0; min-height: 0; font-size: .78rem; height: auto; aspect-ratio: 1; }
.card-dice-faces img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
#card-choice.original-dice { background: transparent; overflow: visible; }
#card-choice.original-dice #card-choice-panel { padding: 0; }
#card-choice.original-dice #card-choice-title {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
#card-choice.original-dice .card-dice-faces {
  width: 100%; aspect-ratio: 269 / 69; padding: 5.8% 5.9% 6%;
  align-items: center; background: url('/art/dice-picker.png') center / 100% 100% no-repeat;
}
#card-choice.original-dice .card-dice-faces button { background: transparent; border: 0; border-radius: 1px; }
.card-dice-faces .chosen { outline: 2px solid #ffdc75; }
#card-choice.original-dice #close-card-choice {
  position: absolute; top: 100%; right: 8px; margin: 0;
}
#card-choice.original-dice #card-choice-status { position: absolute; top: 100%; right: 3rem; left: 0; }
#item-rebuild {
  position: absolute; z-index: 3; top: 54%; left: 50%; transform: translate(-50%, -50%);
  display: grid; justify-items: center; gap: 8px; color: #fff6e0;
}
#item-rebuild-title {
  display: grid; place-items: center; width: 188px; height: 98px; margin: 0;
  background: #223335f5 center / 100% 100% no-repeat; border: 1px solid #7f7861; border-radius: 5px;
  color: inherit; font-size: .9rem; font-weight: 500;
}
#item-rebuild-choices { display: flex; gap: 8px; }
#item-rebuild-choices button {
  display: grid; grid-template-rows: 21px 72px 1fr; justify-items: center; align-items: center;
  width: 106px; height: 159px; padding: 0; color: inherit;
  background: #223335f5 center / 100% 100% no-repeat; font-size: .8rem;
}
#item-rebuild-choices strong { font-weight: 500; }
.rebuild-preview { display: grid; place-items: center; }
.rebuild-preview :is(canvas, img) { width: 58px; height: 58px; image-rendering: pixelated; }
#item-rebuild.original #item-rebuild-title { background-image: url('/art/rebuild-panel.png'); }
#item-rebuild.original button { background-image: url('/art/rebuild-option.png'); }
#item-rebuild.original :is(h2, button) { background-color: transparent; box-shadow: none; border: 0; }
#item-rebuild button:hover { filter: brightness(1.25); }
@media (max-width: 600px) {
  #item-rebuild { top: 50%; gap: 4px; }
  #item-rebuild-title { height: 52px; }
  #item-rebuild-choices button { height: 116px; grid-template-rows: 15px 53px 1fr; }
  .rebuild-preview :is(canvas, img) { width: 44px; height: 44px; }
}
.events { margin-top: 4px; padding: .6rem .85rem; }
.shop-goods { display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 6px; }
.shop-goods button > span, .shop-goods button > small { display: block; }
.shop-empty { grid-column: 1 / -1; text-align: center; }
#shop-dialog { position: fixed; inset: 0; max-height: 94dvh; }
#shop-dialog[data-mode="map"] { z-index: 10; }
#shop-dialog.shop-positioned { right: auto; bottom: auto; margin: 0; }
#shop-header { margin-top: 0; }
#shop-dialog:not([data-mode="solo"]) #shop-header { cursor: grab; touch-action: none; }
#shop-balance { color: #ffe7ab; }
#shop-dialog.original-shop { width: min(467px, calc(100vw - 20px)); background: transparent; border-radius: 0; }
.original-shop::backdrop { background: #07161955; }
.original-shop #shop-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }
.original-shop #shop-stage { position: relative; aspect-ratio: 467 / 504; background: url('/art/shop-board.png') center / 100% 100% no-repeat; }
.original-shop #shop-header { position: absolute; inset: 0; display: block; margin: 0; pointer-events: none; }
.original-shop #shop-header::before { position: absolute; content: ""; left: 27%; width: 70%; height: 11%; pointer-events: auto; }
.original-shop #shop-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.original-shop #close-shop {
  position: absolute; left: 63.6%; top: 89.3%; width: 20.13%; aspect-ratio: 94 / 34;
  min-height: 0; padding: 0; border: none; color: transparent; box-shadow: none;
  background: url('/art/shop-close.png') 0 0 / 400% 100% no-repeat; pointer-events: auto;
}
.original-shop #close-shop:hover { background-position-x: 33.333%; }
.original-shop #close-shop:active { background-position-x: 66.666%; }
.original-shop #shop-balance {
  position: absolute; left: 48.2%; top: 12.4%; width: 43.4%; height: 4.8%; margin: 0;
  display: grid; place-items: center; font-size: .78rem; text-shadow: 1px 1px #000;
}
.original-shop[data-mode="map"] #shop-stage::after {
  position: absolute; content: ""; left: 30%; top: 19.2%; width: 12.85%; height: 3.77%;
  background: url('/art/shop-item-tab.png') center / contain no-repeat; pointer-events: none;
}
.original-shop #shop-time { position: absolute; left: 47%; top: 19.2%; margin: 0; color: #ffe7ab; font-size: .74rem; }
.original-shop #shop-goods {
  position: absolute; left: 34.9%; top: 25.4%; width: 55.67%; height: 57.74%;
  grid-template: repeat(3, minmax(0, 1fr)) / repeat(4, minmax(0, 1fr)); gap: 0;
}
.original-shop .shop-product {
  display: grid; grid-template-rows: 62% 20% 18%; place-items: center; width: 89.23%; height: 92.78%;
  min-height: 0; padding: 0; border: none; border-radius: 3px; box-shadow: none;
  background: transparent; text-align: center; color: #fff2d3; font-size: .69rem; line-height: 1;
  white-space: nowrap; text-shadow: 1px 1px #000;
}
.original-shop .shop-product img { grid-row: 1; width: 89%; height: 93%; margin: 0; }
.original-shop .shop-product span { grid-row: 2; }
.original-shop .shop-product small { grid-row: 3; font-size: .66rem; }
.original-shop .shop-product:hover, .original-shop .shop-product:focus-visible {
  background: url('/art/shop-highlight.png') center / 100% 100% no-repeat;
}
.original-shop .shop-product:disabled { opacity: 1; color: #c4c1b3; }
.shop-product:disabled img { filter: grayscale(1) brightness(.78); }
.shop-product.sold small { color: #f2c48a; }
.shop-sales { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: .26rem; }
.shop-sales button { min-height: 33px; padding: .25rem; font-size: .75rem; }
.original-shop #shop-sell { background: #192b2aec; border: 1px solid #767d67; padding: .3rem .45rem .45rem; }
.original-shop #shop-sell h3 { margin: 0 0 .3rem; }
@media (max-width: 500px) {
  .original-shop .shop-product { font-size: .62rem; }
  .original-shop .shop-product small { font-size: .6rem; }
}
#market-dialog { width: min(720px, calc(100vw - 28px)); }
#market-feedback, .market-result { color: #f7d28d; margin-block: .55rem; }
#market-dialog button[aria-pressed="true"] { border-color: #f2cc79; color: #ffe8af; }
#market-dialog[data-mode="lottery"] { width: min(350px, calc(100vw - 20px)); }
#market-dialog.original-market { background: transparent; border-radius: 0; max-height: 92dvh; }
#market-dialog.original-market::backdrop { background: #07161955; }
.original-market #market-panel { position: relative; display: flex; flex-direction: column; padding: 0; background: transparent; border: 0; box-shadow: none; }
.original-market #market-feedback { order: 2; }
.original-market #market-header { position: absolute; z-index: 1; margin: 0; left: 0; top: 0; width: 100%; pointer-events: none; }
.original-market #market-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.original-market #close-market { position: absolute; padding: 0; min-height: 0; border: 0; box-shadow: none; color: transparent; pointer-events: auto; }
.lottery-stage { color: #fff0c7; display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.lottery-draw { display: grid; place-items: center; grid-row: span 2; font-size: 1.5rem; }
.lottery-draw img { width: 50px; height: 45px; object-fit: contain; image-rendering: pixelated; }
.lottery-tickets { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; }
.lottery-ticket { position: relative; display: grid; place-items: center; padding: .15rem; font-size: .7rem; }
.lottery-ticket img { display: block; width: 100%; max-width: 54px; object-fit: contain; image-rendering: pixelated; }
.lottery-ripple { position: absolute; width: 163%; height: auto; pointer-events: none; z-index: 1; image-rendering: pixelated; }
.lottery-issue { font-size: .76rem; }
.original-market .lottery-issue, .original-market .market-result,
.original-market .market-availability, .original-market #market-feedback {
  background: #233433f5; padding: .32rem .55rem; margin: 0; font-size: .8rem;
}
.original-market .market-availability { color: #f8d39a; }
#market-dialog.original-market[data-mode="lottery"] { width: min(313px, calc(100vw - 20px)); }
.original-market[data-mode="lottery"] #market-header { aspect-ratio: 313 / 336; }
.original-market[data-mode="lottery"] #close-market {
  left: 37.7%; top: 86.3%; width: 20.77%; aspect-ratio: 65 / 22;
  background: url('/art/panel-lottery-close.png') left / 400% 100% no-repeat;
}
.original-market[data-mode="lottery"] #close-market:hover { background-position-x: 33.333%; }
.original-market[data-mode="lottery"] #close-market:active { background-position-x: 66.666%; }
.original-market .lottery-stage {
  position: relative; display: block; aspect-ratio: 313 / 336;
  background: url('/art/panel-lottery-bg.png') center / 100% 100% no-repeat;
}
.original-market .lottery-draw, .original-market .lottery-cost, .original-market .lottery-pool,
.original-market .lottery-tickets { position: absolute; }
.original-market .lottery-draw { left: 62.3%; top: 19.3%; width: 16%; aspect-ratio: 50 / 45; }
.original-market .lottery-draw img { width: 100%; height: 100%; display: block; }
.original-market .lottery-pool { left: 26%; top: 28.1%; width: 26%; text-align: right; }
.original-market .lottery-cost { left: 58%; top: 47.6%; width: 11%; text-align: center; }
.original-market :is(.lottery-pool, .lottery-cost) strong { color: #ffb21c; font-size: .88rem; }
.original-market :is(.lottery-amount-label, .lottery-amount-unit, .lottery-ticket-label) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.original-market .lottery-tickets { left: 2.55%; top: 59.52%; width: 91.05%; height: 20.83%; gap: 0; }
.original-market .lottery-ticket {
  width: 94.74%; height: 100%; min-height: 0; border: 0; padding: 0; box-shadow: none; background: transparent;
}
.original-market .lottery-ticket img { max-width: none; width: 100%; height: 100%; }
.original-market .lottery-ticket.revealed { background: url('/art/panel-lottery-sold.png') center / 100% 100% no-repeat; }
.original-market .lottery-ticket.revealed img { width: 92.6%; height: auto; }
.original-market .lottery-ticket:hover:enabled, .original-market .lottery-ticket:focus-visible { outline: 2px solid #edcb76; }
.original-market .lottery-ticket:disabled { opacity: .8; }
.research-banner { min-height: 28px; display: grid; align-items: center; padding: .25rem .55rem; background: #21464a; }
.research-remaining, .research-item-name { display: none; }
.research-slots { display: grid; direction: rtl; grid-template-columns: repeat(9, minmax(0, 1fr)); }
.research-slot {
  direction: ltr; display: grid; grid-template-rows: 20% 55% 25%; justify-items: center; align-items: center;
  padding: 0; min-width: 0; aspect-ratio: 60 / 83; border-radius: 2px; font-size: .69rem; text-align: center;
}
.research-slot.empty { background: #233133; border: 1px solid #526565; }
.research-slot img { grid-row: 2; width: 91%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.research-days { grid-row: 1; }
.research-name { grid-row: 3; white-space: nowrap; }
.research-slot.running { border-color: #e3ba66; background: #61512d; }
.research-count { padding: .24rem .45rem; font-size: .76rem; color: #f7d991; background: #233433f5; }
#market-dialog[data-mode="research"] { width: min(540px, calc(100vw - 20px)); }
.original-market .research-banner {
  position: relative; padding: 0; height: auto; aspect-ratio: 540 / 27; min-height: 0;
  background: url('/art/panel-research-bg.png') center / 100% 100% no-repeat;
}
.original-market[data-mode="research"] #market-header { height: 27px; }
.original-market[data-mode="research"] #close-market {
  width: 19px; height: 19px; top: 4px; right: 6px;
  background: url('/art/panel-research-close.png') left / 300% 100% no-repeat;
}
.original-market[data-mode="research"] #close-market:hover { background-position-x: 50%; }
.original-market[data-mode="research"] #close-market:active { background-position-x: 100%; }
.original-market .research-progress { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.original-market :is(.research-remaining, .research-item-name, .research-inactive) {
  display: block; position: absolute; color: #ffeab2; font-size: .76rem;
}
.original-market .research-remaining { left: 19%; }
.original-market :is(.research-item-name, .research-inactive) { left: 49%; }
.original-market .research-slot {
  border: 0; background: url('/art/panel-research-cell.png') center / 100% 100% no-repeat;
  box-shadow: none; color: #fff1cb;
}
.original-market .research-slot.running, .original-market button.research-slot:hover:enabled {
  background-image: url('/art/panel-research-mark.png');
}
@media (max-width: 570px) {
  #market-dialog[data-mode="research"] { width: min(330px, calc(100vw - 20px)); }
  .research-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .research-slot { aspect-ratio: auto; height: 82px; }
  .original-market .research-banner { aspect-ratio: auto; min-height: 34px; padding: .35rem 2rem .35rem .5rem; background: #21464a; }
  .original-market .research-progress { position: static; width: auto; height: auto; clip-path: none; font-size: .76rem; }
  .original-market :is(.research-remaining, .research-item-name) { display: none; }
  .original-market .research-inactive { position: static; }
}
.research-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .45rem; margin-block: .6rem; }
.research-grid label, .research-grid button { display: flex; gap: .4rem; align-items: center; justify-content: start; text-align: left; min-height: 35px; padding: .25rem; }
.research-grid input { width: auto; min-height: 0; margin: 0; accent-color: #cda55e; }
.research-grid img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.research-grid button small { margin-left: auto; white-space: nowrap; }
#shop-sell h3 { margin-bottom: .5rem; font-size: .9rem; }
#shop-tabs { margin-bottom: .65rem; }
#shop-tabs button[aria-pressed="true"] { border-color: #f2cc79; color: #ffe8af; }
#pet-bag { width: min(570px, calc(100vw - 28px)); }
#pet-summary { margin-bottom: .55rem; }
.pet-row { flex-wrap: wrap; }
.pet-row .buttons { margin-top: 0; }
.pet-identity { display: flex; align-items: center; gap: .6rem; }
.pet-identity img { width: 46px; height: 42px; object-fit: contain; image-rendering: pixelated; }
.pet-identity small { display: block; }
.pet-rename { width: 100%; display: flex; flex-wrap: wrap; gap: .35rem; align-items: end; }
.pet-rename label { flex: 1 1 120px; }
.pet-state { color: #f2d897; }
.player .world-state, .player .world-danger { text-align: center; white-space: normal; }
.world-state { color: #b9d9ff; }
.world-danger { color: #ffb299; }
.prepare-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, 300px); gap: .65rem; align-items: start; }
#lobby-chat-slot, #match-chat-slot { margin-top: .55rem; }
.chat-panel { padding: .55rem .62rem; }
.chat-panel .heading { margin-bottom: .4rem; }
.chat-log { margin: 0; padding: .38rem .5rem; height: 156px; overflow-y: auto; list-style: none; background: #142625; border: 1px solid #596753; border-radius: 3px; font-size: .8rem; scrollbar-gutter: stable; }
.chat-log li { display: flex; gap: .45rem; line-height: 1.55; align-items: baseline; padding: .13rem 0; }
.chat-log strong { color: #ebce88; flex: 0 0 auto; max-width: 39%; overflow-wrap: anywhere; }
.chat-log strong[class^="seat-"] { border-left: 2px solid var(--seat); padding-left: .3rem; }
.chat-log li > span { min-width: 0; overflow-wrap: anywhere; }
.chat-log li > span:not(.chat-gesture) { white-space: pre-wrap; }
.chat-inline { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; image-rendering: pixelated; }
.chat-gesture canvas, .chat-gesture-list canvas, .seat-chat canvas { width: auto; display: inline-block; vertical-align: middle; image-rendering: pixelated; }
.chat-compose { display: flex; gap: .3rem; margin-top: .45rem; }
.chat-compose input { min-width: 0; padding: .4rem; flex: 1; }
.chat-compose button { min-height: 34px; padding: .35rem .48rem; white-space: nowrap; }
.chat-latest { min-height: 27px; padding: .15rem .4rem; font-size: .76rem; }
.chat-feedback { margin-top: .3rem; color: #f1bf8f; }
.chat-pickers { display: grid; gap: .35rem; margin-top: .38rem; }
.chat-gesture-list, .chat-inline-list { display: flex; flex-wrap: wrap; gap: .23rem; }
.chat-inline-list { max-height: 111px; overflow-y: auto; }
.chat-pickers button { min-height: 28px; padding: 2px 4px; }
.chat-shortcuts summary { cursor: pointer; color: var(--gold); }
.chat-shortcuts label { font-size: .8rem; margin-block: .4rem; }
.shortcut-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; margin-block: .4rem; }
.shortcut-slots button { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.chat-inline-list button img { display: block; width: 23px; height: 23px; object-fit: contain; image-rendering: pixelated; }
.seat-chat { display: block; width: fit-content; max-width: 230px; margin-top: .34rem; padding: .19rem .39rem; border-radius: 4px; background: #eaf6b1 center / 100% 100% no-repeat; color: #1c261e; font-size: .82rem; overflow-wrap: anywhere; }
.dice-count { display: flex; gap: .24rem; align-items: center; font-size: .8rem; }
.dice-count select { width: auto; min-height: 29px; padding: .16rem; }
#match.watching .game-tray { grid-template-columns: 1fr; }
#match.watching .game-tray .items, #match.watching .game-tray .controls { display: none; }
.minigame-window { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; padding: 0; border: 0; border-radius: 0; background: #162625; z-index: 2; }
.mini-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.mini-hud { position: absolute; inset: 0 0 auto; padding: .45rem .7rem; background: linear-gradient(#162321ed, #16232196 75%, transparent); pointer-events: none; text-shadow: 0 1px 2px #151515; }
.mini-hud .heading { margin: 0; }
.mini-hud .mini-status { margin: 0 0 .4rem; color: #f5e7bb; }
.mini-action, .mini-gesture {
  position: absolute; left: var(--mini-x); top: var(--mini-y); width: var(--mini-w); height: var(--mini-h);
  min-width: 0; min-height: 0; padding: 0; font-size: clamp(.55rem, 1.4vw, .95rem);
}
.hammer-hole { position: absolute; width: 10%; height: 12.4%; min-height: 25px; padding: 0; font-size: clamp(.58rem, 1.2vw, .8rem); }
.hammer-hole[data-points] { color: #fff1a0; border-color: #bfa56a; }
.hammer-hole[data-points^="-"] { color: #ff9a91; }
.mini-action-art.hammer-hole[data-points] { color: transparent; border-color: transparent; }
#match:not(.watching) .mini-4 .mini-scene { touch-action: none; }
@media (hover: hover) {
  #match .mini-hammer-art .hammer-hole, #match .mini-hammer-art .mini-scene { cursor: none; }
}
.mini-action-art, .mini-action-art:hover, .mini-action-art:disabled { font-size: 0; color: transparent; background: transparent; border-color: transparent; box-shadow: none; }
.mini-action-art:focus-visible { outline: 2px solid #fff3a9; outline-offset: 1px; }
.mini-outcome { position: relative; display: grid; gap: .4rem; width: min(420px, 100%); padding: .65rem .8rem; color: #fff0b9; background: #213230 center / 100% 100%; border: 1px solid #a78755; }
.native-mini .mini-outcome { position: absolute; left: 50%; top: 52%; width: min(420px, 92%); transform: translate(-50%, -50%); }
.mini-inputs { display: contents; }
.mini-outcome h3 { margin: 0; color: #fff0b9; font-size: 1rem; }
.mini-outcome button { justify-self: end; }
.mini-result-badge { position: absolute; right: 0; bottom: 100%; width: clamp(55px, 22%, 128px); height: auto; object-fit: contain; pointer-events: none; }
.mini-results { display: grid; gap: .2rem; padding: 0; margin: 0; list-style: none; }
.mini-results li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(4rem, .6fr) auto; gap: .35rem; align-items: center; padding: .2rem .35rem; background: #162725cf; font-size: clamp(.68rem, 1.5vw, .9rem); }
.mini-results .own-result { background: #6f4e2ae0; }
#recent-minigame { margin: .5rem 0; color: var(--muted); }
#recent-minigame summary { cursor: pointer; }
#recent-minigame-results { margin-top: .35rem; }
#match-panels, #roster-dock:empty { display: none; }
.match-side { display: contents; }
@media (max-width: 600px) {
  #match:not(.native-match) .board-frame:has(#minigame:not([hidden]) .mini-inputs) { --mini-input-height: 54px; padding-bottom: var(--mini-input-height); }
  #match:not(.native-match) #minigame:has(.mini-inputs) .mini-scene { height: calc(100% - var(--mini-input-height, 0px)); }
  #match:not(.native-match) .mini-inputs {
    display: flex; position: absolute; inset: auto 0 0; height: var(--mini-input-height);
    gap: .4rem; padding: 5px 8px; background: #162625;
  }
  #match:not(.native-match) .mini-inputs :is(.mini-gesture, .mini-action) {
    flex: 1; position: static; width: auto; height: auto; min-height: 44px;
    color: #eef9f2; background: #294940; border: 1px solid #698f7d; border-radius: 6px; font-size: .9rem;
  }
  #match:not(.native-match) .mini-inputs .mini-gesture[aria-pressed="true"] {
    color: #ffe59c; border-color: #eac766; opacity: 1;
  }
  .native-mini .mini-outcome { max-height: calc(100% - 12px); overflow-y: auto; top: 50%; }
  #match:not(.training) .match-heading { display: grid; gap: .35rem; }
  #match:not(.training) .match-heading > :first-child {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .65rem;
  }
  #match:not(.training) #match-title { font-size: 1.15rem; }
  #match:not(.training) #match-remaining { font-size: .85rem; }
  #match:not(.training) .camera-controls { justify-content: flex-start; gap: .25rem; }
  #match:not(.training) #match-panels {
    position: sticky; top: 0; z-index: 5;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px;
    margin: 4px 0; padding: 4px; border: 1px solid #526b65; border-radius: 6px; background: #173032;
  }
  #match-panels button { min-height: 42px; padding: .2rem 0; border-color: transparent; font-size: .8rem; white-space: nowrap; }
  #match-panels button[aria-pressed="true"] { color: #eef9f2; border-color: #698f7d; background: #294940; }
  #match.watching #match-panels [data-player-panel] { display: none; }
  #match:not(.training) .game-tray { display: block; margin-top: 0; }
  #match:not(.training):not([data-tray="players"]) #match-roster,
  #match:not(.training):not([data-tray="items"]) #item-panel,
  #match:not(.training):not([data-tray="actions"]) #match-controls,
  #match:not(.training):not([data-tray="chat"]) #match-chat-slot,
  #match:not(.training):not([data-tray="events"]) #match-events,
  #match:not(.training):is([data-tray="chat"], [data-tray="events"]) .game-tray { display: none; }
  #match:not(.training) #match-chat-slot { margin-top: 0; }
}
@media (min-width: 1120px) {
  #match { max-width: none; }
  #match:not(.training) .match-heading > :first-child { display: flex; align-items: baseline; gap: .75rem; }
  #match:not(.training) #match-remaining { font-size: .81rem; }
  .match-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(228px, 260px); gap: 5px 8px; }
  .match-grid > :not(.match-side, #tutorial-hint) { grid-column: 1; }
  #match:not(.training) .match-side {
    display: grid; grid-column: 2; grid-row: 1 / span 2; gap: 8px;
    align-content: start; position: sticky; top: 12px;
  }
  #match:not(.training) .game-tray { grid-template-columns: minmax(0, 1fr) minmax(185px, .44fr); }
  #match.watching .game-tray { display: none; }
  .match-side .panel { background: #1e2c2d; border-color: #645944; border-radius: 6px; }
  #turn-dock {
    display: grid; gap: 9px; padding: 11px; border-top-color: #c89b62;
    background: linear-gradient(#30332b, #222c2a 62%);
  }
  #turn-dock #match-state {
    padding: 0; border: 0; background: transparent; color: #e8dec4;
    font-size: .96rem; font-weight: 650; overflow-wrap: anywhere;
  }
  #turn-dock #match-state.own-turn { color: #ffdf9a; font-size: 1.16rem; }
  #turn-dock #round-clock { position: static; align-items: center; gap: 7px; }
  #turn-dock #round-clock-meter {
    flex: 1; width: auto; height: 5px; border-radius: 2px; overflow: hidden; background: #131d1d;
  }
  #turn-dock #round-clock-fill { background: #cba061; }
  #turn-dock #round-clock.urgent #round-clock-fill { background: #d47953; }
  #turn-dock #round-clock-seconds { min-width: 0; padding: 0; background: transparent; white-space: nowrap; }
  #turn-dock #roll-panel {
    position: static; display: flex; align-items: center; gap: 5px;
    width: auto; aspect-ratio: auto; border-radius: 0; background: none;
  }
  #turn-dock #roll-panel .roll-die { position: relative; inset: auto; width: 34px; flex: none; }
  #turn-dock #roll-panel #roll-button {
    position: static; display: flex; flex: 1; align-items: center; justify-content: center; gap: .55rem;
    width: auto; min-height: 44px; height: auto; padding: .45rem .3rem; border: 1px solid #e3a16f;
    border-radius: 5px; color: #fff4dc; background: linear-gradient(#b65439, #92392c);
    font-size: 1rem; box-shadow: inset 0 0 0 2px #612a263d, 0 2px 3px #14151387;
  }
  #turn-dock #roll-panel #roll-button:hover:enabled { background: linear-gradient(#c86244, #a34533); }
  #turn-dock #roll-panel #roll-button:active:enabled { background: #843328; }
  #turn-dock #roll-shortcut {
    display: inline; padding: 1px 4px; border: 1px solid #ffc993b0; border-radius: 3px;
    color: #ffe7c5; font: inherit; font-size: .7rem; font-weight: 500; white-space: nowrap;
  }
  #roster-dock #match-roster { padding: 8px; }
  #roster-dock h2, .match-side .chat-panel h2 { font-size: .85rem; color: #d5c9aa; }
  #roster-dock #match-players { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; max-width: none; }
  #roster-dock .player {
    display: grid; grid-template-columns: 37% minmax(0, 1fr); gap: 2px; align-items: center;
    padding: 2px; border: 1px solid #484b40; border-radius: 4px; background: #182424;
  }
  #roster-dock .player.turn { border-color: #cca36b; background: #37332a; }
  #roster-dock .player-portrait {
    height: 48px; background: linear-gradient(transparent 22%, #111e2080);
  }
  #roster-dock .player.turn .player-portrait { background: radial-gradient(ellipse at 50% 91%, #ac79504a, transparent 73%); }
  #roster-dock .player-ledger { min-width: 0; min-height: 48px; grid-template-rows: 15px 15px auto; outline: none; }
  #roster-dock .player-ledger strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #roster-dock .player-badges img { width: 12px; }
  #roster-dock .player-notes { grid-column: 1 / -1; }
  #match-chat-slot { margin: 0; }
  #match-chat-slot .chat-log { height: clamp(104px, 18dvh, 220px); background: #182323; }
  #match-chat-slot .chat-panel button[type="submit"] { background: #29413b; color: #f0ead7; border-color: #798679; }
  #tutorial-hint { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 12px; }
  .original-guide .tutorial-hint { width: 240px; min-height: 288px; padding: 48px 16px 22px; border: 0; background: url('/art/tutorial-hint.png') center / 100% 100% no-repeat; box-shadow: none; }
}
@media (max-width: 840px) {
  .match-grid, .columns { grid-template-columns: 1fr; }
  .events { grid-column: 1 / -1; }
  #match { max-width: none; }
  .game-tray { grid-template-columns: 1fr 1.4fr; }
  .game-tray .controls { grid-column: 1 / -1; min-height: auto; }
  .prepare-columns { grid-template-columns: 1fr; }
}
@media (max-width: 530px) {
  .game-tray { grid-template-columns: 1fr; }
  .lobby-map-layout { grid-template-columns: 1fr; }
  .lobby-map-options { max-height: 23dvh; }
  .lobby-map-preview img { max-height: 22dvh; }
  .prepare-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The native landscape layout places the four seats and inventory below the board. */
#match.classic { max-width: none; }
#match.classic .match-heading {
  display: flex; gap: 6px; flex-wrap: wrap;
}
#match.classic .match-heading > :first-child { display: flex; align-items: baseline; gap: .5em; }
#match.classic .match-heading h1 { font-size: 1rem; }
#match.classic .camera-controls { gap: 3px; }
#match.classic :is(#map-music, #scene-motion, #sound-effects, #match-panels) { display: none; }
#match.classic .match-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 2px; }
#match.classic .board-frame { grid-area: 1 / 1; }
#match.classic .game-tray {
  display: grid; grid-area: 2 / 1; grid-template-columns: minmax(0, 30fr) minmax(0, 49fr) minmax(0, 21fr);
  align-items: stretch; gap: 2px; margin: 0;
}
#match.classic .game-tray .panel { padding: 4px; min-height: 0; max-height: 148px; overflow-y: auto; }
#match.classic .game-tray h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#match.classic #match-players { max-width: none; }
#match.classic .player-portrait { height: 54px; }
#match.classic #market-actions { margin-top: 4px; }
#match.classic #market-actions button { min-height: 26px; }
#match.classic .item-bar-tabs button { min-height: 25px; }
#match.classic .match-side, #match.classic #match-events {
  grid-area: 1 / 1; justify-self: start; align-self: end; position: relative; inset: auto; z-index: 2;
  width: min(32%, 330px); max-height: 40%; margin: 0 0 2px 2px; overflow: auto; scrollbar-width: thin;
}
#match.classic .match-side { display: block; pointer-events: none; }
#match.classic .match-side :is(.chat-compose, .chat-pickers, .chat-latest, .chat-log:focus) { pointer-events: auto; }
#match.classic #match-chat-slot { display: block; margin: 0; }
#match.classic :is(.chat-panel, #match-events) { background: #14201cda; border-color: #7e8067; padding: 5px; }
#match.classic .chat-log { height: clamp(42px, 8vh, 100px); background: transparent; }
#match.classic .chat-compose input { min-height: 28px; }
#match.classic :is(#match-events, #match-chat-slot .heading) { display: none; }
#match.classic[data-feed="log"] #match-events { display: block; max-height: 19vh; }
#match.classic:not([data-feed="chat"]) .match-side,
#match.classic:has(#board.targeting) .match-side,
#match.classic:has(:is(#minigame, #construction, #item-rebuild):not([hidden])) :is(.match-side, #match-events) { display: none; }
#match.classic:not(.watching) :is(#match-roster, #item-panel, #match-controls),
#match.classic.watching #match-roster { display: block; }
#match.classic.watching .game-tray { grid-template-columns: minmax(0, 350px); }

/* A single game surface owns the window. Only the contents of a menu scroll. */
html, body { height: 100%; overflow: hidden; }
body { min-width: 0; background: #15282b; }
body > main {
  isolation: isolate; width: 100%; height: 100dvh; margin: 0; overflow: hidden;
}
#game-app, #game-app > section { width: 100%; height: 100%; min-height: 0; }
.bar {
  position: absolute; inset: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) auto auto;
  z-index: 8; padding: 0; min-height: 0; background: none; border: 0;
}
.bar .account { flex-wrap: nowrap; gap: 4px; }
.account :is(#connection, #nickname, #logout) { font-size: .76rem; color: #ffedc8; text-shadow: 0 1px 3px #151810; }
.account :is(#connection, #nickname) { padding-inline: 4px; }
.account #nickname { max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:has(#game-app:not([hidden])) .account :is(#connection,#nickname) { padding: 4px 6px; background: #152721c9; }
body:has(#signin:not([hidden])) #connection, body:has(:is(#room, #match):not([hidden])) #logout,
body:has(#match:not([hidden])) :is(#connection, #nickname) { display: none; }
.bar button, .bar #logout {
  height: 32px; min-height: 32px; min-width: 32px; padding: 2px 7px; border: 0; border-radius: 3px;
  background: #162326ce; color: #f4deb0;
}
.bar .window-tool { font: 21px/1 system-ui, sans-serif; }
.bar button:hover:enabled { color: white; background: #304343; }
#notice {
  position: absolute; z-index: 7; top: 54px; left: 50%; transform: translateX(-50%); width: max-content;
  max-width: calc(100% - 22px); margin: 0; box-shadow: 0 3px 18px #0006;
}

/* Login and the two gathering screens use the game's own painted scenery. */
#signin {
  position: relative; display: grid; align-items: end; justify-items: start; grid-template-columns: 1fr;
  width: 100%; height: 100%; min-height: 0; max-width: none; margin: 0; padding: 5dvh clamp(18px, 7vw, 140px) 8dvh;
  overflow: auto; border: 0; border-radius: 0;
  background: linear-gradient(90deg, #261914ee, #46291b85 35%, transparent 65%),
    linear-gradient(0deg, #26150fd9, transparent 37%), #8a4b22 url('/art/login.jpg') center 45% / cover no-repeat;
}
#signin .login-form {
  position: relative; width: min(330px, 100%); margin: 0; padding: 0; gap: .9rem; border: 0;
  background: none; box-shadow: none; text-shadow: 0 1px 3px #241408;
}
.login-form h1, .scene-heading h1 {
  font-family: KaiTi, STKaiti, "Songti SC", SimSun, serif; font-weight: 800; color: #fff0be;
  letter-spacing: .08em; text-shadow: 0 2px #62401d, 0 4px 14px #1b170e99;
}
#signin h1 { margin: 0 0 .15em -.04em; font-size: clamp(3.2rem, 6.8vw, 6.4rem); line-height: 1.14; white-space: nowrap; }
.login-form label { gap: 4px; color: #ffebc3; font-weight: 600; }
.login-form input {
  height: 42px; color: #fff6de; background: #191711ba; border: 1px solid #bb975c; border-radius: 2px;
}
.login-form .primary, #lobby .hall-nav #lobby-create, #create-form .primary {
  min-height: 43px; border: 1px solid #edc181; border-radius: 2px; color: #ffefc6;
  background: linear-gradient(#ad632b, #773919); text-shadow: 0 1px #35190e; letter-spacing: .15em;
}
#signin .primary { margin-top: 5px; }

#game-app :is(#lobby, #room) {
  --scene-gutter: clamp(18px, 5.8vw, 110px);
  display: flex; flex-direction: column; align-items: start; position: relative;
  margin: 0; padding: clamp(48px, 8dvh, 100px) var(--scene-gutter) 0; overflow: hidden;
  border: 0; border-radius: 0; background-color: #233c37; background-size: cover; background-position: center;
}
#lobby {
  background-image: linear-gradient(90deg, #152825f5, #162b24e8 23%, #152a22a8 45%, transparent 76%),
    linear-gradient(0deg, #10251eeb, transparent 20%, transparent 87%, #162b2660), var(--hall-scene, none);
}
.original-art { --hall-scene: url('/art/scene-base-14.jpg'); }
.scene-heading { flex: none; padding-bottom: clamp(10px, 2.7dvh, 30px); }
.scene-heading h1 { font-size: clamp(2rem, 4.4vw, 4.6rem); line-height: 1.22; }
.scene-heading p { color: #f3e6c8; margin-top: 6px; text-shadow: 0 1px 3px #101d14; }
#lobby .hall-nav { display: flex; flex: none; align-items: stretch; max-width: 100%; border-bottom: 1px solid #c0a66d70; }
.hall-nav button, .scene-footer button {
  border: 0; border-radius: 0; color: #e2dcc8; background: none; text-shadow: 0 1px 4px #111;
}
.hall-nav button { padding: .4rem clamp(.6rem, 1.5vw, 1.6rem); border-bottom: 2px solid transparent; }
.hall-nav button[aria-pressed="true"] { color: #ffe29a; border-bottom-color: #eac47e; background: linear-gradient(0deg,#b99b5529,transparent); }
.hall-nav button:hover:enabled, .scene-footer button:hover:enabled { color: #ffe3a2; background-color: #233b32a6; }
.hall-content {
  flex: 1; min-height: 0; width: min(580px, 100%); overflow: auto; overscroll-behavior: contain;
  scrollbar-width: thin; padding: clamp(12px, 2.6dvh, 30px) 4px 12px 0;
}
.hall-content :is(.panel, .lobby-rooms, .lobby-presence, .history) {
  padding: 0; margin: 0; border: 0; box-shadow: none; background: transparent;
}
.hall-content .lobby-room-controls { flex: 1; justify-content: start; }
#hall-rooms .heading { flex-wrap: nowrap; }
.hall-content #lobby-room-search { max-width: 13rem; }
#refresh { min-height: 32px; padding: .2rem .5rem; }
#hall-rooms .lobby-empty { padding: 2.5rem 0 1rem; color: #f3ead5; }
#lobby .hall-nav #lobby-create { min-height: 36px; align-self: center; margin: 0 0 3px .6em; }
#lobby .hall-nav #lobby-create[aria-pressed="true"] { box-shadow: inset 0 -3px #ffe4a7; }
.hall-content .lobby-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 246px), 1fr)); }
#create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; max-width: 410px; }
#hall-chat .chat-panel { margin-top: 1.1rem; }
#hall-chat .chat-log { background: #14251dcc; }
#hall-chat #lobby-online { max-height: 22dvh; }
#hall-history .history-mode { width: fit-content; }
#resume { max-width: 100%; margin-bottom: 8px; padding: 5px 12px; background: #1a2b24e8; }
.scene-footer {
  display: flex; flex-wrap: wrap; gap: 0 .8rem; margin-top: auto; width: 100%; flex: none;
  padding: 8px 0 max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #d6b46b65;
}
.scene-footer button, .original-lobby .scene-footer #open-red-hall { min-height: 36px; padding: 4px .45rem; background: none; }

#room {
  background-image: linear-gradient(0deg, #13251ff5 0%, #18251be6 21%, #17271b5e 66%, #10211f98),
    var(--room-scene, var(--hall-scene, none));
}
#room .prepare-columns { display: grid; grid-template-columns: minmax(0,1fr); flex: 1; min-height: 0; width: 100%; align-items: end; overflow-y: auto; }
#room .prepare {
  width: 100%; max-width: none; display: grid; align-items: end; grid-template-columns: 1fr auto;
  gap: .65rem; padding: 12px 0 clamp(12px, 3dvh, 40px); border: 0; box-shadow: none; background: none;
}
#room .prepare h2 { align-self: end; color: #f7e2a9; letter-spacing: .12em; font-family: KaiTi, SimSun, serif; font-size: 1.4rem; }
#room .prepare-preview img { width: 92px; height: 58px; }
#room .prepare-seats { display: grid; grid-auto-columns: minmax(0,1fr); grid-auto-flow: column; grid-template-columns: none; gap: 0; }
#room .prepare-seat {
  gap: 3px; padding: 8px 2px 12px; border: 0; border-bottom: 2px solid var(--seat); border-radius: 0;
  background: linear-gradient(0deg,#16241dd6,transparent 88%); text-shadow: 0 1px 4px #10190e;
}
#room .prepare-portrait {
  height: clamp(90px, 20dvh, 200px);
  background: radial-gradient(ellipse 32% 8% at 50% 94%, #090e09b0,transparent);
}
#room .prepare-portrait > .prepare-avatar { position: absolute; inset: 0; height: 100%; width: 100%; max-height: none; object-fit: contain; }
#room .prepare-status { padding: 0; border: 0; }
#room #room-actions { gap: 5px 9px; align-items: center; background: none; padding: 6px 0 0; }
#room-actions > :is(button, label) { min-height: 34px; padding: 4px 8px; border-color: #8c98766b; background-color: #172921b0; }
#room-actions button.prepare-art-button { margin-left: auto; padding: 0; border: 0; background: none; }
#room-chat-dialog { width: min(480px, 94vw); max-height: 85dvh; overflow: auto; }

/* Match controls form the two edges of the game window, around a live camera. */
body:has(#match:not([hidden])) .bar { top: 3px; right: 4px; }
#game-app #match { display: flex; flex-direction: column; max-width: none; margin: 0; background: #172927; }
#match .match-heading {
  position: relative; flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px;
  min-height: 38px; width: 100%; margin: 0; padding: 3px 80px 3px 9px; border-bottom: 1px solid #887347;
  background: linear-gradient(#293a35, #172724);
}
#match .match-heading h1 { font-size: 1rem; }
#match .match-heading p { font-size: .76rem; }
#match .match-grid {
  flex: 1; display: grid; min-height: 0; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto;
  gap: 0; align-items: stretch; isolation: isolate;
}
#match .board-frame { grid-area: 1/1; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; }
#board-hint { position: absolute; bottom: 0; right: 0; max-width: 100%; background: #e9d8adeb; }
#board-hint:not([hidden]) {
  display: flex; align-items: center; gap: 8px; z-index: 4; padding: 3px 5px 3px 10px;
  border-radius: 5px; color: #31271a; text-shadow: none; pointer-events: none;
}
#cancel-card-target { flex: none; pointer-events: auto; touch-action: manipulation; }
#match.native-match #board-hint { bottom: 175px; right: 15px; }
@media (pointer: coarse) {
  #cancel-card-target { min-height: 44px; }
}
#match .game-tray {
  min-height: 0; margin: 0; column-gap: 0; border-top: 2px ridge #84754d;
  background: linear-gradient(#293833, #172623); overflow: auto;
}
#match .game-tray .panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#match.classic .game-tray .panel + .panel { border-left: 1px solid #74765a8c; }
#match.classic .game-tray { max-height: 25dvh; }
#match.classic .match-side .chat-panel { background: linear-gradient(0deg,#14251edd,#17251d85); border: 0; border-radius: 0; box-shadow: none; }
#match.classic .chat-log { border: 0; }
#match.classic .chat-panel:not(:focus-within) .chat-log:empty { height: 0; padding: 0; }
#match .board-frame:has(.minigame-window:not([hidden])) { container-type: size; }
#match .minigame-window {
  inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: min(100cqw, calc((100cqh - var(--mini-input-height, 0px)) * 1024 / 708));
  height: auto; aspect-ratio: 1024 / 708; box-sizing: content-box; padding-bottom: var(--mini-input-height, 0px);
  box-shadow: 0 0 0 200vmax #12201ff2;
}
@media (min-width: 1120px) and (min-height: 620px) {
  #match:not(.classic,.training) .match-grid { grid-template-columns: minmax(0,1fr) minmax(210px, 18%); }
  #match:not(.classic,.training) .match-side { grid-area: 1/2; position: static; overflow: auto; min-height: 0; }
  #match:not(.classic,.training) #match-events { grid-area: 2/2; max-height: 20dvh; overflow: auto; }
  #match:not(.classic,.training) .game-tray { max-height: 24dvh; }
}
#match.training .match-grid { grid-template-rows: auto minmax(0,1fr) auto; }
#match.training .board-frame { grid-area: 2/1; }
#match.training #tutorial-hint {
  display: flex; grid-area: 1/1; align-items: center; justify-content: space-between; gap: .7rem;
  width: auto; min-height: 0; max-height: 22dvh; padding: 5px 12px; margin: 0; overflow: auto;
  position: static; border: 0; border-radius: 0; background: #26372e; box-shadow: none;
}
#match.training #tutorial-hint button { flex: none; }
#match.training #match-events { grid-area: 3/1; justify-self: end; width: 25%; max-height: 23dvh; overflow: auto; }
#match.training .game-tray { grid-area: 3/1; margin-right: 25%; max-height: 23dvh; }
@media (max-width: 1119px), (max-height: 619px) {
  #match:not(.classic,.training) .match-grid { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto minmax(0,clamp(82px,18dvh,142px)); }
  #match:not(.classic,.training) #match-panels { display: flex; grid-area: 2/1; align-items: stretch; position: static; margin: 0; padding: 0; border: 0; border-radius: 0; }
  #match-panels button { flex: 1; min-height: 32px; padding: 2px; border: 0; border-radius: 0; }
  #match:not(.classic,.training) :is(.game-tray, #match-events, #match-chat-slot) { grid-area: 3/1; margin: 0; overflow: auto; }
  #match:not(.classic,.training) .game-tray { display: block; }
  #match:not(.classic,.training)[data-tray="board"] .match-grid { grid-template-rows: minmax(0,1fr) auto 0; }
  #match:not(.classic,.training)[data-tray="board"] .game-tray { display: none; }
  #match:not(.classic,.training) .match-side { display: contents; }
  #match:not(.classic,.training):not([data-tray="players"]) #match-roster,
  #match:not(.classic,.training):not([data-tray="items"]) #item-panel,
  #match:not(.classic,.training):not([data-tray="actions"]) #match-controls,
  #match:not(.classic,.training):not([data-tray="chat"]) #match-chat-slot,
  #match:not(.classic,.training):not([data-tray="events"]) #match-events,
  #match:not(.classic,.training):is([data-tray="chat"],[data-tray="events"]) .game-tray { display: none; }
}
@media (max-width: 650px) {
  #signin { padding: 42px 7vw max(6dvh, 20px); background-position: center, center, 55% 25%; }
  #signin .login-form { width: min(290px, 100%); }
  #signin h1 { font-size: 3.6rem; }
  #game-app :is(#lobby,#room) { --scene-gutter: 14px; padding-top: 54px; }
  .scene-heading { padding-bottom: 12px; }
  .hall-nav { width: 100%; }
  .hall-nav button { flex: 1; padding: 6px 2px; }
  #lobby { background-image: linear-gradient(90deg,#11251de8,#152b217a), var(--hall-scene,none); }
  #hall-rooms .inline-field span { display: none; }
  .scene-footer { gap: 2px; }
  .scene-footer button { font-size: .84rem; }
  #room .prepare-seats { grid-auto-flow: row; grid-template-columns: repeat(2,minmax(0,1fr)); }
  #room .prepare-portrait { height: clamp(62px,12dvh,108px); }
  #room .prepare-seat { padding: 2px; }
  #room .prepare-preview img { width: 65px; height: 40px; }
  #room-actions > :is(button,label) { font-size: .83rem; }
  #match:not(.training) .match-heading { display: flex; justify-content: start; }
  #match .match-heading .camera-controls { gap: 2px; }
  #match .camera-controls :is(#map-music,#scene-motion,#sound-effects) { display: none; }
}
@media (max-height: 480px) {
  #signin { align-items: center; padding-block: 10px; }
  #signin .login-form { gap: 5px; }
  #signin h1 { font-size: 2.7rem; }
  #game-app :is(#lobby,#room) { padding-top: 9px; }
  .scene-heading { padding-bottom: 4px; max-width: 62%; }
  .scene-heading h1 { font-size: 1.6rem; }
  .scene-footer { padding-block: 2px; }
  #room .prepare { padding-block: 4px; gap: 2px; }
  #room .prepare-portrait { height: 70px; }
}

/* The desktop draws into one 1024 × 738 surface, including its own title bar. */
body.native-ui:has(#signin:not([hidden]), #game-app:not([hidden]) :is(#lobby,#room):not([hidden])) {
  overflow: hidden; background: #17262b;
}
body.native-ui:has(#signin:not([hidden]), #game-app:not([hidden]) :is(#lobby,#room):not([hidden])) > .bar {
  display: none;
}
body.native-ui #signin.native-stage,
body.native-ui :is(#game-app #lobby,#game-app #server-select,#game-app #room).native-stage,
body.native-ui dialog.native-overlay {
  position: fixed; inset: var(--stage-top) auto auto var(--stage-left);
  width: 1024px; height: 738px; min-width: 0; min-height: 0; max-width: none; max-height: none;
  box-sizing: border-box; transform: scale(var(--stage-scale)); transform-origin: 0 0;
  display: block; overflow: hidden; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: #173638 var(--backdrop) no-repeat 0 0 / 1024px 738px;
  box-shadow: none; color: white; font: 14px/16px SimSun, '宋体', serif; text-shadow: none;
}
body.native-ui :is(#signin,#lobby,#room,#server-select)[hidden],
body.native-ui #game-app:has(#server-select:not([hidden])) #lobby,
body.native-ui dialog.native-overlay:not([open]), .native-stage [hidden], .native-overlay [hidden] { display: none !important; }
body.native-ui .native-stage::before, body.native-ui .native-stage::after { content: none !important; }
.native-stage, .native-overlay { isolation: isolate; }
.native-stage, .native-overlay, .native-stage button:enabled, .native-overlay button:enabled { cursor:var(--native-pointer,auto); }
.native-stage :is(button, input, select), .native-overlay :is(button, input, select) { font-family: inherit; }
.native-stage .native-part, .native-overlay .native-part {
  position: absolute; margin: 0; box-sizing: border-box;
}
.native-stage .tcp, .native-overlay .tcp {
  --frame: 0;
  display: block; width: var(--w) !important; height: var(--h) !important;
  min-width: 0 !important; min-height: 0 !important; max-width: none; max-height: none;
  padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important;
  color: transparent !important; font-size: 0 !important; line-height: 0; text-shadow: none !important;
  box-shadow: none !important; background-color: transparent !important; background-image: var(--picture) !important;
  background-position: calc(-1 * var(--w) * var(--frame)) 0 !important;
  background-size: auto !important; background-repeat: no-repeat !important;
  translate: var(--dx) var(--dy); transform: none !important; transition: none; filter: none !important; opacity: 1 !important;
}
.native-stage i.tcp, .native-overlay i.tcp, .native-stage .native-caption, .native-overlay .native-caption {
  pointer-events: none; user-select: none;
}
.native-stage button.tcp:hover, .native-overlay button.tcp:hover { --frame: var(--hover); }
.native-stage button.tcp:active, .native-overlay button.tcp:active { --frame: var(--press); }
.native-stage button.tcp:disabled, .native-overlay button.tcp:disabled { --frame: var(--off); }
.native-stage :is(button,input,select):focus-visible, .native-overlay :is(button,input,select):focus-visible {
  outline: 2px solid #ffe888; outline-offset: 1px;
}
.native-stage .native-caption, .native-overlay .native-caption {
  color: #fff; font: 14px/16px SimSun,'宋体',serif; white-space: pre; margin: 0;
}
.native-stage .native-titlebar { width: 1024px; height: 32px; z-index: 7; }
.native-titlebar .native-version { font: bold 16px/18px SimSun,serif; color: #eee; text-shadow: 1px 1px #161616; }
.native-titlebar .native-link { width: 49px; text-align: right; color: #e2b556; font: 12px/14px SimSun,serif; }
.native-titlebar .native-link.online { color: #94ed89; }
.native-titlebar .native-link::after {
  content: ''; position: absolute; left: 50px; bottom: 1px; width: 27px; height: 17px;
  background: currentColor; clip-path: polygon(0 82%,18% 82%,18% 100%,24% 100%,24% 62%,42% 62%,42% 100%,48% 100%,48% 40%,66% 40%,66% 100%,72% 100%,72% 15%,90% 15%,90% 100%,0 100%); opacity: .75;
}
.native-titlebar .native-link:not(.online)::after { color: #425859; }
body.native-ui #signin .native-login-form, body.native-ui .native-create-form {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; margin: 0; padding: 0;
  background: none; border: 0; border-radius: 0; box-shadow: none; pointer-events: none;
}
.native-login-form > *, .native-create-form > * { pointer-events: auto; }
body.native-ui #signin #login-title, body.native-ui #lobby > .scene-heading,
body.native-ui #room > :is(.scene-heading,.prepare-columns,.scene-footer), body.native-ui #lobby > :is(.hall-nav,.hall-content,.scene-footer) {
  display: none;
}
body.native-ui .native-login-form > label, body.native-ui .native-create-form > label {
  display: block; width: auto; height: auto; border: 0; padding: 0; font-size: 0; line-height: 0; color: transparent;
}
body.native-ui .native-login-form label input, body.native-ui .native-create-form > label :is(input,select),
body.native-ui .native-stage .native-player-search, body.native-ui #lobby-chat-slot .chat-compose input {
  display: block; margin: 0; padding: 0; border: 0; border-radius: 0; outline-offset: 0; box-shadow: none;
  width: 140px; min-height: 0; height: 23px; color: white; background: transparent;
  font: 14px/20px SimSun,serif; caret-color: white;
}
body.native-ui #signin .native-login-form [name=password] { width: 115px; }
.native-login-form button[type=submit] { z-index: 1; }
.native-stage .login-type { font-size: 12px; }
.native-overlay .native-create-form > label:has([name=no_items]) { display:none; }
body.native-ui dialog.native-overlay:not(#lobby-shop) { background: transparent; }
dialog.native-overlay::backdrop { background: transparent; }
body.native-ui .native-create-form > label :is(input,select) { width: 156px; height: 20px; padding: 0 3px; }
body.native-ui .native-create-form > label:has([name=name]) input { width: 104px; }
.native-create-form select { appearance: none; cursor: pointer; }
.native-create-form option { background-color: #152221; color: white; }
.native-create-form .mode-description { width: 235px; white-space: normal; line-height: 20px; color: #281800; }
.native-create-options { color: #32210d; width: 241px; line-height: 18px; z-index: 2; }
.native-create-options summary { cursor: pointer; font-size: 12px; }
.native-create-options[open] { padding: 7px; background: #f2d69c; border: 1px solid #715834; }
.native-create-options[open] label { display: block; font-size: 13px; color: #302617; }
.native-create-options[open] :is(select,button) { font-size: 13px; min-height: 21px; }
.native-create-options[open] .create-map-field { display: flex; align-items: end; gap: 5px; }
.native-stage .native-news {
  width: 245px; height: 510px; overflow-y: auto; scrollbar-width: none; overflow-wrap: anywhere;
  color: #fff; font: 12px/24px SimSun,serif;
}
.native-news p { margin: 0; }.native-news .headline { color: red; font-weight: bold; }
.native-stage .native-intro { width: 145px; white-space: normal; line-height: 20px; }
.native-stage .small-label { font-size: 12px; }
.native-stage .native-titlebar ~ i { pointer-events: none; }
body.native-ui #lobby #rooms {
  display: block; width: 576px; height: 425px; min-height: 0; max-height: none; overflow: visible; margin: 0; padding: 0;
}
#lobby .native-desk, #lobby .native-player-hit, #lobby .native-find {
  appearance: none; display: block; border: 0; padding: 0; background: transparent; box-shadow: none;
  color: white; transform: none; text-align: left; border-radius: 0; min-height: 0;
}
#lobby .native-desk { width: 288px; height: 105px; overflow: visible; }
#lobby .native-desk:disabled { opacity: 1; cursor: default; }
#lobby .native-desk:focus-visible { outline-offset: -6px; }
#lobby .native-desk .native-desk-map { width: 70px; height: 70px; }
#lobby .native-desk .desk-name { width: 134px; overflow: hidden; white-space: pre; }
#lobby .native-desk .desk-count { color: #1b1208; }
#lobby .native-desk .desk-mode { color: #fffbe9; text-shadow: 1px 1px #3d231b; }
#lobby .rank-caption, #lobby .nick-key { font: bold 15px/17px KaiTi,SimSun,serif; color: #eaffff; text-shadow: 1px 1px #14313c; }
#lobby .native-nickname { width: 98px; overflow: hidden; }
#lobby #announcement { color: #57b2ff; text-shadow: 1px 1px #fff5cc; font: 12px/16px SimSun,serif; width: 458px; white-space: nowrap; overflow: hidden; }
#lobby .native-find { width: 210px; height: 23px; font-size: 0; }
#lobby .native-find:focus-visible { font: 14px SimSun,serif; color: #142622; background: #e8ca8c; }
#lobby #lobby-room-page, #lobby .page-number { color: #161005; font: 14px/16px SimSun,serif; }
body.native-ui #lobby #lobby-online { display: block; width: 274px; height: 265px; margin: 0; padding: 0; border: 0; list-style: none; overflow: hidden; }
#lobby .native-player { display: block; position: relative; padding: 0; margin: 0; width: 274px; height: 20px; border: 0; }
#lobby .native-player-hit { width: 100%; height: 100%; }
#lobby .native-player-hit span { color: #91d9ff; font: bold 12px/16px SimSun,serif; text-shadow: -1px -1px #000,1px -1px #000,-1px 1px #000,1px 1px #000; }
#lobby .native-player-hit .featured-nickname { color: #ff4956; }
#lobby .native-player-hit .player-name { width: 89px; overflow: hidden; }
body.native-ui .native-stage .native-player-search { width: 107px; height: 21px; }
body.native-ui .native-stage .native-rename { width:91px; height:20px; margin:0; padding:0; border:0; border-radius:0; min-height:0; background:transparent; color:white; font:14px SimSun,serif; }
body.native-ui #lobby-chat-slot { width: 1024px; height: 738px; margin:0; pointer-events: none; }
body.native-ui #lobby-chat-slot :is(.chat-panel,.chat-compose) {
  display: contents; position: static; background: none; border: 0; box-shadow: none; padding: 0; margin: 0;
}
body.native-ui #lobby-chat-slot .heading { display:none; }
body.native-ui #lobby-chat-slot :is(.chat-log,.chat-compose input,.chat-compose button,.chat-pickers,.chat-feedback) { position:absolute; pointer-events:auto; }
body.native-ui #lobby-chat-slot .chat-log {
  left: 50px; top: 573px; width: 560px; height: 105px; max-height: none; min-height: 0; padding: 0; margin: 0;
  overflow-y: auto; scrollbar-width: none; border: 0; background: none; color: #effaff; font: 14px/18px SimSun,serif;
}
body.native-ui #lobby-chat-slot .chat-compose input { left: 154px; top: 690px; width: 393px; height: 19px; }
body.native-ui #lobby-chat-slot .chat-toggle { left:599px; top:689px; margin:0; }
body.native-ui #lobby-chat-slot .chat-compose [type=submit] { left:577px; top:689px; margin:0; }
body.native-ui #lobby-chat-slot .chat-pickers { left: 325px; bottom: 54px; width: 313px; background: #182e31; z-index: 5; }
body.native-ui #lobby-chat-slot .chat-feedback { left: 50px; top: 551px; color: #fff2ac; }
body.native-ui #lobby #resume:not([hidden]) { position:absolute; left:73px; top:439px; width:525px; max-height:70px; overflow:auto; z-index:4; background:#14292aef; }
.native-popup:not(.native-overlay) { max-width: min(92vw,620px); max-height: 85dvh; overflow: auto; }
.native-popup .popup-close { display: block; width: fit-content; margin: 10px 0 0 auto; }
.native-popup #hall-history { min-width:min(420px,75vw); }
body.native-ui #room #prepare-preview { display: block; width: 161px; height: 106px; padding: 0; margin: 0; border: 0; }
body.native-ui #room #prepare-preview img { width: 100%; height: 100%; object-fit: fill; border-radius: 0; }
body.native-ui #room #seats { width: 1024px; height: 510px; display: block; padding: 0; margin: 0; border: 0; pointer-events: none; }
body.native-ui #room .prepare-seat {
  position:absolute; top: 317px; left: 351px; width: 150px; height: 195px; padding: 0; margin: 0; display: flex;
  align-items: center; justify-content: end; flex-direction: column; gap: 0; background:none; border:0; box-shadow:none; color:white;
}
body.native-ui #room .prepare-seat.seat-1 { left: 539px; }
body.native-ui #room .prepare-seat.seat-2 { left: 180px; top: 309px; }
body.native-ui #room .prepare-seat.seat-3 { left: 711px; top: 309px; }
body.native-ui #room .prepare-seat.empty-seat, body.native-ui #room .prepare-seat small { display:none; }
body.native-ui #room .prepare-portrait { width:150px; height:145px; margin:0; display:grid; place-items:end center; }
body.native-ui #room .prepare-portrait :is(img,canvas) { width:auto; height:145px; max-width:150px; }
body.native-ui #room .prepare-seat strong { color:#fff4b2; font:14px/17px SimSun,serif; text-shadow:1px 1px #311600; }
body.native-ui #room .room-kind, body.native-ui #room .room-map { font-size:16px; }
body.native-ui #room .prepare-settings-label { font-size:12px; color:#f5e5aa; }
body.native-ui #signin #login-title, body.native-ui #lobby > .scene-heading, body.native-ui #room > .scene-heading {
  display:block; position:absolute; width:1px; height:1px; clip-path:inset(50%); overflow:hidden; margin:0; padding:0;
}
#lobby .native-player-hit span { font-weight: normal; color: #68a3fe; }
.native-stage .native-version, .native-stage .native-caption { -webkit-font-smoothing: antialiased; }
#prepare-options #room-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
#prepare-options .prepare-art-button { display:none; }
body.native-ui #room .prepare-rule {
  width:128px; height:18px; line-height:18px; appearance:none; border:0; padding:0 5px; margin:0;
  min-height:0; background:transparent; color:white; font:14px SimSun,serif; border-radius:0;
}
body.native-ui #room .prepare-rule:disabled { opacity:1; color:white; }
body.native-ui #room .prepare-rule option { background:#182522; }
body.native-ui #room .prepare-title { width:100%; color:#ffe596; font:12px/14px SimSun,serif; text-align:center; }
body.native-ui #room .prepare-seat strong { width:110px; text-align:center; background:linear-gradient(90deg,transparent,#d43f37b0,transparent); }
body.native-ui #room .prepare-seat.seat-1 strong { background:linear-gradient(90deg,transparent,#61b53eb0,transparent); }
body.native-ui #room .prepare-seat .prepare-portrait { position:absolute; top:14px; left:0; width:150px; height:170px; }
body.native-ui #room .prepare-portrait canvas { display:block; width:150px; height:170px; }
body.native-ui #room .prepare-seat strong { position:absolute; left:0; top:182px; width:150px; background:none !important; }
body.native-ui #room .prepare-room-number { font:12px/14px SimSun,serif; }
body.native-ui #native-room-chat { width:1024px; height:738px; pointer-events:none; }
body.native-ui #native-room-chat :is(.chat-panel,.chat-compose) { display:contents; background:none; margin:0; padding:0; border:0; }
body.native-ui #native-room-chat .heading { display:none; }
body.native-ui #native-room-chat :is(.chat-log,.chat-compose input,.chat-compose button,.chat-pickers,.chat-feedback) {
  position:absolute; pointer-events:auto; margin:0; border:0; box-shadow:none;
}
body.native-ui #native-room-chat .chat-log {
  left:34px; top:438px; width:330px; height:77px; min-height:0; max-height:none; padding:0;
  background:transparent; scrollbar-width:thin; font:12px/15px SimSun,serif;
}
body.native-ui #native-room-chat .chat-compose input {
  left:466px; top:710px; width:238px; height:19px; min-height:0; border-radius:0; color:white; background:transparent; font:14px SimSun,serif;
}
body.native-ui #native-room-chat .chat-toggle { left:750px; top:709px; }
body.native-ui #native-room-chat .chat-compose [type=submit] { left:730px; top:709px; }
body.native-ui #native-room-chat .chat-pickers { left:465px; bottom:36px; width:325px; background:#223937; z-index:5; }
body.native-ui #native-room-chat .chat-feedback { left:465px; bottom:33px; color:#f5e5aa; }
#lobby-shop .shop-contents { width:1024px; height:738px; }
body.native-ui #character-details, body.native-ui #character-details::backdrop { background:transparent; }
#character-details .detail-sheet { width:558px; height:551px; }
.native-overlay .shop-hit { min-width:0; min-height:0; padding:0; margin:0; background:none; border:0; border-radius:0; box-shadow:none; }
.native-overlay .shop-hit .shop-hover { visibility:hidden; }
.native-overlay .shop-hit:is(:hover,:focus-visible):enabled .shop-hover { visibility:visible; }
#lobby-shop .goods-name { width:105px; text-align:center; }
#lobby-shop .goods-price { color:#100e01; font-size:14px; letter-spacing:-.4px; }
#lobby-shop .shop-actor, #lobby-shop .shop-effect { height:auto; background:none; border:none; pointer-events:none; }
#lobby-shop .shop-actor { width:212px; }
#lobby-shop .shop-effect { width:441px; }
#lobby-shop .shop-description { width:370px; white-space:pre-line; line-height:18px; }
#lobby-shop .shop-bag-cells { width:365px; height:138px; }
#lobby-shop .shop-bag-scroll { writing-mode:vertical-lr; width:20px; height:91px; min-height:0; margin:0; opacity:0; }
#lobby-shop .equipped-title { width:129px; height:18px; color:#ffe6a0; background:#080806; }
#lobby-shop .shop-title-menu { z-index:4; width:150px; overflow:auto; background:#171b16; }
#confirm-dye .dye-question { width:205px; white-space:normal; font:12px/22px SimSun,serif; }
#confirm-dye .dye-question strong { color:#ff8a00; font-weight:normal; }
.native-password-frame { width:360px; height:410px; background:#292829; }
#native-password .native-password-title { z-index:1; color:#ffe5a3; font:18px SimSun,serif; }
#native-password #account-password-form { display:contents; }
#native-password #account-password-form label { display:block; color:#fff; font:14px SimSun,serif; }
#native-password #account-password-form input { width:209px; height:25px; min-height:0; border:1px solid #ad9a63; border-radius:0; padding:1px 3px; background:#002021; color:#fff; outline-offset:1px; }
#native-password #account-password-form input:focus { outline:0; box-shadow:none; }
#native-password .password-action { min-height:0; padding:0; border:0; border-radius:0; background:transparent; color:#ffe5a3; font:16px/19px SimSun,serif; text-shadow:1px 1px #181818; }
#native-password .password-action:hover, #native-password .password-action:focus-visible { color:white; text-decoration:underline; }
#native-password #account-password-status, #native-password .password-hint { color:#ffd3b0; font:12px SimSun,serif; }
#system-account.native-password-link { width:var(--w); height:var(--h); min-height:0; padding:0; border:0; border-radius:0; background:transparent var(--picture) no-repeat; color:transparent; font-size:0; }
#system-account.native-password-link:hover { background-position:calc(-1 * var(--w)) 0; }
#system-account.native-password-link:active { background-position:calc(-2 * var(--w)) 0; }
#lobby-shop .dye-choice { width:49px; text-align:center; }
#lobby-shop .shop-feedback { max-width:302px; font-size:12px; color:#fff0a8; }
#character-details .detail-name { width:112px; text-align:center; }
#character-details .detail-stat { width:99px; text-align:right; font:bold 16px/18px SimSun,serif; }
#character-details .detail-turns { width:55px; text-align:center; color:#f2fa19; font:12px/14px SimSun,serif; }
#character-details .detail-pages { width:166px; text-align:center; color:#ffe5a3; font:bold 16px/18px SimSun,serif; }
#character-details .detail-notice { width:320px; white-space:pre-wrap; color:#ff1515; font:12px/19px SimSun,serif; letter-spacing:.8px; }
#character-details .detail-experience { width:457px; text-align:center; font:12px/14px SimSun,serif; }
@property --native-animation-frame { syntax: '<number>'; inherits: false; initial-value: 0; }
@media (prefers-reduced-motion:no-preference) {
  .native-stage .tcp-animation {
    animation: native-strip var(--duration) steps(var(--count),end) infinite;
    background-position: calc(-1 * var(--w) * var(--native-animation-frame)) 0 !important;
  }
  @keyframes native-strip { from { --native-animation-frame: 0; } to { --native-animation-frame: var(--count); } }
}
