:root {
  color-scheme: dark;
  --ink: #f8f1dd;
  --muted: #cbbf9d;
  --table: #143c35;
  --table-deep: #071e1b;
  --panel: rgba(11, 27, 27, 0.86);
  --line: rgba(248, 221, 154, 0.24);
  --gold: #f3c463;
  --red: #c94f48;
  --cyan: #5fc8d6;
  --jade: #56bf8e;
  --skin-bg: url("./assets/menu-skins/menu_wood_board.jpg");
  --menu-bg: url("./assets/menu-skins/menu_wood_board.jpg");
  --menu-button-normal: url("./assets/menu-skins/buttons/button_wood_normal.jpg");
  --menu-button-hover: url("./assets/menu-skins/buttons/button_wood_hover.jpg");
  --menu-button-pressed: url("./assets/menu-skins/buttons/button_wood_pressed.jpg");
  --menu-button-disabled: url("./assets/menu-skins/buttons/button_wood_disabled.jpg");
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(4, 15, 14, 0.35), rgba(4, 15, 14, 0.88)),
    var(--skin-bg),
    radial-gradient(circle at top, #22645a, #061614 64%);
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

body[data-view="game"] {
  background:
    linear-gradient(180deg, rgba(4, 15, 14, 0.08), rgba(4, 15, 14, 0.42)),
    var(--skin-bg) center center / contain no-repeat,
    radial-gradient(circle at top, #193f4c, #03100f 72%);
  background-attachment: fixed, fixed, fixed;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: min(5vw, 54px);
  background:
    linear-gradient(180deg, rgba(3, 10, 18, 0.08), rgba(3, 10, 18, 0.12) 45%, rgba(3, 10, 18, 0.38)),
    url("./assets/onboarding/000.jpg") center / cover no-repeat;
}

.splash-panel {
  position: relative;
  width: min(840px, 88vw);
  max-height: calc(100vh - 210px);
  overflow: visible;
  margin-bottom: clamp(100px, 18vh, 160px);
  padding: 18px clamp(18px, 3vw, 34px);
  border: 1px solid rgba(255, 223, 130, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(17, 28, 49, 0.18), rgba(4, 10, 22, 0.28));
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 188, 0.08),
    0 18px 58px rgba(0, 0, 0, 0.24);
  text-align: center;
  backdrop-filter: blur(2px);
}

.splash-panel:has(.splash-auth[hidden]) {
  width: 0;
  height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.splash-panel p {
  color: var(--muted);
  font-weight: 800;
}

.loading-meter {
  position: fixed;
  left: 50%;
  bottom: clamp(86px, 9.5vh, 116px);
  z-index: 2;
  height: clamp(22px, 3.3vw, 30px);
  width: min(900px, 86vw);
  margin: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 234, 149, 0.86);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(20, 22, 48, 0.88), rgba(5, 12, 25, 0.92));
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.62),
    0 0 26px rgba(255, 207, 92, 0.26);
  transform: translateX(-50%);
}

.loading-meter::before,
.realm-intro-meter::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 10px, transparent 10px 20px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.loading-meter span,
.realm-intro-meter span {
  position: absolute;
  inset: 0;
  width: auto;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #ff7a2f, #ffd66d 45%, #fff7bf 62%, #54e9ff);
  box-shadow:
    inset 0 -6px 0 rgba(117, 56, 0, 0.2),
    0 0 24px rgba(255, 222, 103, 0.58);
  transform: scaleX(var(--meter-scale, 0));
  transform-origin: left center;
  transition: transform 0.24s ease;
}

.splash #loadingText {
  position: fixed;
  left: 50%;
  bottom: clamp(128px, 14.5vh, 164px);
  z-index: 3;
  width: min(900px, 86vw);
  min-height: 1.4em;
  margin: 0;
  color: #fff7cb;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.78);
  transform: translateX(-50%);
}

.splash-auth {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.22);
}

#enterGame {
  position: fixed;
  left: 50%;
  bottom: clamp(22px, 3.2vh, 42px);
  z-index: 3;
  min-width: 176px;
  margin: 0;
  transform: translateX(-50%);
}

.splash-auth label {
  display: grid;
  gap: 5px;
  color: #fff3bd;
  font-size: 0.78rem;
  font-weight: 900;
}

.splash-auth input {
  min-height: 40px;
  width: 100%;
  border: 1px solid rgba(95, 200, 214, 0.32);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(4, 17, 17, 0.82);
}

.splash-auth-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.splash-auth-actions button {
  flex: 1;
}

.splash[data-account="guest"] .loading-meter {
  bottom: clamp(30px, 4.8vh, 58px);
}

.splash[data-account="guest"] #loadingText {
  bottom: clamp(72px, 9vh, 108px);
}

@media (max-width: 760px), (max-height: 620px) {
  .splash-panel {
    width: min(620px, 92vw);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    margin-bottom: clamp(88px, 16vh, 130px);
  }

  .splash-auth {
    grid-template-columns: 1fr;
  }

  .splash-auth-actions {
    flex-direction: column;
  }
}

.realm-intro {
  position: fixed;
  inset: 0;
  z-index: 29;
  display: grid;
  place-items: center;
  padding: min(6vw, 68px);
  background:
    linear-gradient(180deg, rgba(3, 9, 16, 0.08), rgba(3, 9, 16, 0.3) 52%, rgba(3, 9, 16, 0.8)),
    var(--realm-intro-bg, url("./assets/onboarding/01.jpg")) center / cover no-repeat;
}

.realm-intro-copy {
  width: min(820px, 94vw);
  margin-top: auto;
  text-align: center;
}

.realm-intro-copy h2 {
  margin: 0;
  color: #fff0a6;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 1;
  text-shadow:
    0 5px 0 rgba(60, 19, 3, 0.86),
    0 0 34px rgba(255, 211, 91, 0.56);
}

.realm-intro-copy p {
  color: #fff8d0;
  font-size: clamp(1rem, 2.6vw, 1.45rem);
  font-weight: 1000;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.realm-intro-meter {
  position: relative;
  width: min(560px, 88vw);
  height: 22px;
  align-self: end;
  margin: 24px auto 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 234, 149, 0.86);
  border-radius: 999px;
  background: rgba(4, 11, 23, 0.88);
  box-shadow: 0 0 28px rgba(255, 207, 92, 0.26);
}

.realm-intro-countdown {
  align-self: end;
  margin: 0;
  color: #fff7cb;
  font-weight: 1000;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.82);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

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

button.primary {
  border-color: rgba(243, 196, 99, 0.72);
  color: #201104;
  background: linear-gradient(180deg, #ffe096, var(--gold));
  font-weight: 900;
}

.app-shell {
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.lobby-hud {
  display: grid;
  grid-template-columns: minmax(360px, 1.4fr) minmax(150px, 0.45fr) minmax(150px, 0.45fr) minmax(260px, 0.9fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 34px;
}

.profile-pill,
.hud-stat,
.hud-actions {
  min-height: 68px;
  border: 2px solid rgba(95, 170, 236, 0.62);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(68, 153, 232, 0.92), rgba(20, 62, 116, 0.9));
  box-shadow: inset 0 -5px 0 rgba(4, 21, 53, 0.35), 0 18px 42px rgba(0, 0, 0, 0.22);
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 20px 8px 8px;
  text-align: left;
  border-radius: 28px;
}

.avatar {
  width: 54px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 235, 152, 0.94);
  border-radius: 50%;
  color: #271304;
  background: radial-gradient(circle at 32% 25%, #fff5b3, #f5bf4f 58%, #a8492c);
  background-size: cover;
  background-position: center;
  font-weight: 1000;
  overflow: hidden;
}

.avatar.large {
  width: 132px;
  margin: 0 auto 10px;
  font-size: 3.2rem;
}

.profile-pill strong {
  display: block;
  color: #fff6ca;
  font-size: 1.18rem;
}

.profile-summary {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.profile-pill small,
.hud-stat small {
  color: rgba(248, 241, 221, 0.86);
  font-weight: 900;
}

.profile-wallet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff6ca;
  font-weight: 1000;
}

.profile-wallet b {
  font-size: 1.05rem;
}

.coin-icon {
  width: 20px;
  aspect-ratio: 1;
  display: inline-block;
  border: 2px solid rgba(255, 246, 186, 0.92);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, #fff9c9 0 18%, #ffd86b 19% 58%, #c77825 59% 100%);
  box-shadow: inset 0 -3px 0 rgba(105, 55, 10, 0.36), 0 2px 7px rgba(255, 215, 95, 0.35);
}

.xp-track {
  position: relative;
  min-height: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 235, 152, 0.48);
  border-radius: 999px;
  background: rgba(4, 20, 52, 0.72);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.28);
}

.xp-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #6af0b5, #f7d56a);
  box-shadow: 0 0 16px rgba(106, 240, 181, 0.36);
  transition: width 0.45s ease;
}

.xp-track em {
  position: relative;
  z-index: 1;
  display: block;
  padding: 1px 8px;
  color: #fff9d6;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 1000;
  line-height: 16px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.hud-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  column-gap: 12px;
  align-items: center;
  padding: 8px 18px;
}

.hud-stat span {
  grid-row: 1 / 3;
  font-size: 2rem;
}

.hud-stat strong {
  color: #fff6ca;
  font-size: 1.7rem;
  line-height: 1;
}

.hud-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  padding: 8px;
}

.hud-actions button,
.quick-dock button {
  border: 0;
  border-radius: 14px;
  color: #fff6ca;
  background:
    linear-gradient(180deg, rgba(255, 244, 198, 0.1), rgba(29, 9, 2, 0.14)),
    var(--menu-button-normal) center / 100% 100% no-repeat;
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(54, 17, 2, 0.8), 0 0 12px rgba(255, 207, 102, 0.28);
}

.hud-actions button:hover,
.quick-dock button:hover {
  background:
    linear-gradient(180deg, rgba(255, 244, 198, 0.16), rgba(29, 9, 2, 0.08)),
    var(--menu-button-hover) center / 100% 100% no-repeat;
}

#hudSettings {
  width: 52px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.5rem;
}

.lobby-menu {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: clamp(16px, 2vw, 28px);
  align-items: stretch;
  min-height: min(52vw, 520px);
  padding: clamp(26px, 4vw, 54px);
  border: 2px solid rgba(247, 215, 135, 0.42);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(8, 9, 12, 0.08), rgba(3, 6, 9, 0.28)),
    var(--menu-bg) center / cover no-repeat;
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 188, 0.12),
    0 30px 74px rgba(0, 0, 0, 0.38);
}

.lobby-card {
  min-height: clamp(150px, 18vw, 220px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: clamp(18px, 2.5vw, 28px);
  border: 0;
  border-radius: 18px;
  color: #fff1bd;
  background:
    linear-gradient(180deg, rgba(255, 244, 198, 0.08), rgba(33, 12, 2, 0.1)),
    var(--menu-button-normal) center / 100% 100% no-repeat;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
  text-align: center;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.lobby-card:hover,
.lobby-card:focus-visible {
  background:
    linear-gradient(180deg, rgba(255, 244, 198, 0.14), rgba(33, 12, 2, 0.04)),
    var(--menu-button-hover) center / 100% 100% no-repeat;
  filter: brightness(1.07);
  transform: translateY(-2px);
}

.lobby-card:active {
  background:
    linear-gradient(180deg, rgba(20, 7, 2, 0.12), rgba(0, 0, 0, 0.16)),
    var(--menu-button-pressed) center / 100% 100% no-repeat;
  transform: translateY(1px) scale(0.99);
}

.lobby-card.primary-card {
  background:
    linear-gradient(180deg, rgba(255, 244, 198, 0.14), rgba(33, 12, 2, 0.04)),
    var(--menu-button-hover) center / 100% 100% no-repeat;
}

.lobby-card.placeholder-card {
  background:
    linear-gradient(180deg, rgba(255, 244, 198, 0.06), rgba(33, 12, 2, 0.16)),
    var(--menu-button-normal) center / 100% 100% no-repeat;
}

.menu-icon {
  display: none;
}

.lobby-card strong {
  min-width: min(230px, 100%);
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  color: #fff2bd;
  background: transparent;
  font-family: Georgia, "STKaiti", "KaiTi", serif;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  letter-spacing: 0;
  text-shadow: 0 3px 0 rgba(55, 18, 2, 0.84), 0 0 18px rgba(255, 207, 102, 0.36);
  box-shadow: none;
}

.primary-card strong {
  color: #fff8d0;
  background: transparent;
}

.lobby-card small {
  max-width: 80%;
  color: rgba(255, 239, 194, 0.82);
  font-weight: 900;
  text-shadow: 0 2px 7px rgba(0, 0, 0, 0.62);
}

.online-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.online-card {
  padding: 20px;
  border: 2px solid rgba(248, 221, 154, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.16)),
    rgba(6, 24, 23, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 18px 36px rgba(0, 0, 0, 0.22);
}

.online-card h3 {
  margin: 0 0 14px;
  color: #fff6ca;
}

.online-account-badge {
  margin: 12px 0 16px;
  padding: 14px 16px;
  border: 2px solid rgba(248, 221, 154, 0.28);
  border-radius: 8px;
  color: #ffefb6;
  background: rgba(8, 31, 72, 0.72);
  font-weight: 1000;
}

.online-account-badge[data-logged-in="1"] {
  border-color: rgba(86, 191, 142, 0.78);
  background: rgba(20, 76, 55, 0.76);
}

.online-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.online-button,
.online-actions button {
  position: relative;
  min-width: 112px;
  border: 2px solid rgba(95, 200, 214, 0.48);
  color: #fff9d9;
  background: linear-gradient(180deg, #3c8bd5, #15518d);
  box-shadow: inset 0 -5px 0 rgba(2, 19, 38, 0.34), 0 10px 22px rgba(0, 0, 0, 0.28);
  font-weight: 1000;
  transform: translateY(0);
  transition: transform 140ms ease, filter 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.online-button:hover:not(:disabled),
.online-actions button:hover:not(:disabled) {
  filter: brightness(1.12);
}

.online-button:active:not(:disabled),
.online-actions button:active:not(:disabled),
.online-button.clicked,
.online-actions button.clicked {
  transform: translateY(3px) scale(0.99);
  filter: brightness(1.35);
  box-shadow: inset 0 -2px 0 rgba(2, 19, 38, 0.24), 0 0 28px rgba(243, 196, 99, 0.58);
}

.online-button:disabled,
.online-actions button:disabled {
  border-color: rgba(160, 170, 170, 0.24);
  color: rgba(248, 241, 221, 0.42);
  background: linear-gradient(180deg, #374650, #1c282d);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.26);
  opacity: 0.72;
}

.ready-button {
  border-color: rgba(86, 191, 142, 0.64);
  background: linear-gradient(180deg, #5de3a1, #168957);
}

.ready-button.is-ready,
.ready-button.is-ready:disabled {
  color: rgba(255, 248, 216, 0.7);
  background: linear-gradient(180deg, #315f4e, #1d3f35);
}

.start-button {
  background: linear-gradient(180deg, #56626b, #202c32);
}

.start-button.is-active {
  border-color: rgba(255, 235, 152, 0.9);
  color: #2b1604;
  background: linear-gradient(180deg, #fff0a7, #f3c463 54%, #cf812d);
  box-shadow: inset 0 -5px 0 rgba(108, 55, 9, 0.34), 0 0 34px rgba(243, 196, 99, 0.36);
}

.leave-button {
  border-color: rgba(255, 142, 126, 0.62);
  background: linear-gradient(180deg, #d85d54, #8a2f34);
}

.online-status {
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid rgba(95, 200, 214, 0.34);
  border-radius: 8px;
  color: #fff6ca;
  background: rgba(15, 61, 74, 0.66);
  font-weight: 900;
}

.online-status[data-tone="ok"] {
  border-color: rgba(86, 191, 142, 0.72);
  background: rgba(24, 82, 56, 0.72);
}

.online-status[data-tone="busy"] {
  border-color: rgba(243, 196, 99, 0.72);
  background: rgba(91, 67, 22, 0.72);
}

.reconnect-ticker,
.online-game-alert {
  grid-column: 1 / -1;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 900;
}

.reconnect-ticker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff6ca;
  border: 1px solid rgba(243, 196, 99, 0.82);
  background: rgba(91, 67, 22, 0.84);
  overflow: hidden;
}

.reconnect-ticker span {
  white-space: nowrap;
  animation: tickerSlide 9s linear infinite;
}

@keyframes tickerSlide {
  from { transform: translateX(18%); }
  to { transform: translateX(-18%); }
}

.online-game-alert {
  margin: 0 0 12px;
  color: #fff6ca;
  border: 1px solid rgba(95, 200, 214, 0.45);
  background: rgba(15, 61, 74, 0.78);
}

.online-game-alert[data-tone="danger"] {
  color: #ffe7e2;
  border-color: rgba(255, 112, 99, 0.8);
  background: rgba(120, 30, 34, 0.84);
}

.online-game-alert[data-tone="warn"] {
  color: #fff4c7;
  border-color: rgba(243, 196, 99, 0.82);
  background: rgba(91, 67, 22, 0.84);
}

.online-game-alert[data-tone="ok"] {
  color: #dbffe8;
  border-color: rgba(86, 191, 142, 0.76);
  background: rgba(24, 82, 56, 0.78);
}

.danger-exit,
.kick-button {
  border-color: rgba(255, 142, 126, 0.72) !important;
  color: #fff4ee !important;
  background: linear-gradient(180deg, #ec5c52, #9f252f) !important;
  box-shadow: inset 0 -4px 0 rgba(69, 7, 15, 0.42), 0 0 18px rgba(236, 92, 82, 0.28) !important;
}

.online-countdown {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
  padding: 16px 20px;
  border: 2px solid rgba(255, 235, 152, 0.74);
  border-radius: 8px;
  color: #fff6ca;
  background: linear-gradient(135deg, rgba(67, 38, 4, 0.88), rgba(13, 58, 51, 0.86));
  box-shadow: 0 0 36px rgba(243, 196, 99, 0.18);
  font-weight: 1000;
}

.online-countdown strong {
  width: 72px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2b1604;
  background: radial-gradient(circle at 32% 22%, #fff8c8, #f3c463 65%, #b96624);
  font-size: 2.2rem;
}

.online-countdown[hidden] {
  display: none;
}

.referee-countdown {
  position: relative;
  z-index: 12;
  margin: 0 0 14px;
  border-color: rgba(255, 176, 76, 0.86);
  background: linear-gradient(135deg, rgba(91, 42, 16, 0.92), rgba(45, 30, 100, 0.88));
}

.online-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.online-users-panel {
  grid-column: 1 / -1;
}

.online-board article {
  min-height: 180px;
  padding: 14px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 8px;
  background: rgba(6, 24, 23, 0.7);
}

.online-board h3 {
  margin: 0 0 10px;
  color: #fff6ca;
}

.online-list {
  display: grid;
  gap: 8px;
  color: rgba(248, 241, 221, 0.82);
  font-weight: 900;
}

.online-list.empty {
  align-content: center;
  min-height: 112px;
  color: var(--muted);
}

.online-list-row {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 8px 10px;
  border-color: rgba(95, 200, 214, 0.28);
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
}

.online-list-row.ready {
  border-color: rgba(86, 191, 142, 0.62);
  background: rgba(18, 84, 56, 0.46);
}

.online-list-row strong {
  color: #fff6ca;
}

.online-list-row small {
  grid-column: 2;
  color: rgba(248, 241, 221, 0.7);
}

.online-dot {
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #56bf8e;
  box-shadow: 0 0 16px rgba(86, 191, 142, 0.85);
}

.online-log {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 14px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 8px;
  color: #dff8ef;
  background: rgba(3, 10, 10, 0.72);
}

.quick-dock {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.quick-dock button {
  flex: 1 1 150px;
  min-height: 54px;
}

.hero {
  min-height: clamp(260px, 44vh, 520px);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(22px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.9;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.46);
}

.lede {
  max-width: 560px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}

.hero-card {
  flex: 0 0 auto;
  width: clamp(116px, 18vw, 190px);
  aspect-ratio: 0.72;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 245, 211, 0.92);
  border-radius: 14px;
  color: #2a1109;
  background: linear-gradient(145deg, #fff4cb, #dd3f3b 48%, #661c24);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
  transform: rotate(5deg);
}

.hero-card span {
  font-size: clamp(3.5rem, 10vw, 7rem);
  font-weight: 1000;
}

.hero-card strong {
  align-self: end;
  margin-bottom: 16px;
}

.setup-panel,
.message-panel,
.target-panel,
.history-panel,
.settings-panel,
.round-summary,
.save-panel,
.leaderboard-panel,
.hand,
.status-bar,
.player-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
}

#game .status-bar,
#game .message-panel,
#game .target-panel,
#game .history-panel,
#game .round-summary,
#game .hand,
#game .player-card {
  border-color: rgba(248, 221, 154, 0.34);
  background:
    linear-gradient(180deg, rgba(4, 18, 20, 0.46), rgba(3, 13, 14, 0.34));
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 188, 0.045),
    0 12px 30px rgba(0, 0, 0, 0.16);
}

#game .status-bar,
#game .message-panel,
#game .history-panel {
  background:
    linear-gradient(180deg, rgba(4, 18, 20, 0.38), rgba(3, 13, 14, 0.28));
}

.setup-panel {
  padding: 22px;
}

.subpage-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.subpage-header h2,
.info-panel h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.info-panel {
  min-height: 420px;
  padding: 26px;
  border: 2px solid rgba(95, 170, 236, 0.68);
  border-radius: 28px;
  background: rgba(5, 18, 67, 0.86);
  box-shadow: inset 0 0 0 2px rgba(248, 221, 154, 0.16), 0 24px 72px rgba(0, 0, 0, 0.34);
}

.info-panel > .backHome {
  margin-bottom: 18px;
}

.table-map-view {
  min-height: 680px;
  padding: 22px;
  border: 2px solid rgba(95, 170, 236, 0.68);
  border-radius: 28px;
  background:
    radial-gradient(circle at 16% 18%, rgba(86, 191, 142, 0.28), transparent 32%),
    radial-gradient(circle at 76% 8%, rgba(243, 196, 99, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(5, 18, 67, 0.9), rgba(4, 18, 30, 0.92));
  box-shadow: inset 0 0 0 2px rgba(248, 221, 154, 0.14), 0 24px 72px rgba(0, 0, 0, 0.34);
}

.map-header {
  align-items: flex-start;
}

.map-header h2 {
  margin: 0;
  color: #ffe49a;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.map-progress {
  margin: 6px 0 0;
  color: #bff7db;
  font-weight: 1000;
}

.table-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  align-items: start;
}

.table-map-scroll {
  min-height: 560px;
  max-height: min(68vh, 760px);
  overflow: auto;
  display: grid;
  gap: 18px;
  padding: 12px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent),
    rgba(2, 13, 53, 0.38);
}

.realm-strip {
  position: relative;
  min-height: 170px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent 42%),
    rgba(4, 22, 47, 0.72);
}

.realm-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background:
    radial-gradient(circle at 18% 30%, rgba(255, 255, 255, 0.25), transparent 16%),
    radial-gradient(circle at 82% 72%, rgba(255, 255, 255, 0.18), transparent 18%);
  pointer-events: none;
}

.realm-cloud { border-color: rgba(142, 229, 255, 0.3); }
.realm-sand { border-color: rgba(255, 211, 122, 0.36); }
.realm-swamp { border-color: rgba(86, 191, 142, 0.34); }
.realm-mystic { border-color: rgba(169, 141, 255, 0.34); }
.realm-ember { border-color: rgba(255, 126, 96, 0.34); }
.realm-star { border-color: rgba(147, 217, 255, 0.34); }
.realm-gate { border-color: rgba(255, 231, 143, 0.44); }

.realm-strip header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.realm-strip header span {
  color: #fff3bd;
  font-size: 1.18rem;
  font-weight: 1000;
}

.realm-strip header small {
  display: block;
  margin-top: 4px;
  color: rgba(248, 241, 221, 0.72);
  font-weight: 900;
}

.realm-nodes {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 16px;
  align-items: center;
}

.realm-nodes::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 50%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(86, 191, 142, 0.2), rgba(243, 196, 99, 0.72), rgba(95, 200, 214, 0.2));
  box-shadow: 0 0 22px rgba(243, 196, 99, 0.24);
}

.map-node {
  position: relative;
  min-height: 176px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  justify-items: center;
  padding: 8px 9px 12px;
  border: 2px solid rgba(248, 221, 154, 0.38);
  border-radius: 18px;
  color: #fff7d0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.18)),
    linear-gradient(145deg, #1c695b, #123754);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.24), 0 16px 26px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.map-node-thumb,
.map-panel-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1.52;
  overflow: hidden;
  border: 2px solid rgba(255, 232, 151, 0.72);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 232, 151, 0.18), rgba(0, 0, 0, 0.12)),
    rgba(6, 18, 24, 0.7);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 211, 0.12),
    0 10px 18px rgba(0, 0, 0, 0.24);
}

.map-node-thumb::after,
.map-panel-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 34%, rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.map-node-thumb img,
.map-panel-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.map-node:hover,
.map-node.selected {
  transform: translateY(-2px);
}

.map-node.locked {
  filter: grayscale(0.8);
  opacity: 0.72;
  background: linear-gradient(145deg, #31435b, #1a2030);
}

.map-node.locked .map-node-thumb img {
  filter: brightness(0.62) saturate(0.72);
}

.map-node.available {
  border-color: rgba(255, 225, 128, 0.88);
  background: linear-gradient(145deg, #236d66, #7d5922);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.24), 0 0 26px rgba(243, 196, 99, 0.28);
}

.map-node.current::after {
  content: "荐";
  position: absolute;
  right: -9px;
  top: -10px;
  width: 34px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 246, 186, 0.96);
  border-radius: 50%;
  color: #3c1905;
  background: linear-gradient(180deg, #fff3a5, #f4ae37);
  font-weight: 1000;
}

.map-node.selected {
  outline: 3px solid rgba(255, 236, 150, 0.7);
  outline-offset: 3px;
}

.map-node-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  width: 38px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 246, 186, 0.88);
  border-radius: 50%;
  color: #261203;
  background: radial-gradient(circle at 34% 26%, #fff9ce, #f2bc4c 62%, #99551f);
  font-weight: 1000;
}

.map-node strong {
  max-width: 100%;
  font-size: 1.02rem;
  line-height: 1.15;
}

.map-node small {
  color: rgba(255, 248, 216, 0.82);
  font-size: 0.78rem;
  font-weight: 900;
}

.table-map-panel {
  position: sticky;
  top: 18px;
}

.map-panel-card {
  padding: 20px;
  border: 2px solid rgba(248, 221, 154, 0.34);
  border-radius: 18px;
  background:
    radial-gradient(circle at 24% 0%, rgba(243, 196, 99, 0.18), transparent 34%),
    rgba(4, 18, 30, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 18px 46px rgba(0, 0, 0, 0.28);
}

.map-panel-thumb {
  margin: 8px 0 14px;
  border-color: rgba(255, 232, 151, 0.82);
  border-radius: 18px;
}

.map-panel-card h3 {
  margin: 0 0 10px;
  color: #ffe49a;
  font-size: 1.8rem;
}

.map-panel-card p {
  color: rgba(248, 241, 221, 0.82);
  font-weight: 800;
  line-height: 1.55;
}

.map-stat-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.map-stat-grid span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(95, 200, 214, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.map-stat-grid small {
  color: rgba(248, 221, 154, 0.78);
  font-weight: 900;
}

.map-stat-grid strong {
  color: #fff6ca;
}

.map-stat-grid .rules-hidden {
  border-color: rgba(248, 221, 154, 0.14);
  background:
    linear-gradient(135deg, rgba(75, 79, 105, 0.18), rgba(4, 18, 30, 0.5));
}

.map-stat-grid .rules-hidden strong {
  color: rgba(248, 241, 221, 0.64);
}

.map-status {
  padding: 10px;
  border: 1px solid rgba(86, 191, 142, 0.42);
  border-radius: 8px;
  color: #c6ffd9;
  background: rgba(21, 89, 67, 0.28);
}

.map-empty {
  padding: 24px;
  border: 1px solid rgba(248, 221, 154, 0.2);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  max-width: 820px;
}

.settings-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(248, 221, 154, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.settings-group h3 {
  margin: 0;
  color: var(--gold);
}

.volume-field {
  gap: 8px;
}

.volume-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.volume-field output {
  color: #bff7db;
  font-weight: 900;
}

.volume-field input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.placeholder-action {
  justify-content: center;
  min-height: 56px;
  border-color: rgba(95, 170, 236, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.skin-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(248, 221, 154, 0.26);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 45%),
    rgba(2, 13, 53, 0.58);
}

.skin-panel header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.skin-panel h3 {
  margin: 0;
  color: #ffe49a;
  font-size: 1.35rem;
}

.skin-panel header small {
  color: #bff7db;
  font-weight: 900;
}

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

.skin-choice {
  min-height: 154px;
  overflow: hidden;
  display: grid;
  align-content: end;
  padding: 0;
  border: 2px solid rgba(248, 221, 154, 0.26);
  border-radius: 14px;
  background: rgba(4, 18, 30, 0.76);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

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

.skin-choice span {
  display: grid;
  gap: 2px;
  padding: 9px;
  text-align: left;
}

.skin-choice strong {
  color: #fff6ca;
  font-size: 0.92rem;
}

.skin-choice small {
  color: rgba(248, 241, 221, 0.72);
  font-weight: 900;
}

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

.table-reward-preview span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(86, 191, 142, 0.22);
  border-radius: 8px;
  background: rgba(86, 191, 142, 0.08);
}

.table-reward-preview small {
  color: var(--muted);
  font-weight: 900;
}

.table-reward-preview strong {
  color: #fff6ca;
}

.skin-choice.selected {
  border-color: rgba(255, 225, 128, 0.92);
  box-shadow: 0 0 24px rgba(243, 196, 99, 0.32), 0 14px 28px rgba(0, 0, 0, 0.24);
}

.profile-view {
  display: grid;
  grid-template-columns: minmax(220px, 0.32fr) minmax(420px, 1fr);
  gap: 20px;
}

.profile-view[hidden],
.records-view[hidden],
.leaderboard-view[hidden] {
  display: none !important;
}

.profile-card,
.profile-tabs article {
  padding: 18px;
  border: 1px solid rgba(248, 221, 154, 0.24);
  border-radius: 18px;
  background: rgba(2, 13, 53, 0.58);
}

.profile-card {
  text-align: center;
}

.profile-tabs {
  display: grid;
  gap: 14px;
}

.profile-tabs h3 {
  margin: 0 0 8px;
  color: #fff6ca;
}

.profile-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.profile-metric-grid > span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(248, 221, 154, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.profile-metric-grid small {
  color: rgba(248, 241, 221, 0.68);
  font-weight: 900;
}

.profile-metric-grid strong {
  color: #fff6ca;
  font-size: 1.08rem;
}

.title-wall,
.recent-performance {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(248, 221, 154, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.title-wall h4,
.recent-performance h4,
.recent-performance p {
  margin: 0;
}

.title-wall h4,
.recent-performance h4 {
  color: var(--gold);
}

.title-wall div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.title-wall span {
  padding: 7px 9px;
  border: 1px solid rgba(248, 221, 154, 0.16);
  border-radius: 999px;
  color: rgba(248, 241, 221, 0.46);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  font-weight: 900;
}

.title-wall span.owned {
  color: #fff6ca;
  border-color: rgba(243, 196, 99, 0.62);
  background: rgba(243, 196, 99, 0.14);
}

.recent-performance p,
.recent-performance small {
  color: var(--muted);
  font-weight: 850;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(58px, 1fr));
  gap: 10px;
}

.avatar-choice {
  width: 100%;
  min-height: auto;
  aspect-ratio: 1;
  padding: 3px;
  border: 2px solid rgba(95, 200, 214, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.avatar-choice.selected {
  border-color: rgba(255, 235, 152, 0.98);
  box-shadow: 0 0 0 3px rgba(243, 196, 99, 0.22), 0 0 28px rgba(243, 196, 99, 0.25);
}

.avatar-choice img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

.settings-panel {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px;
}

.field.compact {
  width: min(210px, 55vw);
}

.toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-weight: 900;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.setup-grid,
.name-grid,
.save-controls,
.scoreboard,
.table {
  display: grid;
  gap: 14px;
}

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

.table-info {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.name-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 18px 0;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.save-panel,
.leaderboard-panel,
.ai-archive-panel {
  margin-top: 14px;
  padding: 16px;
}

.save-panel header,
.ai-archive-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.save-panel h2,
.leaderboard-panel h2,
.ai-archive-panel h2 {
  margin: 0;
}

.ai-archive-content {
  display: grid;
  gap: 14px;
}

.ai-archive-note {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.ai-export-summary {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(95, 200, 214, 0.26);
  border-radius: 8px;
  color: #fff6ca;
  background: rgba(95, 200, 214, 0.08);
  white-space: pre-wrap;
  font: inherit;
  font-weight: 900;
}

.ai-stat-grid,
.ai-evaluation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ai-stat-card,
.ai-evaluation-card,
.ai-match-row {
  padding: 14px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 8px;
  background: rgba(8, 24, 28, 0.74);
}

.ai-stat-card strong,
.ai-evaluation-card h4 {
  display: block;
  margin: 0 0 6px;
  color: var(--gold);
}

.ai-stat-card span {
  display: block;
  font-size: 1.35rem;
  font-weight: 1000;
}

.ai-stat-card small,
.ai-evaluation-card small,
.ai-match-row small {
  color: var(--muted);
  font-weight: 800;
}

.ai-trait-bars {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.ai-trait-bars span {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.ai-trait-bars b {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #56cfd8 var(--trait), rgba(255, 255, 255, 0.12) var(--trait));
  box-shadow: inset 0 0 0 1px rgba(248, 221, 154, 0.16);
}

.ai-trait-bars em {
  color: var(--gold);
  font-style: normal;
  font-weight: 1000;
  text-align: right;
}

.ai-compare-wrap {
  overflow-x: auto;
}

.ai-compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid rgba(248, 221, 154, 0.18);
  border-radius: 8px;
}

.ai-compare-table th,
.ai-compare-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(248, 221, 154, 0.14);
  text-align: left;
  white-space: nowrap;
}

.ai-compare-table th {
  color: var(--gold);
  background: rgba(248, 221, 154, 0.08);
}

.ai-recent-log {
  display: grid;
  max-height: 420px;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.ai-recent-log h3 {
  margin: 0;
  color: var(--gold);
}

.ai-match-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ai-match-row p {
  margin: 4px 0;
  color: var(--muted);
  font-weight: 850;
}

.save-controls {
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  margin-bottom: 12px;
}

.save-list {
  display: grid;
  gap: 10px;
}

.save-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(248, 221, 154, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.save-item strong {
  display: block;
}

.save-item span,
.empty-save,
.leaderboard-panel p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.field .player-kind {
  margin-top: 8px;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
}

.status-bar div {
  display: grid;
  gap: 4px;
}

.status-bar span,
.player-card span,
.hand p {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.status-bar strong {
  color: var(--gold);
}

.message-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
}

.message-panel p {
  margin: 0;
  font-weight: 850;
}

.turn-banner {
  pointer-events: none;
  position: fixed;
  left: 50%;
  top: clamp(92px, 16vh, 160px);
  z-index: 27;
  width: min(720px, calc(100vw - 48px));
  display: grid;
  gap: 6px;
  padding: clamp(16px, 2.4vw, 24px) clamp(22px, 4vw, 42px);
  border: 2px solid rgba(243, 196, 99, 0.82);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(93, 27, 37, 0.82), rgba(13, 62, 55, 0.78));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  text-align: center;
  transform: translateX(-50%);
  animation: turnToastIn 0.26s ease-out both;
  backdrop-filter: blur(3px);
}

.turn-banner strong {
  color: #fff1b6;
  font-size: clamp(1.45rem, 3.1vw, 2.35rem);
  line-height: 1.15;
}

.turn-banner span {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.turn-banner[data-kind="action"] {
  border-color: rgba(95, 200, 214, 0.88);
  background: linear-gradient(135deg, rgba(10, 60, 84, 0.86), rgba(79, 42, 122, 0.78));
}

.target-panel[data-kind="action"] {
  box-shadow: inset 0 0 0 1px rgba(95, 200, 214, 0.28), 0 18px 42px rgba(0, 0, 0, 0.24);
}

@keyframes turnToastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.banter-layer {
  pointer-events: none;
  position: fixed;
  inset: auto 22px 108px auto;
  z-index: 26;
  width: min(460px, calc(100vw - 44px));
  display: grid;
  gap: 10px;
}

.banter-pop {
  justify-self: end;
  min-width: min(340px, 100%);
  padding: 12px 16px;
  border: 2px solid rgba(255, 235, 152, 0.86);
  border-radius: 18px 18px 6px 18px;
  color: #fff8d8;
  background:
    linear-gradient(135deg, rgba(94, 35, 120, 0.94), rgba(10, 69, 82, 0.94));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.36), inset 0 0 18px rgba(255, 238, 172, 0.08);
  animation: banterFloat 3.6s ease-in forwards;
}

.banter-pop strong {
  display: block;
  margin-bottom: 3px;
  color: #ffe99b;
  font-size: 0.86rem;
}

.banter-pop span {
  display: block;
  font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 1000;
  text-shadow: 0 2px 0 rgba(64, 18, 40, 0.8);
}

.banter-pop.boom {
  background: linear-gradient(135deg, rgba(155, 42, 42, 0.95), rgba(88, 31, 103, 0.94));
  animation-name: banterBoom;
}

.banter-pop.shield {
  background: linear-gradient(135deg, rgba(19, 111, 105, 0.95), rgba(34, 60, 142, 0.94));
}

.banter-pop.calm {
  background: linear-gradient(135deg, rgba(20, 79, 62, 0.95), rgba(31, 59, 96, 0.94));
}

.banter-pop.action {
  background: linear-gradient(135deg, rgba(100, 48, 180, 0.95), rgba(31, 48, 128, 0.94));
}

.banter-pop.manual {
  background: linear-gradient(135deg, rgba(221, 104, 48, 0.95), rgba(101, 45, 132, 0.94));
}

.table-fx-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.table-fx {
  position: absolute;
  display: grid;
  place-items: center;
  width: min(54vw, 520px);
  aspect-ratio: 1;
  color: #fff8dd;
  text-align: center;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
  animation: fxFade 0.9s ease-out forwards;
}

.table-fx i {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
}

.table-fx strong,
.table-fx .fx-label {
  position: relative;
  z-index: 5;
  display: block;
  padding: 4px 14px;
  border-radius: 8px;
  background: rgba(7, 15, 22, 0.5);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.36);
}

.table-fx strong {
  align-self: end;
  color: #fff3b8;
  font-size: clamp(1.1rem, 3vw, 2.1rem);
}

.table-fx .fx-label {
  align-self: start;
  margin-top: 8px;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-weight: 1000;
}

.fx-shockwave,
.fx-debris,
.fx-smoke {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.table-fx.freeze i {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18) 0 18%, transparent 19%),
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.9) 0 2%, transparent 3%),
    radial-gradient(circle at 78% 28%, rgba(255, 255, 255, 0.82) 0 2%, transparent 3%),
    conic-gradient(from 15deg, rgba(172, 246, 255, 0), rgba(197, 250, 255, 0.9), rgba(83, 173, 255, 0.48), rgba(172, 246, 255, 0));
  border: 8px solid rgba(211, 251, 255, 0.8);
  box-shadow: inset 0 0 70px rgba(202, 248, 255, 0.7), 0 0 58px rgba(109, 210, 255, 0.62);
  clip-path: polygon(50% 0, 58% 18%, 76% 8%, 74% 28%, 95% 28%, 80% 43%, 100% 56%, 78% 60%, 87% 82%, 66% 75%, 58% 100%, 45% 78%, 26% 92%, 29% 68%, 4% 65%, 22% 48%, 5% 30%, 29% 31%, 27% 10%, 44% 20%);
  animation: freezeBurst 0.88s ease-out forwards;
}

.table-fx.bust i {
  inset: 1%;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 1) 0 4%, rgba(255, 244, 162, 0.96) 5% 12%, transparent 13%),
    radial-gradient(circle at 43% 46%, rgba(255, 230, 92, 0.92) 0 14%, transparent 15%),
    radial-gradient(circle at 59% 54%, rgba(255, 99, 47, 0.92) 0 22%, transparent 23%),
    radial-gradient(circle at 51% 60%, rgba(111, 23, 28, 0.72) 0 34%, transparent 35%),
    conic-gradient(from 9deg, transparent 0 5%, #ffe66d 6% 9%, transparent 10% 15%, #ff6d36 16% 21%, transparent 22% 31%, #ffd35a 32% 36%, transparent 37% 45%, #b42227 46% 53%, transparent 54% 64%, #fff0a5 65% 69%, transparent 70% 100%);
  border-radius: 48% 52% 45% 55%;
  box-shadow:
    0 0 34px rgba(255, 249, 184, 0.96),
    0 0 82px rgba(255, 98, 38, 0.82),
    0 0 150px rgba(144, 26, 31, 0.56);
  clip-path: polygon(52% 0, 59% 30%, 82% 8%, 72% 40%, 100% 35%, 75% 53%, 95% 76%, 64% 65%, 58% 100%, 47% 67%, 23% 94%, 33% 61%, 0 66%, 27% 48%, 6% 20%, 39% 35%);
  animation: bustFlash 1.04s cubic-bezier(.08, .82, .24, 1) forwards;
}

.table-fx.bust .fx-shockwave {
  inset: 18%;
  border: 6px solid rgba(255, 231, 118, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 48px rgba(255, 126, 41, 0.66), inset 0 0 40px rgba(255, 255, 255, 0.28);
  animation: bustShockwave 1.06s ease-out forwards;
}

.table-fx.bust .fx-debris {
  inset: 48%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff7ad;
  box-shadow:
    -138px -84px 0 2px #ffdf58,
    126px -76px 0 1px #ff7345,
    154px 21px 0 2px #ffd36a,
    -151px 44px 0 1px #ff6c39,
    76px 128px 0 2px #ffc14d,
    -84px 133px 0 1px #fff0a4,
    -31px -156px 0 1px #ffef8f,
    39px 156px 0 1px #c9392e,
    189px -41px 0 1px #fff4b6,
    -194px -18px 0 1px #d1432f;
  animation: bustDebris 1.16s cubic-bezier(.08, .76, .22, 1) forwards;
}

.table-fx.bust .fx-smoke {
  inset: 16%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 58%, rgba(53, 38, 35, 0.48) 0 14%, transparent 15%),
    radial-gradient(circle at 59% 34%, rgba(78, 54, 47, 0.42) 0 18%, transparent 19%),
    radial-gradient(circle at 67% 64%, rgba(35, 33, 37, 0.38) 0 16%, transparent 17%);
  filter: blur(7px);
  animation: bustSmoke 1.22s ease-out forwards;
}

.table-fx.shield i {
  border-radius: 44% 44% 52% 52%;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.72), transparent 18%),
    linear-gradient(150deg, rgba(120, 247, 223, 0.56), rgba(57, 123, 255, 0.34));
  border: 7px solid rgba(159, 255, 228, 0.82);
  box-shadow: inset 0 0 64px rgba(159, 255, 228, 0.46), 0 0 54px rgba(69, 209, 186, 0.52);
  clip-path: polygon(50% 0, 90% 15%, 83% 66%, 50% 100%, 17% 66%, 10% 15%);
  animation: shieldPulse 1.1s ease-out forwards;
}

.table-fx.shieldBreak i {
  border-radius: 44% 44% 52% 52%;
  background:
    linear-gradient(130deg, transparent 0 43%, rgba(255, 255, 255, 0.95) 44% 47%, transparent 48%),
    linear-gradient(72deg, transparent 0 51%, rgba(255, 255, 255, 0.75) 52% 54%, transparent 55%),
    linear-gradient(150deg, rgba(145, 245, 255, 0.52), rgba(70, 104, 255, 0.22));
  border: 7px solid rgba(176, 251, 255, 0.7);
  box-shadow: inset 0 0 54px rgba(176, 251, 255, 0.34), 0 0 42px rgba(97, 185, 255, 0.42);
  clip-path: polygon(50% 0, 90% 15%, 83% 66%, 50% 100%, 17% 66%, 10% 15%);
  animation: shieldCrack 0.88s ease-out forwards;
}

@keyframes fxFade {
  0% { opacity: 0; transform: scale(0.72) rotate(-2deg); }
  16% { opacity: 1; transform: scale(1.02) rotate(0deg); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.18) rotate(1deg); }
}

@keyframes freezeBurst {
  0% { transform: scale(0.62) rotate(-18deg); filter: blur(5px); }
  35% { transform: scale(1.05) rotate(4deg); filter: blur(0); }
  100% { transform: scale(1.18) rotate(18deg); filter: blur(1px); }
}

@keyframes bustFlash {
  0% { transform: scale(0.18) rotate(-18deg); opacity: 0; filter: brightness(2.6) blur(7px); }
  12% { transform: scale(0.72) rotate(-6deg); opacity: 1; filter: brightness(2.2) blur(0); }
  38% { transform: scale(1.18) rotate(7deg); opacity: 0.98; filter: brightness(1.25) saturate(1.3); }
  100% { transform: scale(1.62) rotate(24deg); opacity: 0; filter: brightness(0.72) blur(3px) saturate(0.82); }
}

@keyframes bustShockwave {
  0% { transform: scale(0.16); opacity: 0; }
  14% { opacity: 0.98; }
  100% { transform: scale(2.42); opacity: 0; border-width: 1px; }
}

@keyframes bustDebris {
  0% { transform: translate(0, 0) scale(0.2); opacity: 0; filter: blur(0); }
  18% { opacity: 1; }
  100% { transform: translate(0, 36px) scale(1.75); opacity: 0; filter: blur(2px); }
}

@keyframes bustSmoke {
  0% { transform: scale(0.35); opacity: 0; }
  30% { opacity: 0.56; }
  100% { transform: scale(1.85) translateY(-22px); opacity: 0; }
}

@keyframes screenImpactShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  10% { transform: translate3d(-6px, 3px, 0); }
  20% { transform: translate3d(7px, -4px, 0); }
  32% { transform: translate3d(-5px, -2px, 0); }
  44% { transform: translate3d(4px, 3px, 0); }
  58% { transform: translate3d(-3px, 1px, 0); }
  72% { transform: translate3d(2px, -1px, 0); }
}

body.fx-screen-shake #app {
  animation: screenImpactShake 0.42s ease-out;
}

@keyframes shieldPulse {
  0% { transform: translateY(16px) scale(0.76); opacity: 0.2; }
  35% { transform: translateY(0) scale(1.04); opacity: 0.95; }
  100% { transform: translateY(-4px) scale(1.08); opacity: 0; }
}

@keyframes shieldCrack {
  0% { transform: scale(0.94); filter: brightness(1.5); }
  36% { transform: scale(1.08) skewX(-4deg); filter: brightness(1.05); }
  100% { transform: scale(1.2) skewX(5deg); filter: brightness(0.75); }
}

@keyframes banterFloat {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.92) rotate(-1deg);
  }
  12% {
    opacity: 1;
    transform: translateY(0) scale(1.03) rotate(0.6deg);
  }
  76% {
    opacity: 1;
    transform: translateY(-8px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-32px) scale(0.96);
  }
}

@keyframes banterBoom {
  0% {
    opacity: 0;
    transform: scale(0.74) rotate(-5deg);
  }
  10% {
    opacity: 1;
    transform: scale(1.12) rotate(3deg);
  }
  22% {
    transform: scale(1) rotate(-1deg);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(0.94);
  }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.target-panel {
  margin-bottom: 14px;
  padding: 16px;
  position: sticky;
  top: 10px;
  z-index: 16;
  border-width: 2px;
  border-color: rgba(243, 196, 99, 0.82);
  background: linear-gradient(135deg, rgba(86, 35, 11, 0.76), rgba(9, 48, 44, 0.74));
  box-shadow:
    0 0 0 3px rgba(255, 218, 116, 0.16),
    0 18px 46px rgba(0, 0, 0, 0.34);
}

.target-panel h2,
.history-panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.target-panel h2 {
  color: var(--gold);
  font-size: 1.35rem;
}

.target-panel p {
  margin: 0 0 12px;
  color: var(--ink);
  font-weight: 900;
  font-size: 1.02rem;
}

.targets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.target-button {
  border-color: rgba(95, 200, 214, 0.58);
  color: #fff8cf;
  background: linear-gradient(180deg, rgba(95, 200, 214, 0.34), rgba(20, 72, 80, 0.78));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

.target-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  filter: grayscale(0.35);
}

.round-summary {
  margin-bottom: 14px;
  padding: 16px;
}

.round-summary header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.round-summary h2 {
  margin: 0;
}

.round-summary header strong {
  color: var(--gold);
}

.summary-rows {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(248, 221, 154, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.summary-row.busted {
  border-color: rgba(201, 79, 72, 0.52);
}

.summary-row.flipSeven {
  border-color: rgba(86, 191, 142, 0.64);
}

.summary-score {
  display: grid;
  gap: 3px;
}

.summary-score span,
.summary-score small {
  color: var(--muted);
  font-weight: 800;
}

.summary-score output {
  color: var(--gold);
  font-size: 1.6rem;
  font-weight: 1000;
}

.compact-cards .card {
  width: 54px;
}

.round-record-list {
  grid-auto-columns: 72px;
}

.round-record-list .record-card .card {
  width: 72px;
}

.scoreboard {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 14px;
}

.player-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.player-card.active {
  border-color: var(--gold);
}

.player-card.winner {
  border-color: var(--jade);
}

.player-card strong {
  display: block;
}

.player-card output {
  color: var(--gold);
  font-size: 1.9rem;
  font-weight: 1000;
}

.table {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.hand {
  min-height: 220px;
  padding: 14px;
}

.hand.current {
  outline: 2px solid rgba(243, 196, 99, 0.46);
}

.hand header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hand h3,
.hand p {
  margin: 0;
}

.hand header strong {
  color: var(--gold);
  font-size: 1.55rem;
}

.focus-hand {
  min-height: clamp(300px, 43vh, 470px);
}

.focus-hand .cards {
  justify-content: center;
}

.focus-hand .card {
  width: clamp(104px, 14vw, 150px);
}

.shield-line {
  color: #9de8d0 !important;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card {
  position: relative;
  width: 72px;
  aspect-ratio: 0.72;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  border: 2px solid rgba(255, 248, 222, 0.92);
  border-radius: 8px;
  color: #251207;
  background: #fff0c3;
  overflow: hidden;
}

.image-card {
  padding: 0;
  background: transparent;
  border-color: rgba(255, 248, 222, 0.78);
}

.image-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-card b {
  display: none;
}

.image-card.image-missing.freeze b,
.image-card.image-missing.flipThree b,
.image-card.image-missing.secondChance b {
  display: block;
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8%;
  z-index: 2;
  padding: 3px 4px;
  border: 1px solid rgba(255, 239, 170, 0.84);
  border-radius: 6px;
  color: #fff6ca;
  background: linear-gradient(180deg, rgba(42, 23, 9, 0.88), rgba(8, 18, 33, 0.9));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.34);
  font-size: clamp(0.62rem, 1.7vw, 0.86rem);
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.image-card.image-missing {
  background: #fff0c3;
}

.image-card.image-missing b {
  display: block;
}

.image-card span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.card b {
  font-size: 1.15rem;
}

.card span {
  font-size: 0.63rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card.bonus {
  background: #d9f5c8;
}

.card.multiplier {
  background: #f7cf75;
}

.card.freeze {
  background: #b8ebff;
}

.card.flipThree {
  background: #ffc0ad;
}

.card.secondChance {
  background: #d7c7ff;
}

.empty-hand {
  min-height: 90px;
  display: grid;
  place-items: center;
  width: 100%;
  color: rgba(248, 241, 221, 0.68);
  border: 1px dashed rgba(248, 241, 221, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

.history-panel {
  margin-top: 14px;
  padding: 16px;
}

.history-panel ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.final-results {
  display: grid;
  gap: 16px;
}

.final-results > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 21, 21, 0.82);
}

.final-results h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(1.45rem, 3vw, 2.4rem);
}

.final-results p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 850;
}

.final-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding-bottom: 8px;
}

.final-overview {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
  gap: 14px;
  align-items: start;
}

.final-overview-card,
.final-round-matrix,
.final-action-ledger,
.final-player {
  backdrop-filter: blur(8px);
}

.final-overview-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(248, 221, 154, 0.32);
  border-radius: 8px;
  background: rgba(7, 21, 21, 0.76);
}

.final-overview-card div {
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid rgba(248, 221, 154, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.final-overview-card small,
.final-round-matrix small {
  color: rgba(248, 241, 221, 0.68);
  font-weight: 900;
}

.final-overview-card strong {
  color: var(--gold);
  font-size: 1.3rem;
}

.final-round-matrix {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(95, 200, 214, 0.22);
  border-radius: 8px;
  background: rgba(7, 21, 21, 0.72);
  overflow-x: auto;
}

.final-round-matrix header,
.final-round-row {
  min-width: max-content;
  display: grid;
  grid-template-columns: 86px repeat(var(--final-player-count), minmax(112px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.final-round-matrix header > *,
.final-round-row > * {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(248, 221, 154, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
  font-weight: 900;
}

.final-round-matrix header > * {
  color: var(--gold);
  background: rgba(243, 196, 99, 0.1);
}

.final-round-row em {
  color: #fff6ca;
  font-style: normal;
}

.final-round-row span {
  gap: 2px;
}

.final-round-row b {
  color: var(--gold);
  font-size: 1.1rem;
}

.final-round-row .busted b {
  color: #ffaaa0;
}

.final-round-row .frozen b {
  color: #9ddcff;
}

.final-action-ledger {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px solid rgba(248, 221, 154, 0.2);
  border-radius: 8px;
  background: rgba(7, 21, 21, 0.72);
}

.final-action-ledger h3 {
  margin: 0 0 10px;
  color: var(--gold);
}

.final-action-ledger ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 0;
  padding-left: 22px;
  color: rgba(248, 241, 221, 0.88);
  font-weight: 850;
}

.final-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}

.final-player {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(248, 221, 154, 0.24);
  border-radius: 8px;
  background: rgba(11, 27, 27, 0.9);
}

.reward-summary {
  min-width: 320px;
  padding: 16px;
  border: 1px solid rgba(86, 191, 142, 0.62);
  border-radius: 8px;
  color: #fff6ca;
  background: linear-gradient(135deg, rgba(24, 82, 56, 0.88), rgba(8, 31, 72, 0.86));
  font-weight: 1000;
  scroll-snap-align: start;
}

.records-list,
.records-block,
.transaction-list {
  display: grid;
  gap: 12px;
}

.records-block {
  margin-top: 14px;
}

.records-block h3 {
  margin: 0;
  color: var(--gold);
}

.leaderboard-view {
  display: grid;
  gap: 16px;
}

.leaderboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(248, 221, 154, 0.28);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(19, 46, 52, 0.78), rgba(55, 25, 72, 0.54));
}

.leaderboard-hero h2,
.leaderboard-hero p {
  margin: 0;
}

.leaderboard-hero h2 {
  color: #fff6ca;
  font-size: clamp(1.8rem, 3.2vw, 3rem);
}

.leaderboard-hero button,
.leaderboard-tabs button {
  min-height: 46px;
  border: 1px solid rgba(248, 221, 154, 0.36);
  border-radius: 8px;
  color: #fff6ca;
  background: rgba(6, 28, 34, 0.72);
  font-weight: 1000;
}

.leaderboard-hero button {
  min-width: 132px;
  background: linear-gradient(180deg, #ffe28a, #d89434);
  color: #23160a;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.leaderboard-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.leaderboard-tabs button.selected {
  border-color: rgba(255, 231, 145, 0.94);
  color: #241505;
  background: linear-gradient(180deg, #fff2a8, #f2b24d);
  box-shadow: 0 0 18px rgba(243, 196, 99, 0.26);
}

.leaderboard-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.leaderboard-summary span {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid rgba(86, 191, 142, 0.28);
  border-radius: 10px;
  background: rgba(4, 20, 24, 0.64);
}

.leaderboard-summary small,
.leaderboard-name small {
  color: var(--muted);
  font-weight: 900;
}

.leaderboard-summary strong,
.leaderboard-name b {
  color: #fff6ca;
}

.leaderboard-list {
  display: grid;
  gap: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 54px 58px minmax(0, 1fr) minmax(118px, auto);
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 12px 14px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 12px;
  background: rgba(5, 22, 27, 0.68);
}

.leaderboard-row.mine {
  border-color: rgba(86, 191, 142, 0.76);
  box-shadow: inset 0 0 0 1px rgba(86, 191, 142, 0.2);
}

.leaderboard-row.top-1 {
  background: linear-gradient(90deg, rgba(137, 86, 22, 0.6), rgba(5, 22, 27, 0.72));
}

.leaderboard-row.top-2,
.leaderboard-row.top-3 {
  background: linear-gradient(90deg, rgba(55, 74, 102, 0.46), rgba(5, 22, 27, 0.7));
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(248, 221, 154, 0.34);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.22);
  font-size: 1.2rem;
}

.leaderboard-avatar {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(248, 221, 154, 0.72);
  border-radius: 14px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
}

.leaderboard-name {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.leaderboard-name b,
.leaderboard-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row output {
  display: grid;
  justify-items: end;
  color: var(--gold);
  font-size: 1.8rem;
  font-weight: 1000;
}

.leaderboard-row output small {
  color: var(--muted);
  font-size: 0.78rem;
}

.leaderboard-empty {
  padding: 18px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 12px;
  background: rgba(8, 24, 28, 0.76);
  color: #fff6ca;
  font-weight: 900;
}

.game-record-card,
.record-empty {
  padding: 16px;
  border: 1px solid rgba(248, 221, 154, 0.22);
  border-radius: 8px;
  background: rgba(8, 24, 28, 0.86);
}

.game-record-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.game-record-card h3,
.game-record-card p {
  margin: 0;
}

.game-record-card header strong {
  color: var(--gold);
  font-size: 1.35rem;
}

.reward-line,
.muted-line {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 900;
}

.final-reward-line {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(86, 191, 142, 0.42);
  border-radius: 8px;
  background: rgba(24, 82, 56, 0.3);
}

.final-reward-line strong {
  color: #fff6ca;
}

.reward-breakdown-grid {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) minmax(120px, 1fr);
  gap: 8px 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(248, 221, 154, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.reward-breakdown-grid span {
  color: rgba(248, 241, 221, 0.68);
  font-weight: 900;
}

.reward-breakdown-grid strong {
  color: #fff6ca;
}

.local-record-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.local-record-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(95, 200, 214, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.local-record-row strong {
  color: var(--gold);
}

.local-record-row span,
.local-record-row small {
  color: var(--muted);
  font-weight: 850;
}

.referee-records,
.transaction-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.transaction-filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.transaction-filter-summary span {
  padding: 7px 10px;
  border: 1px solid rgba(248, 221, 154, 0.2);
  border-radius: 999px;
  color: #fff6ca;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
}

.transaction-buckets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.transaction-buckets h4 {
  margin: 0;
  color: var(--gold);
}

.referee-records li,
.transaction-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-weight: 850;
}

.transaction-list li.penalty strong {
  color: #ffb2a6;
}

.transaction-list li.reward strong {
  color: #b8ffd0;
}

.final-player.mvp {
  border-color: rgba(243, 196, 99, 0.86);
  box-shadow: inset 0 0 0 1px rgba(243, 196, 99, 0.24), 0 18px 46px rgba(0, 0, 0, 0.28);
}

.final-player header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.final-player h3,
.final-player p {
  margin: 0;
}

.final-player h3 {
  font-size: 1.25rem;
}

.final-player header strong {
  flex: 0 0 auto;
  max-width: 140px;
  padding: 7px 10px;
  border: 1px solid rgba(243, 196, 99, 0.55);
  border-radius: 8px;
  color: var(--gold);
  background: rgba(243, 196, 99, 0.1);
  text-align: center;
  font-size: 0.9rem;
}

.record-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 96px;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.round-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.round-score-grid span,
.round-score-grid strong {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 221, 154, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.round-score-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.round-score-grid strong {
  color: var(--gold);
}

.final-action-note {
  margin: -4px 0 14px !important;
  padding: 8px 10px;
  border: 1px solid rgba(95, 200, 214, 0.32);
  border-radius: 8px;
  color: #9de8d0 !important;
  background: rgba(95, 200, 214, 0.1);
  font-size: 0.82rem;
}

.record-card {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
}

.record-card.duplicate::after {
  content: "💥";
  position: absolute;
  right: -7px;
  top: -10px;
  z-index: 2;
  font-size: 1.35rem;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.55));
}

.record-card.shield-broken::before {
  content: "护盾破裂";
  position: absolute;
  left: 3px;
  top: 5px;
  z-index: 2;
  padding: 2px 5px;
  border-radius: 6px;
  color: #061614;
  background: #9de8d0;
  font-size: 0.62rem;
  font-weight: 1000;
}

.record-card .card {
  width: 96px;
}

.record-card div {
  min-height: 42px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.25;
}

.record-card em,
.bomb,
.shield-mark {
  display: inline-block;
  font-style: normal;
}

.bomb {
  color: #ffaaa4;
}

.shield-mark {
  color: #9de8d0;
}

@media (orientation: landscape) and (min-width: 900px) {
  .app-shell {
    width: min(1440px, calc(100% - 36px));
  }

  .hero {
    min-height: 170px;
    padding-block: 24px;
  }

  h1 {
    font-size: clamp(3.4rem, 7vw, 6rem);
  }

  #game {
    display: grid;
    grid-template-columns: minmax(170px, 0.44fr) minmax(620px, 1.9fr) minmax(200px, 0.58fr);
    grid-template-areas:
      "status message message"
      "scores target history"
      "scores table history"
      "scores table history"
      "summary summary summary";
    gap: 14px;
    align-items: start;
    min-height: calc(100vh - 62px);
  }

  .status-bar {
    grid-area: status;
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .message-panel {
    grid-area: message;
    margin-bottom: 0;
  }

  .scoreboard {
    grid-area: scores;
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .table {
    grid-area: table;
    grid-template-columns: minmax(280px, 1fr);
    align-items: stretch;
  }

  .history-panel {
    grid-area: history;
    margin-top: 0;
    position: sticky;
    top: 14px;
  }

  .target-panel {
    grid-area: target;
    margin-bottom: 0;
    position: sticky;
    top: 14px;
  }

  .round-summary {
    grid-area: summary;
    margin-bottom: 0;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .app-shell {
    width: min(100%, calc(100vw - 16px));
  }

  #game {
    gap: 8px;
    min-height: calc(100vh - 20px);
  }

  #game .status-bar,
  #game .message-panel,
  #game .target-panel,
  #game .history-panel,
  #game .player-card,
  #game .hand {
    padding: 9px;
    background: rgba(5, 19, 20, 0.48);
  }

  .scoreboard {
    gap: 8px;
  }

  .player-card output {
    font-size: 1.45rem;
  }

  .focus-hand {
    min-height: clamp(230px, 52vh, 330px);
  }

  .focus-hand .card {
    width: clamp(86px, 11vw, 118px);
  }

  .history-panel ol {
    max-height: 42vh;
  }
}

@media (max-width: 720px) {
  .lobby-hud,
  .lobby-menu,
  .profile-view,
  .leaderboard-summary,
  .settings-grid,
  .table-map-layout,
  .final-overview,
  .final-action-ledger ol,
  .skin-library {
    grid-template-columns: 1fr;
  }

  .skin-panel header {
    align-items: start;
    flex-direction: column;
  }

  .lobby-hud {
    gap: 10px;
  }

  .hud-actions {
    justify-content: stretch;
  }

  .hud-actions button {
    flex: 1;
  }

  .lobby-card {
    min-height: 180px;
  }

  .table-map-view {
    padding: 16px;
    border-radius: 18px;
  }

  .table-map-scroll {
    max-height: none;
    min-height: 0;
    padding: 8px;
  }

  .realm-nodes {
    grid-template-columns: 1fr;
  }

  .realm-nodes::before {
    left: 50%;
    right: auto;
    top: 18px;
    bottom: 18px;
    width: 8px;
    height: auto;
  }

  .table-map-panel {
    position: static;
  }

  .hero,
  .message-panel,
  .settings-panel,
  .round-summary header {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-card {
    display: none;
  }

  .setup-grid,
  .save-controls,
  .status-bar,
  .online-grid,
  .online-board,
  .leaderboard-tabs,
  .ai-stat-grid,
  .ai-evaluation-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-hero,
  .leaderboard-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .leaderboard-hero {
    flex-direction: column;
  }

  .leaderboard-row {
    text-align: center;
  }

  .leaderboard-rank,
  .leaderboard-avatar {
    justify-self: center;
  }

  .leaderboard-row output {
    justify-items: center;
  }

  .online-card,
  .online-board article {
    padding: 14px;
  }

  .online-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .online-actions.account-actions {
    display: flex;
  }

  .online-button,
  .online-actions button {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding-inline: 10px;
  }

  .online-countdown {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .online-users-panel {
    grid-column: auto;
  }

  .online-list-row {
    grid-template-columns: 12px 1fr;
  }

  .reconnect-ticker {
    align-items: stretch;
    flex-direction: column;
  }

  .reconnect-ticker span {
    white-space: normal;
    animation: none;
  }

  .save-item {
    align-items: stretch;
    flex-direction: column;
  }

  .save-actions {
    justify-content: stretch;
  }

  .save-actions button {
    flex: 1;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }

  .controls button {
    flex: 1 1 120px;
  }
}
