:root {
  color-scheme: dark;
  font-family: system-ui, "Microsoft JhengHei", "PingFang TC", sans-serif;
  --ink: #172331;
  --paper: #fff2d4;
  --red: #ee6b63;
  --blue: #6f9bb5;
  --ui-button: url("/assets/ui-starter-pack/button-green.png");
  --ui-button-pressed: url("/assets/ui-starter-pack/button-green-pressed.png");
  --ui-small-button: url("/assets/ui-starter-pack/small-green.png");
  --ui-small-button-pressed: url("/assets/ui-starter-pack/small-green-pressed.png");
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background: #14202b;
  color: var(--ink);
}

body.in-game {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

#menu-shell[hidden],
#game-shell[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
}

#menu-shell {
  min-height: 100dvh;
  padding: 24px;
  display: grid;
  place-items: center;
  background-color: #5d9fc5;
  background-image:
    linear-gradient(rgba(41, 116, 158, 0.64), rgba(41, 116, 158, 0.64)),
    url("/assets/dungeon/floor.png");
  background-size: auto, 64px 64px;
}

.screen {
  display: none;
  width: min(100%, 980px);
  overflow: visible;
}

.screen.active {
  display: block;
  animation: arrive 180ms ease-out;
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
}

.kenney-panel {
  position: relative;
  border: 5px solid #101820;
  border-radius: 20px;
  background: #fff7e7;
  box-shadow: inset 0 -7px 0 #dacaa9, 0 14px 0 rgba(17, 37, 52, 0.3);
  color: var(--ink);
}

.menu-panel {
  width: min(100%, 600px);
  margin: auto;
  padding: 24px clamp(18px, 5vw, 58px) 32px;
  text-align: center;
}

.menu-panel h1 {
  font-size: clamp(42px, 8vw, 68px);
  white-space: nowrap;
}

.wide-panel {
  padding: 22px clamp(16px, 4vw, 48px) 34px;
  text-align: center;
}

.screen[data-screen="lobby"] {
  width: min(100%, 1180px);
}

.ggc-panel {
  width: 100%;
  padding: 18px 24px 26px;
}

.lobby-header,
.room-heading,
.box-title-row,
.room-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.lobby-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
}

.lobby-brand {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: auto minmax(220px, auto);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 14px;
  min-width: 0;
}

.lobby-brand .eyebrow {
  grid-column: 1;
  grid-row: 1;
}

.lobby-brand h1 {
  grid-column: 1;
  grid-row: 2;
}

.lobby-header h1 {
  font-size: clamp(34px, 5vw, 54px);
  white-space: nowrap;
}

.lobby-header-stats {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  text-align: right;
}

.lobby-header .online,
.lobby-header-stats p {
  margin: 0;
  white-space: nowrap;
}

.lobby-header-stats #total-plays {
  margin-top: 5px;
  color: #9b5a2f;
  font-size: 12px;
  font-weight: 900;
}

.lobby-header-actions {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lobby-header-actions .kenney-button {
  min-width: 180px;
  min-height: 42px;
  padding: 8px 20px;
  font-size: 12px;
  text-decoration: none;
}

#benefits-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  padding: 16px;
  place-items: center;
  background: rgba(20, 32, 43, 0.82);
}

#benefits-dialog[hidden] { display: none; }

.benefits-card {
  width: min(96vw, 1180px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border: 5px solid #101820;
  border-radius: 18px;
  background: #fff7e7;
  box-shadow: 8px 10px 0 rgba(0, 0, 0, 0.28);
}

.benefits-card header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fff9e8;
}

.benefits-card h2 {
  margin: 0;
  font-size: clamp(20px, 4vmin, 30px);
}

.benefits-gallery {
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 112px);
  padding: 12px;
  overflow: auto;
}

.benefits-gallery img {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid #101820;
  border-radius: 10px;
  background: #fff;
}

.info-dialog {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  padding: 12px;
  place-items: center;
  background: rgba(20, 32, 43, 0.86);
}

.info-dialog[hidden] { display: none; }

.info-card {
  width: min(94vw, 940px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 5px solid #101820;
  border-radius: 18px;
  background: #fff7e7;
  box-shadow: 8px 10px 0 rgba(0, 0, 0, 0.28);
}

.info-card > header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fff9e8;
}

.info-card h2 { font-size: clamp(22px, 4vmin, 34px); }

.notice-card { width: min(94vw, 860px); }

.notice-list {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.notice-section {
  overflow: hidden;
  border: 4px solid #101820;
  border-radius: 13px;
  background: #fff9e8;
}

.notice-section h3 {
  margin: 0;
  padding: 9px 12px;
  color: #fff;
  font-size: clamp(18px, 3vmin, 24px);
  text-shadow: 2px 2px 0 rgba(16, 24, 32, 0.7);
}

.notice-section-latest h3 { background: #2f78a7; }
.notice-section-author h3 { background: #9b5a2f; }
.notice-section-music h3 { background: #526b48; }

.notice-entry {
  padding: 14px;
  border-top: 3px solid #d7c79d;
}

.notice-entry h4 {
  margin: 0;
  color: #172331;
  font-size: clamp(18px, 3vmin, 24px);
  line-height: 1.38;
}

.notice-entry p {
  margin: 10px 0 0;
  color: #314552;
  font-size: clamp(16px, 2.4vmin, 18px);
  line-height: 1.65;
}

.notice-empty {
  margin: 0;
  padding: 14px;
  color: #536572;
  font-size: 16px;
  font-weight: 800;
}

.step-grid,
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
}

.step-grid article,
.guide-grid article {
  min-width: 0;
  padding: 12px;
  border: 4px solid #101820;
  border-radius: 13px;
  background: #fff9e8;
  text-align: center;
}

.step-grid svg {
  display: block;
  width: 100%;
  height: 120px;
  margin: auto;
  fill: #e8f2f5;
  stroke: #2f78a7;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-grid b,
.step-grid span {
  display: block;
}

.step-grid b { margin-top: 6px; font-size: 18px; }
.step-grid span { margin-top: 5px; color: #536572; font-weight: 800; }

.guide-grid { grid-template-columns: repeat(2, 1fr); }
#game-guide-dialog .guide-grid { grid-template-columns: repeat(4, minmax(180px, 1fr)); }
.guide-mode-card {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.guide-mode-card:hover,
.guide-mode-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 0 rgba(47, 120, 167, 0.28);
}
.guide-open-prompt {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 12px;
  border: 3px solid #101820;
  border-radius: 8px;
  background: #6f9bb5;
  color: #fff;
  font-size: 14px;
}
.guide-lead {
  margin: 0 14px;
  padding: 10px 12px;
  border: 3px solid #101820;
  border-radius: 10px;
  background: #dceef5;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 900;
}
.guide-grid h3 { margin: 8px 0 4px; font-size: 20px; }
.guide-grid p { margin: 0; line-height: 1.45; font-weight: 800; }

.guide-label-visual {
  min-height: 76px;
  flex-direction: column;
  gap: 3px;
  padding: 9px;
  background: linear-gradient(145deg, #d9f1ff, #fff2bd);
  text-align: center;
}

.guide-label-visual strong { font-size: 18px; }
.guide-label-visual span { color: #526572; font-size: 13px; font-weight: 900; }

.guide-visual {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 3px solid #101820;
  border-radius: 10px;
  background: #dfe9ec;
}

.guide-visual img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  image-rendering: pixelated;
}

.guide-visual img[alt="T112 步槍"] {
  width: 82px;
  height: 42px;
}

.cake-guide-visual {
  background: linear-gradient(#91d8ef 0 55%, #79ba68 55%);
}

.cake-guide-visual span { font-size: 42px; }
.cake-guide-visual strong {
  padding: 8px;
  border-radius: 50%;
  background: #f59ab9;
  color: #fff;
  text-shadow: 2px 2px 0 #a5446e;
}
.cake-guide-visual i { font-size: 34px; font-style: normal; }
.cake-guide-visual b {
  padding: 7px 11px;
  border-radius: 8px;
  background: #845235;
  color: #fff7d1;
}

.controls-visual i,
.pickup-visual span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 4px solid #6e9cb3;
  border-radius: 50%;
  background: rgba(79, 137, 163, 0.25);
  font-style: normal;
  font-size: 11px;
  font-weight: 1000;
}

.score-visual strong,
.victory-visual span,
.victory-visual strong {
  font-weight: 1000;
}

.score-visual b,
.victory-visual b { color: #d85250; font-size: 24px; }
.victory-visual span:first-child { color: #27875a; }
.victory-visual span:last-child { color: #c74745; }
.victory-visual strong { font-size: 26px; }

.pickup-visual span {
  border-radius: 8px;
  color: #fff;
  font-size: 24px;
}

.pickup-visual span:nth-child(1) { background: #ee6b63; }
.pickup-visual span:nth-child(2) { background: #f6be55; }
.pickup-visual span:nth-child(3) { background: #a879d1; }

.lobby-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 44px auto;
  gap: 14px;
  margin-top: 16px;
}

.profile-box { grid-column: 1; grid-row: 1 / 3; }

.lobby-tabs {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.lobby-tabs .kenney-button {
  min-height: 44px;
  padding: 6px 12px 9px;
  font-size: 15px;
}

.lobby-tabs .kenney-button:not(.active) { filter: saturate(.55) brightness(.9); }

.lobby-pane {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow: visible;
}

.lobby-pane[hidden] { display: none; }

.lobby-box {
  min-width: 0;
  padding: 14px;
  border: 4px solid #101820;
  border-radius: 16px;
  background: #fff9ea;
  box-shadow: inset 0 -5px 0 rgba(112, 88, 46, 0.14);
}

.profile-box { background: #fff2bd; }
.room-browser { background: #d9f1ff; }
.chat-box { background: #e5f4cf; }

.lobby-box h2,
.lobby-box h3 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: -0.03em;
  text-shadow: 2px 2px 0 #fff;
}

.profile-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 8px;
}

.profile-box > h2,
.profile-box > .name-field,
.profile-box > .loadout-summary,
.profile-box > #game-guide-button,
.profile-box > #install-hint { grid-column: 1 / -1; }

.profile-box .loadout-summary {
  margin: 0;
}

.profile-box .kenney-button {
  width: 100%;
  padding-inline: 10px;
}

.room-browser {
  display: grid;
  grid-template-columns: minmax(210px, .85fr) minmax(260px, 1.15fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px 12px;
}

.army-life-link {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  min-width: 220px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding-inline: 8px;
  text-align: center;
  text-decoration: none;
  white-space: normal;
}

.army-life-link::after {
  position: absolute;
  inset: -3px;
  content: "";
  border: 2px solid rgba(222, 202, 255, 0.92);
  border-radius: 14px;
  pointer-events: none;
  animation: army-life-glow 1.8s ease-in-out infinite;
}

@keyframes army-life-glow {
  0%, 100% { opacity: 0.68; box-shadow: 0 0 8px 2px rgba(190, 150, 255, 0.52); }
  50% { opacity: 1; box-shadow: 0 0 20px 7px rgba(207, 176, 255, 0.88); }
}

@media (prefers-reduced-motion: reduce) {
  .army-life-link::after {
    animation: none;
    box-shadow: 0 0 12px 4px rgba(207, 176, 255, 0.72);
  }
}

.room-browser > .box-title-row { grid-column: 1 / -1; grid-row: 1; }
.room-browser > .game-mode-field { grid-column: 1; grid-row: 2; }
.room-browser > .project-disclaimer { grid-column: 1; grid-row: 3; align-self: start; }
.room-browser > .room-list { grid-column: 2; grid-row: 2 / 4; }

.room-create-controls {
  grid-column: 1 / -1;
  grid-row: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 8px;
  align-items: stretch;
}

.room-create-controls .room-name-field,
.room-create-controls .room-name-field input { min-width: 0; height: 100%; }
.room-create-controls .room-name-field input { margin: 0; }
.room-create-controls .room-actions { margin: 0; }

.compact-button {
  min-height: 42px;
  font-size: 12px;
}

.box-title-row span,
.p2p-status,
.role-badge {
  padding: 5px 9px;
  border-radius: 5px;
  background: #4f6473;
  color: #fff9e8;
  font-size: 12px;
  font-weight: 900;
}

.room-list {
  height: auto;
  min-height: 226px;
  overflow: visible;
  display: grid;
  align-content: start;
  gap: 7px;
  padding-right: 4px;
}

.empty-room-list {
  margin: auto;
  color: #647582;
  text-align: center;
  font-weight: 900;
}

.room-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 9px 14px 12px;
  border: 0;
  background: url("/assets/ui-starter-pack/button-blue.png") center / 100% 100% no-repeat;
  color: var(--ink);
  text-align: left;
  image-rendering: pixelated;
}

.room-entry:nth-child(3n + 2) {
  background-image: url("/assets/ui-starter-pack/button-green.png");
}

.room-entry:nth-child(3n) {
  background-image: url("/assets/ui-starter-pack/button-yellow.png");
}

.room-entry:active:not(:disabled) {
  transform: translateY(3px);
}

.room-entry:disabled {
  background-image: url("/assets/ui-starter-pack/button-disabled.png");
}

.room-entry strong,
.room-entry small {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.room-entry small {
  margin-top: 3px;
  color: #647582;
}

.room-entry b {
  color: #c34f4c;
  white-space: nowrap;
}

.room-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.game-mode-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 2px 0 7px;
  font-size: 14px;
  font-weight: 900;
}

.game-mode-field select,
.room-name-field input {
  width: 100%;
  min-height: 42px;
  border: 4px solid #101820;
  border-radius: 11px;
  background: #f3f3f3;
  color: var(--ink);
  font-weight: 900;
  box-shadow: inset 0 -4px 0 #d3d3d3;
}

.game-mode-field select {
  padding: 7px 28px 7px 9px;
}

.project-disclaimer {
  margin: 0 0 8px;
  color: #37474f;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.room-name-field input {
  margin-top: 8px;
  padding: 8px 10px;
}

.chat-box {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.online-roster {
  min-width: 0;
  margin: -3px 0 8px;
  padding: 6px 7px;
  border: 3px solid #101820;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
}

.online-roster > b {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.online-player-list {
  display: flex;
  min-height: 26px;
  gap: 5px;
  overflow-x: auto;
  align-items: center;
  scrollbar-width: thin;
}

.online-player-chip,
.empty-online-list {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 2px solid #101820;
  border-radius: 999px;
  background: #d9f1ff;
  color: #172331;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.online-player-chip.red { background: #ffd7cf; }
.online-player-chip.playing { box-shadow: inset 0 -3px 0 #f2be4e; }
.empty-online-list { border-style: dashed; color: #647582; }

.chat-log {
  height: 270px;
  overflow: auto;
  padding: 8px;
  border: 3px solid #101820;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.4;
}

.chat-message {
  margin: 0 0 7px;
  overflow-wrap: anywhere;
}

.chat-message b {
  color: #b94c49;
}

.chat-system {
  color: #647582;
  font-style: italic;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 8px;
}

.chat-form input {
  min-width: 0;
  padding: 8px;
  border: 3px solid #101820;
  border-radius: 10px;
  background: #f3f3f3;
  color: var(--ink);
  box-shadow: inset 0 -3px 0 #d3d3d3;
}

.chat-form .kenney-button {
  min-height: 38px;
  padding-inline: 14px;
}

.room-panel {
  max-width: 960px;
  margin: auto;
}

.room-share {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 8px 0 12px;
  padding: 7px;
  border: 3px solid #101820;
  border-radius: 13px;
  background: #f3f3f3;
  text-align: left;
}

.room-share img {
  width: 84px;
  height: 84px;
  background: #fff;
}

.room-share label,
.room-share label span {
  display: block;
}

.room-share label span {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
}

.room-share input {
  width: 100%;
  min-width: 0;
  padding: 7px;
  border: 3px solid #101820;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}

.room-share > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.room-share .kenney-button {
  min-height: 38px;
  padding: 6px 11px;
  font-size: 10px;
}

#room-share-status {
  grid-column: 1 / -1;
  min-height: 14px;
  color: #39835a;
  text-align: center;
  font-weight: 900;
}

.room-heading {
  text-align: left;
}

.role-badge.host {
  background: #d85250;
}

.p2p-status {
  margin: 12px 0;
  text-align: left;
}

.p2p-status.connected {
  background: #39835a;
}

.p2p-status.migrating {
  background: #b07b30;
}

.room-layout {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 14px;
}

.room-layout .chat-log {
  height: 220px;
}

.room-members {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 220px;
}

.room-member {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 3px solid #101820;
  border-radius: 11px;
  background: #f3f3f3;
}

.room-member img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}

.room-member small {
  color: #b94c49;
  font-weight: 900;
}

.room-member.offline {
  opacity: 0.52;
}

.room-footer {
  margin-top: 14px;
}

.room-footer #play-button {
  min-width: 220px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #9b5a2f;
  font-weight: 900;
  letter-spacing: 0.12em;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.06em;
  text-shadow: 3px 3px 0 #fff;
}

h1 {
  font-size: clamp(48px, 10vw, 86px);
}

h1 span {
  color: #d85250;
}

h2 {
  font-size: clamp(30px, 6vw, 52px);
}

.tagline {
  margin: 18px auto 24px;
  max-width: 450px;
  line-height: 1.55;
  font-weight: 700;
}

.name-field {
  display: grid;
  gap: 8px;
  text-align: left;
  font-weight: 900;
}

.name-field input {
  width: 100%;
  padding: 13px 16px;
  border: 4px solid #101820;
  border-radius: 11px;
  background: #f3f3f3;
  color: var(--ink);
  font-weight: 900;
  box-shadow: inset 0 -4px 0 #d3d3d3;
}

.loadout-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0;
}

.loadout-summary span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 6px 10px;
  border: 4px solid #101820;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 -4px 0 rgba(89, 76, 42, 0.16);
}

.loadout-summary img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.menu-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.menu-actions #play-button {
  font-size: 20px;
}

#install-button,
#game-guide-button { width: 100%; padding-inline: 12px; }

#install-hint {
  margin: 8px 0 0;
  color: #9b5a2f;
  font-size: 12px;
  font-weight: 900;
}

.kenney-button {
  --button-image: var(--ui-button);
  --button-pressed-image: var(--ui-button-pressed);
  position: relative;
  display: grid;
  min-height: 50px;
  padding: 10px 30px 13px;
  place-items: center;
  border: 0;
  background: var(--button-image) center / 100% 100% no-repeat;
  color: #172331;
  font-weight: 1000;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  text-shadow: none;
  image-rendering: pixelated;
}

.kenney-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.kenney-button:active:not(:disabled) {
  transform: translateY(3px);
  background-image: var(--button-pressed-image);
}

.kenney-button:disabled {
  cursor: not-allowed;
  background-image: url("/assets/ui-starter-pack/button-disabled.png");
  color: #52606a;
  filter: none;
  opacity: 0.82;
}

.kenney-button.secondary,
.kenney-button.tone-blue {
  --button-image: url("/assets/ui-starter-pack/button-blue.png");
  --button-pressed-image: url("/assets/ui-starter-pack/button-blue-pressed.png");
}

.kenney-button.tone-yellow {
  --button-image: url("/assets/ui-starter-pack/button-yellow.png");
  --button-pressed-image: url("/assets/ui-starter-pack/button-yellow-pressed.png");
}

.kenney-button.tone-green {
  --button-image: url("/assets/ui-starter-pack/button-green.png");
  --button-pressed-image: url("/assets/ui-starter-pack/button-green-pressed.png");
}

.kenney-button.tone-red {
  --button-image: url("/assets/ui-starter-pack/button-red.png");
  --button-pressed-image: url("/assets/ui-starter-pack/button-red-pressed.png");
}

.kenney-button.tone-pink {
  --button-image: url("/assets/ui-starter-pack/button-red.png");
  --button-pressed-image: url("/assets/ui-starter-pack/button-red-pressed.png");
  background-image: linear-gradient(rgba(215, 45, 134, 0.78), rgba(181, 25, 103, 0.78)), var(--button-image);
  background-size: 100% 100%, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat;
  filter: none;
}

.kenney-button.tone-pink:hover:not(:disabled) {
  filter: brightness(1.08);
}

.kenney-button.tone-pink:active:not(:disabled) {
  background-image: linear-gradient(rgba(215, 45, 134, 0.78), rgba(181, 25, 103, 0.78)), var(--button-pressed-image);
}

.share-reward-card { width: min(94vw, 620px); }

.share-reward-content {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 14px;
  color: #172331;
  text-align: center;
}

.share-reward-content img {
  display: block;
  width: min(100%, 340px);
  max-height: min(58dvh, 520px);
  object-fit: contain;
  border: 3px solid #101820;
  border-radius: 10px;
  background: #fff;
}

.share-reward-content p { margin: 0; font-weight: 900; }

.share-reward-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.share-reward-actions .kenney-button { min-width: 0; min-height: 48px; padding-inline: 8px; }

.kenney-button.tone-lavender {
  --button-image: url("/assets/ui-starter-pack/button-blue.png");
  --button-pressed-image: url("/assets/ui-starter-pack/button-blue-pressed.png");
  filter: hue-rotate(42deg) saturate(0.72) brightness(1.18);
}

.kenney-button.tone-lavender:hover:not(:disabled) {
  filter: hue-rotate(42deg) saturate(0.78) brightness(1.28);
}

.online {
  margin: 20px 0 0;
  font-weight: 900;
}

.online i {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 8px;
  border-radius: 50%;
  background: #44bf71;
  box-shadow: 0 0 0 4px rgba(68, 191, 113, 0.2);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 560px;
  margin: 26px 0;
  margin-inline: auto;
}

.choice-card {
  min-width: 0;
  min-height: 180px;
  padding: 22px 20px 28px;
  border: 0;
  background: url("/assets/ui-starter-pack/small-green.png") center / 100% 100% no-repeat;
  color: var(--ink);
  font-weight: 900;
  image-rendering: pixelated;
}

.choice-card:nth-child(even) {
  background-image: url("/assets/ui-starter-pack/small-red.png");
}

.choice-card.selected {
  transform: translateY(-6px);
  filter: brightness(1.12) drop-shadow(0 8px 0 rgba(16, 24, 32, 0.34));
}

.choice-card img {
  display: block;
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
  object-fit: contain;
  image-rendering: pixelated;
}

.choice-card small {
  display: block;
  min-height: 34px;
  margin-top: 8px;
  color: #172331;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.72);
}

#game-shell,
#game-root,
#game-root canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-shell,
#game-root {
  width: 100dvw;
  height: 100dvh;
}

#game-shell,
#game-root canvas {
  touch-action: none;
  overscroll-behavior: none;
}

#game-root canvas {
  image-rendering: pixelated;
}

#reverse-city-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #091117;
}

#reverse-city-frame[hidden] { display: none; }

body[data-game-mode="war-sandbox"] :is(#minimap, #combat-stats, #card-battle-hud, #frenzy-timer, #streak-banner, #desktop-controls, #touch-controls, #cake-tower-picker, #rotate-device, #game-music-button, #leave-button) { display: none !important; }

body[data-game-mode="reverse-city"] #minimap,
body[data-game-mode="frontline-bomber"] #minimap,
body[data-game-mode="crowd-runner"] #minimap,
body[data-game-mode="reverse-city"] #combat-stats,
body[data-game-mode="frontline-bomber"] #combat-stats,
body[data-game-mode="crowd-runner"] #combat-stats,
body[data-game-mode="reverse-city"] #card-battle-hud,
body[data-game-mode="frontline-bomber"] #card-battle-hud,
body[data-game-mode="crowd-runner"] #card-battle-hud,
body[data-game-mode="reverse-city"] #frenzy-timer,
body[data-game-mode="frontline-bomber"] #frenzy-timer,
body[data-game-mode="crowd-runner"] #frenzy-timer,
body[data-game-mode="reverse-city"] #streak-banner,
body[data-game-mode="frontline-bomber"] #streak-banner,
body[data-game-mode="crowd-runner"] #streak-banner,
body[data-game-mode="reverse-city"] #desktop-controls,
body[data-game-mode="frontline-bomber"] #desktop-controls,
body[data-game-mode="crowd-runner"] #desktop-controls,
body[data-game-mode="reverse-city"] #touch-controls,
body[data-game-mode="frontline-bomber"] #touch-controls,
body[data-game-mode="crowd-runner"] #touch-controls,
body[data-game-mode="reverse-city"] #cake-tower-picker,
body[data-game-mode="frontline-bomber"] #cake-tower-picker,
body[data-game-mode="crowd-runner"] #cake-tower-picker,
body[data-game-mode="reverse-city"] #rotate-device,
body[data-game-mode="frontline-bomber"] #rotate-device,
body[data-game-mode="crowd-runner"] #rotate-device,
body[data-game-mode="reverse-city"] #game-music-button,
body[data-game-mode="frontline-bomber"] #game-music-button,
body[data-game-mode="crowd-runner"] #game-music-button {
  display: none !important;
}

body[data-game-mode="shooting"] #game-root canvas,
body[data-game-mode="cake-defense"] #game-root canvas {
  image-rendering: auto;
}

body[data-game-mode="cake-defense"] #combat-stats {
  border-color: #ffd4e4;
  background: rgba(72, 36, 62, 0.78);
}

body[data-game-mode="cake-defense"] #combat-stats strong {
  color: #ffb9d3;
}

body[data-game-mode="cake-defense"] #dash-button {
  display: none;
}

#minimap,
#combat-stats,
.controls,
#frenzy-timer,
#streak-banner,
#connection-banner,
#game-music-button,
#leave-button {
  position: fixed;
  z-index: 5;
  color: #fff;
  text-shadow: 2px 2px 0 #162331;
}

#minimap {
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  width: clamp(104px, 16vw, 132px);
  aspect-ratio: 5 / 3;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    rgba(20, 32, 43, 0.72);
  background-size: 20% 20%;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.24);
}

.minimap-title {
  position: absolute;
  top: 3px;
  left: 5px;
  z-index: 2;
  font-size: 9px;
  font-weight: 900;
}

.minimap-base,
.minimap-dot {
  position: absolute;
  transform: translate(-50%, -50%);
}

.minimap-base {
  top: 50%;
  width: 12px;
  height: 18px;
  border: 2px solid #fff;
}

.minimap-base.green { left: 7.5%; background: #36cf83; }
.minimap-base.red { left: 92.5%; background: #ee5c58; }

.minimap-dot {
  z-index: 3;
  width: 6px;
  height: 6px;
  border: 1px solid #fff;
  border-radius: 50%;
}

.minimap-dot[data-faction="green"] { background: #36cf83; }
.minimap-dot[data-faction="red"] { background: #ee5c58; }
.minimap-dot.local { width: 9px; height: 9px; box-shadow: 0 0 0 2px #f6d65f; }
.minimap-dot.dead { opacity: 0.3; }

#combat-stats {
  top: max(10px, env(safe-area-inset-top));
  right: max(76px, calc(env(safe-area-inset-right) + 68px));
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 6px 10px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(20, 32, 43, 0.72);
  text-align: right;
}

#combat-stats strong { color: #f6d65f; font-size: 13px; }
#combat-stats span { font-size: 11px; font-weight: 900; }

.controls {
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 9px 14px;
  background: rgba(20, 32, 43, 0.84);
  white-space: nowrap;
  font-size: 13px;
}

#frenzy-timer,
#streak-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  border: 3px solid #fff;
  background: rgba(20, 32, 43, 0.88);
  color: #fff;
  font-weight: 900;
  text-align: center;
  text-shadow: 2px 2px 0 #162331;
  pointer-events: none;
}

#frenzy-timer {
  top: max(12px, env(safe-area-inset-top));
  padding: 7px 12px;
  font-size: 13px;
}

.frenzy-active #frenzy-timer {
  border-color: #ffe172;
  background: rgba(190, 48, 43, 0.92);
  color: #fff3a0;
}

#streak-banner {
  top: calc(max(8px, env(safe-area-inset-top)) + 64px);
  width: max-content;
  max-width: min(72vw, 440px);
  padding: 7px 12px;
  border-color: #f6be55;
  color: #f6be55;
  font-size: clamp(18px, 5vmin, 24px);
}

#streak-banner[hidden] { display: none; }

#connection-banner {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: min(84vw, 380px);
  padding: 132px 22px 18px;
  border: 4px solid #fff;
  background: #d85250 url("/assets/brand/app-logo.jpg") center 14px / 92px 92px no-repeat;
  font-weight: 900;
  text-align: center;
}

#connection-banner::before {
  position: absolute;
  top: 108px;
  right: 12px;
  left: 12px;
  content: "我要簽下去online";
  color: #fff;
  font-size: 16px;
  font-weight: 1000;
  text-shadow: 2px 2px 0 #14202b;
}

#touch-controls,
#cake-tower-picker,
#rotate-device,
#orientation-lock,
#browser-warning {
  display: none;
}

#browser-warning[hidden] { display: none; }

#victory-summary,
#death-summary {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 32, 43, 0.7);
  pointer-events: auto;
}

#victory-summary[hidden],
#death-summary[hidden] {
  display: none;
}

.victory-summary-card {
  width: min(90vw, 520px);
  padding: 24px 34px 28px;
  text-align: center;
}

.victory-summary-card h2 {
  color: #d85250;
  font-size: clamp(30px, 8vmin, 48px);
}

.victory-summary-card p {
  margin: 12px 0 18px;
  font-size: 18px;
  font-weight: 900;
}

.death-summary-card {
  width: min(94vw, 620px);
  padding: 18px 28px 20px;
  text-align: center;
}

.death-summary-card h2 {
  font-size: clamp(28px, 8vmin, 46px);
}

.death-thanks {
  margin: -4px 0 8px;
  color: #9b5a2f;
  font-weight: 900;
}

.discharge-identity {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.discharge-identity span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 3px solid #4f6473;
  font-weight: 900;
}

.discharge-identity b { color: #9b5a2f; }

.death-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.death-stats span {
  display: grid;
  gap: 4px;
  padding: 8px 5px;
  border: 4px solid #4f6473;
  background: #fff9e8;
  font-size: 13px;
  font-weight: 900;
}

.death-stats b {
  color: #d85250;
  font-size: 19px;
}

#death-return-button { margin-top: 14px; }

#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

#cake-tower-picker {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  width: min(440px, 54vw);
  transform: translateX(-50%);
  pointer-events: auto;
}

body[data-game-mode="cake-defense"] #cake-tower-picker {
  display: grid;
}

#cake-tower-picker button {
  --tower-image: url("/assets/ui-starter-pack/small-blue.png");
  --tower-pressed-image: url("/assets/ui-starter-pack/small-blue-pressed.png");
  min-width: 0;
  min-height: 54px;
  padding: 8px 4px 10px;
  border: 0;
  background: var(--tower-image) center / 100% 100% no-repeat;
  color: #172331;
  font: 900 12px/1.08 system-ui, "Microsoft JhengHei", sans-serif;
  text-align: center;
  text-shadow: none;
  image-rendering: pixelated;
}

#cake-tower-picker button:nth-child(1) {
  --tower-image: url("/assets/ui-starter-pack/small-blue.png");
  --tower-pressed-image: url("/assets/ui-starter-pack/small-blue-pressed.png");
}
#cake-tower-picker button:nth-child(2) {
  --tower-image: url("/assets/ui-starter-pack/small-green.png");
  --tower-pressed-image: url("/assets/ui-starter-pack/small-green-pressed.png");
}
#cake-tower-picker button:nth-child(3) {
  --tower-image: url("/assets/ui-starter-pack/small-yellow.png");
  --tower-pressed-image: url("/assets/ui-starter-pack/small-yellow-pressed.png");
}
#cake-tower-picker button:nth-child(4) {
  --tower-image: url("/assets/ui-starter-pack/small-red.png");
  --tower-pressed-image: url("/assets/ui-starter-pack/small-red-pressed.png");
}

#cake-tower-picker button span {
  display: block;
  margin-top: 3px;
  color: #273946;
  font-size: 11px;
}

#cake-tower-picker button[aria-pressed="true"] {
  transform: translateY(-4px);
  filter: drop-shadow(0 4px 0 #fff) drop-shadow(0 0 4px #f6d65f);
}

#cake-tower-picker button:active:not(:disabled) {
  background-image: var(--tower-pressed-image);
}

#cake-tower-picker button:disabled {
  background-image: url("/assets/ui-starter-pack/small-disabled.png");
  color: #52606a;
  cursor: not-allowed;
  filter: none;
  opacity: 0.78;
}

body[data-game-mode="cake-defense"] #desktop-controls { bottom: 76px; }

.virtual-stick {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: clamp(124px, 34vmin, 150px);
  height: clamp(124px, 34vmin, 150px);
  border: 0;
  border-radius: 28%;
  background:
    url("/assets/ui-starter-pack/small-blue.png") center / 100% 100% no-repeat;
  box-shadow: none;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#move-stick {
  left: max(18px, env(safe-area-inset-left));
}

.virtual-stick span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #162331;
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52%;
  height: 52%;
  transform: translate(-50%, -50%);
  border: 4px solid #fff;
  border-radius: 50%;
  background: #6f9bb5;
  box-shadow: inset 0 -7px 0 rgba(31, 65, 83, 0.35), 3px 4px 0 rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

#attack-button {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  width: clamp(124px, 34vmin, 150px);
  height: clamp(124px, 34vmin, 150px);
  place-content: center;
  gap: 3px;
  border: 0;
  border-radius: 28%;
  background:
    url("/assets/ui-starter-pack/small-red.png") center / 100% 100% no-repeat;
  color: #fff;
  box-shadow: none;
  text-shadow: 2px 2px 0 #7b1f27;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#attack-button b { font-size: clamp(20px, 5vmin, 28px); }
#attack-button span { font-size: 10px; font-weight: 900; }
#attack-button.active {
  background-image: url("/assets/ui-starter-pack/small-red-pressed.png");
}

#dash-button {
  position: fixed;
  left: auto;
  right: calc(max(14px, env(safe-area-inset-right)) + clamp(124px, 34vmin, 150px) + 9px);
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
  display: grid;
  width: clamp(60px, 15vmin, 74px);
  height: clamp(60px, 15vmin, 74px);
  place-content: center;
  gap: 2px;
  border: 0;
  border-radius: 28%;
  background:
    url("/assets/ui-starter-pack/small-yellow.png") center / 100% 100% no-repeat;
  color: #172331;
  box-shadow: none;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

#dash-button b { font-size: 14px; }
#dash-button span { font-size: 9px; font-weight: 900; }
#dash-button.cooldown {
  background-image: url("/assets/ui-starter-pack/small-disabled.png");
  color: #52606a;
}
#dash-button:active {
  transform: translateY(3px);
  background-image: url("/assets/ui-starter-pack/small-yellow-pressed.png");
}

#rotate-device {
  position: fixed;
  inset: 0;
  z-index: 30;
  place-content: center;
  gap: 16px;
  padding: 32px;
  background: #14202b;
  color: #fff;
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  pointer-events: auto;
}

#rotate-device b {
  font-size: 72px;
  line-height: 1;
}

#orientation-lock,
#browser-warning {
  position: fixed;
  inset: 0;
  z-index: 200;
  place-content: center;
  gap: 16px;
  padding: 24px;
  background: #14202b;
  color: #fff;
  text-align: center;
  pointer-events: auto;
}

#orientation-lock b {
  font-size: 72px;
  line-height: 1;
}

#browser-warning {
  z-index: 210;
}

#browser-warning:not([hidden]) {
  display: grid;
}

.browser-warning-card {
  width: min(92vw, 620px);
  padding: 24px;
  text-align: center;
}

.browser-warning-card h2 {
  margin: 0 0 12px;
  font-size: clamp(24px, 5vmin, 38px);
}

.browser-warning-card p {
  max-width: 520px;
  margin: 0 auto 16px;
  font-size: 16px;
  line-height: 1.6;
}

.browser-warning-card .kenney-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.browser-warning-card .browser-warning-note {
  margin-bottom: 0;
  color: #c9d9e2;
  font-size: 14px;
}

#leave-button {
  left: 18px;
  bottom: 18px;
  padding: 8px 12px;
  min-width: 72px;
  min-height: 52px;
  border: 0;
  background: url("/assets/ui-starter-pack/button-red.png") center / 100% 100% no-repeat;
  color: #172331;
  font-weight: 900;
  text-shadow: none;
  image-rendering: pixelated;
}

#game-music-button {
  left: 98px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border: 0;
  background: url("/assets/ui-starter-pack/button-blue.png") center / 100% 100% no-repeat;
  color: #172331;
  font-weight: 900;
  text-shadow: none;
  image-rendering: pixelated;
}

@media (max-width: 720px) {
  #menu-shell { padding: 10px; }
  .room-layout { grid-template-columns: 1fr; }
  .lobby-header { grid-template-columns: 1fr auto; }
  .lobby-header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 0 4px 4px;
  }
  .lobby-header-actions .kenney-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 4px 3px 7px;
    font-size: 11px;
    line-height: 1.1;
    white-space: normal;
  }
  .share-reward-actions { grid-template-columns: 1fr; }
  .lobby-header-stats { grid-column: 2; grid-row: 1; }
  .step-grid,
  .guide-grid { grid-template-columns: 1fr; }
  .room-list,
  .chat-log { height: 210px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .choice-card img { width: 68px; height: 68px; }
  .controls { display: none; }
}

@media (orientation: landscape) and (max-height: 520px),
  (orientation: landscape) and (hover: none) and (pointer: coarse) {
  #menu-shell { padding: 4px; }
  .ggc-panel { padding: 4px 9px 8px; border-width: 4px; }
  .lobby-header .eyebrow { margin-bottom: 2px; font-size: 12px; }
  .lobby-header h1 { font-size: 34px; }
  .lobby-header .online { font-size: 12px; }
  .lobby-header {
    grid-template-columns: minmax(170px, 1fr) auto;
  }
  .lobby-header-stats {
    grid-column: 2;
    grid-row: 1;
  }
  .lobby-header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
    padding: 0 4px 4px;
  }
  .lobby-header-actions .kenney-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 4px 3px 7px;
    font-size: 11px;
    line-height: 1.1;
    white-space: normal;
  }
  @media (max-width: 720px) {
    .lobby-header-actions .kenney-button {
      flex: 1 1 0;
      min-width: 0;
      width: auto;
      padding-inline: 5px;
    }
  }
  .lobby-header-stats #total-plays { margin-top: 2px; font-size: 9px; }
  .benefits-card { max-height: calc(100dvh - 12px); }
  .benefits-card header { padding: 4px 7px; }
  .benefits-card header .kenney-button { min-height: 44px; font-size: 12px; }
  .benefits-gallery { max-height: calc(100dvh - 72px); padding: 6px; }
  .info-card { max-height: calc(100dvh - 12px); }
  .info-card > header { padding: 4px 7px; }
  .info-card > header .kenney-button { min-height: 44px; font-size: 12px; }
  .notice-list { gap: 7px; padding: 7px; }
  .notice-section h3 { padding: 6px 8px; }
  .notice-entry { padding: 9px; }
  .notice-entry p { margin-top: 6px; }
  .step-grid,
  .guide-grid {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 6px;
    padding: 6px;
    overflow-x: auto;
  }
  .guide-lead {
    display: none;
  }
  .guide-grid { grid-template-columns: repeat(6, minmax(230px, 1fr)); }
  #game-guide-dialog .guide-grid { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
  .game-guide-detail .guide-grid { grid-template-columns: repeat(3, minmax(230px, 1fr)); }
  @media (max-width: 720px) {
    #game-guide-dialog .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  .step-grid article,
  .guide-grid article { padding: 6px; }
  .step-grid svg { height: 74px; }
  .step-grid b { font-size: 14px; }
  .step-grid span { font-size: 11px; }
  .guide-grid p { font-size: 14px; }
  .guide-visual { min-height: 68px; }
  .guide-visual img { width: 42px; height: 42px; }
  .guide-visual img[alt="T112 步槍"] { width: 58px; height: 30px; }
  .controls-visual i,
  .pickup-visual span { width: 42px; height: 42px; font-size: 9px; }
  .lobby-grid {
    grid-template-columns: minmax(170px, 0.72fr) minmax(0, 1.55fr);
    grid-template-rows: 44px auto;
    gap: 6px;
    margin-top: 5px;
  }
  .lobby-tabs { gap: 5px; }
  .lobby-tabs .kenney-button { font-size: 14px; }
  .lobby-box { padding: 7px; border-width: 3px; }
  .lobby-box h2,
  .lobby-box h3 { margin-bottom: 5px; font-size: 16px; }
  .profile-box { gap: 4px; }
  .profile-box .name-field { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 5px; font-size: 12px; }
  .profile-box .name-field input { min-height: 44px; padding: 5px 7px; border-width: 2px; font-size: 12px; }
  .profile-box .loadout-summary span { min-height: 40px; padding: 1px; border-width: 3px; font-size: 12px; }
  .profile-box .loadout-summary img { width: 34px; height: 34px; }
  .profile-box .kenney-button { min-height: 44px; font-size: 13px; }
  .room-list,
  .chat-log { height: 126px; font-size: 12px; line-height: 1.3; }
  .room-browser { grid-template-columns: minmax(145px, .82fr) minmax(175px, 1.18fr); grid-template-rows: 44px 44px minmax(0, 1fr) 44px; gap: 4px 6px; }
  .room-browser .room-list { height: auto; min-height: 226px; overflow: visible; }
  .army-life-link { min-height: 44px; padding: 3px 5px; font-size: 12px; line-height: 1.2; }
  .room-entry { min-height: 46px; padding: 4px 6px; border-width: 2px; font-size: 12px; }
  .room-actions { gap: 4px; margin-top: 4px; }
  .game-mode-field { gap: 4px; margin: 0 0 4px; font-size: 14px; }
  .game-mode-field select { min-height: 44px; padding: 4px 22px 4px 6px; font-size: 14px; }
  .project-disclaimer { margin-bottom: 0; font-size: 11px; line-height: 1.25; overflow: auto; }
  .room-name-field input { min-height: 44px; margin-top: 4px; padding: 5px 6px; border-width: 2px; font-size: 12px; }
  .room-create-controls { grid-template-columns: minmax(0, 1fr) minmax(190px, 1fr); gap: 5px; }
  .room-create-controls .room-name-field input { margin: 0; }
  .room-create-controls .room-actions { margin: 0; }
  .room-actions .kenney-button,
  .chat-form .kenney-button { min-height: 44px; padding-inline: 8px; font-size: 13px; }
  .chat-form { gap: 3px; margin-top: 3px; }
  .chat-form input { min-height: 44px; padding: 5px 6px; border-width: 2px; font-size: 12px; }
  .room-panel { padding: 4px 10px 8px; border-width: 4px; }
  .room-heading h2 { font-size: 24px; }
  .p2p-status { margin: 3px 0; padding: 4px 7px; font-size: 11px; }
  .room-share {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 5px;
    margin: 3px 0 4px;
    padding: 3px;
    border-width: 2px;
  }
  .room-share img { width: 46px; height: 46px; }
  .room-share label span { margin-bottom: 2px; font-size: 9px; }
  .room-share input { padding: 3px 5px; border-width: 2px; font-size: 10px; }
  .room-share .kenney-button { min-height: 44px; padding: 5px 8px; font-size: 11px; }
  #room-share-status { min-height: 9px; font-size: 8px; }
  .room-layout { grid-template-columns: 0.8fr 1.2fr; gap: 6px; }
  .room-layout .chat-log,
  .room-members { height: 62px; min-height: 0; }
  .room-member { grid-template-columns: 32px 1fr auto; gap: 5px; padding: 4px; border-width: 2px; font-size: 11px; }
  .room-member img { width: 30px; height: 30px; }
  .room-footer { margin-top: 4px; }
  .room-footer .kenney-button { min-height: 44px; font-size: 13px; }
  .menu-panel {
    padding: 3px 16px 8px;
    border-width: 4px;
  }
  .menu-panel .eyebrow { margin-bottom: 2px; font-size: 12px; }
  .menu-panel h1 { font-size: 38px; }
  .menu-panel .tagline { margin: 5px auto 7px; font-size: 12px; line-height: 1.25; }
  .menu-panel .name-field { gap: 2px; font-size: 12px; }
  .menu-panel .name-field input { padding: 6px 10px; border-width: 3px; }
  .menu-panel .loadout-summary { gap: 7px; margin: 6px 0; }
  .menu-panel .loadout-summary span { min-height: 42px; padding: 2px 6px; border-width: 3px; }
  .menu-panel .loadout-summary img { width: 32px; height: 32px; }
  .menu-panel .menu-actions { gap: 7px; }
  .menu-panel #install-button { font-size: 12px; }
  .menu-panel #install-hint { margin-top: 4px; font-size: 10px; }
  .menu-panel .kenney-button { min-height: 44px; }
  .menu-panel .online { margin-top: 6px; font-size: 11px; }
  #touch-controls { display: block; }
  #cake-tower-picker {
    bottom: max(7px, env(safe-area-inset-bottom));
    gap: 3px;
    width: min(410px, 54vw);
  }
  #cake-tower-picker button {
    min-height: 52px;
    padding: 7px 2px 9px;
    font-size: 12px;
  }
  #cake-tower-picker button span {
    margin-top: 2px;
    font-size: 10px;
  }
  .controls { display: none; }
  #minimap { width: clamp(96px, 25vmin, 112px); }
  #combat-stats { min-width: 132px; padding: 4px 7px; }
  #combat-stats strong { font-size: 11px; }
  #combat-stats span { font-size: 9px; }
  #leave-button {
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    top: max(8px, env(safe-area-inset-top));
    bottom: auto;
    min-width: 46px;
    min-height: 46px;
  }
  #game-music-button {
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    top: calc(max(8px, env(safe-area-inset-top)) + 54px);
    bottom: auto;
    width: 46px;
    height: 46px;
  }
  #frenzy-timer {
    top: max(7px, env(safe-area-inset-top));
    padding: 5px 9px;
    font-size: 11px;
  }
  .death-summary-card { padding: 8px 18px 11px; }
  .death-summary-card h2 { font-size: 28px; }
  .discharge-identity { margin-top: 7px; }
  .discharge-identity span { padding: 5px 8px; }
  .death-stats { margin-top: 10px; }
  .death-stats span { padding: 5px 4px; }
  .death-stats b { font-size: 16px; }
  #death-return-button { min-height: 44px; margin-top: 8px; }
}

@media (orientation: portrait) and (hover: none) and (pointer: coarse) {
  body.in-game #orientation-lock { display: grid; }
  body.in-game #rotate-device { display: grid; }
  #touch-controls { display: none; }
}

#card-battle-hud,
#card-battle-hud[hidden] {
  position: fixed;
  inset: 0;
  z-index: 9;
  color: #fff9e8;
  text-shadow: 2px 2px 0 #162331;
  pointer-events: none;
}

#card-battle-hud[hidden] { display: none; }

body[data-game-mode="card-battle"] #card-battle-hud { display: block; }
body[data-game-mode="card-battle"] #touch-controls,
body[data-game-mode="card-battle"] #cake-tower-picker,
body[data-game-mode="card-battle"] #combat-stats,
body[data-game-mode="card-battle"] #minimap,
body[data-game-mode="card-battle"] #frenzy-timer {
  display: none;
}

body[data-game-mode="card-battle"] #game-root canvas {
  image-rendering: auto;
}

.card-battle-topline {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  grid-template-columns: auto minmax(190px, auto) auto;
  align-items: center;
  gap: 10px;
  width: min(92vw, 640px);
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 3px solid rgba(255, 255, 255, 0.86);
  background: rgba(20, 32, 43, 0.82);
  text-align: center;
}

#card-battle-timer {
  color: #f6d65f;
  font-size: 20px;
}

#card-battle-towers,
#card-battle-energy {
  font-size: 13px;
  font-weight: 900;
}

#card-battle-energy { color: #9fe4ff; }

#card-battle-status {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top) + 44px));
  left: 50%;
  margin: 0;
  padding: 4px 9px;
  transform: translateX(-50%);
  background: rgba(20, 32, 43, 0.68);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

#card-battle-hand {
  position: absolute;
  bottom: max(7px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 82px));
  gap: 6px;
  width: min(92vw, 360px);
  transform: translateX(-50%);
  pointer-events: auto;
}

.card-battle-card {
  display: grid;
  grid-template-rows: 32px auto auto auto;
  min-width: 0;
  min-height: 76px;
  padding: 7px 4px 5px;
  border: 3px solid #fff9e8;
  border-radius: 8px;
  background: linear-gradient(160deg, #315c74, #1c3446);
  box-shadow: 3px 3px 0 rgba(20, 32, 43, 0.58);
  color: #fff9e8;
  font: 900 12px/1.1 system-ui, "Microsoft JhengHei", sans-serif;
  text-shadow: 1px 1px 0 #162331;
  text-align: center;
  touch-action: manipulation;
}

.card-battle-card img {
  width: 100%;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(1px 2px 0 rgba(20, 32, 43, 0.45));
}

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

.card-battle-card span {
  color: #9fe4ff;
  font-size: 11px;
}

.card-battle-card small {
  color: #ffe9a6;
  font-size: 9px;
}

.card-battle-card[aria-pressed="true"] {
  transform: translateY(-6px);
  border-color: #f6d65f;
  box-shadow: 3px 7px 0 rgba(20, 32, 43, 0.58), 0 0 12px rgba(246, 214, 95, 0.75);
}

.card-battle-card:disabled {
  filter: grayscale(0.8);
  opacity: 0.54;
}

@media (max-width: 620px) {
  .card-battle-topline {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px;
    width: min(96vw, 520px);
    padding: 5px 6px;
  }
  #card-battle-towers,
  #card-battle-energy { font-size: 10px; }
  #card-battle-timer { font-size: 17px; }
  #card-battle-status { font-size: 10px; }
  #card-battle-hand { gap: 4px; width: min(96vw, 340px); }
  .card-battle-card { min-height: 76px; padding: 5px 2px 4px; font-size: 11px; }
  .card-battle-card img { height: 32px; }
  .card-battle-card span { font-size: 10px; }
  .card-battle-card small { font-size: 8px; }
}

@media (orientation: landscape) and (max-width: 720px) and (max-height: 520px),
  (orientation: landscape) and (max-width: 720px) and (hover: none) and (pointer: coarse) {
  .lobby-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px 48px;
    gap: 5px;
    align-items: stretch;
  }
  .lobby-brand {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: auto minmax(150px, 1fr);
    grid-template-rows: 44px;
    align-self: stretch;
    gap: 4px;
    min-width: 0;
  }
  .lobby-header .eyebrow { display: none; }
  .lobby-header h1 { grid-column: 1; grid-row: 1; align-self: center; overflow-wrap: normal; font-size: 23px; line-height: 1; }
  .lobby-brand .army-life-link { grid-column: 2; grid-row: 1; min-width: 0; min-height: 44px; padding: 4px 5px 7px; font-size: 11px; line-height: 1.05; }
  .lobby-header-stats {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    display: flex;
    gap: 5px;
    min-width: 0;
    text-align: left;
  }
  .lobby-header .online,
  .lobby-header-stats #total-plays { margin: 0; font-size: 8px; line-height: 1; }
  .lobby-header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    min-width: 0;
    padding: 0 4px 4px;
  }
  .lobby-header-actions .kenney-button,
  .lobby-header-actions #music-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 4px 2px 7px;
    font-size: 11px;
    line-height: 1.1;
    white-space: normal;
  }
}

@media (orientation: portrait) and (max-width: 1024px) {
  body[data-menu-screen="lobby"]:not(.in-game) { overflow-x: hidden; }

  #menu-shell {
    min-height: 100dvh;
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    place-items: start center;
  }

  .screen[data-screen="lobby"],
  .screen[data-screen="room"] {
    width: 100%;
    min-width: 0;
  }

  .ggc-panel,
  .room-panel {
    width: 100%;
    min-width: 0;
    padding: 10px 8px 16px;
    border-width: 4px;
    border-radius: 14px;
  }

  .lobby-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 8px;
  }

  .lobby-brand {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 4px;
    text-align: center;
  }

  .lobby-header .eyebrow {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.05em;
  }

  .lobby-header h1 {
    grid-column: 1;
    grid-row: 2;
    font-size: clamp(30px, 10vw, 42px);
    line-height: 1;
    white-space: normal;
  }

  .lobby-brand .army-life-link {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
    min-width: 0;
  }

  .lobby-header-stats {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    text-align: left;
  }

  .lobby-header-stats #total-plays { margin-top: 0; text-align: right; }

  .lobby-header-actions {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0;
  }

  .lobby-header-actions .kenney-button,
  .lobby-header-actions #music-button {
    min-width: 0;
    min-height: 44px;
    padding: 6px 5px 9px;
    font-size: 12px;
    white-space: normal;
  }

  .lobby-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 10px;
    margin-top: 10px;
  }

  .profile-box { grid-column: 1; grid-row: 1; }
  .lobby-tabs { grid-column: 1; grid-row: 2; }
  .lobby-pane { grid-column: 1; grid-row: 3; }

  .lobby-tabs .kenney-button,
  .profile-box .kenney-button,
  .room-actions .kenney-button,
  .chat-form .kenney-button,
  .room-footer .kenney-button { min-height: 44px; }

  .room-browser {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto;
    gap: 8px;
  }

  .room-browser > .box-title-row { grid-column: 1; grid-row: 1; }
  .room-browser > .game-mode-field { grid-column: 1; grid-row: 2; }
  .room-browser > .project-disclaimer { grid-column: 1; grid-row: 3; }
  .room-browser > .room-list { grid-column: 1; grid-row: 4; min-height: 180px; }

  .room-create-controls {
    grid-column: 1;
    grid-row: 5;
    grid-template-columns: minmax(0, 1fr);
  }

  .game-mode-field { grid-template-columns: minmax(0, 1fr); gap: 4px; }

  .game-mode-field select,
  .room-name-field input,
  .chat-form input { min-height: 44px; }

  .chat-log { height: 260px; }
  .room-heading { align-items: flex-start; }
  .room-heading h2 { overflow-wrap: anywhere; }

  .room-share {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
  }

  .room-share img { width: 64px; height: 64px; }
  .room-share > div { grid-column: 1 / -1; }
  .room-share .kenney-button { min-height: 44px; }
  .room-layout { grid-template-columns: minmax(0, 1fr); }
  .room-members,
  .room-layout .chat-log { height: 220px; }

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

  .room-footer #play-button { min-width: 0; }

  .info-dialog {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .info-card,
  .notice-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-width: 4px;
    border-radius: 14px;
  }

  .info-card > header { gap: 8px; padding: 7px 8px; }
  .info-card > header .kenney-button { min-height: 44px; }
  .notice-list { gap: 9px; padding: 8px; }
}

/* Play-first lobby: game selection precedes profile and community tools. */
body[data-menu-screen="lobby"] #menu-shell {
  background: radial-gradient(ellipse at 85% 0, #234c49, transparent 55%), #101d29;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  place-items: start center;
}
.screen[data-screen="lobby"] { width: min(100%, 1120px); }
.ggc-panel { background: transparent; border: 0; box-shadow: none; padding: 0; color: #edf5f3; }
.ggc-panel .lobby-header { display: block; border: 0; padding: 0 0 20px; }
.ggc-panel .lobby-brand { display: block; text-align: left; }
.ggc-panel .lobby-brand h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.15; margin: 4px 0; color: #f4f8f5; text-shadow: none; }
.ggc-panel .lobby-brand h1 span { font-size: 12px; letter-spacing: .15em; color: #9be2bf; vertical-align: middle; }
.ggc-panel .lobby-brand .eyebrow { color: #b4c6ca; font-size: 12px; }
.ggc-panel .lobby-brand .army-life-link { display: none; }
.portal-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.portal-kicker { margin: 0 0 6px; color: #9be2bf; font-size: 12px; letter-spacing: .14em; }
.portal-heading h2 { margin: 0; font-size: clamp(24px, 4vw, 32px); color: #f4f8f5; }
.ggc-panel h2 { text-shadow: none; }
#graphics-quality { min-width: 0; min-height: 44px; width: 100%; font-size: 14px; }
.portal-heading > span { font-size: 13px; color: #afc1c7; }
.featured-game { position: relative; display: flex; justify-content: space-between; gap: 20px; overflow: hidden; padding: 28px; border: 1px solid #658676; border-radius: 20px; color: #102d25; text-decoration: none; background: linear-gradient(110deg, #dbf2cf, #a9d6c2); }
.featured-copy { display: grid; gap: 10px; position: relative; z-index: 1; }
.featured-copy small { font-size: 13px; font-weight: 700; }
.featured-copy strong { font-size: clamp(24px, 4vw, 34px); }
.featured-copy > span { font-size: 15px; line-height: 1.6; max-width: 440px; }
.featured-copy b { padding: 12px 22px; border-radius: 10px; background: #173f35; color: #fff; width: fit-content; font-size: 17px; }
.featured-art { flex: 0 0 190px; display: grid; place-items: center; position: relative; font-size: 100px; color: #2c6557; transform: rotate(-12deg); border: 2px solid #609e86; border-radius: 50%; }
.featured-art i { position: absolute; width: 74px; height: 10px; background: #2c6557; bottom: 27px; transform: rotate(-10deg); }
.featured-art i:nth-child(2) { bottom: 42px; width: 92px; }
.featured-art i:nth-child(3) { bottom: 57px; width: 110px; }
.game-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.game-card { --accent: #9be2bf; display: flex; flex-direction: column; padding: 0; overflow: hidden; min-width: 0; border: 1px solid #3a4e5a; border-radius: 16px; background: #1b2d3a; color: #f3f7f6; text-align: left; transition: border-color .15s, transform .15s; }
.game-card[data-tone="sky"] { --accent: #9ad2ee; }
.game-card[data-tone="gold"] { --accent: #f1d393; }
.game-card[data-tone="olive"] { --accent: #c3d996; }
.game-card[data-tone="coral"] { --accent: #f2b2a5; }
.game-card[data-tone="violet"] { --accent: #c8b9ef; }
.game-card-art { display: grid; place-items: center; height: 82px; width: 100%; font-size: 60px; line-height: 1; color: var(--accent); background: repeating-linear-gradient(135deg, transparent 0 18px, #ffffff05 18px 20px), linear-gradient(135deg, #253f49, #162731); border-bottom: 1px solid #3a4e5a; }
.game-card-copy { display: flex; flex-direction: column; gap: 8px; padding: 18px; flex: 1; }
.game-card-copy small { color: var(--accent); font-size: 12px; }
.game-card-copy strong { font-size: 21px; }
.game-card-copy > span { color: #bed0d8; font-size: 14px; line-height: 1.65; flex: 1; }
.game-card-copy b { display: flex; justify-content: space-between; font-size: 16px; padding-top: 8px; color: var(--accent); }
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.game-card:active { transform: translateY(1px); }
.game-card:disabled { opacity: .55; cursor: wait; transform: none; }
.game-card:focus-visible, .featured-game:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
#launch-status { font-size: 14px; line-height: 1.5; color: #bed0d8; min-height: 22px; margin: 14px 0 24px; }
.ggc-panel .lobby-grid { border-top: 1px solid #3a4e5a; padding-top: 24px; }
.ggc-panel .lobby-box { color: #172331; }
.lobby-extras { margin-top: 24px; border-top: 1px solid #3a4e5a; padding-top: 20px; display: grid; gap: 16px; }
.lobby-extras .lobby-header-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; grid-column: auto; grid-row: auto; }
.lobby-extras .lobby-header-stats { display: flex; gap: 16px; justify-content: space-between; grid-column: auto; grid-row: auto; color: #bed0d8; }
.lobby-extras .kenney-button { min-height: 44px; font-size: 14px; }
@media (max-width: 600px) {
  .ggc-panel .lobby-header { padding-bottom: 16px; }
  .portal-heading { display: block; margin-bottom: 14px; }
  .portal-heading > span { display: block; margin-top: 8px; }
  .featured-game { padding: 20px; border-radius: 16px; }
  .featured-copy { gap: 8px; }
  .featured-copy > span { max-width: 230px; }
  .featured-art { position: absolute; right: -24px; top: 16px; width: 130px; height: 150px; opacity: .13; }
  .game-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .game-card-art { height: 56px; font-size: 42px; }
  .game-card-copy { padding: 12px; gap: 6px; }
  .game-card-copy strong { font-size: 18px; }
  .game-card-copy > span { font-size: 13px; }
  .lobby-extras .lobby-header-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
  .game-card { transition: none; }
  .game-card:hover { transform: none; }
}

/* Keep combat text legible and avoid duplicate guidance behind the hand. */
body[data-game-mode="card-battle"] #desktop-controls { display: none; }
#combat-stats, #frenzy-timer, .card-battle-topline { border: 1px solid #8ea8b5; border-radius: 10px; background: #132633ee; box-shadow: 0 3px 16px #0003; }
#combat-stats strong { font-size: 14px; }
#combat-stats span { font-size: 12px; }
#card-battle-status { font-size: 14px; line-height: 1.4; }
.card-battle-card { min-height: 76px; border-radius: 12px; }
.card-battle-card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (pointer: coarse) {
  #combat-stats strong { font-size: 12px; }
  #combat-stats span { font-size: 11px; }
  #card-battle-status { font-size: 12px; }
}

/* Unified lobby system: the same surfaces from selection to room and chat. */
body:not(.in-game) #menu-shell {
  background: radial-gradient(ellipse at 85% 0, #234c49, transparent 55%), #101d29;
}
#menu-shell { color: #edf5f3; }
#menu-shell .kenney-panel:not(.ggc-panel) {
  border: 1px solid #3a4e5a; border-radius: 20px; background: #172b36; box-shadow: 0 16px 48px #0003; color: #edf5f3;
}
#menu-shell h2, #menu-shell h3 { color: #edf5f3; text-shadow: none; }
#menu-shell .eyebrow { color: #a8c5c4; }
#menu-shell .lobby-box {
  background: #192d38; border: 1px solid #3a4e5a; border-radius: 16px; box-shadow: none; color: #edf5f3; padding: 20px;
}
#menu-shell .kenney-button, body:not(.in-game) .info-dialog .kenney-button {
  min-height: 44px; padding: 10px 14px; border: 1px solid #4b6572; border-radius: 10px;
  background: #233d49; color: #edf5f3; box-shadow: none; text-shadow: none;
  font-size: 14px; font-weight: 700; line-height: 1.35; image-rendering: auto; filter: none;
}
#menu-shell .kenney-button:hover:not(:disabled), body:not(.in-game) .info-dialog .kenney-button:hover:not(:disabled) {
  background: #2e505a; border-color: #9be2bf; filter: none; transform: none;
}
#menu-shell .kenney-button:active:not(:disabled) { transform: translateY(1px); }
#menu-shell .kenney-button:disabled { opacity: .48; cursor: not-allowed; background: #233d49; }
#menu-shell .room-actions .tone-green, #menu-shell #play-button:not(:disabled), #menu-shell .lobby-tabs .active {
  color: #102d25; border-color: #9be2bf; background: #a5dfbd; box-shadow: none;
}
#menu-shell .room-actions .tone-green:hover, #menu-shell #play-button:not(:disabled):hover { background: #c5efd5; }
#menu-shell .lobby-tabs { gap: 6px; padding: 4px; background: #101f29; border: 1px solid #3a4e5a; border-radius: 12px; height: auto; }
#menu-shell .lobby-tabs .kenney-button { border-color: transparent; font-size: 14px; }
#menu-shell .lobby-grid { grid-template-rows: auto auto; border-top: 0; margin-top: 0; padding-top: 0; align-items: start; }
.community-heading { margin: 30px 0 18px; padding-top: 26px; border-top: 1px solid #3a4e5a; }
.community-heading h2 { font-size: 23px; margin: 0 0 8px; }
.community-heading p { color: #b8cbd1; font-size: 14px; margin: 0; }
#menu-shell .lobby-pane { align-self: stretch; }
#menu-shell .profile-box { gap: 12px; }
#menu-shell .profile-box h2 { font-size: 18px; margin-bottom: 0; }
#menu-shell .name-field { gap: 6px; text-align: left; }
#menu-shell .name-field > span { color: #b8cbd1; font-size: 13px; }
#menu-shell input, #menu-shell select {
  min-height: 44px; width: 100%; min-width: 0; border: 1px solid #54717e; border-radius: 9px;
  background: #10232e; color: #edf5f3; box-shadow: none; padding: 10px 12px; font-size: 16px; font-weight: 500;
}
#menu-shell input::placeholder { color: #9cb2be; opacity: 1; }
#menu-shell input:focus-visible, #menu-shell select:focus-visible, #menu-shell .kenney-button:focus-visible {
  outline: 3px solid #a5dfbd; outline-offset: 2px;
}
#menu-shell .loadout-summary span { color: #edf5f3; border: 1px solid #3a4e5a; border-radius: 10px; background: #10232e; padding: 9px; }
#menu-shell .loadout-summary img { image-rendering: auto; }
#menu-shell .project-disclaimer { color: #a9bec7; font-size: 12px; line-height: 1.6; font-weight: 400; }
#menu-shell .room-list { padding: 8px; border: 1px solid #344d5b; border-radius: 12px; background: #10232e; min-height: 180px; }
#menu-shell .empty-room-list { color: #a9bec7; font-size: 14px; font-weight: 400; padding: 18px; line-height: 1.7; }
#menu-shell .room-entry, #menu-shell .room-entry:disabled {
  border: 1px solid #496372; border-radius: 10px; background: #233d49; color: #edf5f3; padding: 12px; image-rendering: auto;
}
#menu-shell .room-entry:hover:not(:disabled) { border-color: #a5dfbd; background: #2c4a54; }
#menu-shell .room-entry small { color: #aec6ce; }
#menu-shell .room-entry > b { padding: 6px 9px; border-radius: 8px; background: #102d25; color: #a5dfbd; }
#menu-shell .online-roster, #menu-shell .chat-log, #menu-shell .room-share, #menu-shell .room-member {
  border: 1px solid #3a5563; background: #10232e; box-shadow: none; color: #edf5f3; border-radius: 12px;
}
#menu-shell .chat-log { padding: 12px; font-size: 14px; line-height: 1.6; }
#menu-shell .chat-message b { color: #a5dfbd; }
#menu-shell .chat-system { color: #aac2cc; font-style: normal; }
#menu-shell .online-player-chip, #menu-shell .empty-online-list { background: #233d49; border: 1px solid #4b6572; color: #d8e7ec; font-size: 12px; }
#menu-shell .online-player-chip.red { background: #483639; color: #ffd4ce; }
#menu-shell .room-member small { color: #b8cbd1; }
#menu-shell .box-title-row > span, #menu-shell .p2p-status, #menu-shell .role-badge {
  background: #263e48; color: #c7dce1; border: 1px solid #4b6572; border-radius: 8px; font-weight: 500;
}
#menu-shell .p2p-status.connected { background: #153a30; color: #a5dfbd; }
#menu-shell .lobby-extras h2 { margin: 0; font-size: 16px; color: #b8cbd1; }
#menu-shell .lobby-header-stats { color: #a9bec7; font-size: 13px; }
#menu-shell #total-plays, #menu-shell .online { color: #a9bec7; }
body:not(.in-game) .info-card, body:not(.in-game) .benefits-card {
  background: #192d38; color: #edf5f3; border: 1px solid #4b6572; border-radius: 18px; box-shadow: 0 24px 80px #0008;
}
body:not(.in-game) .info-card > header { background: #10232e; border-bottom: 1px solid #3a4e5a; padding: 16px; }
body:not(.in-game) .info-card h2, body:not(.in-game) .info-card h3 { color: #edf5f3; text-shadow: none; }
body:not(.in-game) .notice-section, body:not(.in-game) .notice-entry, body:not(.in-game) .guide-grid > article {
  background: #203944; color: #d7e5e9; border-color: #4b6572; box-shadow: none;
}
body:not(.in-game) .notice-entry h4, body:not(.in-game) .notice-section h3 { color: #bce7cc; }
@media (orientation: portrait) and (max-width: 1024px) {
  #menu-shell .lobby-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  #menu-shell .lobby-box { padding: 16px; }
  #menu-shell .lobby-tabs .kenney-button { padding: 10px 6px; }
  #menu-shell .box-title-row { flex-wrap: wrap; gap: 8px; }
}

body:not(.in-game) .info-card p, body:not(.in-game) .info-card .notice-entry strong,
body:not(.in-game) .info-card .step-grid span, body:not(.in-game) .info-card .step-grid b {
  color: #d7e5e9;
}
body:not(.in-game) .info-card .notice-section { border-width: 1px; }
body:not(.in-game) .info-card .notice-section h3 {
  background: #294852; color: #bce7cc; text-shadow: none; font-size: 18px;
}
body:not(.in-game) .info-card .notice-entry { border-top-width: 1px; }
body:not(.in-game) .info-card .notice-entry strong { font-weight: 500; }
body:not(.in-game) .info-card .step-grid article {
  background: #203944; border: 1px solid #4b6572; border-radius: 12px;
}
body:not(.in-game) .info-card .step-grid svg { color: #a5dfbd; }

#menu-shell .lobby-tabs .kenney-button.active:hover { background: #b5e9cc; color: #102d25; }
#menu-shell .choice-card { border: 1px solid #4b6572; border-radius: 16px; background: #203944; color: #edf5f3; box-shadow: none; }
#menu-shell .choice-card.selected { border: 2px solid #a5dfbd; background: #23443f; box-shadow: none; }
#menu-shell .choice-card small { color: #b8cbd1; }

/* Utility tools occupy the header's spare space; game cards keep their size. */
.ggc-panel .lobby-header {
  display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 640px);
  align-items: center; gap: 20px; position: relative;
}
.ggc-panel .header-tools { min-width: 0; display: grid; gap: 8px; }
.ggc-panel .header-tools .lobby-header-actions {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px;
  grid-column: auto; grid-row: auto; padding: 0;
}
#menu-shell .header-tools .kenney-button, #menu-shell .header-tools #music-button {
  width: 100%; min-width: 0; min-height: 44px; padding: 7px 5px;
  font-size: 12px; line-height: 1.3; white-space: normal; text-align: center;
}
.ggc-panel .header-tools .lobby-header-stats {
  display: flex; justify-content: flex-end; align-items: center; gap: 16px;
  grid-column: auto; grid-row: auto; text-align: right; padding: 0;
}
#menu-shell .header-tools .online, #menu-shell .header-tools #total-plays { margin: 0; font-size: 12px; line-height: 1.4; }
@media (max-width: 700px) {
  .ggc-panel .lobby-header { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ggc-panel .lobby-brand { padding-right: 130px; }
  .ggc-panel .lobby-brand h1 { font-size: 26px; }
  .ggc-panel .lobby-brand h1 span { font-size: 10px; letter-spacing: .06em; }
  .ggc-panel .lobby-brand .eyebrow { font-size: 10px; line-height: 1.4; }
  .ggc-panel .header-tools .lobby-header-stats {
    position: absolute; right: 0; top: 0; width: 122px; display: grid;
    justify-content: end; justify-items: end; gap: 3px;
  }
  #menu-shell .header-tools .online, #menu-shell .header-tools #total-plays { font-size: 10px; line-height: 1.45; }
  #menu-shell .header-tools .kenney-button, #menu-shell .header-tools #music-button { padding: 5px 3px; font-size: 11px; }
}
