﻿
/* --- multipage layout extras --- */
body.pageScroll {
  overflow: auto;
  min-height: 100%;
}

body.gamePage {
  overflow: hidden;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body.gamePage.homeBody {
  background: transparent;
}

.gameWrap {
  position: relative;
  z-index: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  padding: 0 8px 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.gameHeader {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 8px;
  flex-shrink: 0;
}

.gameHeader > * {
  pointer-events: auto;
}

.gameTitle {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  min-width: 0;
  text-decoration: none;
  color: #f4eedf;
  flex-shrink: 1;
}

.gameTitleText {
  font-family: "Silkscreen", "IBM Plex Mono", monospace;
  font-size: clamp(18px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    2px 2px 0 rgba(26, 20, 16, 0.92),
    0 0 18px rgba(0, 0, 0, 0.35);
}

.gameHeaderActions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

body.gamePage .gameHeaderActions a,
body.gamePage .gameHeaderActions button {
  min-height: 30px;
  padding: 5px 10px;
  border: 2px solid rgba(235, 227, 208, 0.42);
  background: rgba(26, 20, 16, 0.52);
  color: #ebe3d0;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

body.gamePage .gameHeaderActions a:hover,
body.gamePage .gameHeaderActions button:hover {
  background: rgba(42, 32, 24, 0.72);
  border-color: rgba(235, 227, 208, 0.62);
}

body.gamePage .gameHeaderActions .accountChip {
  color: rgba(235, 227, 208, 0.78);
  font-size: 10px;
  max-width: 96px;
}

body.gamePage .gameHeaderActions a.settingsGear,
body.gamePage .gameHeaderActions button.settingsGear {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

body.gamePage .gameHeaderActions a.settingsGear.active,
body.gamePage .gameHeaderActions button.settingsGear.active {
  background: #ebe3d0;
  color: #101010;
  border-color: #ebe3d0;
}

body.gamePage .gameWrap.wrap {
  height: 100%;
  padding: 0 8px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

body.gamePage .gameWrap .card {
  flex: 0 1 auto;
  width: min(var(--card-max-width, 980px), var(--card-max-vw, 96vw), 100%);
  max-height: 100%;
  overflow: hidden;
  align-items: start;
  padding: 10px;
  gap: 10px;
}

body.gamePage .card > div:first-child {
  min-height: 0;
  max-height: calc(100dvh - 58px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

body.gamePage .sundayUnlimitedBanner {
  margin-bottom: 6px;
  padding: 8px 10px;
}

body.gamePage .boardShell {
  padding: 8px;
}

body.gamePage .boardShell canvas#game {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 28 / 20;
  max-width: 100%;
}

body.gamePage .campaignTray {
  margin-top: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

body.gamePage .campaignTrayRow {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

body.gamePage .campaignLives {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 0;
  gap: 0;
  min-height: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  flex-direction: row;
  align-items: center;
}

body.gamePage .campaignLivesMeta {
  gap: 8px;
  width: auto;
}

body.gamePage .campaignLivesMetaMain {
  gap: 6px;
}

body.gamePage .campaignLivesLabel,
body.gamePage .campaignStageGoalTitle,
body.gamePage .campaignStageGoalCount {
  font-size: 9px;
  letter-spacing: 0.1em;
}

body.gamePage .campaignHearts {
  gap: 3px;
}

body.gamePage .campaignLivesEditor {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

body.gamePage .campaignLivesEditor.hidden {
  display: none !important;
}

body.gamePage .campaignLivesEditorBtn {
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

body.gamePage .campaignLivesEditorBtn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

body.gamePage .campaignHeart {
  width: 16px;
  height: 14px;
}

body.gamePage .campaignHeart svg {
  width: 16px;
  height: 14px;
}

body.gamePage .playSidePanel .heartPickupTimer.hidden,
body.gamePage .playSidePanel .heartPickupTimer[hidden] {
  display: none !important;
}

body.gamePage .playSidePanel .heartPickupTimer:not(.hidden):not([hidden]) {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 6px 0 0;
  border: 0;
  border-top: 2px solid var(--xenzia-brick-dark);
  background: transparent;
  box-shadow: none;
}

body.gamePage .playSidePanel .heartPickupTimerLabel {
  font-size: 8px;
  letter-spacing: 0.12em;
  flex: 0 0 auto;
}

body.gamePage .playSidePanel .heartPickupTimerTrack {
  flex: 1 1 auto;
  height: 10px;
  max-width: none;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

body.gamePage .playSidePanel .heartPickupTimerFill {
  height: 100%;
  width: 100%;
  background: var(--xenzia-food);
  box-shadow: inset 1px 1px 0 var(--xenzia-food-light);
  transform-origin: left center;
}

body.gamePage .campaignStageGoal {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: auto;
  min-width: 0;
  margin-left: 0;
}

body.gamePage .campaignProgressBar {
  flex: 0 0 auto;
  gap: 3px;
  min-height: 16px;
  justify-content: flex-start;
  overflow: hidden;
}

body.gamePage .campaignStageGoalCount {
  flex: 0 0 auto;
  min-width: 0;
  text-align: left;
}

body.gamePage .campaignDot {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

body.gamePage .campaignDot.filled::before {
  width: 7px;
  height: 7px;
}

body.gamePage .campaignDot.portal::before,
body.gamePage .campaignDot.key::before,
body.gamePage .campaignDot.crown::before {
  transform: scale(0.85);
}

body.gamePage .side {
  min-height: 0;
  max-height: calc(100dvh - 58px);
  overflow-y: auto;
  align-content: start;
  align-self: start;
  width: 100%;
}

body.gamePage .playSide {
  gap: 8px;
}

body.gamePage .playSidePanel {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  height: auto;
  align-self: start;
  width: 100%;
  box-sizing: border-box;
}

body.gamePage .playStats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

body.gamePage .playStats:has(#statTime:not(.hidden)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.gamePage .playStats .stat {
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 42px;
}

body.gamePage .playStats .stat .k {
  font-size: 8px;
  letter-spacing: 0.1em;
  width: 100%;
}

body.gamePage .playStats .stat .v {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.15;
  word-break: break-word;
  width: 100%;
}

body.gamePage .playControls {
  display: grid;
  gap: 6px;
  padding-top: 2px;
  border-top: 2px solid var(--xenzia-brick-dark);
}

body.gamePage .playSettingRow {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  min-height: 0;
}

body.gamePage .playSettingRow > span {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--xenzia-muted);
}

body.gamePage .playSettingRow .speedModeBtns {
  width: 100%;
}

body.gamePage .playSettingRow .speedModeBtns button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 26px;
  padding: 4px 6px;
  font-size: 9px;
}

body.gamePage .playCampaignBtns {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex-wrap: unset !important;
  gap: 3px !important;
}

body.gamePage .playCampaignBtns button {
  flex: none !important;
  min-width: 0 !important;
  padding: 4px 2px !important;
  font-size: 9px !important;
}

body.gamePage .playActions {
  gap: 4px;
  margin: 0;
}

body.gamePage .playActions button {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 4px;
  font-size: 10px;
  letter-spacing: 0.05em;
}

body.gamePage .playToast {
  margin-top: 0;
  padding: 5px 6px;
  min-height: 0;
  font-size: 9px;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

@media (max-width: 640px) {
  body.gamePage .campaignTrayRow {
    gap: 8px;
  }

  body.gamePage .campaignStageGoal {
    gap: 6px;
  }
}

@media (max-width: 640px) {
  .gameHeader {
    padding: 8px 10px 6px;
    gap: 8px;
  }

  .gameTitleText {
    font-size: clamp(15px, 4.8vw, 20px);
  }

  body.gamePage .gameHeaderActions .accountChip {
    display: none;
  }
}

@media (max-height: 760px) {
  .gameTitleText {
    font-size: clamp(15px, 2.2vw, 20px);
  }

  .gameHeader {
    padding: 6px 10px 4px;
  }
}

body.gamePage .card {
  box-shadow:
    inset 2px 2px 0 var(--xenzia-brick-light),
    inset -2px -2px 0 var(--xenzia-brick-shadow),
    10px 12px 0 rgba(26, 20, 16, 0.35);
}

body.gamePage .modalOverlay,
body.gamePage .touchControls,
body.gamePage .achToastStack {
  z-index: 40;
}

.sitePage {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

.siteNav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--xenzia-brick-dark);
}

.siteNavBrand {
  font-size: 18px;
  font-weight: 700;
  color: var(--xenzia-text);
  text-decoration: none;
}

.siteNavLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.siteNavLinks a,
.siteNavLinks .accountChip {
  display: inline-block;
  text-decoration: none;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  color: var(--xenzia-text);
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.siteNavLinks a:hover,
.siteNavLinks a.active {
  background: var(--xenzia-cell);
}

.siteCard {
  background: var(--xenzia-bg);
  border: var(--classic-frame);
  box-shadow: var(--classic-inset);
  padding: 18px;
}

.siteCard h1 {
  margin: 0 0 10px;
  font-size: 28px;
}

.siteCard h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.siteLead {
  color: var(--xenzia-muted);
  margin: 0 0 18px;
  line-height: 1.45;
}

.homeActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.homePage {
  max-width: none;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 18px;
  position: relative;
  z-index: 1;
}

.homeBody {
  position: relative;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  background: #1a1410;
}

.homeStage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  --stage-mid: #cbb896;
  --stage-deep: #a89068;
  --stage-edge: #3a2a1c;
  --stage-grid: rgba(58, 40, 24, 0.16);
  --stage-speck: rgba(184, 104, 40, 0.2);
  --stage-food: #2a5fe0;
  --stage-food-dark: #143a9e;
  --stage-wash: rgba(26, 20, 16, 0.72);
  background: radial-gradient(
    ellipse 90% 70% at 50% 40%,
    var(--stage-mid) 0%,
    var(--stage-deep) 45%,
    var(--stage-edge) 100%
  );
}

.homeStage[data-stage-theme="campaign2"],
.homeStage.campaign2Shell {
  --stage-mid: #6a2020;
  --stage-deep: #3a1010;
  --stage-edge: #120404;
  --stage-grid: rgba(255, 120, 120, 0.12);
  --stage-speck: rgba(255, 80, 80, 0.2);
  --stage-food: #e82828;
  --stage-food-dark: #9c1010;
  --stage-wash: rgba(10, 2, 2, 0.75);
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #6a2020 0%, #3a1010 45%, #120404 100%);
}

.homeStage[data-stage-theme="campaign3"],
.homeStage.campaign3Shell {
  --stage-mid: #3d8c38;
  --stage-deep: #1a4828;
  --stage-edge: #0c1810;
  --stage-grid: rgba(200, 255, 180, 0.1);
  --stage-speck: rgba(120, 220, 100, 0.22);
  --stage-food: #d83068;
  --stage-food-dark: #901840;
  --stage-wash: rgba(8, 18, 10, 0.7);
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #3d8c38 0%, #1a4828 45%, #0c1810 100%);
}

.homeStage[data-stage-theme="campaign4"],
.homeStage.campaign4Shell {
  --stage-mid: #283868;
  --stage-deep: #121836;
  --stage-edge: #060812;
  --stage-grid: rgba(120, 180, 255, 0.12);
  --stage-speck: rgba(72, 200, 248, 0.22);
  --stage-food: #f0e040;
  --stage-food-dark: #a08010;
  --stage-wash: rgba(4, 6, 18, 0.75);
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #283868 0%, #121836 45%, #060812 100%);
}

.homeStage[data-stage-theme="campaign5"],
.homeStage.campaign5Shell {
  --stage-mid: #94b838;
  --stage-deep: #5a7820;
  --stage-edge: #1a2808;
  --stage-grid: rgba(20, 40, 8, 0.16);
  --stage-speck: rgba(40, 80, 16, 0.2);
  --stage-food: #2a6820;
  --stage-food-dark: #184818;
  --stage-wash: rgba(12, 18, 4, 0.65);
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #94b838 0%, #5a7820 45%, #1a2808 100%);
}

.homeStage[data-stage-theme="campaign6"],
.homeStage.campaign6Shell {
  --stage-mid: #90c4dc;
  --stage-deep: #4a88a8;
  --stage-edge: #183850;
  --stage-grid: rgba(255, 255, 255, 0.14);
  --stage-speck: rgba(232, 248, 255, 0.35);
  --stage-food: #d03848;
  --stage-food-dark: #881828;
  --stage-wash: rgba(24, 56, 80, 0.55);
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #90c4dc 0%, #4a88a8 45%, #183850 100%);
}

.homeStage[data-stage-theme="classic"],
.homeStage[data-stage-theme="campaign1"] {
  --stage-mid: #cbb896;
  --stage-deep: #a89068;
  --stage-edge: #3a2a1c;
  --stage-grid: rgba(58, 40, 24, 0.16);
  --stage-speck: rgba(184, 104, 40, 0.2);
  --stage-food: #2a5fe0;
  --stage-food-dark: #143a9e;
  --stage-wash: rgba(26, 20, 16, 0.72);
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #cbb896 0%, #a89068 45%, #3a2a1c 100%);
}

.homeStageGrid {
  position: absolute;
  inset: -8%;
  background-image:
    linear-gradient(var(--stage-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--stage-grid) 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, var(--stage-speck) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 55%, var(--stage-speck) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 80%, var(--stage-speck) 0 1.5px, transparent 2.5px);
  background-size: 28px 28px, 28px 28px, 120px 120px, 160px 160px, 90px 90px;
  animation: homeGridDrift 28s linear infinite;
  opacity: 0.95;
}

.homeStageWash {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 48%,
    transparent 0%,
    transparent 28%,
    color-mix(in srgb, var(--stage-wash) 45%, transparent) 70%,
    var(--stage-wash) 100%
  );
}

.homeSnake {
  position: absolute;
  left: 8%;
  top: 58%;
  width: min(520px, 70vw);
  height: 28px;
  transform: rotate(-8deg);
  animation: homeSnakeSlither 7.5s ease-in-out infinite;
}

.homeSnakeSeg {
  position: absolute;
  top: 0;
  left: calc(var(--i) * 34px);
  width: 26px;
  height: 26px;
  background: #141414;
  box-shadow: inset 2px 2px 0 #3a3a3a;
  animation: homeSegBob 1.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.12s);
}

.homeSnakeHead {
  background: #101010;
  box-shadow: inset 2px 2px 0 #4a4a4a;
}

.homeSnakeHead::after,
.homeSnakeHead::before {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  background: #f5f5f5;
  top: 7px;
}

.homeSnakeHead::before {
  left: 6px;
}

.homeSnakeHead::after {
  right: 6px;
}

.homeFood {
  position: absolute;
  width: 22px;
  height: 22px;
  left: 72%;
  top: 34%;
  background: var(--stage-food, #2a5fe0);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: inset -2px -2px 0 var(--stage-food-dark, #143a9e);
  animation: homeFoodBeat 0.88s ease-in-out infinite;
}

.homeFoodB {
  left: 18%;
  top: 22%;
  width: 16px;
  height: 16px;
  animation-delay: -0.35s;
  opacity: 0.85;
}

.homeHero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(420px, 100%);
}

.homeBrand {
  margin: 0;
  font-family: "Silkscreen", "IBM Plex Mono", monospace;
  font-size: clamp(28px, 7vw, 48px);
  letter-spacing: 0.04em;
  color: #101010;
  text-shadow: 2px 2px 0 rgba(235, 227, 208, 0.55);
  text-align: center;
  animation: homeBrandIn 0.7s ease-out both;
}

.homeTag {
  margin: -6px 0 4px;
  color: #3a2a1c;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  animation: homeBrandIn 0.7s ease-out 0.12s both;
}

.homeStageCard {
  width: 100%;
  padding: 22px 18px;
  background: linear-gradient(180deg, #ebe3d0 0%, #d4c4a8 100%);
  border: 3px solid #3d2818;
  box-shadow:
    inset 2px 2px 0 #8a6848,
    inset -2px -2px 0 #2a1a10,
    10px 12px 0 rgba(26, 20, 16, 0.35);
  animation: homeCardIn 0.75s ease-out 0.18s both;
  display: flex;
  justify-content: center;
}

.homeStageCard .homePanel {
  width: 100%;
  display: flex;
  justify-content: center;
}

.homeActionsStack {
  flex-direction: column;
  width: 100%;
}

.homeActionsStack a {
  width: 100%;
}

.homePage .siteFooter {
  position: relative;
  z-index: 1;
  border-top-color: rgba(235, 227, 208, 0.25);
  justify-content: center;
}

.homePage .siteFooter a {
  color: #ebe3d0;
}

@keyframes homeGridDrift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-28px, -28px, 0);
  }
}

@keyframes homeSnakeSlither {
  0%,
  100% {
    transform: rotate(-8deg) translateX(0);
  }
  50% {
    transform: rotate(-5deg) translateX(18px);
  }
}

@keyframes homeSegBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes homeFoodBeat {
  0%,
  55%,
  100% {
    transform: scale(1);
  }
  9% {
    transform: scale(1.18);
  }
  22% {
    transform: scale(1.08);
  }
}

@keyframes homeBrandIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes homeCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .homeStageGrid,
  .homeSnake,
  .homeSnakeSeg,
  .homeFood,
  .homeBrand,
  .homeTag,
  .homeStageCard {
    animation: none;
  }
}

.homePage .homeNavSlot .siteNav {
  margin-bottom: 0;
}

.homeCenter {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

.homeCenter .homeActions {
  margin: 0;
  justify-content: center;
  align-items: center;
}

.homeCenter .homeActions a {
  min-width: 140px;
  text-align: center;
  padding: 12px 18px;
  font-size: 14px;
}

.homeCenter .homeActions a.hidden {
  display: none;
}

.homeLoginForm {
  width: min(320px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  align-self: center;
}

.homeLoginForm label {
  color: var(--xenzia-muted);
  font-size: 12px;
}

.homeLoginForm input {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  color: var(--xenzia-text);
  font: inherit;
  padding: 8px 10px;
  box-sizing: border-box;
}

.homeLoginForm .homeActions {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

.homeLoginForm .homeActions button,
.homeLoginForm .homeActions a {
  min-width: 120px;
  text-align: center;
  padding: 12px 18px;
  font-size: 14px;
  text-decoration: none;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  color: var(--xenzia-text);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--classic-inset-sm);
}

.homeLoginForm .homeActionsStack {
  width: 100%;
}

.homeLoginForm .homeActionsStack button,
.homeLoginForm .homeActionsStack a {
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
}

.homeCornerBack {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--ui-text, #101010);
  background: linear-gradient(
    180deg,
    var(--ui-cell, #ebe3d0) 0%,
    var(--ui-bg, #d4c4a8) 100%
  );
  border: 3px solid var(--ui-border, #3d2818);
  box-shadow:
    inset 2px 2px 0 var(--ui-light, #8a6848),
    inset -2px -2px 0 var(--ui-shadow, #2a1a10),
    4px 4px 0 rgba(26, 20, 16, 0.35);
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease,
    border-color 0.12s ease;
}

.homeCornerBack:hover {
  background: var(--ui-cell, #ebe3d0);
  transform: translate(-1px, -1px);
}

.homeCornerBack:active {
  transform: translate(1px, 1px);
  box-shadow:
    inset 2px 2px 0 var(--ui-shadow, #2a1a10),
    inset -1px -1px 0 var(--ui-light, #8a6848);
}

.homeCornerBackIcon {
  display: block;
  width: 24px;
  height: 24px;
  position: relative;
}

.homeCornerBackIcon::before {
  content: "\2190";
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  transform: translateY(-1px);
}

.homeLoginForm .homeActions button.primary {
  background: var(--xenzia-food);
  color: var(--xenzia-cell);
  border-color: var(--xenzia-food-dark);
}

.homeEmailEcho {
  margin: 0 0 4px;
  color: var(--xenzia-muted);
  font-size: 13px;
  word-break: break-all;
}

.homeActions a,
.pageBtn {
  display: inline-block;
  text-decoration: none;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  color: var(--xenzia-text);
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.homeActions a.primary,
.pageBtn.primary,
button.primary {
  background: var(--xenzia-food);
  color: var(--xenzia-cell);
  border-color: var(--xenzia-food-dark);
}

.homeLinks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.homeLinks a {
  text-decoration: none;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-cell);
  color: var(--xenzia-text);
  padding: 10px;
  font-size: 12px;
  text-align: center;
}

.siteFooter {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--xenzia-brick-dark);
  color: var(--xenzia-muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.siteFooter a {
  color: var(--xenzia-muted);
}

.ad-slot {
  margin: 20px 0;
  min-height: 90px;
  border: 1px dashed var(--xenzia-brick-dark);
  background: var(--xenzia-cell);
  color: var(--xenzia-muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  padding: 12px;
}

.pageForm .modalRow {
  margin-bottom: 12px;
}

.pageForm label {
  display: block;
  margin-bottom: 4px;
  color: var(--xenzia-muted);
  font-size: 12px;
}

.pageForm input,
.pageForm select {
  width: 100%;
  min-height: 36px;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  color: var(--xenzia-text);
  font: inherit;
  padding: 6px 8px;
}

.pageActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.comingSoonNote {
  color: var(--xenzia-muted);
  line-height: 1.5;
}

.brandActions a {
  display: inline-block;
  text-decoration: none;
  border: 2px solid var(--xenzia-brick-dark);
  background: var(--xenzia-slot);
  color: var(--xenzia-text);
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.brandActions a.settingsGear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.brandActions a.hidden {
  display: none;
}

/* ---------- Profile + Ranks pages ---------- */
.homeStage--quiet .homeFood {
  display: none;
}

/* Local UI palette (set per campaign via data-stage-theme) */
.pageTheme,
body[data-stage-theme] {
  --ui-bg: #d4c4a8;
  --ui-cell: #ebe3d0;
  --ui-slot: #c8b898;
  --ui-border: #3d2818;
  --ui-light: #8a6848;
  --ui-shadow: #2a1a10;
  --ui-text: #101010;
  --ui-muted: #4a3828;
  --ui-food: #2a5fe0;
  --ui-food-dark: #143a9e;
  --ui-food-light: #6ea0ff;
  --ui-title: #101010;
  --ui-kicker: #3a2a1c;
  --ui-title-shadow: 1px 1px 0 rgba(235, 227, 208, 0.45);
}

.pageTheme[data-stage-theme="campaign2"],
body[data-stage-theme="campaign2"] {
  --ui-bg: #1a0808;
  --ui-cell: #2a1010;
  --ui-slot: #3a1414;
  --ui-border: #601818;
  --ui-light: #a03030;
  --ui-shadow: #280808;
  --ui-text: #f5e8e8;
  --ui-muted: #c8a0a0;
  --ui-food: #e82828;
  --ui-food-dark: #9c1010;
  --ui-food-light: #ff7070;
  --ui-title: #ebe3d0;
  --ui-kicker: rgba(235, 227, 208, 0.8);
  --ui-title-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.pageTheme[data-stage-theme="campaign3"],
body[data-stage-theme="campaign3"] {
  --ui-bg: #1a3020;
  --ui-cell: #2a4828;
  --ui-slot: #345838;
  --ui-border: #2a5830;
  --ui-light: #4a8850;
  --ui-shadow: #142818;
  --ui-text: #e8f8e0;
  --ui-muted: #a8c8a0;
  --ui-food: #48b858;
  --ui-food-dark: #287838;
  --ui-food-light: #88e898;
  --ui-title: #ebe3d0;
  --ui-kicker: rgba(235, 227, 208, 0.8);
  --ui-title-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.pageTheme[data-stage-theme="campaign4"],
body[data-stage-theme="campaign4"] {
  --ui-bg: #0a1028;
  --ui-cell: #141c38;
  --ui-slot: #1a2448;
  --ui-border: #283868;
  --ui-light: #4868a8;
  --ui-shadow: #080818;
  --ui-text: #e8f0ff;
  --ui-muted: #98b0d8;
  --ui-food: #48c8f8;
  --ui-food-dark: #2088c8;
  --ui-food-light: #88e8ff;
  --ui-title: #ebe3d0;
  --ui-kicker: rgba(235, 227, 208, 0.8);
  --ui-title-shadow: 0 1px 0 rgba(0, 0, 0, 0.45), 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.pageTheme[data-stage-theme="campaign5"],
body[data-stage-theme="campaign5"] {
  --ui-bg: #7a9828;
  --ui-cell: #8aaa30;
  --ui-slot: #94b838;
  --ui-border: #0a1808;
  --ui-light: #284018;
  --ui-shadow: #081008;
  --ui-text: #0a1808;
  --ui-muted: #3a5820;
  --ui-food: #2a6820;
  --ui-food-dark: #184818;
  --ui-food-light: #78d050;
  --ui-title: #0a1808;
  --ui-kicker: #3a5820;
  --ui-title-shadow: 1px 1px 0 rgba(255, 255, 255, 0.28);
}

.pageTheme[data-stage-theme="campaign6"],
body[data-stage-theme="campaign6"] {
  --ui-bg: #90c4dc;
  --ui-cell: #c8e8f8;
  --ui-slot: #b0d8ec;
  --ui-border: #2a6898;
  --ui-light: #e8f8ff;
  --ui-shadow: #184868;
  --ui-text: #183850;
  --ui-muted: #386888;
  --ui-food: #9a5800;
  --ui-food-dark: #3a2008;
  --ui-food-light: #ffe878;
  --ui-title: #183850;
  --ui-kicker: #386888;
  --ui-title-shadow: 1px 1px 0 rgba(255, 255, 255, 0.28);
}

.profileShell,
.ranksShell {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 32px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--ui-text);
}

.profileHead,
.ranksHead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.profileKicker,
.ranksKicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ui-kicker);
}

.profileTitle,
.ranksTitle {
  margin: 0;
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ui-title);
  text-shadow: var(--ui-title-shadow);
  word-break: break-word;
}

.profileRefresh,
.ranksRefresh {
  appearance: none;
  flex: 0 0 auto;
  border: 2px solid var(--ui-border);
  background: var(--ui-cell);
  color: var(--ui-text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    3px 3px 0 rgba(26, 20, 16, 0.28);
}

.profileRefresh:hover,
.ranksRefresh:hover {
  background: var(--ui-slot);
}

.profilePanel,
.ranksPanel {
  margin-bottom: 14px;
  padding: 14px;
  background: linear-gradient(180deg, var(--ui-cell) 0%, var(--ui-bg) 100%);
  border: 3px solid var(--ui-border);
  box-shadow:
    inset 2px 2px 0 var(--ui-light),
    inset -2px -2px 0 var(--ui-shadow),
    6px 8px 0 rgba(26, 20, 16, 0.28);
  color: var(--ui-text);
}

.profilePanelLabel {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.profileRows,
.ranksRows {
  margin-top: 0;
  gap: 6px;
}

.profileRows .lbRow,
.ranksRows .lbRow {
  border: none !important;
  border-bottom: 1px solid color-mix(in srgb, var(--ui-border) 30%, transparent) !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 2px;
  grid-template-columns: 36px 1fr auto auto;
  font-size: 12px;
  color: var(--ui-text);
}

.profileRows .lbRow:last-child,
.ranksRows .lbRow:last-child {
  border-bottom: none !important;
}

.ranksRows .lbRow.lbYou {
  border: 1px solid var(--ui-food-dark) !important;
  background: var(--ui-slot) !important;
  box-shadow: inset 1px 1px 0 var(--ui-food-light) !important;
  padding: 8px;
}

.profileAch {
  margin-top: 2px;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.profileAch .achItem {
  border: 2px solid var(--ui-border) !important;
  background: var(--ui-cell) !important;
  color: var(--ui-text) !important;
  box-shadow: inset 1px 1px 0 var(--ui-light) !important;
}

.profileAch .achDesc {
  color: var(--ui-muted) !important;
}

.ranksControls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ranksTabs {
  margin-bottom: 0;
}

.ranksTabs button {
  border: 2px solid var(--ui-border);
  background: var(--ui-slot);
  color: var(--ui-text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--ui-light);
}

.ranksTabs button.active {
  background: var(--ui-border);
  color: var(--ui-cell);
}

.ranksSelectLabel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.ranksSelectLabel select {
  min-width: 180px;
  min-height: 36px;
  border: 2px solid var(--ui-border);
  background: var(--ui-slot);
  color: var(--ui-text);
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
}

.ranksRows {
  max-height: min(58vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-top: 4px;
}

.ranksHint {
  margin: 8px 0 0;
  color: var(--ui-muted);
  font-size: 11px;
}

.ranksRows .lbEmpty {
  color: var(--ui-muted);
  padding: 12px 2px;
}

.profileFooter,
.ranksFooter,
.settingsFooter {
  position: relative;
  z-index: 1;
  justify-content: center;
  border-top-color: rgba(235, 227, 208, 0.25);
}

.profileFooter a,
.ranksFooter a,
.settingsFooter a {
  color: #ebe3d0;
}

/* ---------- Settings page ---------- */
.settingsShell {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 32px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--ui-text);
}

.settingsHead {
  margin-bottom: 22px;
}

.settingsKicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ui-kicker);
}

.settingsPageTitle {
  margin: 0;
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ui-title);
  text-shadow: var(--ui-title-shadow);
}

.settingsPanel {
  margin-bottom: 14px;
  padding: 14px;
  background: linear-gradient(180deg, var(--ui-cell) 0%, var(--ui-bg) 100%);
  border: 3px solid var(--ui-border);
  box-shadow:
    inset 2px 2px 0 var(--ui-light),
    inset -2px -2px 0 var(--ui-shadow),
    6px 8px 0 rgba(26, 20, 16, 0.28);
  color: var(--ui-text);
}

.settingsPanelLabel {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.settingsPanelHint {
  margin: -4px 0 12px;
  font-size: 11px;
  color: var(--ui-muted);
  opacity: 0.9;
}

.settingsToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.settingsToggleCopy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.settingsToggleName {
  font-size: 13px;
  font-weight: 700;
  color: var(--ui-text);
}

.settingsToggleHint {
  font-size: 11px;
  color: var(--ui-muted);
}

.settingsToggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.settingsSwitch {
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border: 2px solid var(--ui-border);
  background: var(--ui-slot);
  box-shadow: inset 1px 1px 0 var(--ui-shadow);
  position: relative;
  transition: background 0.15s ease;
}

.settingsSwitch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--ui-cell);
  border: 2px solid var(--ui-border);
  transition: transform 0.15s ease, background 0.15s ease;
}

.settingsToggle input:checked + .settingsSwitch {
  background: var(--ui-food);
  border-color: var(--ui-food-dark);
}

.settingsToggle input:checked + .settingsSwitch::after {
  transform: translateX(20px);
  background: var(--ui-cell);
  border-color: var(--ui-food-dark);
}

.settingsSeg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.settingsSeg button {
  appearance: none;
  border: 2px solid var(--ui-border);
  background: var(--ui-slot);
  color: var(--ui-text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 10px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--ui-light);
}

.settingsSeg button.active {
  background: var(--ui-border);
  color: var(--ui-cell);
  box-shadow: inset 1px 1px 0 var(--ui-shadow);
}

.settingsSeg button:hover:not(.active) {
  background: var(--ui-cell);
}

.settingsDanger {
  appearance: none;
  width: 100%;
  border: 2px solid #8a2020;
  background: #c83030;
  color: #fff8f0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 #e87070, 3px 3px 0 rgba(26, 20, 16, 0.28);
}

.settingsDanger:hover {
  background: #e04040;
}

.settingsPanelAccount.hidden {
  display: none;
}

@media (max-width: 520px) {
  .profileHead,
  .ranksHead {
    flex-direction: column;
    align-items: stretch;
  }

  .profileRefresh,
  .ranksRefresh {
    width: 100%;
  }

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

  .ranksSelectLabel select {
    width: 100%;
    min-width: 0;
  }

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

