/* The original theme.scss, using system UI text and local icons. */

:root {
  --muted: #909090;
  --danger: #e04545;
  --app-version-height: 18px;
  --app-font-family: "Open Sans", Arial, Verdana, sans-serif;
  --ui-cream: #f5ecd9;
  --ui-cream-soft: #ded8d5;
  --gold-cream: #eadfbd;
  --gold-light: #d4c48c;
  --gold-bright: #b8a76f;
  --gold-mid: #817349;
  --gold-low: #5a4f34;
  --gold-shadow: #302919;
  --gold-border: #9e9166;
  --gold-border-soft: rgba(158, 145, 102, 0.48);
  --gold-glow-soft: rgba(212, 196, 140, 0.18);
  --panel-warm: #15110a;
  --field-bg: #14120f;
  --gold-hover-bg: #1c1811;
  --gold-gradient: linear-gradient(90deg, #302919 0%, #5f5438 28%, #a49464 52%, #c3b47d 60%, #7d6f49 80%, #352d1c 100%);
  --gold-gradient-reverse: linear-gradient(270deg, #302919 0%, #5f5438 28%, #a49464 52%, #c3b47d 60%, #7d6f49 80%, #352d1c 100%);
  --gold-button-gradient: radial-gradient(circle at 45% 30%, #c9ba82 0%, #9f8f60 34%, #685c3d 70%, #332c1c 100%);
  --gold-button-hover-gradient: radial-gradient(circle at 45% 30%, #d5c58e 0%, #ab9b6b 38%, #756843 72%, #3a321f 100%);
  /* Declare the native scheme so dark-mode extensions leave us alone. */
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background-color: black;
  color: var(--ui-cream);
  font-family: var(--app-font-family);
  font-size: 0.8125em;
  -webkit-text-size-adjust: none;
  overflow: hidden;
}

.app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-version {
  flex: 0 0 var(--app-version-height);
  min-height: 0;
  height: var(--app-version-height);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: rgba(222, 216, 213, 0.58);
  font-size: 10px;
  line-height: 1;
  font-family: var(--app-font-family);
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  user-select: none;
}
@media (max-height: 570px), (max-width: 835px) {
  .app.game-screen > .app-version {
    justify-content: flex-start;
    padding-left: max(0px, calc((100vw - 836px) / 2));
    text-align: left;
  }
}
.startup {
  min-height: calc(100dvh - var(--app-version-height));
  background: #000;
}

button {
  background-image: var(--gold-button-gradient);
  color: var(--gold-cream);
  box-sizing: border-box;
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: inherit;
  font-weight: bold;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  cursor: pointer;
}
button:hover:not(:disabled):not(.fa):not(.icon):not(.styled),
button:focus:not(:disabled):not(.fa):not(.icon):not(.styled) {
  background: var(--gold-button-hover-gradient);
  outline: none;
}
button:disabled:not(.fa):not(.icon) {
  background: radial-gradient(var(--ui-cream-soft) 10%, #444);
  color: inherit;
  border: 1px solid var(--ui-cream-soft);
  opacity: 0.4;
  cursor: default;
}
button.styled, button.link {
  border: 0 none;
  background-color: transparent;
  background-image: none;
  color: var(--gold-light);
  font-weight: normal;
  text-shadow: none;
}
button.link { text-decoration: underline; }
a, button.link { color: var(--gold-light); }
a:hover, button.link:hover {
  color: var(--gold-cream);
  text-decoration: underline;
  text-shadow: 0 0 4px var(--gold-glow-soft);
}

input {
  background: transparent;
  border: 1px solid var(--gold-low);
  border-radius: 2px;
  color: var(--ui-cream);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 14px;
}
input:focus { outline: 1px solid var(--gold-bright); }

/* Auth: centered like the original intro screens. */
.auth {
  width: min(360px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: calc(100dvh - var(--app-version-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  text-align: center;
}
.auth h1 { margin-bottom: 0; letter-spacing: 1px; font-size: 2em; }
.auth p { color: var(--muted); margin-top: 0; }
.name-feedback {
  color: var(--danger);
  min-height: 1.2em;
  font-size: 13px;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.entry {
  min-height: calc(100dvh - var(--app-version-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.entry h1 { margin: 0; letter-spacing: 1px; font-size: 2em; }
.entry button { font-size: 1.1em; padding: 6px 16px; }

/* Lobby: the original online.html page with bronze tabs. */
.page {
  width: 100%;
  max-width: 836px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.page > header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px 0 8px;
  font-size: 1.2em;
}
.page > header button {
  display: inline-block;
  border-radius: 2px;
  border: 1px solid var(--gold-low);
  padding: 0 8px;
  background: none;
  color: var(--ui-cream);
  font-weight: normal;
  text-shadow: none;
  line-height: 1.6em;
}
.page > header button:hover { background: var(--panel-warm); }
.page > header .account { color: var(--gold-cream); }
.page > header.lobby-top {
  align-items: center;
  gap: 12px;
  position: relative;
}
.lobby-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 0;
}
.push-status {
  max-width: 460px;
  color: var(--ui-cream-soft);
  font-size: 0.9em;
  line-height: 1.25;
}
.push-state { font-weight: bold; }
.push-state.on { color: #58c470; }
.push-state.off { color: var(--gold-mid); }
.push-state.blocked { color: #ff2222; }
.push-state.unsupported { color: #aaaaaa; }
.push-detail { color: var(--gold-cream); }
.push-toggle {
  margin-left: 8px;
  font-size: 0.75em;
  line-height: 1.35em !important;
  vertical-align: 1px;
}
.lobby-account {
  display: flex;
  align-items: center;
  align-self: center;
  justify-content: flex-end;
  gap: 3px;
  position: relative;
  margin-left: 8px;
  min-height: 48px;
  width: max-content;
  max-width: 100%;
}
.lobby-account .account-button {
  margin: 8px 32px 8px 0;
  padding-right: 16px;
  font-family: var(--app-font-family);
  font-style: normal;
}
.lobby-play-center {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
}
.lobby-play-center .lobby-play-button.lobby-builder-button {
  min-width: 118px;
  padding: 0 14px;
  font-size: 12px;
  letter-spacing: 1px;
}
.lobby-play-center .lobby-play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 136px;
  height: 24px;
  margin: 0;
  padding: 0 18px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background-image: linear-gradient(100deg, #2e2618 0%, #625537 26%, #9c8c5e 46%, #b8a86f 54%, #7b6d46 76%, #2e2618 100%);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
  box-shadow:
    0 1px 5px rgba(0, 0, 0, 0.45);
  color: #000;
  font-weight: bold;
  font-size: 14px;
  letter-spacing: 2px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  white-space: nowrap;
}
.lobby-play-center .lobby-play-button::before {
  position: absolute;
  inset: 1px;
  z-index: 0;
  background-image: linear-gradient(100deg, #352d1d 0%, #675b3c 28%, #a79868 48%, #c1b37b 56%, #83754e 78%, #332c1c 100%);
  clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 11px 100%, 0 50%);
  content: "";
}
.lobby-play-center .lobby-play-label {
  display: block;
  position: relative;
  z-index: 1;
  line-height: 24px;
  transform: none;
}
.account-recovery-alerts {
  border: 0 !important;
  padding: 0 2px !important;
  background: none !important;
  color: #ff2222 !important;
  font-weight: bold !important;
  line-height: 1 !important;
  text-shadow: 1px 1px 0 #000 !important;
}
.account-avatar {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  box-sizing: border-box;
  padding: 4px;
  border-radius: 50%;
  overflow: visible;
  background-image: var(--gold-gradient);
  box-shadow: 0 0 0 1px #000;
}
.account-avatar::before {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background:
    linear-gradient(45deg, #000, transparent),
    #050505;
  box-shadow: inset 0 0 8px #000;
  content: "";
  z-index: 0;
}
.lobby-account .account-avatar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
}
.page > header .lobby-account .account-button:hover,
.page > header .lobby-account .account-button:focus {
  border-color: var(--gold-light);
  background: var(--panel-warm);
  color: var(--gold-light);
}
.page > header .lobby-play-center .lobby-play-button:hover,
.page > header .lobby-play-center .lobby-play-button:focus {
  box-shadow:
    0 0 8px rgba(234, 217, 168, 0.38),
    0 1px 5px rgba(0, 0, 0, 0.5);
  color: #000;
  outline: none;
  transform: none;
}
.page > header .lobby-play-center .lobby-play-button:hover::before,
.page > header .lobby-play-center .lobby-play-button:focus::before {
  background-image: linear-gradient(100deg, #3d3422 0%, #766847 28%, #b2a270 48%, #ccbd86 56%, #908159 78%, #3a321f 100%);
}
.lobby-account .account-button:hover .account-avatar,
.lobby-account .account-button:focus .account-avatar {
  background-image: var(--gold-button-hover-gradient);
  background-color: transparent;
}
.account-avatar canvas {
  position: absolute;
  left: -9px;
  top: -9px;
  z-index: 1;
  width: 58px !important;
  height: 58px !important;
  pointer-events: none;
  filter: drop-shadow(2px 3px 2px rgba(0, 0, 0, 0.68));
}
.lobby-account .account-avatar canvas {
  transform: scaleX(-1);
}
.player-info-avatar .account-avatar canvas {
  transform: scaleX(-1);
}
pixi-avatar canvas,
pixi-unit-sprite canvas { display: block; }
pixi-preload { display: none; }

.announcement {
  margin: 8px 8px 0;
  border: 1px solid var(--gold-low);
  border-radius: 4px;
  padding: 7px 10px;
  background: rgba(216, 191, 119, 0.13);
  color: var(--gold-cream);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tabs { margin-top: 8px; user-select: none; }
.tabs ul {
  display: flex;
  position: relative;
  margin: 0;
  padding: 0;
  width: 100%;
  justify-content: center;
  list-style: none;
}
.tabs ul::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--gold-border);
  pointer-events: none;
}
.tabs li {
  display: flex;
  position: relative;
  z-index: 1;
  flex-direction: row;
  align-items: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  padding: 0.4em 0.8em;
  cursor: pointer;
}
.tabs li.is-active {
  background: var(--gold-gradient);
  cursor: default;
}
.tabs li.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--ui-cream);
  pointer-events: none;
}
.tabs li.is-active .label {
  color: var(--gold-cream);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
/* Original tab count badge: a small bronze pill after the label. */
.tabs li .badge {
  margin-left: 0.5em;
  padding: 0 0.45em;
  border-radius: 0.7em;
  background: var(--gold-shadow);
  color: var(--ui-cream);
  font-size: 0.75em;
  line-height: 1.4;
}
.tabs li.is-active .badge { background: #41342b; }

/* The original lobby's arena grid: 14 slots, empties create a game. */
.arena-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 8px 0;
}
.arena-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 92px;
  border: 1px solid var(--gold-low);
  border-radius: 8px;
  background:
    radial-gradient(ellipse at center, rgba(216, 191, 119, 0.22), rgba(0, 0, 0, 0.6)),
    #161616;
  cursor: pointer;
  user-select: none;
}
.arena-slot:hover { border-color: var(--ui-cream); }
.arena-slot.empty .plus { font-size: 28px; color: var(--gold-low); }
.arena-slot.empty:hover .plus { color: var(--ui-cream); }
.arena-slot .vs .name { color: var(--gold-bright); }
.arena-slot .meta { font-size: 11px; color: #888; }
.arena-slot .action {
  color: var(--ui-cream);
  font-size: 12px;
  border: 1px solid var(--gold-low);
  border-radius: 8px;
  padding: 1px 10px;
}

/* The little (i) explainer buttons in popups. */
button.info-btn {
  width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--gold-low);
  background: none;
  color: var(--gold-bright);
  font-style: normal;
  font-family: inherit;
  cursor: pointer;
}
button.info-btn:hover { color: var(--ui-cream); border-color: var(--ui-cream); }

.result-toggle,
.result-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.result-toggle.active {
  border-color: var(--gold-light);
  color: var(--gold-light);
}
.eye-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 50% / 60%;
  box-sizing: border-box;
  flex: 0 0 14px;
}
.eye-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: currentColor;
}

/* Turn clocks on the player banners (original .clock long/short). */
.player .clock { margin-left: 8px; font-weight: bold; }
.player .clock.long { color: var(--ui-cream); }
.player .clock.short { color: #ff4444; }
.player .clock.bank { color: var(--gold-bright); font-weight: normal; }

/* Ephemeral reconnect status. It is intentionally separate from notifications. */
.connection-warning-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--app-version-height) + 14px);
  z-index: 225;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 24px));
  min-height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--gold-border);
  padding: 7px 8px 7px 14px;
  background: linear-gradient(90deg, rgba(65, 49, 21, 0.96), rgba(0, 0, 0, 0.9) 48%, rgba(35, 27, 13, 0.96));
  box-shadow: 4px 6px 9px #000;
  color: var(--ui-cream);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-shadow: 1px 1px 1px #000;
  transform: translateX(-50%);
  pointer-events: auto;
}
.connection-warning-toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--danger);
}
.connection-warning-text {
  min-width: 0;
}
.connection-warning-close {
  position: relative;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 1px solid var(--gold-low);
  border-radius: 3px;
  padding: 0;
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold-bright);
  cursor: pointer;
  flex: 0 0 22px;
}
.connection-warning-close-icon,
.connection-warning-close-icon::before,
.connection-warning-close-icon::after {
  position: absolute;
  display: block;
}
.connection-warning-close-icon {
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
}
.connection-warning-close-icon::before,
.connection-warning-close-icon::after {
  content: "";
  left: 5px;
  top: 0;
  width: 2px;
  height: 12px;
  background: currentColor;
}
.connection-warning-close-icon::before { transform: rotate(45deg); }
.connection-warning-close-icon::after { transform: rotate(-45deg); }
.connection-warning-close:hover,
.connection-warning-close:focus {
  border-color: var(--ui-cream);
  color: var(--ui-cream);
  outline: none;
}

/* Bottom-right notification tray shared by success and errors. */
.app-notifications {
  position: fixed;
  right: 12px;
  bottom: calc(var(--app-version-height) + 12px);
  z-index: 220;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}
.app-notification-toggle {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: 4px 6px 9px #000;
}
.app-notification-icon {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gold-cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.app-notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border: 1px solid var(--gold-cream);
  border-radius: 10px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  text-shadow: 1px 1px 1px #000;
}
.app-notification-panel {
  width: 100%;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(11, 10, 9, 0.96);
  box-shadow: 4px 6px 12px #000;
  color: var(--ui-cream);
  pointer-events: auto;
}
.app-notification-header {
  min-height: 36px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--gold-low);
  background: linear-gradient(90deg, rgba(78, 58, 22, 0.96), rgba(14, 12, 9, 0.98));
}
.app-notification-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
}
.app-notification-count {
  min-width: 22px;
  height: 22px;
  border: 1px solid var(--gold-border);
  border-radius: 11px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.42);
  color: var(--gold-cream);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.app-notification-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.app-notification-dismiss-all,
.app-notification-collapse {
  height: 24px;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 20px;
}
.app-notification-collapse {
  width: 24px;
  padding: 0;
  font-size: 17px;
}
.app-notification-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(50vh, 320px);
  overflow: auto;
  padding: 8px;
}
.app-notice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  padding: 7px 8px 7px 14px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(65, 49, 21, 0.96), rgba(0, 0, 0, 0.9) 48%, rgba(35, 27, 13, 0.96));
  box-shadow: 4px 6px 9px #000;
  color: var(--ui-cream);
  font-size: 13px;
  font-weight: 700;
  text-shadow: 1px 1px 1px #000;
  pointer-events: auto;
}
.app-notice::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold-bright);
}
.app-notice.danger::before { background: var(--danger); }
.app-notice.ok::before { background: #58c470; }
.app-notice-text {
  flex: 1;
  min-width: 0;
  line-height: 18px;
}
.app-notice-close {
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 1px solid var(--gold-low);
  border-radius: 3px;
  padding: 0;
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold-bright);
  font-size: 17px;
  line-height: 18px;
  font-weight: 700;
  cursor: pointer;
}
.app-notice-close:hover,
.app-notice-close:focus {
  border-color: var(--ui-cream);
  color: var(--ui-cream);
  outline: none;
}

@media (max-width: 520px) {
  .app-notifications {
    right: 8px;
    bottom: calc(var(--app-version-height) + 8px);
    width: min(360px, calc(100vw - 16px));
  }
}

/* Players tab rows: rank number and rating column. */
.game-list .rank { min-width: 2em; color: var(--gold-bright); }
.game-list.rankings .player-row {
  cursor: pointer;
}
.game-list.rankings .player-row:hover,
.game-list.rankings .player-row:focus {
  background: rgba(216, 191, 119, 0.12);
  outline: 1px solid var(--gold-border-soft);
  outline-offset: -1px;
}
.lobby-header .controls input { max-width: 12em; }

.builder-slot { display: flex; gap: 8px; margin-bottom: 8px; }
.builder-slot select { flex: 1; }
.builder-slot input { flex: 1; min-width: 0; }

.tabContent {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px;
}
.tabContent .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }

/* The original lobby tab header: style selector left, small bronze
   control buttons right (.tabContent HEADER in online.html). */
.lobby-header {
  display: flex;
  align-items: center;
  padding: 4px 8px 8px;
}
.lobby-header .style { flex-grow: 1; }
.lobby-header .style select {
  background: var(--panel-warm);
  border: 1px solid var(--gold-low);
  color: var(--ui-cream);
  padding: 3px 6px;
  font-family: inherit;
}
.lobby-header .controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}
.lobby-header .controls button {
  height: 18px;
  border: 1px solid var(--gold-bright);
  border-radius: 2px;
  padding: 0 6px;
  line-height: 16px;
  font-weight: normal;
  font-size: 0.8333em;
  background: none;
  color: var(--gold-bright);
  text-shadow: none;
}
.lobby-header .controls button:hover {
  background: none;
  border-color: var(--gold-light);
  color: var(--gold-light);
}
.lobby-header .controls .lobby-reset-button {
  order: 999;
}
.lobby-header .controls .result-toggle {
  min-width: 96px;
  justify-content: center;
  background: linear-gradient(#251f13, #0f0d09);
  border-color: var(--gold-low);
  color: var(--gold-cream);
  text-shadow: none;
}
.lobby-header .controls .result-toggle.active,
.lobby-header .controls .result-toggle:hover,
.lobby-header .controls .result-toggle:focus {
  background: linear-gradient(#3a3018, #17130a);
  border-color: var(--gold-light);
  color: var(--gold-light);
  text-shadow: none;
}
.game-list .row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 8px;
  border-bottom: 1px solid #1c1c1c;
}
.game-list .row .vs { flex: 1; }
.game-list .row .vs .name { color: var(--gold-bright); font-weight: bold; }
.game-list .row .type { color: var(--muted); flex: 0 1 170px; }
.game-list .empty { color: var(--muted); padding: 16px 8px; font-style: normal; }
.game-sections { display: flex; flex-direction: column; gap: 14px; }
.game-section h3 {
  margin: 0 0 4px;
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: normal;
  text-transform: uppercase;
}

.lobby-tab-panel {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
}
.match-table-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 88px;
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid #1c1c1c;
}
.match-table-scroll {
  height: 100%;
  overflow: hidden auto;
  padding-right: 12px;
  box-sizing: border-box;
  scrollbar-width: none;
}
.match-table-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.match-table-wrap .lobby-scrollbar {
  position: absolute;
  top: 0;
  right: 2px;
  bottom: 0;
  width: 9px;
  background: transparent;
  touch-action: none;
  z-index: 2;
}
.match-table-wrap .lobby-scrollbar.is-hidden {
  display: none;
}
.match-table-wrap .lobby-scrollbar-thumb {
  width: 1px;
  min-height: 12px;
  margin-left: 4px;
  background-image: linear-gradient(180deg, #302919 0%, #5f5438 28%, #a49464 50%, #7d6f49 72%, #302919 100%);
  transform: translateY(0);
  will-change: transform, height;
}
.match-table-wrap .lobby-scrollbar:hover,
.match-table-wrap .lobby-scrollbar:active,
.match-table-wrap .lobby-scrollbar-thumb:hover,
.match-table-wrap .lobby-scrollbar-thumb:active {
  cursor: default;
}
.match-table-wrap .lobby-scrollbar-thumb:hover,
.match-table-wrap .lobby-scrollbar-thumb:active {
  width: 1px;
  background-image: linear-gradient(180deg, #302919 0%, #5f5438 28%, #a49464 50%, #7d6f49 72%, #302919 100%);
}
.match-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.match-table th,
.match-table td {
  border-bottom: 1px solid #1c1c1c;
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: break-word;
  word-break: normal;
}
.lobby-data-table {
  --table-row-height: 26px;
  --table-header-height: 48px;
  font-size: 12px;
}
.lobby-data-table th,
.lobby-data-table td {
  box-sizing: border-box;
  padding: 0 6px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
}
.lobby-data-table tbody td {
  height: var(--table-row-height);
}
.lobby-data-table thead th {
  height: var(--table-header-height);
  padding-top: 3px;
  padding-bottom: 3px;
  vertical-align: top;
}
.lobby-data-table .sort-button {
  height: 17px;
}
.lobby-data-table th input {
  height: 24px;
}
.match-table th:nth-child(1), .match-table td:nth-child(1) { width: 92px; }
.match-table th:nth-child(2), .match-table td:nth-child(2) { width: 124px; }
.match-table th:nth-child(3), .match-table td:nth-child(3) { width: 160px; }
.match-table th:nth-child(4), .match-table td:nth-child(4) { width: 128px; }
.match-table th:nth-child(5), .match-table td:nth-child(5) { width: 128px; }
.match-table th:nth-child(6), .match-table td:nth-child(6) { width: 140px; }
.match-table th:nth-child(7), .match-table td:nth-child(7) { width: 64px; }
.match-table-compact {
  width: 100%;
  min-width: 0;
}
.match-table-compact th:nth-child(1), .match-table-compact td:nth-child(1) { width: 68px; }
.match-table-compact th:nth-child(2), .match-table-compact td:nth-child(2) { width: 88px; }
.match-table-compact th:nth-child(3), .match-table-compact td:nth-child(3) { width: 154px; }
.match-table-compact th:nth-child(4), .match-table-compact td:nth-child(4) { width: 76px; }
.match-table-compact th:nth-child(5), .match-table-compact td:nth-child(5) { width: 86px; }
.match-table-compact th:nth-child(6), .match-table-compact td:nth-child(6) { width: 112px; }
.match-table-compact th:nth-child(7), .match-table-compact td:nth-child(7) { width: auto; }
.match-table-compact td:nth-child(1),
.match-table-compact td:nth-child(2),
.match-table-compact td:nth-child(4),
.match-table-compact td:nth-child(5),
.match-table-compact td:nth-child(7) {
  white-space: nowrap;
}
.set-table { min-width: 860px; }
.set-table th:nth-child(1), .set-table td:nth-child(1) { width: 150px; }
.set-table th:nth-child(2), .set-table td:nth-child(2) { width: 170px; }
.set-table th:nth-child(3), .set-table td:nth-child(3) { width: 120px; }
.set-table th:nth-child(4), .set-table td:nth-child(4) { width: 220px; }
.set-table th:nth-child(5), .set-table td:nth-child(5) { width: 80px; }
.set-table th:nth-child(6), .set-table td:nth-child(6) { width: 80px; }
.set-table-compact {
  width: 100%;
  min-width: 0;
}
.set-table-compact th:nth-child(1), .set-table-compact td:nth-child(1) { width: 110px; }
.set-table-compact th:nth-child(2), .set-table-compact td:nth-child(2) { width: 124px; }
.set-table-compact th:nth-child(3), .set-table-compact td:nth-child(3) { width: 82px; }
.set-table-compact th:nth-child(4), .set-table-compact td:nth-child(4) { width: 210px; }
.set-table-compact th:nth-child(5), .set-table-compact td:nth-child(5) { width: 76px; }
.set-table-compact th:nth-child(6), .set-table-compact td:nth-child(6) { width: auto; }
.set-table-compact td:nth-child(3),
.set-table-compact td:nth-child(5),
.set-table-compact td:nth-child(6) {
  white-space: nowrap;
}
.player-table {
  min-width: 760px;
}
.player-table th:nth-child(1), .player-table td:nth-child(1) { width: 86px; }
.player-table th:nth-child(2), .player-table td:nth-child(2) { width: 210px; }
.player-table th:nth-child(3), .player-table td:nth-child(3) { width: 80px; }
.player-table th:nth-child(4), .player-table td:nth-child(4) { width: 88px; }
.player-table th:nth-child(5), .player-table td:nth-child(5) { width: 280px; }
.player-table-compact {
  width: min(100%, 820px);
  min-width: 700px;
}
.player-table-compact th:nth-child(1), .player-table-compact td:nth-child(1) { width: 76px; }
.player-table-compact th:nth-child(2), .player-table-compact td:nth-child(2) { width: 190px; }
.player-table-compact th:nth-child(3), .player-table-compact td:nth-child(3) { width: 70px; }
.player-table-compact th:nth-child(4), .player-table-compact td:nth-child(4) { width: 78px; }
.player-table-compact th:nth-child(5), .player-table-compact td:nth-child(5) { width: 242px; }
.player-table-compact td:nth-child(1),
.player-table-compact td:nth-child(3),
.player-table-compact td:nth-child(4) {
  white-space: nowrap;
}
.player-table tbody tr.player-row {
  cursor: pointer;
  transition: background 90ms ease, outline-color 90ms ease;
}
.player-table tbody tr.player-row:hover,
.player-table tbody tr.player-row:focus {
  background: rgba(216, 191, 119, 0.12);
  outline: 1px solid var(--gold-border-soft);
  outline-offset: -1px;
}
.player-table .mono {
  font-family: inherit;
  font-size: 0.95em;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.set-table tbody tr.set-row {
  cursor: pointer;
  transition: background 90ms ease, outline-color 90ms ease;
}
.set-table tbody tr.set-row:hover,
.set-table tbody tr.set-row:focus {
  background: rgba(216, 191, 119, 0.12);
  outline: 1px solid var(--gold-border-soft);
  outline-offset: -1px;
}
.set-table tbody tr.set-row.is-mine td:first-child {
  color: var(--gold-cream);
}
.set-table tbody tr.set-row.is-selected {
  background: linear-gradient(90deg, rgba(216, 191, 119, 0.25), rgba(65, 49, 21, 0.16));
  outline: 1px solid var(--gold-bright);
  outline-offset: -1px;
}
.set-table tbody tr.set-row.is-selected td {
  color: var(--gold-cream);
}
.match-table th { color: var(--gold-bright); font-weight: normal; }
.match-table th button {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 1px 3px 3px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--gold-bright);
  text-align: left;
  font: inherit;
  text-shadow: none;
  cursor: pointer;
}
.match-table th button.sort-button:hover:not(:disabled):not(.fa):not(.icon):not(.styled),
.match-table th button.sort-button:focus:not(:disabled):not(.fa):not(.icon):not(.styled) {
  border-radius: 0;
  background-color: var(--gold-hover-bg);
  background-image: none;
  color: var(--gold-light);
  outline: none;
  text-shadow: none;
}
.match-table th button.sort-button:hover:not(:disabled) .sort-icon,
.match-table th button.sort-button:focus:not(:disabled) .sort-icon {
  color: var(--gold-light);
}
.sort-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sort-icon {
  position: relative;
  width: 9px;
  height: 13px;
  color: var(--gold-bright);
  flex: 0 0 9px;
}
.sort-icon::before,
.sort-icon::after {
  content: "";
  position: absolute;
  left: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.sort-icon::before {
  top: 0;
  border-bottom: 5px solid currentColor;
  opacity: 0.35;
}
.sort-icon::after {
  bottom: 0;
  border-top: 5px solid currentColor;
  opacity: 0.35;
}
.sort-icon.is-asc::before { opacity: 1; }
.sort-icon.is-asc::after { opacity: 0.15; }
.sort-icon.is-desc::before { opacity: 0.15; }
.sort-icon.is-desc::after { opacity: 1; }
.set-link {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold-cream);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.set-link:hover,
.set-link:focus {
  color: var(--gold-light);
  outline: none;
}
.match-table th input {
  box-sizing: border-box;
  width: 100%;
  min-width: 72px;
  background: var(--field-bg);
  border: 1px solid var(--gold-low);
  color: var(--ui-cream);
  padding: 2px 4px;
  font: inherit;
}
.lobby-data-table th input {
  min-width: 44px;
  height: 24px;
  padding: 3px 5px;
}
.match-table-compact .sort-icon,
.set-table-compact .sort-icon,
.player-table-compact .sort-icon {
  width: 8px;
  height: 11px;
  flex-basis: 8px;
}
.match-table-compact .winner-content { gap: 4px; }
.match-table-compact .result-chip {
  height: 16px;
  padding: 0 4px;
  font-size: 11px;
}
.match-row-clickable {
  cursor: pointer;
}
.match-row-clickable:hover td,
.match-row-clickable:focus td {
  background: rgba(216, 191, 119, 0.1);
}
.match-row-clickable:focus {
  outline: 1px solid var(--gold-bright);
  outline-offset: -1px;
}
.match-row-selected td {
  background: rgba(216, 191, 119, 0.16);
  border-bottom-color: rgba(255, 231, 163, 0.48);
}
.match-row-selected:hover td,
.match-row-selected:focus td {
  background: rgba(216, 191, 119, 0.22);
}
.winner-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.winner-content > span {
  flex: 1;
  min-width: 0;
}
.result-chip {
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--gold-low);
  border-radius: 2px;
  background: var(--field-bg);
  color: var(--gold-bright);
  font: inherit;
  cursor: pointer;
}
.result-chip:hover {
  border-color: var(--gold-light);
  color: var(--gold-light);
}
.match-actions-cell { white-space: normal; }
.match-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.match-actions button {
  min-width: 68px;
  white-space: nowrap;
}
.match-pager {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto minmax(88px, 1fr);
  align-items: center;
  column-gap: 10px;
  padding: 10px 8px;
  color: var(--muted);
}
.match-pager button:first-child { justify-self: start; }
.match-pager span { justify-self: center; text-align: center; }
.match-pager button:last-child { justify-self: end; }

/* Game screen — board canvas with player banners, card, and action bars
   positioned around the play field. */
/* In an actual game the board centers in the window, like the original. */
.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--app-version-height));
}
#game { position: relative; width: 836px; max-width: 100vw; }
#game.layout-bounds {
  outline: 1px solid #ff0000;
  outline-offset: -1px;
}
#field { position: relative; }
pixi-board {
  display: block;
  position: relative;
  overflow: hidden;
  user-select: none;
  width: 100%;
  aspect-ratio: 836 / 552;
}
pixi-board .tao-board-panzoom {
  display: block;
  touch-action: none;
  width: 100%;
  height: auto;
  aspect-ratio: 836 / 552;
  will-change: transform;
}
pixi-board canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 836 / 552;
}

pixi-board .tao-board-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(240px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  padding: 8px 10px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.88), rgba(12, 10, 6, 0.9)),
    var(--panel-black);
  color: var(--ui-cream);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
pixi-board .tao-board-loader[hidden] { display: none; }
pixi-board .tao-board-loader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  line-height: 1;
}
pixi-board .tao-board-loader-percent {
  color: var(--gold-text);
  font-weight: bold;
}
pixi-board .tao-board-loader-track {
  height: 5px;
  margin-top: 7px;
  border: 1px solid #000;
  background-color: rgba(0, 0, 0, 0.75);
}
pixi-board .tao-board-loader-bar {
  width: 0;
  height: 100%;
  background-image: var(--gold-button-gradient);
  transition: width 120ms linear;
}

#alert {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 18px;
  line-height: 18px;
  border-radius: 16px;
  padding: 0 8px;
  background-color: var(--ui-cream-soft);
  color: #000;
  font-weight: bold;
  z-index: 2;
}
#alert.turn-alert {
  border: 1px solid rgba(0, 0, 0, 0.55);
  color: #15110a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 3px rgba(0, 0, 0, 0.18),
    0 1px 5px rgba(0, 0, 0, 0.45);
}
#alert.turn-color-0 {
  background-image: linear-gradient(100deg, #8d7a4d 0%, #c3b27d 24%, #f3e9c7 52%, #fff8dd 62%, #d6c48b 82%, #8f7b4f 100%);
  border-color: var(--gold-border);
}
#alert.turn-color-1 {
  background-image: linear-gradient(100deg, #787878 0%, #a6a6a2 22%, #d6d5ce 48%, #f5f3e8 60%, #c5c3b8 80%, #77766f 100%);
  border-color: rgba(120, 118, 112, 0.8);
}

.game-top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: absolute;
  top: 0;
  right: 0;
  padding: 0;
  z-index: 30;
}
.game.bars-left .game-top-actions {
  right: auto;
  left: 0;
  align-items: flex-start;
}
.game-top-actions > .buttons.game-play {
  position: static;
}
.game-top-actions #alert.turn-alert {
  align-self: center;
  position: static;
  top: auto;
  right: auto;
  left: auto;
  transform: none;
  max-width: min(360px, calc(100vw - 24px));
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  white-space: nowrap;
}
.game.bars-left .game-top-actions #alert.turn-alert {
  margin: 0;
}

/* Player banners (original .player bars, now using team metal gradients). */
.player {
  display: flex;
  align-items: center;
  gap: 5px;
  position: absolute;
  min-width: 146px;
  height: 40px;
  isolation: isolate;
  box-sizing: border-box;
  padding: 0 24px 0 3px;
  line-height: 22px;
  z-index: 1;
}
.player::before {
  position: absolute;
  top: 9px;
  height: 22px;
  content: " ";
  pointer-events: none;
  z-index: 0;
}
.player .name {
  font-family: var(--app-font-family);
  font-style: normal;
  color: #fff;
  position: relative;
  margin: 0;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  z-index: 1;
}
.player .player-status-orb {
  flex: 0 0 auto;
  position: relative;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px #000,
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -2px 4px rgba(0, 0, 0, 0.7);
  z-index: 1;
}
.player.gold-metal .player-status-orb,
.player.red-metal .player-status-orb {
  background-image: var(--gold-button-gradient);
}
.player.silver-metal .player-status-orb,
.player.black-metal .player-status-orb {
  background-image: linear-gradient(135deg, #0f0e0c 0%, #28251f 38%, #464139 49%, #464139 57%, #191814 100%);
}
.player .player-status-orb::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.75);
  border-radius: 50%;
  content: " ";
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -1px 3px rgba(0, 0, 0, 0.75);
}
.player .player-status-orb.is-active::after {
  background: radial-gradient(circle at 35% 28%, #ffffff 0%, #ffffff 28%, #d7d7d7 58%, #777 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.65),
    inset 0 -1px 3px rgba(0, 0, 0, 0.45),
    0 0 3px rgba(255, 255, 255, 0.35);
}
.player .player-status-orb.is-idle::after {
  background: radial-gradient(circle at 35% 28%, #777 0%, #4c4c4c 36%, #242424 72%, #111 100%);
}
.player .player-status-orb.is-disconnected::after {
  background: radial-gradient(circle at 35% 28%, #1a1a1a 0%, #070707 48%, #000 100%);
}
.player.left {
  flex-direction: row;
  left: 0;
  top: 0;
  border-radius: 10px 0 0 10px;
}
.player.left::before {
  left: 0;
  right: 16px;
  border-radius: 10px 0 0 10px;
}
.player.left::after {
  position: absolute;
  top: 14px;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 16px 6px 0;
  border-color: transparent black transparent transparent;
  content: " ";
  pointer-events: none;
  z-index: 0;
}
.player.left.gold-metal::before,
.player.left.red-metal::before {
  background-image: linear-gradient(90deg, #302919 0%, #5f5438 28%, #a49464 52%, #c3b47d 60%, #7d6f49 80%, transparent 102%);
}
.player.left.silver-metal::before,
.player.left.black-metal::before {
  background-image: linear-gradient(90deg, #020202 0%, #0d0c0b 18%, #211f1b 36%, #464139 47%, #464139 55%, #2d2b26 66%, #11100e 82%, transparent 102%);
}
.player.right {
  flex-direction: row-reverse;
  right: 0;
  bottom: 0;
  border-radius: 0 10px 10px 0;
  padding: 0 3px 0 24px;
}
.player.right::before {
  right: 0;
  left: 16px;
  border-radius: 0 10px 10px 0;
}
.player.right::after {
  position: absolute;
  top: 14px;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 16px;
  border-color: transparent transparent transparent black;
  content: " ";
  pointer-events: none;
  z-index: 0;
}
.player.right.gold-metal::before,
.player.right.red-metal::before {
  background-image: linear-gradient(270deg, #302919 0%, #5f5438 28%, #a49464 52%, #c3b47d 60%, #7d6f49 80%, black 102%);
}
.player.right.silver-metal::before,
.player.right.black-metal::before {
  background-image: linear-gradient(270deg, #020202 0%, #0d0c0b 18%, #211f1b 36%, #464139 47%, #464139 55%, #2d2b26 66%, #11100e 82%, black 102%);
}
/* Button bars (original #game-play / #game-settings, using the core
   bundle's own button images via CSS variables set by the renderer). */
.buttons {
  display: flex;
  flex-direction: row;
  position: absolute;
  right: 0;
  padding: 6px;
  z-index: 30;
  user-select: none;
}
.buttons.game-play { top: 0; }
.buttons.game-settings { bottom: 40px; }
/* GameSettings "bar position: left" docks both bars on the other side. */
.game.bars-left .buttons { right: auto; left: 0; }
.buttons .end-turn-stack {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
}
#game > .buttons {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
#game > .buttons::-webkit-scrollbar {
  display: none;
}
.buttons button {
  box-sizing: content-box;
  flex: 0 0 auto;
  margin: 3px;
  border: 0 solid var(--ui-cream-soft);
  border-radius: 0;
  padding: 0;
  width: 34px;
  height: 34px;
  background: none no-repeat center transparent;
  color: var(--ui-cream-soft);
  font-size: 18px;
  line-height: 34px;
  text-align: center;
  cursor: pointer;
}
.buttons button:hover:not(:disabled) { color: #fff; border-color: var(--ui-cream-soft); }
.buttons button.selected { margin: 1px; border-width: 2px; cursor: default; }
.buttons button.ready {
  border-radius: 20px;
  animation: glow ease-in-out 1s infinite;
}
/* Disabled bar buttons keep their image, faded like the original. */
.buttons button:disabled {
  border-width: 0;
  opacity: 0.4;
  cursor: default;
}
.buttons button.selected:disabled { border-width: 2px; }
.buttons button:hover:not(:disabled),
.buttons button:focus:not(:disabled) {
  background-color: transparent;
  outline: none;
}
.buttons .icon-move { background-image: var(--btn-move, url("/icons/btn_move.png?v=core-icons-20260613")); border-color: #0088ff; }
.buttons .icon-attack { background-image: var(--btn-attack, url("/icons/btn_attack.png?v=core-icons-20260613")); border-color: #ff8800; }
.buttons .icon-turn { background-image: var(--btn-turn, url("/icons/btn_turn.png?v=core-icons-20260613")); border-color: #ffe991; }
.buttons .icon-pass { background-image: var(--btn-pass, url("/icons/btn_pass.png?v=core-icons-20260613")); border-color: #ffffff; }
.buttons .icon-surrender { background-image: var(--btn-surrender, url("/icons/btn_surrender.png?v=core-icons-20260613")); border-color: #ffffff; }
/* Themed bar icons painted in the core buttons' style (make_icons.mjs). */
.buttons .icon-chat { background-image: url("/icons/btn_chat.png?v=chat-scroll-bright15-20260612"); border-color: #ffffff; }
.buttons .icon-home { background-image: url("/icons/btn_home.png?v=home-door-20260613"); border-color: #ffffff; }
.buttons .icon-settings { background-image: url("/icons/btn_settings.png?v=rest-icons-crisp-20260613"); border-color: #ffffff; }
.buttons .icon-undo { background-image: url("/icons/btn_undo.png?v=rest-icons-crisp-20260613"); border-color: #ffffff; }

@keyframes glow {
  0% { box-shadow: none; }
  50% { box-shadow: 0 0 14px 4px #ffffff; }
  100% { box-shadow: none; }
}

/* Unit info card (original #card overlay: a 176x100 canvas). */
#card {
  display: block;
  position: absolute;
  top: 40px;
  left: 0;
  width: 176px;
  height: 100px;
  z-index: 20;
}

/* Chat (original compact in-game panel in the lower-left corner). */
#chat {
  display: flex;
  flex-direction: column;
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 40;
  background: transparent;
  width: min(176px, calc(100% - 220px));
  max-height: 140px;
  box-sizing: border-box;
  border: 0;
  padding: 6px;
  overflow: hidden;
}
#chat #messages {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column-reverse;
  min-height: 0;
  max-height: 72px;
  box-sizing: border-box;
  padding-left: 7px;
  overflow: hidden auto;
  direction: rtl;
  scrollbar-width: none;
}
#chat #messages::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
#chat .chat-scrollbar {
  position: absolute;
  top: 6px;
  left: 2px;
  width: 9px;
  height: 72px;
  background: transparent;
  touch-action: none;
  z-index: 1;
}
#chat .chat-scrollbar.is-hidden {
  display: none;
}
#chat .chat-scrollbar-thumb {
  width: 1px;
  min-height: 12px;
  margin-left: 4px;
  background-image: linear-gradient(180deg, #302919 0%, #5f5438 28%, #a49464 50%, #7d6f49 72%, #302919 100%);
  transform: translateY(0);
  will-change: transform, height;
}
#chat .chat-scrollbar:hover,
#chat .chat-scrollbar:active,
#chat .chat-scrollbar-thumb:hover,
#chat .chat-scrollbar-thumb:active {
  background: transparent;
}
#chat .chat-scrollbar-thumb:hover,
#chat .chat-scrollbar-thumb:active {
  width: 1px;
  background-image: linear-gradient(180deg, #302919 0%, #5f5438 28%, #a49464 50%, #7d6f49 72%, #302919 100%);
}
#chat .message {
  direction: ltr;
  line-height: 18px;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 13px;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
#chat .message .chat-player { color: var(--gold-bright); font-weight: bold; }
#chat .message .chat-player::after { content: ":"; }
#chat .message .content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#chat .new-message {
  box-sizing: border-box;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  margin-top: 4px;
  padding: 4px 0 4px 7px;
  width: 100%;
  background-color: transparent;
  color: inherit;
  line-height: 18px;
  overflow-wrap: anywhere;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
#chat .new-message:focus { outline: none; }
#chat .new-message::placeholder {
  color: var(--gold-bright);
  font-weight: bold;
  opacity: 1;
  font-style: normal;
}
#chat .new-message:focus::placeholder { opacity: 0; }

.waiting { text-align: center; padding: 20vh 0; }

/* Modals (the original popup.scss look). */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.popup {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin: 16px;
  border: 1px solid var(--gold-border);
  border-radius: 0;
  min-width: min(340px, calc(100vw - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  background-color: rgba(0, 0, 0, 0.8);
  box-shadow: 6px 8px 10px #000;
}
.popup .title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--gold-gradient);
  padding: 4px 8px;
  color: var(--gold-cream);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.popup .popup-close {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  min-width: 0;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-border-soft);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.25);
  color: var(--gold-cream);
  line-height: 1;
}
.popup .popup-close:hover,
.popup .popup-close:focus {
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  outline: 1px solid var(--gold-cream);
}
.popup .popup-close svg {
  width: 14px;
  height: 14px;
  display: block;
}
.popup.titleCenter .title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.popup .popup-title-main {
  justify-self: start;
}
.popup .popup-title-center {
  justify-self: center;
  color: var(--gold-bright);
  font-weight: bold;
}
.popup.titleCenter .popup-close {
  justify-self: end;
}
.popup .message { padding: 12px 8px; overflow: hidden auto; }
.popup .form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  min-width: 0;
}
.popup .form-label { width: 80px; color: var(--gold-bright); font-weight: bold; text-align: right; }
.popup .form-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.popup .form-field label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.popup input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0 3px 0 0;
  display: inline-grid;
  place-content: center;
  border: 1px solid var(--gold-border-soft);
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, #1d1a14 0%, #070604 72%);
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}
.popup input[type="radio"]::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: scale(0);
  background: radial-gradient(circle at 35% 30%, #fff7dc 0%, var(--gold-light) 45%, var(--gold-low) 100%);
  box-shadow: 0 0 5px var(--gold-glow-soft);
  transition: transform 80ms ease-out;
}
.popup input[type="radio"]:checked {
  border-color: var(--gold-light);
  background: radial-gradient(circle at 45% 35%, #3b3322 0%, #100d08 74%);
}
.popup input[type="radio"]:checked::before {
  transform: scale(1);
}
.popup input[type="radio"]:focus-visible {
  outline: 1px solid var(--gold-light);
  outline-offset: 2px;
}
.popup select {
  background: var(--panel-warm);
  border: 1px solid var(--gold-low);
  color: var(--ui-cream);
  padding: 4px 6px;
  font-family: inherit;
}
.popup .style-blurb { color: var(--muted); margin: 2px 0 6px 90px; max-width: 330px; font-size: 0.95em; }
.popup .dim { color: var(--muted); }
.popup .mono {
  font-family: inherit;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}
.popup .linked { color: #58c470; font-weight: bold; }
.popup .relation-person { padding: 0; }
.popup .player-info-avatar {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}
.popup .set-preview {
  width: min(836px, calc(100vw - 64px));
  max-width: 100%;
  aspect-ratio: 836 / 552;
}
.popup .set-preview pixi-board {
  width: 100%;
  max-width: 836px;
  height: auto;
}
.popup-buttons { padding: 8px 8px 4px; text-align: center; }
.popup-buttons button { margin: 8px 4px 0; min-width: 6em; }

.color-tuning-modal {
  width: min(460px, calc(100vw - 64px));
}
.color-tuning-modal .form-row {
  align-items: center;
}
.color-tuning-modal .form-label {
  width: 112px;
}
.color-tuning-modal .form-field {
  flex: 1 1 auto;
}
.color-tuning-modal input[type="range"] {
  width: min(230px, 44vw);
  accent-color: var(--gold-bright);
}
.color-tuning-modal input[type="color"] {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--gold-low);
  background: #000;
}
.color-tuning-preview {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 4px 0 10px 122px;
  border: 1px solid rgba(216, 191, 119, 0.28);
  padding: 8px 10px 6px;
  background: rgba(0, 0, 0, 0.35);
}
.color-tuning-preview-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 58px;
  color: var(--ui-cream);
  font-size: 12px;
  line-height: 14px;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}
.color-tuning-preview-avatar {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  overflow: visible;
}
.color-tuning-preview-avatar canvas {
  position: absolute;
  inset: 0;
  width: 58px !important;
  height: 58px !important;
  pointer-events: none;
  filter: none;
}
.color-tuning-swatch {
  height: 18px;
  margin: 0 6px 8px 122px;
  border: 1px solid var(--gold-low);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.color-tuning-export {
  box-sizing: border-box;
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--gold-low);
  background: rgba(0, 0, 0, 0.55);
  color: var(--ui-cream);
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
}

/* Taomaster-style setup overview and set builder */
.view.setup.taomaster-setup {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: stretch;
  gap: 24px;
  position: relative;
  overflow: visible;
  padding: 8px;
}
.taomaster-setup .sets {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  flex: 1 1 auto;
  max-width: 548px;
}
.taomaster-setup .sets:not(.isCustomizable) {
  display: block;
  max-width: 362px;
}
.taomaster-setup .sets:not(.isCustomizable) .set:not(:first-child) {
  display: none;
}
.taomaster-setup .set {
  position: relative;
  min-width: 0;
  border: 1px solid var(--gold-border-soft);
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.taomaster-setup .set:hover,
.taomaster-setup .set:focus-within {
  border-color: var(--gold-bright);
  box-shadow: 0 0 10px var(--gold-glow-soft);
}
.taomaster-setup .set .details {
  position: absolute;
  top: 4px;
  left: 6px;
  right: 6px;
  z-index: 1;
  color: var(--gold-bright);
  font-weight: bold;
  font-style: normal;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  pointer-events: none;
}
.taomaster-setup .set .details .name {
  color: var(--gold-cream);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.taomaster-setup .set .details .stats,
.taomaster-setup .set .details .stock {
  font-size: 11px;
}
.taomaster-setup .set .image {
  position: relative;
  width: 100%;
  aspect-ratio: 836 / 552;
  overflow: hidden;
}
.taomaster-setup .set .image pixi-board {
  position: absolute;
  inset: 0;
  height: auto;
  pointer-events: none;
}
.taomaster-setup .selectors {
  flex: 0 0 210px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  color: var(--gold-bright);
  font-weight: bold;
}
.taomaster-setup .selectors label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}
.taomaster-setup .selectors .container {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--gold-border-soft);
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold-cream);
  border-radius: 2px;
  text-shadow: none;
}
.taomaster-setup .selectors .color-choice {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 5px 8px;
  line-height: 16px;
}
.taomaster-setup .selectors .swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ui-cream-soft);
}
.swatch.color-0 { background: linear-gradient(135deg, #5d523a 0%, #c9ba8a 36%, #f3e8c8 52%, #887854 100%); }
.swatch.color-1 { background: linear-gradient(135deg, #74777d 0%, #d9dee7 34%, #ffffff 52%, #777c86 100%); }
.taomaster-builder {
  background: #000;
  padding: 0;
  justify-content: flex-start;
  min-height: calc(100dvh - var(--app-version-height));
}
.modal.setBuilder {
  width: min(100vw, 836px);
  min-height: min(calc(100dvh - var(--app-version-height)), 628px);
  max-height: calc(100dvh - var(--app-version-height));
  display: flex;
  flex-direction: column;
  background: #000;
  color: var(--ui-cream);
}
.modal.setBuilder .title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 8px;
  color: var(--gold-bright);
  font-weight: bold;
  background: transparent;
}
.modal.setBuilder .title .nameField {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-cream);
  white-space: nowrap;
}
.modal.setBuilder .title .computedName {
  min-width: 0;
  overflow: hidden;
  color: var(--gold-bright);
  text-overflow: ellipsis;
}
.modal.setBuilder .title .style {
  flex: 0 0 auto;
  padding-left: 12px;
  color: var(--gold-cream);
}
.modal.setBuilder .title .style .used {
  color: #ff5656;
}
.modal.setBuilder .title .style .remaining {
  color: #66e06f;
}
.modal.setBuilder .content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.modal.setBuilder .field {
  position: relative;
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.setBuilder .field pixi-board {
  width: min(100%, calc((100dvh - var(--app-version-height) - 108px) * 836 / 552));
  max-width: 100%;
  max-height: 100%;
}
.modal.setBuilder .field .setup-card {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 210px;
  max-width: calc(100% - 16px);
  padding: 8px;
  border: 1px solid rgba(216, 191, 119, 0.7);
  background: rgba(0, 0, 0, 0.82);
  color: var(--ui-cream);
  opacity: 0.92;
  pointer-events: none;
}
.modal.setBuilder .field .setup-card .card-name {
  color: var(--gold-cream);
  font-weight: bold;
  text-align: center;
  margin-bottom: 6px;
}
.modal.setBuilder .field .setup-card .card-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  color: var(--gold-bright);
}
.modal.setBuilder .field .setup-card .card-grid b {
  color: var(--ui-cream);
}
.modal.setBuilder .field .setup-card .card-ability {
  margin-top: 6px;
  color: #909090;
  text-align: center;
}
.modal.setBuilder .buttons {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
}
.modal.setBuilder .buttons button.fa {
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--gold-bright);
  font-size: 20px;
  text-shadow: none;
}
.modal.setBuilder .buttons button.fa:hover:not(:disabled),
.modal.setBuilder .buttons button.fa:focus:not(:disabled) {
  border-color: var(--gold-bright);
  color: var(--gold-cream);
}
.modal.setBuilder .buttons button.fa:disabled {
  color: #555;
  cursor: default;
}
.modal.setBuilder .buttons select.slot {
  height: 30px;
  background: var(--panel-warm);
  border: 1px solid var(--gold-low);
  color: var(--ui-cream);
}
.modal.setBuilder .buttons .close {
  min-width: 64px;
  border-radius: 2px;
}
.popup.modal.unitPicker {
  max-width: 728px;
  background: rgba(0, 0, 0, 0.67);
}
.unitPicker .message {
  padding: 0;
}
.unit-picker-pane {
  padding: 4px;
  min-height: 218px;
}
.unit-picker-pane p {
  margin: 0 0 5px;
  line-height: 15px;
}
.unit-picker-pane .units {
  display: grid;
  grid-template-columns: repeat(auto-fit, 118px);
  justify-content: center;
  gap: 2px;
}
.unit-picker-pane .unit {
  position: relative;
  width: 118px;
  min-height: 124px;
  padding: 0 1px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ui-cream);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.unit-picker-pane .unit:hover:not(:disabled),
.unit-picker-pane .unit:focus:not(:disabled) {
  border-color: var(--gold-bright);
  background: rgba(216, 191, 119, 0.12);
}
.unit-picker-pane button.unit:disabled:not(.fa):not(.icon) {
  background: transparent;
  background-image: none;
  border-color: transparent;
  color: var(--ui-cream);
  opacity: 0.5;
  cursor: default;
}
.unit-picker-pane .unit .image {
  width: 116px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-cream);
  font-weight: bold;
  overflow: hidden;
}
.unit-picker-pane .unit .unit-sprite,
.unit-picker-pane .unit .unit-sprite canvas {
  width: 116px;
  height: 92px;
}
.unit-picker-pane .unit .unit-sprite img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center center;
}
.unit-picker-pane .unit label {
  display: block;
  min-height: 14px;
  text-align: center;
  font-weight: bold;
  line-height: 14px;
  font-size: 11px;
  pointer-events: none;
}
.unit-picker-pane .unit .cost,
.unit-picker-pane .unit .inventory {
  color: var(--gold-bright);
  font-size: 10px;
  line-height: 10px;
}
.unit-picker-pane .unit .inventory {
  color: var(--gold-cream);
}
/* Original mobile game layout: the board remains zoomable/pannable, while
   button bars sit outside the field instead of covering the canvas. */
@media (hover: none) and (pointer: coarse) and (max-width: 835px) and (max-aspect-ratio: 2/3),
  (hover: none) and (pointer: coarse) and (max-width: 440px) {
  .game {
    justify-content: flex-start;
    min-height: calc(100dvh - var(--app-version-height));
  }
  #game {
    display: flex;
    flex-direction: column;
    max-width: 100vw;
    width: 100%;
  }
  #field {
    box-sizing: border-box;
    padding: 44px 0;
    width: 100%;
  }
  #card {
    position: relative;
    top: auto;
    left: auto;
    margin: 0 auto 8px;
  }
  .player {
    min-width: min(200px, 52vw);
  }
  .player.left {
    top: 0;
  }
  .player.right {
    bottom: 0;
  }
  #game > .buttons {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    box-sizing: border-box;
    width: 100%;
    background-color: #000;
    overflow-x: auto;
    overflow-y: hidden;
  }
  #game > .game-top-actions {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    align-items: stretch;
    width: 100%;
    background-color: #000;
  }
  #game > .game-top-actions > .buttons.game-play {
    box-sizing: border-box;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
  }
  #game > .game-top-actions #alert.turn-alert {
    align-self: flex-end;
    max-width: calc(100% - 16px);
    margin: 2px 8px 6px;
  }
  .game.bars-left #game > .game-top-actions {
    right: auto;
    left: auto;
    align-items: stretch;
  }
  .game.bars-left #game > .game-top-actions #alert.turn-alert {
    align-self: flex-start;
  }
  #game > .buttons.game-play,
  #game > .buttons.game-settings {
    top: auto;
    bottom: auto;
  }
  .game.bars-left #game > .buttons {
    right: auto;
    left: auto;
  }
  #game > .buttons .end-turn-stack {
    flex-direction: row;
  }
  #chat {
    bottom: 128px;
    width: min(260px, calc(100% - 16px));
    max-height: 160px;
  }
}

/* Landscape mobile keeps the action bars in a side gutter so a zoomed board
   never renders underneath the controls. */
@media (hover: none) and (pointer: coarse) and (max-height: 440px) and (min-aspect-ratio: 5/3) {
  .game {
    align-items: stretch;
    justify-content: flex-start;
    min-height: calc(100dvh - var(--app-version-height));
  }
  #game {
    height: calc(100dvh - var(--app-version-height));
    max-width: 100vw;
    width: 100%;
  }
  #field {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 44px 0;
    width: calc(100% - 52px);
    height: 100%;
  }
  #field > pixi-board {
    flex: 0 1 auto;
    aspect-ratio: 836 / 552;
    width: auto;
    max-height: min(100%, 552px);
  }
  #field > pixi-board .tao-board-panzoom,
  #field > pixi-board canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 836 / 552;
  }
  .player.left {
    top: 0;
  }
  .player.right {
    bottom: 0;
  }
  #game > .buttons {
    flex-direction: column;
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    box-sizing: border-box;
    width: 52px;
    height: 50%;
    padding: 4px 6px;
    background-color: #000;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #game > .game-top-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    align-items: stretch;
    width: 52px;
    height: 50%;
    background-color: #000;
  }
  #game > .game-top-actions > .buttons.game-play {
    flex-direction: column;
    box-sizing: border-box;
    width: 52px;
    height: 100%;
    padding: 4px 6px;
    background-color: #000;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #game > .game-top-actions #alert.turn-alert {
    position: absolute;
    top: calc(100% + 4px);
    right: 58px;
    max-width: min(220px, calc(100vw - 68px));
    margin: 0;
  }
  #game > .buttons.game-play {
    top: 0;
    bottom: auto;
  }
  #game > .buttons.game-settings {
    top: 50%;
    bottom: auto;
  }
  #game > .buttons .end-turn-stack {
    flex-direction: column;
  }
  .game.bars-left #field {
    margin-left: 52px;
  }
  .game.bars-left #game > .buttons {
    right: auto;
    left: 0;
  }
  .game.bars-left #game > .game-top-actions {
    right: auto;
    left: 0;
  }
  .game.bars-left #game > .game-top-actions #alert.turn-alert {
    right: auto;
    left: 58px;
  }
  #chat {
    width: min(176px, calc(100% - 68px));
    max-height: 140px;
  }
  .game.bars-left #chat {
    left: 52px;
  }
}

@media (max-width: 760px) {
  .page > header.lobby-top {
    align-items: stretch;
    flex-direction: column;
  }
  .lobby-play-center {
    position: static;
    align-self: center;
    transform: none;
  }
  .lobby-account {
    align-self: flex-end;
    justify-content: flex-end;
  }
  .lobby-actions {
    min-height: 0;
  }
  .lobby-play-center .lobby-play-button {
    min-width: 106px;
    height: 24px;
    padding: 0 14px;
    font-size: 14px;
    line-height: 22px;
  }
  .push-status {
    max-width: none;
  }
  .view.setup.taomaster-setup {
    flex-direction: column;
    gap: 14px;
  }
  .taomaster-setup .sets {
    grid-template-columns: 1fr;
    max-width: none;
  }
  .taomaster-setup .selectors {
    flex: 0 0 auto;
  }
  .modal.setBuilder .title {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
  }
  .modal.setBuilder .title .style {
    padding-left: 8px;
  }
  .modal.setBuilder .title .nameField {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .popup {
    margin: 8px;
    min-width: 0;
    max-width: calc(100% - 16px);
    max-height: calc(100% - 16px);
  }
  .popup .form-row {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }
  .popup .form-label {
    width: auto;
    text-align: left;
  }
  .popup .form-field {
    gap: 8px;
  }
  .popup .style-blurb {
    margin-left: 0;
    max-width: 100%;
  }
  .popup input,
  .popup select {
    max-width: 100%;
  }
  .match-pager {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "status status"
      "previous next";
    row-gap: 6px;
    column-gap: 8px;
    padding: 8px;
  }
  .match-pager button:first-child {
    grid-area: previous;
    justify-self: start;
  }
  .match-pager span {
    grid-area: status;
    min-width: 0;
    max-width: 100%;
    justify-self: stretch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .match-pager button:last-child {
    grid-area: next;
    justify-self: end;
  }
}

@media (max-height: 440px) and (orientation: landscape) and (max-width: 760px) {
  .match-table-wrap {
    min-height: 32px;
  }
}
