:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #15100c;
  color: #f8eed8;
  --panel: rgba(35, 27, 20, 0.86);
  --panel-strong: rgba(24, 18, 13, 0.94);
  --line: rgba(232, 196, 123, 0.28);
  --gold: #e5bb63;
  --gold-soft: #f8e3ad;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(86, 65, 42, 0.2), transparent 42%),
    linear-gradient(180deg, #211811, #120d0a 62%, #1b130e);
}

button,
input,
textarea {
  font: inherit;
}

select {
  background: rgba(18, 13, 10, 0.82);
  border: 1px solid rgba(236, 204, 137, 0.32);
  border-radius: 6px;
  color: #f7e9c7;
  min-height: 38px;
  padding: 0 10px;
  width: 100%;
}

button {
  border: 1px solid rgba(246, 213, 136, 0.5);
  border-radius: 7px;
  background: linear-gradient(#89632f, #543719);
  box-shadow: inset 0 1px 0 rgba(255, 238, 184, 0.22), 0 8px 18px rgba(0, 0, 0, 0.18);
  color: #fff2c7;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  text-shadow: 0 1px 2px #000;
  transition: filter 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: rgba(255, 229, 139, 0.75);
  filter: brightness(1.12);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
textarea {
  background: rgba(18, 13, 10, 0.82);
  border: 1px solid rgba(236, 204, 137, 0.32);
  border-radius: 6px;
  color: #f7e9c7;
  padding: 0 10px;
  width: 100%;
}

input {
  min-height: 38px;
}

textarea {
  line-height: 1.45;
  min-height: 96px;
  padding: 10px;
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(26px, 4.2vw, 42px);
  line-height: 1.08;
  margin-bottom: 6px;
}

h2 {
  font-size: 18px;
}

.app {
  margin: 0 auto;
  max-width: 1380px;
  padding: 18px;
}

.topbar {
  align-items: center;
  background: rgba(18, 13, 10, 0.5);
  border: 1px solid rgba(232, 196, 123, 0.12);
  border-radius: 10px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px;
}

.topbar > div:first-child {
  min-width: 0;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.top-icon-button[disabled] {
  opacity: 0.42;
}

.room-menu {
  position: relative;
}

.room-menu-panel {
  background: rgba(21, 15, 11, 0.98);
  border: 1px solid rgba(232, 196, 123, 0.34);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  display: grid;
  gap: 6px;
  min-width: 142px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
}

.menu-field {
  display: grid;
  gap: 4px;
}

.menu-field span {
  color: #cbb98e;
  font-size: 12px;
}

.menu-field input {
  min-height: 34px;
}

.topbar p,
.hint {
  color: #cdbd9a;
}

.room-badge,
.entry-card,
.side-panel,
.finished-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
}

.room-badge {
  min-width: 118px;
  padding: 10px 14px;
  text-align: right;
}

.room-badge span,
.panel-title span,
.field span {
  color: #cbb98e;
  display: block;
  font-size: 12px;
}

.room-badge strong {
  font-size: clamp(20px, 2.2vw, 24px);
  letter-spacing: 2px;
}

.top-icon-button,
.icon-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-width: 42px;
  padding: 0;
}

.top-icon-button svg {
  display: block;
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 21px;
}

.lobby-shell {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
}

.game-shell {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(560px, 1fr) 360px;
  min-height: min(680px, calc(100svh - 150px));
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px;
}

.panel-title {
  align-items: center;
  border-bottom: 1px solid rgba(232, 196, 123, 0.2);
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
}

.hero-panel .panel-title {
  display: none;
}

.bot-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 70px 1fr;
}

.tool-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 90px 1fr;
  margin-bottom: 10px;
}

.identity-config {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0;
}

.identity-config h3 {
  color: #ffe58b;
  font-size: 14px;
  grid-column: 1 / -1;
  margin: 4px 0 0;
}

.identity-config label {
  display: grid;
  gap: 4px;
}

.identity-config span {
  color: #cbb98e;
  font-size: 12px;
}

.rules-box {
  background: rgba(13, 10, 8, 0.42);
  border: 1px solid rgba(232, 196, 123, 0.18);
  border-radius: 8px;
  margin-top: 12px;
  padding: 12px;
}

.rules-box h3 {
  color: #ffe58b;
  font-size: 16px;
  margin-bottom: 8px;
}

.rules-box ul {
  color: #e9d8b4;
  display: grid;
  gap: 6px;
  line-height: 1.65;
  margin: 0;
  padding-left: 18px;
}

.identity-dialog {
  max-width: min(460px, 92vw);
  width: 460px;
}

.identity-notice-card {
  border: 1px solid rgba(255, 235, 166, 0.36);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 18px;
}

.identity-notice-card > span {
  color: #ead39e;
  font-size: 13px;
}

.identity-notice-card > strong {
  color: #fff5cf;
  font-size: 34px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.identity-card-image {
  align-self: center;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  max-height: 220px;
  object-fit: contain;
  width: min(180px, 60vw);
}

.identity-card-image.fallback {
  align-items: center;
  aspect-ratio: 3 / 4;
  background: rgba(15, 10, 7, 0.72);
  border: 1px solid rgba(255, 235, 166, 0.34);
  color: #ffe58b;
  display: flex;
  font-size: 30px;
  font-weight: 800;
  justify-content: center;
}

.identity-notice-card p {
  color: #f3e3bf;
  line-height: 1.7;
  margin: 0;
}

.secret-list {
  background: rgba(10, 7, 5, 0.42);
  border: 1px solid rgba(255, 235, 166, 0.2);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 10px;
}

.secret-list h3 {
  color: #ffe58b;
  font-size: 15px;
  margin: 0;
}

.secret-list b {
  color: #ffe58b;
}

.filter-scroll {
  overflow: auto;
  padding-right: 4px;
}

.filters {
  display: grid;
  gap: 8px;
}

.pool-tool-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.custom-pool-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.filter-results-panel {
  background: rgba(13, 10, 8, 0.34);
  border: 1px solid rgba(232, 196, 123, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
}

.compact-title {
  border-bottom: 0;
  padding-bottom: 0;
}

.filter-results {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  max-height: min(340px, 36vh);
  overflow: auto;
  padding-right: 2px;
}

.filter-result-more {
  grid-column: 1 / -1;
  margin: 2px 0 0;
}

.filter-result-card {
  align-items: center;
  background: rgba(255, 232, 177, 0.06);
  border-color: rgba(232, 196, 123, 0.22);
  box-shadow: none;
  cursor: pointer;
  display: grid;
  gap: 3px 8px;
  grid-template-columns: 34px 1fr;
  min-height: 50px;
  padding: 6px 76px 6px 6px;
  position: relative;
  text-align: left;
}

.filter-result-card > span {
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 5px;
  display: flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  overflow: hidden;
  width: 34px;
}

.filter-result-card img {
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  width: 100%;
}

.filter-result-card strong,
.filter-result-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-result-card small {
  color: #cdbd9a;
  font-size: 12px;
}

.filter-result-actions {
  align-items: center;
  bottom: 6px;
  display: flex;
  justify-content: center;
  position: absolute;
  right: 6px;
  top: 6px;
  width: 64px;
}

.filter-result-actions button {
  font-size: 12px;
  min-height: 28px;
  padding: 0 8px;
}

.filter-result-actions button {
  min-width: 56px;
  position: relative;
  z-index: 2;
}

.pool-save-bar {
  align-items: end;
  background:
    linear-gradient(180deg, rgba(24, 18, 13, 0.86), rgba(16, 11, 8, 0.98)),
    radial-gradient(circle at 20% 0%, rgba(229, 187, 99, 0.16), transparent 34%);
  border: 1px solid rgba(232, 196, 123, 0.34);
  border-radius: 8px;
  bottom: 0;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.24);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(150px, 0.9fr) minmax(110px, 0.7fr) minmax(140px, 0.9fr) minmax(220px, 1.2fr) repeat(6, minmax(78px, auto));
  margin-top: 16px;
  padding: 12px;
  position: sticky;
  z-index: 6;
}

.pool-save-bar .custom-pool-panel {
  grid-column: 1 / -1;
  margin: 0;
}

.pool-save-bar .custom-pool-panel h3 {
  margin: 0;
}

.pool-save-bar .custom-pool-summary {
  padding: 8px 10px;
}

.pool-save-bar span {
  color: #d8c59f;
  font-size: 13px;
}

.pool-save-bar button {
  min-width: 0;
}

.pool-action-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pool-action-field span {
  color: #d8c59f;
  font-size: 12px;
}

.pool-action-field input,
.pool-action-field select,
.pool-action-field textarea {
  min-width: 0;
}

.custom-pool-summary {
  background: rgba(13, 10, 8, 0.34);
  border: 1px solid rgba(232, 196, 123, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.custom-pool-summary > strong {
  color: #ffe58b;
  font-size: 14px;
}

.custom-pool-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 104px;
  overflow: auto;
}

.custom-pool-chip {
  align-items: center;
  background: rgba(255, 232, 177, 0.08);
  border-color: rgba(232, 196, 123, 0.25);
  box-shadow: none;
  display: inline-flex;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
}

.custom-pool-chip small {
  color: #cdbd9a;
  font-size: 11px;
}

.custom-pool-more {
  align-items: center;
  border: 1px dashed rgba(232, 196, 123, 0.32);
  border-radius: 8px;
  color: #d8c59f;
  display: inline-flex;
  font-size: 12px;
  min-height: 32px;
  padding: 0 10px;
}

.filter-group {
  border: 0;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
}

.filter-group legend {
  color: #e7d09b;
  padding: 0;
}

.collapsible-filter details {
  display: grid;
  gap: 8px;
}

.collapsible-filter summary {
  align-items: center;
  background: rgba(255, 232, 177, 0.08);
  border: 1px solid rgba(232, 196, 123, 0.18);
  border-radius: 7px;
  color: #e7d09b;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  justify-content: space-between;
  list-style: none;
  min-height: 34px;
  padding: 0 10px;
}

.collapsible-filter summary::-webkit-details-marker {
  display: none;
}

.collapsible-filter summary::after {
  color: #ffe58b;
  content: "展开";
  font-size: 12px;
  font-weight: 700;
}

.collapsible-filter details[open] summary::after {
  content: "收起";
}

.collapsible-filter summary span {
  color: #cdbd9a;
  font-size: 12px;
  font-weight: 400;
  margin-left: auto;
  margin-right: 10px;
}

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.checkboxes label {
  align-items: center;
  background: rgba(255, 232, 177, 0.08);
  border: 1px solid rgba(232, 196, 123, 0.18);
  border-radius: 999px;
  display: flex;
  gap: 4px;
  min-height: 28px;
  padding: 0 8px;
}

.checkboxes input {
  min-height: auto;
  width: auto;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.toggle-field {
  align-items: center;
  grid-template-columns: 1fr auto;
}

.toggle-field input {
  min-height: auto;
  width: auto;
}

.table-stage {
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(244, 219, 154, 0.07) 50%, transparent 51%),
    linear-gradient(0deg, transparent 0 49%, rgba(244, 219, 154, 0.05) 50%, transparent 51%),
    linear-gradient(145deg, rgba(87, 72, 56, 0.85), rgba(42, 32, 24, 0.86));
  border: 1px solid rgba(236, 204, 137, 0.3);
  border-radius: 10px;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.25), 0 16px 44px rgba(0, 0, 0, 0.24);
  min-height: clamp(620px, calc(100svh - 120px), 760px);
  overflow: hidden;
  position: relative;
}

.table-stage::before {
  border: 1px solid rgba(246, 224, 172, 0.18);
  border-radius: 50%;
  content: "";
  height: min(58vw, 560px);
  left: 50%;
  position: absolute;
  top: 52%;
  transform: translate(-50%, -50%);
  width: min(72vw, 720px);
}

.table-actions {
  display: flex;
  gap: 8px;
  left: 16px;
  position: absolute;
  top: 16px;
  z-index: 4;
}

.round-table {
  height: 100%;
  min-height: clamp(620px, calc(100svh - 120px), 760px);
  position: relative;
}

.table-center {
  align-items: center;
  background: rgba(21, 15, 11, 0.58);
  border: 1px solid rgba(246, 224, 172, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  height: 228px;
  justify-content: center;
  left: 50%;
  position: absolute;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 304px;
}

.table-center span {
  color: #d6c393;
  display: none;
  font-size: 16px;
}

.table-center strong {
  font-size: 38px;
}

.seat-card {
  background: linear-gradient(160deg, rgba(42, 32, 25, 0.96), rgba(21, 15, 11, 0.96));
  border: 1px solid rgba(233, 198, 119, 0.38);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  min-height: 168px;
  padding: 8px 8px 39px;
  position: absolute;
  transform: translate(-50%, -50%) scale(var(--seat-scale, 1));
  transform-origin: center;
  width: 136px;
  z-index: 2;
}

.dealt-seat {
  min-height: 214px;
  padding-bottom: 42px;
}

.dead-seat {
  border-color: rgba(255, 112, 88, 0.58);
  filter: saturate(0.8);
}

.death-ribbon {
  background: linear-gradient(#8d2f26, #4d1712);
  border: 1px solid rgba(255, 190, 150, 0.35);
  border-radius: 999px;
  color: #ffe1d5;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  position: absolute;
  left: 7px;
  right: auto;
  top: 7px;
  z-index: 3;
}

.empty-seat {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0.82;
}

.seat-number {
  align-items: center;
  background: rgba(255, 229, 139, 0.12);
  border: 1px solid rgba(232, 196, 123, 0.42);
  border-radius: 999px;
  color: #ffe58b;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 0 5px;
  position: static;
  z-index: auto;
}

.seat-label {
  align-items: center;
  background: rgba(10, 7, 5, 0.9);
  border: 1px solid rgba(232, 196, 123, 0.24);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  color: #f5dfac;
  display: inline-flex;
  gap: 5px;
  left: 50%;
  line-height: 1;
  max-width: calc(100% + 34px);
  padding: 3px 7px 3px 3px;
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 9;
}

.label-above .seat-label {
  top: -25px;
}

.label-below .seat-label {
  bottom: -29px;
}

.seat-player-name {
  display: block;
  font-size: 12px;
  font-weight: 800;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-label {
  color: #d7c69d;
  margin-bottom: 10px;
}

.danger-button {
  background: linear-gradient(#7a2d28, #431d1a);
  border-color: rgba(255, 166, 130, 0.42);
  color: #ffd6c7;
  margin-top: 6px;
  min-height: 28px;
  padding: 0 9px;
  width: 100%;
}

.seat-icon-button {
  align-items: center;
  background: rgba(19, 13, 10, 0.78);
  border: 1px solid rgba(255, 222, 160, 0.3);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  color: #ffe9b6;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  padding: 0;
  position: absolute;
  right: 7px;
  top: 7px;
  width: 28px;
  z-index: 5;
}

.seat-text-action {
  align-items: center;
  background: rgba(19, 13, 10, 0.86);
  border: 1px solid rgba(255, 222, 160, 0.36);
  border-radius: 7px;
  bottom: 7px;
  box-shadow: none;
  color: #ffe9b6;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  min-height: 0;
  padding: 0 9px;
  position: absolute;
  right: 7px;
  text-shadow: none;
  top: auto;
  z-index: 5;
}

.seat-icon-button svg,
.remark-icon svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 15px;
}

.danger-icon,
.death-action {
  background: rgba(70, 22, 18, 0.86);
  border-color: rgba(255, 161, 132, 0.45);
  color: #ffd6c7;
}

.death-action {
  right: 7px;
  top: 7px;
}

.death-action.confirming {
  background: linear-gradient(#b4552e, #6f2119);
  border-color: rgba(255, 221, 150, 0.82);
  color: #fff3c4;
  font-size: 13px;
  font-weight: 800;
}

.stand-action {
  bottom: 7px;
  right: 7px;
  top: auto;
}

.delete-seat-action {
  bottom: 7px;
  right: 7px;
  top: auto;
}

.seat-card:not(.empty-seat) .delete-seat-action {
  right: 7px;
}

.seat-action {
  margin-top: 6px;
  min-height: 28px;
  padding: 0 9px;
  width: 100%;
}

.mini-portrait {
  align-items: center;
  background: rgba(11, 8, 6, 0.58);
  border-radius: 6px;
  display: flex;
  font-size: 26px;
  font-weight: 700;
  height: 100px;
  justify-content: center;
  margin-bottom: 7px;
  overflow: hidden;
}

.dealt-seat .mini-portrait,
.dealt-seat .general-art {
  height: 126px;
  margin-bottom: 9px;
  margin-top: 0;
}

.mini-portrait img {
  height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  width: 100%;
}

.seat-info {
  display: grid;
  gap: 1px;
  padding: 0 48px 0 2px;
  text-align: left;
}

.seat-info strong,
.seat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-info strong {
  font-size: 13px;
  line-height: 1.12;
}

.seat-info span,
.seat-name,
.identity-chip,
.actual-identity-badge {
  color: #d7c69d;
  font-size: 13px;
}

.actual-identity-badge {
  align-items: center;
  background: rgba(12, 8, 6, 0.78);
  border: 1px solid rgba(236, 204, 137, 0.38);
  border-radius: 7px;
  bottom: 7px;
  color: #f6dd9d;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  left: 7px;
  max-width: 70px;
  min-width: 28px;
  overflow: hidden;
  padding: 0 7px;
  position: absolute;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 4;
}

.dealt-seat .actual-identity-badge {
  left: 7px;
  max-width: none;
  right: 36px;
}

.remark-control {
  align-items: center;
  background: rgba(12, 8, 6, 0.78);
  border: 1px solid rgba(236, 204, 137, 0.42);
  border-radius: 7px;
  box-shadow: none;
  bottom: 7px;
  color: #ffe58b;
  cursor: pointer;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  left: auto;
  margin: 0;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  position: absolute;
  right: 7px;
  text-shadow: none;
  top: auto;
  width: 28px;
  z-index: 4;
}

.dealt-seat .remark-control {
  left: auto;
  right: 7px;
}

.remark-control:hover {
  border-color: rgba(255, 229, 139, 0.72);
  filter: brightness(1.12);
}

.remark-letter {
  color: #ffe58b;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.hidden-identity {
  opacity: 0.72;
}

.unknown-card {
  align-items: center;
  border: 1px dashed rgba(232, 196, 123, 0.34);
  border-radius: 6px;
  color: #cdbd9a;
  display: flex;
  height: 90px;
  justify-content: center;
  text-align: center;
}

.small-general {
  background: transparent;
  border: 0;
  display: grid;
  gap: 5px;
  min-height: 0;
  padding: 0;
  text-align: left;
  width: 100%;
}

.dealt-seat .small-general {
  gap: 0;
  pointer-events: auto;
}

.small-general.active {
  filter: drop-shadow(0 0 10px rgba(118, 255, 132, 0.55));
}

.general-art {
  align-items: center;
  border-radius: 6px;
  display: flex;
  font-size: 30px;
  font-weight: 800;
  height: 76px;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.dealt-seat .general-art {
  width: 100%;
}

.general-meta {
  display: none;
}

.general-art img {
  display: block;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  width: 100%;
}

.dead-seat .general-art img {
  opacity: 0.58;
}

.seat-identity-card {
  border: 1px solid rgba(255, 241, 180, 0.55);
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(18, 12, 8, 0.62);
  display: block;
  height: 38px;
  left: 50%;
  margin: 0;
  object-fit: cover;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-2deg);
  width: 28px;
  z-index: 5;
}

.seat-identity-card.fallback {
  align-items: center;
  background: rgba(15, 10, 7, 0.72);
  border: 1px solid rgba(255, 235, 166, 0.26);
  color: #ffe58b;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
}

.small-general strong {
  color: #fff3c9;
}

.small-general small {
  color: #cdbd9a;
}

.dealt-seat .general-meta {
  color: #fff3c9;
  display: -webkit-box;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  padding: 0 2px 2px;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dealt-seat .small-general strong,
.dealt-seat .small-general small {
  display: none;
}

.my-area {
  min-height: 0;
  overflow: auto;
}

.spotlight:empty {
  display: none;
}

.choice-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.choice-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.point-select-button {
  min-height: 34px;
  padding: 0 14px;
}

.choice-step-header {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.choice-step-header .hint {
  margin: 0;
}

.back-icon-button {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 30px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.choice-card {
  background: rgba(15, 11, 9, 0.62);
  border-color: rgba(232, 196, 123, 0.34);
  box-shadow: none;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
  position: relative;
  text-align: left;
}

.choice-card.offline-unsuitable-choice {
  border-color: rgba(255, 213, 104, 0.56);
}

.choice-card-actions {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 0.8fr;
}

.choice-card-actions button {
  font-size: 12px;
  height: 34px;
  min-height: 30px;
  padding: 0 8px;
}

.replace-choice-button {
  align-items: center;
  background: rgba(18, 13, 10, 0.86);
  border: 1px solid rgba(255, 229, 139, 0.58);
  border-radius: 999px;
  color: #ffe58b;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  position: absolute;
  right: 10px;
  top: 10px;
  width: 30px;
  z-index: 3;
}

.replace-choice-button:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.replace-choice-button.used {
  color: rgba(255, 229, 139, 0.62);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.choice-card:hover:not(:disabled),
.skin-choice-card:hover:not(:disabled),
.codex-card:hover:not(:disabled) {
  transform: translateY(-2px);
}

.choice-card .general-face {
  border-width: 1px;
  cursor: pointer;
  min-height: 0;
  padding: 5px;
}

.choice-card .general-face.detail-trigger:hover {
  border-color: rgba(255, 229, 139, 0.86);
  filter: brightness(1.08);
}

.choice-card .general-face strong,
.choice-card .offline-warning-name {
  font-size: 14px;
  line-height: 1.1;
}

.offline-warning-name {
  background: transparent;
  border: 0;
  border-bottom: 1px dashed rgba(255, 229, 139, 0.92);
  border-radius: 0;
  box-shadow: none;
  color: #fff4d4;
  cursor: help;
  font: inherit;
  font-weight: 900;
  min-height: 0;
  min-width: 0;
  padding: 0 0 1px;
  text-align: inherit;
}

.offline-warning-name:hover,
.offline-warning-name:focus-visible {
  background: transparent;
  color: #ffe58b;
  filter: none;
  transform: none;
}

.choice-card .general-face small,
.choice-card .faction-mark {
  font-size: 13px;
}

.choice-card > span {
  color: #ffe58b;
  font-size: 12px;
  text-align: center;
}

.general-face {
  align-items: end;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(255, 235, 166, 0.42);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-height: 210px;
  overflow: hidden;
  padding: 12px;
  position: relative;
}

.general-face::before {
  content: "";
  inset: 0;
  opacity: 0.42;
  position: absolute;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(255, 255, 255, 0.2) 44%, transparent 47%),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.05) 19px 20px);
}

.general-face img {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.general-face::after {
  background: linear-gradient(transparent 32%, rgba(0, 0, 0, 0.82));
  content: "";
  inset: 0;
  position: absolute;
}

.general-face strong {
  font-size: 32px;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 4px #000;
}

.general-face small,
.faction-mark {
  position: relative;
  z-index: 1;
}

.faction-mark {
  align-self: flex-start;
  background: transparent;
  border-radius: 0;
  bottom: 12px;
  left: 12px;
  max-width: 45%;
  padding: 0;
  position: absolute;
  text-align: left;
  text-shadow: 0 2px 4px #000;
}

.hero-general {
  display: grid;
  gap: 14px;
}

.my-area .hero-general > .general-face {
  justify-self: center;
  max-height: 220px;
  min-height: 0;
  width: min(100%, 165px);
}

.spotlight .hero-general > .general-face {
  justify-self: center;
  max-height: 360px;
  min-height: 0;
  width: min(100%, 270px);
}

.skin-choice-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.variant-picker {
  background: rgba(255, 232, 177, 0.05);
  border: 1px solid rgba(232, 196, 123, 0.18);
  border-radius: 8px;
  min-height: 65px;
  margin: 2px 0 0;
  padding: 7px;
}

.variant-picker-placeholder {
  background: transparent;
  border-color: transparent;
  pointer-events: none;
  visibility: hidden;
}

.variant-picker label {
  display: grid;
  gap: 5px;
}

.variant-picker span {
  color: #ffe58b;
  font-size: 12px;
  font-weight: 800;
}

.variant-picker select {
  background: rgba(16, 11, 8, 0.92);
  border: 1px solid rgba(232, 196, 123, 0.44);
  border-radius: 6px;
  color: #fff3c9;
  font: inherit;
  font-size: 12px;
  min-height: 32px;
  min-width: 0;
  padding: 0 8px;
  width: 100%;
}

.faction-choice-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
}

.faction-choice {
  font-size: 18px;
  font-weight: 900;
  min-height: 58px;
}

.skin-choice-card {
  background: rgba(15, 11, 9, 0.62);
  border-color: rgba(232, 196, 123, 0.34);
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
  text-align: left;
}

.skin-choice-art {
  align-items: center;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(255, 235, 166, 0.36);
  border-radius: 6px;
  display: flex;
  font-size: 22px;
  font-weight: 800;
  justify-content: center;
  overflow: hidden;
}

.skin-choice-art img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.skin-choice-card strong,
.skin-choice-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skin-choice-card strong {
  color: #fff3c9;
  font-size: 12px;
}

.skin-choice-card small {
  color: #cdbd9a;
  font-size: 10px;
}

.skill-scroll {
  background: rgba(12, 9, 7, 0.68);
  border: 1px solid rgba(232, 196, 123, 0.24);
  border-radius: 8px;
  padding: 14px;
}

.skill-scroll h3 {
  font-size: 24px;
  margin-bottom: 12px;
}

.skill-scroll h3 span {
  color: #d7c69d;
  font-size: 14px;
  font-weight: 400;
}

.skill-line {
  border-top: 1px solid rgba(232, 196, 123, 0.18);
  padding-top: 10px;
}

.skill-line strong {
  color: #ffe58b;
  font-size: 18px;
}

.skill-line p {
  color: #f4e6c4;
  line-height: 1.75;
  margin-bottom: 0;
}

.codex-variant-list {
  display: grid;
  gap: 12px;
}

.codex-variant-detail {
  background: rgba(255, 232, 177, 0.05);
  border: 1px solid rgba(232, 196, 123, 0.2);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 110px 1fr;
  padding: 10px;
}

.codex-variant-head {
  display: grid;
  gap: 4px;
  grid-column: 1 / -1;
}

.codex-variant-head strong {
  color: #ffe58b;
}

.codex-variant-head span {
  color: #cdbd9a;
  font-size: 12px;
}

.codex-variant-detail > img {
  align-self: start;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(255, 235, 166, 0.28);
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

.source-link {
  color: #ffe58b;
}

.release-meta,
.codex-meta {
  color: #d7c69d;
  font-size: 13px;
  margin: -4px 0 8px;
}

.codex-meta + .release-meta {
  margin-top: -6px;
}

.skin-section {
  border-top: 1px solid rgba(232, 196, 123, 0.18);
  margin-top: 14px;
  padding-top: 12px;
}

.skin-section h4 {
  margin: 0 0 10px;
}

.skin-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.skin-card {
  background: rgba(255, 232, 177, 0.06);
  border: 1px solid rgba(232, 196, 123, 0.18);
  border-radius: 8px;
  padding: 8px;
}

.skin-card strong,
.skin-card small {
  display: block;
}

.skin-card small,
.skin-card p {
  color: #cdbd9a;
}

.skin-card p {
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0 0;
}

.skin-art {
  align-items: center;
  aspect-ratio: 3 / 4;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  display: flex;
  font-size: 28px;
  font-weight: 800;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
}

.skin-art img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.finished-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: 320px 1fr;
  margin-top: 14px;
  padding: 16px;
}

.table-generals {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
}

.table-general {
  background: rgba(12, 9, 7, 0.45);
  border: 1px solid rgba(232, 196, 123, 0.18);
  border-radius: 8px;
  padding: 10px;
}

.table-general > span {
  color: #d7c69d;
  display: block;
  margin-bottom: 8px;
}

.detail-dialog,
.settings-dialog {
  background:
    linear-gradient(rgba(23, 18, 14, 0.9), rgba(23, 18, 14, 0.9)),
    radial-gradient(circle at 30% 20%, rgba(234, 199, 126, 0.22), transparent 36%);
  border: 1px solid rgba(232, 196, 123, 0.5);
  border-radius: 8px;
  color: #f8eed8;
  max-width: min(760px, 92vw);
  padding: 18px;
  width: 760px;
}

.settings-dialog {
  max-width: min(980px, 94vw);
  width: 980px;
}

#pool-dialog {
  max-width: min(1280px, 96vw);
  width: 1280px;
}

.pool-code-dialog {
  max-width: min(760px, 92vw);
  width: 760px;
}

.pool-name-dialog {
  max-width: min(460px, 92vw);
  width: 460px;
}

.guide-dialog {
  max-width: min(560px, 92vw);
  margin: 0;
  position: fixed;
  z-index: 82;
  width: 560px;
}

.guide-overlay {
  background: transparent;
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 80;
}

.guide-overlay.guide-fallback {
  background: rgba(0, 0, 0, 0.46);
}

.guide-highlight {
  border: 2px solid rgba(255, 229, 139, 0.94);
  border-radius: 12px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.38),
    0 0 24px rgba(255, 213, 104, 0.36),
    inset 0 0 18px rgba(255, 213, 104, 0.16);
  position: fixed;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.guide-arrow {
  background: linear-gradient(90deg, rgba(255, 229, 139, 0.25), #ffe58b);
  border-radius: 999px;
  height: 3px;
  position: fixed;
  transform-origin: 0 50%;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, transform 0.18s ease;
}

.guide-arrow::after {
  border-bottom: 6px solid transparent;
  border-left: 10px solid #ffe58b;
  border-top: 6px solid transparent;
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
}

.guide-content {
  min-height: 190px;
}

.guide-step {
  background: rgba(12, 9, 7, 0.34);
  border: 1px solid rgba(232, 196, 123, 0.2);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.guide-step-badge {
  color: #ffe58b;
  font-size: 13px;
  font-weight: 700;
}

.guide-step h3 {
  font-size: 22px;
  margin: 0;
}

.guide-step p {
  color: #f4e6c4;
  line-height: 1.75;
  margin: 0;
}

.guide-actions {
  grid-template-columns: minmax(90px, 0.7fr) minmax(120px, 1fr);
}

.pool-code-dialog textarea {
  background: rgba(18, 13, 10, 0.82);
  border: 1px solid rgba(236, 204, 137, 0.32);
  border-radius: 7px;
  color: #f7e9c7;
  min-height: 220px;
  padding: 10px;
  resize: vertical;
  width: 100%;
}

.dialog-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.codex-dialog {
  background: rgba(21, 15, 11, 0.96);
  border: 1px solid rgba(232, 196, 123, 0.5);
  border-radius: 8px;
  color: #f8eed8;
  height: min(860px, 92vh);
  max-width: min(1180px, 94vw);
  padding: 16px;
  width: 1180px;
}

.codex-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-head,
.codex-head {
  align-items: start;
  border-bottom: 1px solid rgba(232, 196, 123, 0.2);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.settings-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 260px 1fr;
}

#pool-dialog .settings-grid {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

#pool-dialog .settings-grid > section:last-child {
  align-items: start;
  align-content: start;
  display: grid;
  gap: 12px 18px;
  grid-column: 1 / -1;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  grid-template-rows: max-content max-content max-content;
}

#pool-dialog .settings-grid > section:last-child > h3,
#pool-dialog .settings-grid > section:last-child > .field,
#pool-dialog .settings-grid > section:last-child > .filters {
  grid-column: 1;
}

#pool-dialog .filter-results-panel {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin-top: 0;
  min-width: 0;
}

#pool-dialog .filter-results {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  max-height: min(620px, calc(92vh - 235px));
}

.codex-filters {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  margin-bottom: 12px;
}

.codex-filters input {
  grid-column: span 2;
}

.codex-filters input,
.codex-filters select {
  background: rgba(18, 13, 10, 0.82);
  border: 1px solid rgba(236, 204, 137, 0.32);
  border-radius: 6px;
  color: #f7e9c7;
  min-height: 38px;
  padding: 0 10px;
}

.codex-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  max-height: calc(92vh - 170px);
  overflow: auto;
  padding-right: 4px;
}

.codex-card {
  background: rgba(255, 232, 177, 0.06);
  border-color: rgba(232, 196, 123, 0.22);
  display: grid;
  gap: 6px;
  min-height: 0;
  padding: 8px;
  text-align: left;
}

.codex-card strong,
.codex-card small,
.codex-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-card small,
.codex-card span {
  color: #cdbd9a;
}

.codex-art {
  align-items: center;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  display: flex;
  font-size: 34px;
  font-weight: 800;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.codex-art img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.detail-dialog::backdrop,
.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.close-button {
  float: right;
  font-size: 22px;
  min-height: 34px;
  padding: 0 12px;
}

#message {
  color: #ffd36e;
  min-height: 26px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.wei {
  background: linear-gradient(150deg, #445b78, #1f2b3c 58%, #d8dfea);
}

.shu {
  background: linear-gradient(150deg, #6d8a3b, #233a20 58%, #e7d087);
}

.wu {
  background: linear-gradient(150deg, #3f7f81, #18363c 58%, #f0d580);
}

.qun {
  background: linear-gradient(150deg, #8d7040, #49351e 58%, #e2d4b4);
}

.lord {
  background: linear-gradient(150deg, #b08a35, #5a3516 58%, #ffe08a);
}

.loyal {
  background: linear-gradient(150deg, #3f7f81, #18363c 58%, #f0d580);
}

.spy {
  background: linear-gradient(150deg, #7a5a91, #352443 58%, #e4cef5);
}

.rebel {
  background: linear-gradient(150deg, #8c3a32, #401c18 58%, #f0c0a0);
}

.neutral {
  background: linear-gradient(150deg, #746555, #30251d 58%, #c9b68a);
}

@media (max-width: 1180px) {
  .app {
    padding: 14px;
  }

  .topbar {
    gap: 12px;
    padding: 10px;
  }

  .topbar h1 {
    font-size: clamp(30px, 4vw, 38px);
    margin-bottom: 0;
  }

  .top-actions {
    gap: 8px;
  }

  .room-badge {
    min-width: 108px;
    padding: 8px 10px;
  }

  .top-icon-button,
  .icon-button {
    min-height: 40px;
    min-width: 40px;
  }
}

@media (max-width: 1120px) {
  .game-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .side-panel {
    max-height: none;
  }

  .table-stage,
  .round-table {
    min-height: clamp(390px, calc(100svh - 245px), 560px);
  }

  .finished-panel,
  .lobby-shell,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  #pool-dialog .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #pool-dialog .settings-grid > section:last-child {
    grid-template-columns: minmax(0, 1fr);
  }

  #pool-dialog .settings-grid > section:last-child > h3,
  #pool-dialog .settings-grid > section:last-child > .field,
  #pool-dialog .settings-grid > section:last-child > .filters,
  #pool-dialog .filter-results-panel {
    grid-column: 1;
  }

  #pool-dialog .filter-results-panel {
    grid-row: auto;
    margin-top: 12px;
  }

  .pool-save-bar {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .pool-save-bar > span,
  .pool-action-field {
    grid-column: 1 / -1;
  }

  .lobby-shell {
    gap: 10px;
  }

  .entry-card {
    gap: 8px;
    padding: 12px;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: clamp(27px, 6vw, 34px);
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(112px, 1fr) repeat(6, 42px);
  }

  .room-badge {
    min-width: 0;
  }

  .codex-filters {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .pool-save-bar {
    grid-template-columns: 1fr 1fr;
  }

  .pool-save-bar > span,
  .pool-action-field {
    grid-column: 1 / -1;
  }

  body {
    overflow-x: hidden;
  }

  .custom-pool-selected {
    max-height: 84px;
  }

  .filter-results {
    max-height: 32vh;
  }

  .filter-result-card {
    grid-template-columns: 30px 1fr;
    min-height: 46px;
    padding: 5px 62px 5px 5px;
  }

  .filter-result-card > span {
    height: 34px;
    width: 30px;
  }

  .filter-result-actions {
    right: 5px;
    width: 52px;
  }

  .filter-result-actions button {
    min-height: 26px;
    min-width: 46px;
    padding: 0 6px;
  }

  .app {
    max-width: 100%;
    padding: 8px;
  }

  .topbar {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 7px;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 9px;
  }

  .topbar > div:first-child {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .topbar h1 {
    display: inline-block;
    font-size: clamp(18px, 5.2vw, 24px);
    line-height: 1;
    margin-bottom: 2px;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
    word-break: keep-all;
  }

  .topbar p {
    display: none;
  }

  .top-actions {
    align-items: center;
    display: grid;
    flex: 0 0 auto;
    gap: 5px;
    grid-template-columns: max-content repeat(6, 36px);
    justify-content: end;
  }

  .room-badge {
    background: transparent;
    border: 0;
    box-shadow: none;
    grid-column: auto;
    min-width: 0;
    padding: 0 4px 0 0;
    text-align: left;
  }

  .room-badge span {
    display: inline;
    font-size: 11px;
    margin-right: 5px;
  }

  .room-badge strong {
    font-size: 19px;
    letter-spacing: 1px;
  }

  .top-actions > button,
  .room-menu > button {
    border-radius: 8px;
    height: 36px;
    min-height: 36px;
    min-width: 36px;
    padding: 0;
    width: 36px;
  }

  .room-menu {
    height: 36px;
    width: 36px;
  }

  .top-icon-button svg {
    height: 19px;
    width: 19px;
  }

  .icon-button {
    font-size: 18px;
    min-width: 0;
  }

  .room-menu-panel {
    left: auto;
    right: 0;
    width: 154px;
  }

  .game-shell {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .codex-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .codex-dialog {
    height: calc(100svh - 20px);
    max-height: calc(100svh - 20px);
    padding: 12px;
  }

  .codex-dialog .dialog-head {
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .codex-dialog .dialog-head h2 {
    font-size: 17px;
    margin-bottom: 4px;
  }

  .codex-dialog .hint {
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 0;
  }

  .codex-filters input,
  .codex-filters select {
    font-size: 13px;
    min-height: 34px;
    padding: 0 8px;
  }

  .entry-card h2 {
    font-size: 16px;
    margin-bottom: 0;
  }

  .entry-card input,
  .entry-card button {
    min-height: 36px;
  }

  .table-stage {
    border-radius: 10px;
    display: grid;
    grid-template-rows: auto 1fr;
    height: clamp(430px, calc(100svh - 178px), 760px);
    min-height: 0;
    overflow: hidden;
  }

  .round-table {
    height: 100%;
    min-height: 0;
  }

  .table-stage.mobile-column-stage {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .table-stage.mobile-column-stage::before {
    display: none;
  }

  .table-stage.mobile-column-stage .table-actions {
    position: sticky;
    top: 0;
  }

  .round-table.mobile-column-layout {
    height: auto;
    min-height: max(100%, calc(var(--mobile-seat-rows, 4) * 216px + 64px));
  }

  .table-stage::before {
    height: min(76vw, 500px);
    top: 55%;
    width: min(104vw, 680px);
  }

  .table-actions {
    background: rgba(21, 15, 11, 0.72);
    border-bottom: 1px solid rgba(232, 196, 123, 0.18);
    display: flex;
    gap: 7px;
    justify-content: center;
    left: auto;
    padding: 6px;
    position: relative;
    right: auto;
    top: auto;
    z-index: 8;
  }

  .table-actions button {
    border-radius: 8px;
    font-size: 14px;
    min-height: 32px;
    min-width: 104px;
    padding: 0 14px;
    width: auto;
  }

  .table-center {
    height: 124px;
    top: 55%;
    width: 162px;
  }

  .table-center span {
    font-size: 14px;
    line-height: 1.4;
  }

  .table-center strong {
    font-size: 29px;
  }

  .seat-card {
    border-radius: 10px;
    min-height: 132px;
    padding: 5px 5px 32px;
    width: 104px;
  }

  .dealt-seat {
    min-height: 182px;
    padding-bottom: 35px;
    width: 118px;
  }

  .seat-number {
    font-size: 11px;
    height: 17px;
    min-width: 19px;
    padding: 0 4px;
  }

  .seat-label {
    gap: 3px;
    max-width: calc(100% + 28px);
    padding: 2px 5px 2px 2px;
  }

  .label-above .seat-label {
    top: -22px;
  }

  .label-below .seat-label {
    bottom: -23px;
  }

  .seat-player-name {
    font-size: 12px;
    max-width: 82px;
  }

  .mini-portrait {
    height: 72px;
    margin-bottom: 5px;
  }

  .dealt-seat .mini-portrait,
  .dealt-seat .general-art {
    height: 96px;
    margin-bottom: 6px;
    margin-top: 0;
  }

  .seat-info {
    padding: 0 42px 0 1px;
    text-align: left;
  }

  .seat-info strong {
    font-size: 12px;
  }

  .seat-info span,
  .seat-name,
  .identity-chip,
  .actual-identity-badge {
    font-size: 12px;
  }

  .actual-identity-badge {
    border-radius: 6px;
    bottom: 5px;
    height: 23px;
    left: 5px;
    max-width: 50px;
    min-width: 23px;
    padding: 0 5px;
  }

  .dealt-seat .actual-identity-badge {
    left: 5px;
    max-width: none;
    right: 33px;
  }

  .remark-control {
    border-radius: 6px;
    bottom: 5px;
    height: 23px;
    left: auto;
    right: 5px;
    top: auto;
    width: 23px;
  }

  .remark-letter {
    font-size: 12px;
  }

  .stand-action {
    bottom: 5px;
    right: 5px;
  }

  .delete-seat-action {
    bottom: 5px;
    right: 5px;
  }

  .seat-card:not(.empty-seat) .delete-seat-action {
    right: 5px;
  }

  .death-action {
    right: 5px;
    top: 5px;
  }

  .dealt-seat .general-meta {
    font-size: 14px;
    line-height: 1.18;
    padding: 0 1px 3px;
  }

  .seat-icon-button {
    height: 24px;
    width: 24px;
  }

  .seat-icon-button svg {
    height: 13px;
    width: 13px;
  }

  .general-art {
    height: 48px;
  }

  .side-panel {
    border-radius: 10px;
    padding: 8px;
  }

  .hero-panel {
    min-height: 58px;
  }

  .hero-panel:has(.my-area:empty) {
    display: none;
  }

  .panel-title {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .my-area:empty {
    display: none;
  }

  .my-area.choices .hint {
    display: none;
  }

  .choice-grid,
  .skin-choice-grid {
    gap: 5px;
  }

  .skin-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pool-tool-row,
  .dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: start;
  }

  .pool-tool-row button,
  .dialog-actions button {
    min-width: 0;
    width: auto;
  }

  .choice-card,
  .skin-choice-card {
    border-radius: 6px;
    gap: 3px;
    padding: 4px;
  }

  .choice-card .general-face {
    border-radius: 5px;
    padding: 3px;
  }

  .choice-card .general-face strong,
  .choice-card .offline-warning-name,
  .skin-choice-card strong {
    font-size: 11px;
  }

  .choice-card .general-face small,
  .skin-choice-card small {
    display: none;
  }

  .choice-card .faction-mark {
    bottom: 5px;
    font-size: 10px;
    left: 5px;
    max-width: 48%;
  }

  .choice-card > span {
    font-size: 11px;
  }

  .finished-panel {
    gap: 10px;
    padding: 10px;
  }

  .detail-dialog,
  .settings-dialog,
  .codex-dialog {
    max-width: calc(100vw - 20px);
    width: calc(100vw - 20px);
  }

  .detail-dialog {
    max-height: calc(100svh - 20px);
    overflow: auto;
    padding: 12px;
  }

  .detail-dialog .general-face {
    min-height: 0;
    width: min(210px, 70vw);
  }

  .skill-scroll {
    gap: 10px;
    padding: 10px;
  }

  .skill-scroll h3 {
    font-size: 20px;
    line-height: 1.25;
    margin-bottom: 8px;
  }

  .codex-variant-detail {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .codex-variant-detail > img {
    max-height: 112px;
    object-position: 50% 18%;
  }

  .skin-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }

  .skin-art {
    max-height: 132px;
  }

  .codex-grid {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: calc(100svh - 178px);
  }

  .codex-card {
    align-items: center;
    display: grid;
    gap: 2px 8px;
    grid-template-columns: 54px minmax(0, 1fr);
    min-height: 66px;
    padding: 6px;
  }

  .codex-card strong,
  .codex-card small,
  .codex-card span {
    grid-column: 2;
  }

  .codex-card strong {
    font-size: 14px;
    line-height: 1.2;
  }

  .codex-card small,
  .codex-card span {
    font-size: 12px;
    line-height: 1.25;
  }

  .codex-art {
    grid-row: 1 / span 3;
    height: 62px;
    width: 46px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 5px;
    padding: 8px;
  }

  .topbar h1 {
    font-size: clamp(18px, 5vw, 22px);
  }

  .top-actions {
    gap: 4px;
    grid-template-columns: max-content repeat(6, 34px);
    justify-content: end;
  }

  .room-badge {
    grid-column: auto;
    padding: 0 4px 0 0;
  }

  .room-badge strong {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .table-stage {
    height: clamp(420px, calc(100svh - 178px), 720px);
  }

  .codex-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .codex-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .app {
    padding: 8px;
  }

  .table-stage {
    height: clamp(400px, calc(100svh - 178px), 680px);
  }

  .round-table {
    height: 100%;
    min-height: 0;
  }

  .top-actions {
    gap: 3px;
    grid-template-columns: max-content repeat(6, 32px);
  }

  .topbar h1 {
    font-size: 18px;
  }

  .room-badge span {
    display: none;
  }

  .room-badge strong {
    font-size: 17px;
  }

  .top-actions > button,
  .room-menu > button {
    height: 32px;
    min-height: 32px;
    min-width: 32px;
    width: 32px;
  }

  .room-menu {
    height: 32px;
    width: 32px;
  }

  .top-icon-button svg {
    height: 18px;
    width: 18px;
  }

  .codex-filters {
    gap: 5px;
  }

  .codex-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .codex-art {
    height: 56px;
    width: 42px;
  }

  .pool-tool-row,
  .dialog-actions {
    grid-template-columns: 1fr;
  }
}
