:root {
  color-scheme: dark;
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #101317;
  color: #f1efe6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(16, 19, 23, 0.86), rgba(16, 19, 23, 0.92)),
    url("./assets/ui/battlefield-bg.svg") center / cover fixed;
}

button {
  min-height: 38px;
  border: 1px solid #d5b45f;
  border-radius: 6px;
  padding: 0 14px;
  background: #d5b45f;
  color: #101317;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  border-color: #5f6974;
  background: #242b32;
  color: #f1efe6;
}

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: 0.42;
}

button.icon-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.mobile-tool {
  display: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(241, 239, 230, 0.14);
  background: rgba(16, 19, 23, 0.92);
}

.brand,
.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand strong {
  font-size: 18px;
}

.runtime-badge {
  align-self: center;
  border: 1px solid rgba(61, 214, 208, 0.34);
  border-radius: 999px;
  padding: 5px 9px;
  color: #8fe2dd;
  background: rgba(61, 214, 208, 0.08);
  font-size: 11px;
  white-space: nowrap;
}

.start-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    url("./assets/key-art/art-direction-anchor.png") center 48% / cover no-repeat,
    #0b1013;
}

.start-screen-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 9, 11, 0.94) 0%, rgba(5, 9, 11, 0.72) 38%, rgba(5, 9, 11, 0.12) 72%),
    linear-gradient(180deg, rgba(5, 9, 11, 0.46) 0%, transparent 28%, rgba(5, 9, 11, 0.58) 100%);
}

.start-header {
  position: relative;
  z-index: 1;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid rgba(241, 239, 230, 0.14);
}

.start-brand img {
  width: 42px;
  height: 42px;
}

.start-brand strong {
  font-size: 20px;
}

.start-copy {
  position: relative;
  z-index: 1;
  width: min(580px, calc(100vw - 68px));
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 42px 34px 76px;
}

.start-copy h1 {
  margin: 10px 0 14px;
  font-size: 64px;
  line-height: 1.05;
  letter-spacing: 0;
}

.start-copy p {
  max-width: 440px;
  margin: 0;
  color: #d4d8d3;
  font-size: 17px;
  line-height: 1.7;
}

.start-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.start-actions button {
  min-width: 132px;
  min-height: 44px;
}

.save-summary {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
  padding-left: 12px;
  border-left: 2px solid #5f6974;
  color: #939a9b;
  font-size: 12px;
}

.save-summary.available {
  border-left-color: #3dd6d0;
  color: #b9d8d3;
}

.save-summary strong {
  color: #f1efe6;
  font-size: 13px;
}

.start-grid {
  height: calc(100vh - 58px);
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(620px, 1.1fr);
}

.start-panel {
  position: relative;
  overflow: hidden;
  background: #0c1517;
}

.start-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  filter: saturate(0.9) contrast(1.06);
}

.start-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(7, 12, 14, 0.88) 100%);
  pointer-events: none;
}

.character-caption {
  position: absolute;
  z-index: 1;
  left: 34px;
  bottom: 30px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.character-caption span,
.character-caption small {
  color: #b9d8d3;
  font-size: 13px;
}

.character-caption strong {
  margin: 5px 0 3px;
  font-size: 34px;
  line-height: 1;
}

.start-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 34px;
  background: rgba(20, 23, 27, 0.94);
  border-left: 1px solid rgba(241, 239, 230, 0.14);
}

.start-controls h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.character-select-panel {
  justify-content: flex-start;
  overflow-y: auto;
}

.eyebrow {
  color: #d5b45f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.selection-note {
  margin: 10px 0 0;
  color: #bfc3bd;
  font-size: 13px;
  line-height: 1.6;
}

.character-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

button.character-option {
  min-height: 82px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-color: rgba(241, 239, 230, 0.14);
  background: rgba(31, 37, 42, 0.92);
  color: #f1efe6;
  text-align: left;
}

button.character-option.selected {
  border-color: #d5b45f;
  background: rgba(67, 61, 42, 0.92);
  box-shadow: 0 0 0 1px rgba(213, 180, 95, 0.3);
}

.character-option img {
  width: 58px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  object-position: center 20%;
}

.character-option strong,
.character-option small {
  display: block;
}

.character-option em {
  display: block;
  margin-top: 4px;
  color: #d5b45f;
  font-size: 10px;
  font-style: normal;
  line-height: 1.35;
}

.skills {
  color: #d5b45f;
  font-size: 11px;
}

button.skill-action {
  border-color: #60d4ce;
  background: #245a5b;
  color: #f4ffff;
}

.character-option strong {
  margin-bottom: 5px;
  font-size: 15px;
}

.character-option small {
  color: #bfc3bd;
  font-size: 11px;
  line-height: 1.45;
}

.game-layout {
  height: calc(100vh - 58px);
  display: grid;
  grid-template-columns: minmax(700px, 1fr) 300px;
  gap: 12px;
  padding: 12px;
}

.log-panel,
.table {
  min-height: 0;
}

.player {
  position: absolute;
  z-index: 2;
  width: 230px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px;
  border: 1px solid rgba(241, 239, 230, 0.12);
  border-radius: 8px;
  background: rgba(23, 27, 31, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.player.seat-1 {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.player.seat-2 {
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
}

.player.seat-3 {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.player.seat-4 {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.seat-label {
  position: absolute;
  top: 7px;
  right: 8px;
  color: #d5b45f;
  font-size: 10px;
  font-weight: 700;
}

.distance-label {
  position: absolute;
  top: 7px;
  left: 8px;
  color: #8fe2dd;
  font-size: 10px;
  font-weight: 700;
}

.player.current {
  border-color: #d5b45f;
  box-shadow: 0 0 0 1px rgba(213, 180, 95, 0.26), 0 10px 28px rgba(0, 0, 0, 0.28);
}

.player.self {
  background: rgba(38, 50, 55, 0.92);
}

.player.dead {
  opacity: 0.58;
}

.player.targetable {
  border-color: #3dd6d0;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(61, 214, 208, 0.24), 0 0 24px rgba(61, 214, 208, 0.2);
}

.player.targetable:hover,
.player.targetable:focus-visible {
  outline: 0;
  background: rgba(30, 59, 61, 0.98);
}

.player.selected-target {
  border-color: #d5b45f;
  background: rgba(66, 58, 36, 0.98);
  box-shadow: 0 0 0 2px rgba(213, 180, 95, 0.26), 0 0 26px rgba(213, 180, 95, 0.22);
}

.player-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.player-head img {
  width: 42px;
  height: 42px;
}

.player-head img.character-portrait {
  border: 1px solid rgba(61, 214, 208, 0.52);
  border-radius: 4px;
  object-fit: cover;
  object-position: center 20%;
}

.player-head strong,
.player-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-head span,
.bars,
.loadout,
.statuses,
.card span,
.hint {
  color: #bfc3bd;
  font-size: 12px;
}

.bars,
.loadout,
.statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 24px;
  overflow: hidden;
}

.bars span,
.loadout span,
.statuses span {
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(241, 239, 230, 0.08);
}

.bars span.opening-state {
  color: #d5b45f;
}

.bars span.opening-state.confirmed {
  color: #8fe2dd;
  background: rgba(61, 214, 208, 0.12);
}

.table {
  display: grid;
  grid-template-rows: minmax(420px, 1fr) 180px 68px;
  gap: 12px;
}

.battlefield {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(241, 239, 230, 0.12);
  border-radius: 8px;
  background: #171b1f;
}

.field-bg {
  position: absolute;
  inset: 0;
  background: url("./assets/ui/battlefield-bg.svg") center / cover;
  opacity: 0.22;
}

.battlefield-center {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(40%, 360px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  transform: translate(-50%, -50%);
}

.table-card-zone {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.table-card {
  width: min(100%, 220px);
  height: 92px;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(240, 91, 72, 0.72);
  border-radius: 8px;
  background: rgba(16, 19, 23, 0.94);
  box-shadow: 0 0 18px rgba(240, 91, 72, 0.2);
}

.table-card img {
  width: 60px;
  height: 78px;
  object-fit: contain;
}

.table-card div {
  min-width: 0;
}

.table-card strong,
.table-card span {
  display: block;
}

.table-card strong {
  font-size: 17px;
}

.table-card span {
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: #bfc3bd;
  font-size: 12px;
}

.battlefield-center.has-table-card .optional-field-stat {
  display: none;
}

.battlefield-center.has-table-card {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-stat,
.pending {
  position: relative;
  min-height: 48px;
  border: 1px solid rgba(241, 239, 230, 0.12);
  border-radius: 8px;
  padding: 7px 9px;
  background: rgba(16, 19, 23, 0.72);
}

.field-stat span {
  display: block;
  color: #bfc3bd;
  font-size: 12px;
}

.field-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.pending {
  grid-column: 1 / -1;
  min-height: 34px;
  color: #f1efe6;
  font-size: 12px;
}

.hand-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 126px;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}

.card {
  height: 176px;
  display: grid;
  grid-template-rows: 96px auto auto 26px;
  gap: 5px;
  align-items: center;
  justify-items: center;
  padding: 8px;
  border: 1px solid rgba(241, 239, 230, 0.14);
  border-radius: 8px;
  background: #202529;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.card.usable {
  cursor: pointer;
  border-color: rgba(61, 214, 208, 0.42);
}

.card.usable:hover,
.card.usable:focus-visible {
  outline: 0;
  border-color: #3dd6d0;
  background: #263236;
}

.card.selected {
  border-color: #d5b45f;
  background: #343126;
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px rgba(213, 180, 95, 0.18);
}

.card.card-committing {
  opacity: 0.28;
  transform: translateY(-10px) scale(0.96);
}

.card.draw-receiving {
  opacity: 0;
}

.card.draw-revealed {
  animation: card-reveal 420ms cubic-bezier(0.2, 0.78, 0.2, 1);
}

.card.unavailable {
  opacity: 0.5;
}

.card.opening-card {
  border-color: rgba(213, 180, 95, 0.34);
  background: #25282a;
}

.card img {
  width: 82px;
  height: 92px;
  object-fit: contain;
}

.card strong {
  width: 100%;
  text-align: center;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discard-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 12px;
  border: 1px solid rgba(241, 239, 230, 0.12);
  border-radius: 8px;
  background: rgba(23, 27, 31, 0.92);
}

.selection-status {
  min-width: 170px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: baseline;
}

.selection-status span,
.selection-status small {
  color: #bfc3bd;
  font-size: 11px;
}

.selection-status small {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.selection-status .skill-damage-preview {
  color: #d5b45f;
  font-weight: 700;
}

.selection-status.opening-confirmation {
  min-width: 280px;
}

.use-modes {
  height: 36px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: stretch;
  padding: 2px;
  border: 1px solid rgba(241, 239, 230, 0.14);
  border-radius: 6px;
  background: #171b1f;
}

button.mode-button {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  padding: 0 10px;
  background: transparent;
  color: #bfc3bd;
  font-size: 12px;
}

button.mode-button.selected {
  background: #d5b45f;
  color: #101317;
}

.command-bar button {
  flex: 0 0 auto;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result {
  font-size: 18px;
  font-weight: 700;
  color: #d5b45f;
}

.log-panel {
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(241, 239, 230, 0.12);
  border-radius: 8px;
  background: rgba(23, 27, 31, 0.9);
}

.log-panel h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.log-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.log-panel-header .icon-button {
  display: none;
}

.log-panel ol {
  height: calc(100% - 30px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.log-panel li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(241, 239, 230, 0.08);
  font-size: 13px;
  line-height: 1.45;
}

.log-panel li span {
  color: #d5b45f;
}

.log-scrim {
  display: none;
}

.inspector-scrim {
  position: fixed;
  z-index: 1090;
  inset: 0;
  border: 0;
  background: rgba(4, 8, 10, 0.68);
}

.player-inspector {
  position: fixed;
  z-index: 1100;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid rgba(61, 214, 208, 0.38);
  border-radius: 8px;
  background: #171d21;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.56);
}

.inspector-header,
.inspector-profile,
.inspector-stats {
  display: flex;
}

.inspector-header {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inspector-header strong,
.inspector-header span {
  display: block;
}

.inspector-header span {
  margin-top: 3px;
  color: #bfc3bd;
  font-size: 12px;
}

.inspector-profile {
  gap: 12px;
  margin-top: 12px;
}

.inspector-profile > img {
  width: 88px;
  height: 112px;
  border-radius: 6px;
  object-fit: cover;
  object-position: center 18%;
}

.inspector-stats {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  color: #bfc3bd;
  font-size: 12px;
}

.inspector-stats strong {
  color: #f1efe6;
}

.inspector-list {
  margin: 12px 0 0;
}

.inspector-list > div {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(241, 239, 230, 0.08);
  font-size: 12px;
  line-height: 1.45;
}

.inspector-list dt {
  color: #d5b45f;
}

.inspector-list dd {
  margin: 0;
  color: #d8dbd7;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid #d5b45f;
  border-radius: 8px;
  background: #202529;
  color: #f1efe6;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.motion-card {
  position: fixed;
  z-index: 1000;
  display: block;
  margin: 0;
  border: 1px solid rgba(241, 239, 230, 0.35);
  border-radius: 7px;
  object-fit: contain;
  background: #161c20;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  will-change: transform, opacity;
}

.motion-card.draw-flight {
  box-shadow: 0 0 0 1px rgba(61, 214, 208, 0.3), 0 18px 42px rgba(0, 0, 0, 0.52);
}

.motion-card.play-flight {
  box-shadow: 0 0 24px rgba(213, 180, 95, 0.34), 0 18px 42px rgba(0, 0, 0, 0.52);
}

.motion-card.revealed-play-flight {
  border-color: rgba(213, 180, 95, 0.88);
  box-shadow: 0 0 32px rgba(213, 180, 95, 0.48), 0 18px 42px rgba(0, 0, 0, 0.62);
}

.target-connection-line {
  position: fixed;
  z-index: 999;
  height: 2px;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: rgba(226, 239, 235, 0.78);
  box-shadow: 0 0 7px rgba(202, 237, 231, 0.62);
  opacity: 0.88;
  pointer-events: none;
}

.target-connection-line::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1px;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #e2efeb;
  box-shadow: 0 0 8px rgba(202, 237, 231, 0.82);
}

.play-announcement {
  position: fixed;
  z-index: 1002;
  top: calc(50% + 72px);
  left: 50%;
  max-width: min(80vw, 360px);
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid rgba(213, 180, 95, 0.68);
  border-radius: 999px;
  background: rgba(12, 16, 19, 0.94);
  color: #f1efe6;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.46);
  pointer-events: none;
}

.static-card-reveal {
  position: fixed;
  z-index: 1001;
  top: 50%;
  left: 50%;
  width: 82px;
  height: 116px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(213, 180, 95, 0.88);
  border-radius: 7px;
  object-fit: contain;
  background: #161c20;
  box-shadow: 0 0 32px rgba(213, 180, 95, 0.48), 0 18px 42px rgba(0, 0, 0, 0.62);
  pointer-events: none;
}

@keyframes card-reveal {
  0% {
    opacity: 0;
    transform: translateY(-18px) rotateY(82deg) scale(0.86);
  }
  55% {
    opacity: 1;
    transform: translateY(2px) rotateY(-8deg) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card.draw-revealed {
    animation: none;
    transition: none;
  }

  .card.draw-receiving {
    opacity: 1;
  }

  .motion-card {
    display: none;
  }
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  button {
    min-height: 40px;
    touch-action: manipulation;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
  }

  .topbar {
    height: 44px;
    padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  }

  .brand {
    gap: 6px;
  }

  .brand img {
    width: 30px;
    height: 30px;
  }

  .brand strong,
  .runtime-badge,
  .top-tool .tool-label {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .mobile-tool {
    display: inline-flex;
  }

  .top-tool,
  .mobile-tool {
    min-width: 40px;
    width: 40px;
    padding: 0;
    align-items: center;
    justify-content: center;
    font-size: 21px;
  }

  .start-screen {
    min-height: 100dvh;
  }

  .start-header {
    height: 54px;
    padding: 0 16px;
  }

  .start-brand strong {
    display: block;
  }

  .start-copy {
    width: 100%;
    min-height: calc(100dvh - 54px);
    padding: 26px 18px max(28px, env(safe-area-inset-bottom));
  }

  .start-copy h1 {
    margin: 8px 0 10px;
    font-size: 42px;
  }

  .start-copy p {
    max-width: 360px;
    font-size: 14px;
  }

  .start-actions {
    margin-top: 20px;
  }

  .start-grid {
    height: calc(100dvh - 44px);
    grid-template-columns: 1fr;
    grid-template-rows: 38dvh minmax(0, 1fr);
  }

  .start-controls {
    min-height: 0;
    padding: 14px max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid rgba(241, 239, 230, 0.14);
    border-left: 0;
  }

  .character-caption {
    left: 16px;
    bottom: 14px;
  }

  .character-caption strong {
    font-size: 26px;
  }

  .character-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  button.character-option {
    min-height: 70px;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 7px;
    padding: 6px;
  }

  .character-option img {
    width: 48px;
    height: 56px;
  }

  .game-layout {
    position: relative;
    height: calc(100dvh - 44px);
    display: block;
    padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .table {
    width: 100%;
    height: 100%;
    gap: 6px;
  }

  .player {
    width: 142px;
    gap: 2px;
    padding: 5px;
    border-radius: 6px;
  }

  .player-head {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 5px;
  }

  .player-head img {
    width: 30px;
    height: 30px;
  }

  .player-head strong {
    font-size: 11px;
  }

  .player-head span,
  .bars,
  .loadout,
  .statuses,
  .skills {
    font-size: 9px;
  }

  .player .loadout,
  .player .statuses,
  .player .skills {
    display: none;
  }

  .bars {
    max-height: 18px;
    gap: 3px;
  }

  .bars span {
    padding: 2px 5px;
  }

  .seat-label,
  .distance-label {
    top: 3px;
    font-size: 8px;
  }

  .seat-label {
    right: 4px;
  }

  .distance-label {
    left: 4px;
  }

  .player.seat-1 {
    bottom: 3px;
  }

  .player.seat-2 {
    left: 3px;
  }

  .player.seat-3 {
    top: 3px;
  }

  .player.seat-4 {
    right: 3px;
  }

  .battlefield-center {
    width: 210px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  .table-card {
    width: 160px;
    height: 54px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 6px;
    padding: 4px;
  }

  .table-card img {
    width: 34px;
    height: 44px;
  }

  .table-card strong {
    font-size: 11px;
  }

  .table-card span {
    margin-top: 2px;
    font-size: 8px;
  }

  .field-stat,
  .pending {
    min-height: 32px;
    padding: 4px 5px;
    border-radius: 5px;
  }

  .field-stat span,
  .pending {
    font-size: 8px;
  }

  .field-stat strong {
    margin-top: 1px;
    font-size: 11px;
  }

  .pending {
    min-height: 24px;
  }

  .hand-row {
    grid-auto-columns: 78px;
    gap: 5px;
    padding: 2px 2px 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .card {
    width: 78px;
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(48px, 1fr) 16px 18px;
    gap: 2px;
    padding: 4px;
    scroll-snap-align: start;
    border-radius: 6px;
  }

  .card img {
    width: 58px;
    height: 100%;
    min-height: 48px;
  }

  .card strong {
    font-size: 11px;
  }

  .card > span {
    display: none;
  }

  .discard-check {
    gap: 2px;
    font-size: 9px;
  }

  .command-bar {
    min-width: 0;
    gap: 5px;
    padding: 5px;
    border-radius: 6px;
  }

  .command-bar button {
    min-height: 38px;
    max-width: 160px;
    padding: 0 10px;
    font-size: 11px;
  }

  .selection-status {
    min-width: 118px;
  }

  .selection-status strong {
    font-size: 12px;
  }

  .selection-status small {
    font-size: 9px;
  }

  .selection-status.opening-confirmation {
    min-width: 180px;
  }

  .use-modes {
    height: 36px;
  }

  button.mode-button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 10px;
  }

  .log-panel {
    position: fixed;
    z-index: 1060;
    top: 44px;
    right: 0;
    bottom: 0;
    width: min(86vw, 340px);
    padding: 10px;
    border-radius: 0;
    transform: translateX(102%);
    transition: transform 180ms ease;
  }

  .log-panel.open {
    transform: translateX(0);
  }

  .log-panel-header .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .log-panel h2 {
    margin: 0;
  }

  .log-panel ol {
    height: calc(100% - 44px);
  }

  .log-scrim {
    position: fixed;
    z-index: 1050;
    inset: 44px 0 0;
    display: block;
    border: 0;
    background: rgba(4, 8, 10, 0.58);
  }

  .player-inspector {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(72dvh, 520px);
    padding: 12px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .inspector-profile > img {
    width: 72px;
    height: 94px;
  }

  .toast {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 16px);
    font-size: 12px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .start-grid {
    grid-template-columns: minmax(260px, 0.8fr) minmax(430px, 1.2fr);
    grid-template-rows: 1fr;
  }

  .start-controls {
    overflow-y: auto;
    border-top: 0;
    border-left: 1px solid rgba(241, 239, 230, 0.14);
  }

  .selection-note,
  .character-option em {
    display: none;
  }

  .table {
    grid-template-rows: minmax(168px, 1fr) 98px 48px;
  }

  .battlefield-center:not(.has-table-card) .field-stat:nth-child(3),
  .battlefield-center:not(.has-table-card) .field-stat:nth-child(5),
  .battlefield-center:not(.has-table-card) .field-stat:nth-child(6) {
    display: none;
  }

  .battlefield-center {
    width: 200px;
  }

  .player-inspector {
    right: 0;
    bottom: 0;
    width: min(64vw, 520px);
    max-height: calc(100dvh - 44px);
    border-left: 1px solid rgba(61, 214, 208, 0.38);
    border-radius: 8px 0 0 0;
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 380px) {
  .table {
    grid-template-rows: minmax(132px, 1fr) 78px 44px;
  }

  .player {
    width: 128px;
  }

  .battlefield-center {
    width: 176px;
  }

  .hand-row {
    grid-auto-columns: 68px;
  }

  .card {
    width: 68px;
    grid-template-rows: minmax(36px, 1fr) 14px 16px;
  }

  .card img {
    width: 50px;
    min-height: 36px;
  }

  .command-bar button {
    min-height: 34px;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .table {
    grid-template-rows: minmax(330px, 1fr) 148px 60px;
  }

  .player.seat-2,
  .player.seat-4 {
    width: 128px;
  }

  .battlefield-center {
    width: 150px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .battlefield-center:not(.has-table-card) .field-stat:nth-child(5),
  .battlefield-center:not(.has-table-card) .field-stat:nth-child(6) {
    display: none;
  }
}
