:root {
  color-scheme: light;
  --ink: #1e2b2e;
  --muted: #657374;
  --paper: #fff8df;
  --paper-strong: #fffdf0;
  --panel: rgba(255, 248, 222, 0.9);
  --panel-strong: rgba(255, 252, 238, 0.98);
  --line: rgba(73, 69, 44, 0.16);
  --line-strong: rgba(96, 73, 34, 0.28);
  --teal: #1faaa0;
  --teal-dark: #116865;
  --grass: #6ebf4f;
  --leaf: #358f45;
  --soil: #6e422c;
  --gold: #f4ba37;
  --sun: #f6d96e;
  --coral: #e85d4a;
  --rose: #ca3e63;
  --blue: #3f86c8;
  --shadow: 0 24px 70px rgba(35, 54, 38, 0.23);
  --soft-shadow: 0 12px 28px rgba(38, 58, 40, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 228, 119, 0.58), transparent 24%),
    radial-gradient(circle at 86% 16%, rgba(62, 170, 202, 0.34), transparent 29%),
    linear-gradient(145deg, #8fd3df 0%, #d6e984 48%, #f1bf65 100%);
}

button,
input {
  color: inherit;
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.auth-screen {
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 28px));
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 430px);
  gap: 16px;
  align-items: stretch;
}

.auth-art,
.auth-card,
.game-frame {
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-art {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(105, 205, 224, 0.92) 0 38%, rgba(167, 223, 98, 0.98) 39% 100%);
}

.auth-art::before {
  content: "";
  position: absolute;
  inset: 40% -10% auto -8%;
  height: 42%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(135deg, #98d46c, #57a944 62%, #438b39);
  box-shadow: inset 0 28px 60px rgba(255, 255, 255, 0.26);
}

.auth-art::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 8%;
  bottom: 10%;
  height: 15%;
  border-radius: 50%;
  background: rgba(31, 60, 43, 0.17);
  filter: blur(14px);
}

.mini-map {
  position: absolute;
  left: 50%;
  top: 56%;
  width: min(620px, 82%);
  aspect-ratio: 1.58;
  transform: translate(-50%, -50%) rotateX(58deg) rotateZ(-38deg);
  transform-style: preserve-3d;
}

.mini-map span {
  position: absolute;
  transform-style: preserve-3d;
}

.mini-field {
  inset: 18% 8% 12% 8%;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 221, 150, 0.72) 2px, transparent 2px) 0 0 / 12% 100%,
    linear-gradient(0deg, rgba(255, 221, 150, 0.72) 2px, transparent 2px) 0 0 / 100% 16%,
    linear-gradient(145deg, #9c6742, #593622);
  box-shadow:
    18px 18px 0 #4d3021,
    32px 32px 34px rgba(22, 44, 38, 0.28),
    inset 0 0 0 3px rgba(255, 232, 184, 0.32);
}

.mini-barn {
  left: 3%;
  top: 2%;
  width: 24%;
  height: 31%;
  border-radius: 8px;
  background: linear-gradient(135deg, #f6e0aa, #cc633a);
  box-shadow: 12px 12px 0 #8d4932, 18px 18px 28px rgba(36, 50, 42, 0.2);
}

.mini-barn::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: -35%;
  height: 46%;
  background: linear-gradient(135deg, #263a42, #11191f);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.mini-tree {
  width: 8%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #d9f994, #3b944b 70%);
  box-shadow: 7px 7px 0 #7d5838, 14px 14px 18px rgba(27, 52, 39, 0.2);
}

.mini-tree.one {
  right: 8%;
  top: 4%;
}

.mini-tree.two {
  right: 18%;
  bottom: 5%;
}

.mini-pond {
  right: 1%;
  bottom: 1%;
  width: 25%;
  height: 15%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d5fbff, #35b6ce 68%, #1c7895);
  box-shadow: 8px 8px 0 rgba(16, 85, 100, 0.22);
}

.mini-cart {
  left: 42%;
  top: 2%;
  width: 13%;
  height: 11%;
  border-radius: 5px;
  background: linear-gradient(135deg, #fbfbf1, #b9cdd2);
  box-shadow: 7px 8px 0 rgba(49, 65, 62, 0.2);
}

.auth-card {
  display: grid;
  align-content: center;
  gap: 20px;
  padding: clamp(22px, 4vw, 34px);
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 254, 244, 0.98), rgba(248, 240, 211, 0.91));
}

.auth-brand,
.brand,
.profile-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  color: #fff9dc;
  font-weight: 950;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.28), transparent 36%),
    linear-gradient(135deg, #15766d 0 48%, #dc5e45 49% 100%);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 24px rgba(25, 92, 84, 0.24), inset 0 -5px 0 rgba(0, 0, 0, 0.16);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 242, 0.75);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.auth-tab.active {
  color: #fffdf0;
  background: linear-gradient(180deg, #2fc5b5, #16877f);
  box-shadow: 0 10px 22px rgba(22, 135, 127, 0.22), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  font-weight: 850;
}

.field span,
.eyebrow,
.muted {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 830;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(43, 71, 68, 0.16);
  border-radius: 8px;
  background: rgba(255, 253, 244, 0.94);
  color: var(--ink);
  font-weight: 800;
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.field input:focus {
  border-color: rgba(32, 166, 154, 0.72);
  box-shadow: 0 0 0 4px rgba(32, 166, 154, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.auth-status {
  min-height: 22px;
  color: #9b3b2f;
  font-size: 0.86rem;
  font-weight: 800;
}

.auth-status.success {
  color: #13786f;
}

.primary-action {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  color: #2f2418;
  cursor: pointer;
  font-weight: 950;
  background: linear-gradient(180deg, #ffd36b, #ee9136);
  box-shadow: 0 14px 30px rgba(195, 111, 33, 0.25), inset 0 -4px 0 rgba(97, 55, 15, 0.16);
}

.game-frame {
  width: min(1760px, 100%);
  min-height: min(980px, calc(100vh - 28px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(239, 248, 222, 0.58);
}

.game-tabs {
  min-height: 38px;
  display: flex;
  align-items: stretch;
  padding: 0 8px;
  border-bottom: 1px solid rgba(97, 72, 34, 0.2);
  background: linear-gradient(180deg, #f8dfa2, #d9a956);
  box-shadow: inset 0 -2px 0 rgba(100, 68, 25, 0.14);
}

.tab-button {
  min-width: 88px;
  border: 0;
  border-left: 1px solid rgba(103, 70, 31, 0.18);
  border-right: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #4f341b;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 8px 12px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.32);
}

.tab-button.active,
.tab-button:hover {
  background: rgba(255, 249, 224, 0.52);
}

.hud,
.tooldock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(255, 253, 236, 0.95), rgba(247, 239, 207, 0.78));
  border-color: rgba(43, 71, 68, 0.1);
}

.hud {
  border-bottom: 1px solid rgba(43, 71, 68, 0.1);
}

.tooldock {
  border-top: 1px solid rgba(43, 71, 68, 0.12);
}

.brand {
  min-width: 240px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.18rem, 2.2vw, 1.72rem);
  line-height: 1.05;
}

h2 {
  font-size: 0.92rem;
  line-height: 1.2;
}

.resource-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.stat,
.pill,
.level-chip,
.energy-stat {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(73, 69, 44, 0.15);
  border-radius: 8px;
  background: rgba(255, 253, 241, 0.84);
  padding: 6px 10px;
  font-weight: 870;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 8px 18px rgba(33, 52, 44, 0.08);
}

.level-chip {
  min-width: 178px;
  padding-left: 7px;
}

.level-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff9dd;
  background: radial-gradient(circle at 35% 28%, #fff6a6 0 20%, #f0a627 52%, #a85517 100%);
  box-shadow: 0 3px 0 #77401a, inset 0 -5px 0 rgba(117, 56, 13, 0.28);
  font-size: 1.05rem;
}

.level-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.xp-track,
.energy-track {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(44, 76, 63, 0.14);
}

.xp-track {
  width: 104px;
  height: 9px;
}

.xp-track span,
.energy-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1faaa0, #7acb52, #f3b634);
}

.energy-stat {
  min-width: 250px;
  padding-right: 5px;
}

.energy-track {
  width: 92px;
  height: 15px;
}

.energy-track span {
  background: linear-gradient(90deg, #27c2e5, #3ca4db, #5c7fd0);
}

.bolt {
  position: relative;
  width: 18px;
  height: 26px;
  filter: drop-shadow(0 2px 2px rgba(120, 72, 13, 0.22));
}

.bolt::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ffe987, #f0a927);
  clip-path: polygon(54% 0, 15% 55%, 45% 55%, 28% 100%, 88% 38%, 57% 38%, 76% 0);
}

.add-energy,
.mini-command,
.tiny-button,
.icon-button,
.top-icon,
.tool,
.rail-button {
  border: 1px solid rgba(59, 75, 54, 0.14);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 890;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 8px 18px rgba(39, 61, 54, 0.1);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.add-energy,
.mini-command,
.tiny-button {
  color: #fffdf0;
  background: linear-gradient(180deg, #32bdb0, #15867c);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16), 0 7px 12px rgba(22, 116, 105, 0.16);
}

.add-energy {
  min-height: 31px;
  padding: 5px 9px;
  font-size: 0.78rem;
}

.top-icon {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 34px;
  background: rgba(255, 253, 242, 0.86);
}

.top-icon::before,
.top-icon::after,
.stat-icon,
.rail-icon,
.tool-icon,
.save-symbol,
.reset-symbol {
  content: "";
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

.mail-icon::before {
  position: absolute;
  inset: 8px 7px;
  border: 2px solid #8b6b3d;
  border-radius: 2px;
}

.mail-icon::after {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10px;
  height: 12px;
  border-left: 2px solid #8b6b3d;
  border-bottom: 2px solid #8b6b3d;
  transform: rotate(-45deg);
}

.cog-icon::before {
  position: absolute;
  inset: 9px;
  border: 4px solid #75806a;
  border-radius: 50%;
}

.cog-icon::after {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 15px;
  height: 4px;
  background: #75806a;
  box-shadow: 0 -7px 0 #75806a, 0 7px 0 #75806a;
}

.exit-icon::before {
  position: absolute;
  left: 9px;
  top: 8px;
  width: 17px;
  height: 17px;
  border: 3px solid #b24b3b;
  border-left-color: transparent;
  border-radius: 50%;
}

.exit-icon::after,
.close-icon::before,
.close-icon::after {
  position: absolute;
  background: #b24b3b;
  border-radius: 99px;
}

.exit-icon::after {
  right: 8px;
  top: 15px;
  width: 14px;
  height: 3px;
}

.close-icon::before,
.close-icon::after {
  left: 10px;
  top: 16px;
  width: 17px;
  height: 3px;
}

.close-icon::before {
  transform: rotate(45deg);
}

.close-icon::after {
  transform: rotate(-45deg);
}

.stat-icon {
  width: 22px;
  height: 22px;
}

.coin-icon {
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff7bd 0 20%, #f5bb37 52%, #a96b12 100%);
  box-shadow: inset -4px -5px 0 rgba(134, 87, 14, 0.22), 0 2px 5px rgba(120, 73, 6, 0.22);
}

.gem-icon {
  background: linear-gradient(135deg, #ffd1df, #d13270 60%, #7f1840);
  clip-path: polygon(50% 0, 90% 25%, 74% 100%, 26% 100%, 10% 25%);
  box-shadow: 0 3px 6px rgba(118, 25, 61, 0.2);
}

.water-icon-small,
.water-icon::before {
  border-radius: 55% 55% 60% 60%;
  background: linear-gradient(150deg, #e8fbff 8%, #58cde2 54%, #2b96b1 100%);
  transform: rotate(45deg);
  box-shadow: inset -4px -3px 0 rgba(24, 119, 146, 0.18), 0 2px 7px rgba(40, 152, 178, 0.18);
}

.play-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 82px minmax(242px, 292px) minmax(520px, 1fr) minmax(270px, 318px) 84px;
  gap: 10px;
  padding: 10px;
}

.rail {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.rail-button {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 7px 5px;
  background: linear-gradient(180deg, #fff8df, #e8cf91);
  color: #4f361f;
  font-size: 0.72rem;
  text-align: center;
}

.rail-button strong {
  min-width: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d94450;
  color: #fffdf0;
  font-size: 0.78rem;
}

.rail-button.active,
.rail-button:hover,
.tool.active,
.icon-button:hover,
.mini-command:hover,
.tiny-button:hover,
.seed-row:hover,
.shop-row:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 153, 145, 0.58);
}

.rail-button.compact {
  min-height: 70px;
}

.shop-cta {
  min-height: 100px;
  background: linear-gradient(180deg, #ffe27f, #ee9a34);
  font-size: 0.92rem;
}

.rail-icon,
.tool-icon {
  width: 28px;
  height: 28px;
}

.goals-icon::before {
  content: "";
  position: absolute;
}

.goals-icon,
.market-icon,
.buddies-icon,
.tools-icon,
.animal-icon,
.basket-icon,
.gift-icon,
.stall-icon {
  position: relative;
}

.goals-icon::before {
  inset: 4px 5px;
  border: 3px solid #8b6b3d;
  border-radius: 4px;
  background: #fff6d2;
}

.goals-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 11px;
  height: 6px;
  border-left: 3px solid #34a05f;
  border-bottom: 3px solid #34a05f;
  transform: rotate(-45deg);
}

.market-icon::before,
.stall-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 15px;
  border-radius: 3px;
  background: #f6dc9a;
  border: 2px solid #8b6236;
}

.market-icon::after,
.stall-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 3px;
  height: 12px;
  border-radius: 8px 8px 2px 2px;
  background: repeating-linear-gradient(90deg, #df4b4b 0 9px, #fff5d9 9px 18px);
  border: 2px solid #8b6236;
}

.buddies-icon::before,
.buddies-icon::after,
.animal-icon::before,
.animal-icon::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #f2c08b;
  border: 2px solid #8a5237;
}

.buddies-icon::before {
  left: 4px;
  top: 5px;
  width: 13px;
  height: 13px;
}

.buddies-icon::after {
  right: 4px;
  top: 8px;
  width: 13px;
  height: 13px;
}

.animal-icon::before {
  left: 3px;
  top: 9px;
  width: 21px;
  height: 15px;
  background: #fff9e8;
}

.animal-icon::after {
  left: 13px;
  top: 5px;
  width: 9px;
  height: 9px;
  background: #3d2a24;
  border: 0;
}

.tools-icon::before,
.tools-icon::after {
  content: "";
  position: absolute;
  border-radius: 3px;
  background: #6a777b;
}

.tools-icon::before {
  left: 13px;
  top: 2px;
  width: 5px;
  height: 24px;
  transform: rotate(35deg);
}

.tools-icon::after {
  left: 5px;
  top: 7px;
  width: 18px;
  height: 6px;
  transform: rotate(-30deg);
}

.basket-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 17px;
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(90deg, #b46b32, #e0a552);
  border: 2px solid #7c4b2c;
}

.basket-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 5px;
  height: 14px;
  border: 3px solid #7c4b2c;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.gift-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f0c333 0 39%, #2f92d1 40% 60%, #f0c333 61% 100%);
  border: 2px solid #9d681c;
}

.gift-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 3px;
  width: 10px;
  height: 10px;
  border: 3px solid #2f92d1;
  border-radius: 50%;
}

.panel-stack {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.panel {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.profile-panel {
  padding: 11px;
}

.panel-heading {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(45, 70, 65, 0.1);
}

.compact-list {
  display: grid;
  gap: 7px;
  padding: 9px;
}

.scroll-list {
  max-height: 236px;
  overflow: auto;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 660px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 12px;
  background: #86c755;
  box-shadow: inset 0 0 0 1px rgba(22, 77, 69, 0.08), 0 18px 48px rgba(24, 74, 61, 0.14);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), transparent 22%),
    radial-gradient(circle at 50% 64%, transparent 0 48%, rgba(28, 54, 42, 0.16) 100%);
}

#farmCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 660px;
  cursor: pointer;
}

.action-hint,
.toast,
.tile-pop {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  border: 1px solid rgba(41, 66, 61, 0.13);
  border-radius: 8px;
  background: rgba(255, 253, 243, 0.93);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(31, 48, 39, 0.18);
  font-weight: 850;
  backdrop-filter: blur(16px);
}

.action-hint {
  left: 12px;
  top: 12px;
  max-width: min(360px, calc(100% - 24px));
  padding: 9px 12px;
  font-size: 0.84rem;
}

.toast {
  left: 50%;
  bottom: 16px;
  max-width: min(460px, calc(100% - 32px));
  padding: 10px 14px;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tile-pop {
  min-width: 190px;
  padding: 10px;
  font-size: 0.84rem;
}

.tile-pop strong,
.tile-pop span {
  display: block;
}

.row,
.seed-row,
.shop-row,
.goal-row,
.order-row,
.inventory-row,
.animal-row,
.buddy-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 50px;
  padding: 8px;
  border: 1px solid rgba(42, 69, 66, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 242, 0.73);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.seed-row,
.shop-row {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.seed-row.active,
.shop-row.active {
  outline: 2px solid rgba(32, 166, 154, 0.24);
  border-color: rgba(32, 166, 154, 0.52);
  background: linear-gradient(180deg, rgba(239, 255, 249, 0.94), rgba(255, 253, 242, 0.78));
}

.seed-row:disabled,
.shop-row:disabled,
.tiny-button:disabled,
.mini-command:disabled {
  cursor: not-allowed;
  filter: saturate(0.68);
  opacity: 0.7;
  transform: none;
}

.swatch,
.product-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: inset -5px -5px 0 rgba(0, 0, 0, 0.15), 0 4px 10px rgba(35, 50, 40, 0.14);
}

.product-dot.square {
  border-radius: 8px;
}

.row-main {
  min-width: 0;
}

.row-main strong,
.row-main span {
  display: block;
}

.row-main strong {
  overflow-wrap: anywhere;
  line-height: 1.14;
}

.row-main span,
.row-note {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 770;
}

.row-note {
  text-align: right;
}

.progress-line {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(36, 82, 68, 0.12);
  margin-top: 5px;
}

.progress-line span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1faaa0, #80bc4b, #f4ba37);
}

.tools,
.dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool,
.icon-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 253, 242, 0.84);
  padding: 8px 11px;
}

.tool {
  min-width: 92px;
}

.tool.active {
  background: linear-gradient(180deg, #e5fff7, #d2f6ec);
}

.icon-button.subtle,
.subtle {
  background: rgba(246, 241, 224, 0.86);
}

.danger {
  background: #ffe4dc;
  color: #8d2d22;
}

.tool-icon {
  position: relative;
  width: 22px;
  height: 22px;
}

.inspect-icon::before,
.seed-icon::before,
.water-icon::before,
.harvest-icon::before,
.feed-icon::before,
.clear-icon::before,
.save-symbol::before,
.reset-symbol::before,
.save-symbol::after {
  content: "";
  position: absolute;
}

.inspect-icon::before {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 18px solid var(--teal-dark);
  filter: drop-shadow(0 2px 2px rgba(18, 72, 68, 0.18));
  transform: rotate(-35deg);
}

.seed-icon::before {
  inset: 1px;
  border-radius: 50% 50% 50% 12%;
  background: radial-gradient(circle at 30% 28%, #ffac9c, var(--coral) 62%, #9a352e 100%);
  transform: rotate(-32deg) scale(0.86);
}

.harvest-icon::before {
  left: 0;
  right: 0;
  top: 10px;
  height: 9px;
  border-radius: 99px;
  background: var(--gold);
  box-shadow: 4px -9px 0 -3px var(--leaf), -5px -7px 0 -3px var(--leaf);
}

.feed-icon::before {
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 15px;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #d9a34e, #8b5329);
}

.feed-icon::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 2px;
  height: 11px;
  border-radius: 50%;
  background: #9ccd55;
}

.clear-icon::before {
  left: 5px;
  right: 5px;
  top: 3px;
  bottom: 3px;
  border-radius: 3px;
  background:
    linear-gradient(90deg, transparent 40%, #86604a 41% 58%, transparent 59%),
    linear-gradient(160deg, transparent 45%, #4f6170 46% 72%, transparent 73%);
}

.save-symbol,
.reset-symbol {
  position: relative;
  width: 20px;
  height: 20px;
}

.save-symbol::before {
  inset: 1px;
  border: 3px solid var(--teal-dark);
  border-radius: 4px;
}

.save-symbol::after {
  left: 5px;
  right: 5px;
  top: 4px;
  height: 5px;
  background: var(--teal-dark);
}

.reset-symbol::before {
  inset: 1px;
  border: 3px solid var(--coral);
  border-right-color: transparent;
  border-radius: 50%;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 38, 38, 0.42);
  backdrop-filter: blur(10px);
}

.dialog {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 16px;
  box-shadow: var(--shadow);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.dialog p {
  margin-top: 8px;
  color: var(--muted);
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}


.sign-editor {
  display: grid;
  gap: 8px;
}

.sign-editor span {
  font-weight: 900;
  color: var(--ink);
}

.sign-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(131, 94, 48, 0.42);
  border-radius: 7px;
  background: rgba(255, 253, 242, 0.92);
  padding: 9px 11px;
  color: var(--ink);
  font: 900 1rem Arial, sans-serif;
  outline: none;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.62);
}

.sign-input:focus {
  border-color: rgba(29, 143, 129, 0.72);
  box-shadow: 0 0 0 3px rgba(39, 167, 150, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.62);
}

@media (max-width: 1460px) {
  .play-layout {
    grid-template-columns: 76px minmax(220px, 272px) minmax(480px, 1fr) minmax(248px, 298px);
  }

  .right-rail {
    display: none;
  }
}

@media (max-width: 1120px) {
  .auth-screen {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-art {
    min-height: 330px;
  }

  .game-frame {
    min-height: auto;
  }

  .game-tabs {
    overflow-x: auto;
  }

  .play-layout {
    grid-template-columns: 1fr;
  }

  .left-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rail-button {
    min-height: 58px;
    grid-template-columns: auto 1fr auto;
    text-align: left;
    padding: 8px 10px;
  }

  .left-panels,
  .right-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage,
  #farmCanvas {
    min-height: 590px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 0;
  }

  .auth-screen {
    min-height: 100vh;
    gap: 0;
  }

  .auth-art {
    min-height: 230px;
    border-radius: 0;
  }

  .auth-card {
    order: -1;
    min-height: calc(100vh - 230px);
    border-radius: 0;
  }

  .game-frame {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .hud,
  .tooldock {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .resource-strip,
  .tools,
  .dock-actions {
    justify-content: stretch;
  }

  .stat,
  .level-chip,
  .energy-stat,
  .tool,
  .icon-button {
    flex: 1 1 136px;
  }

  .left-rail,
  .left-panels,
  .right-panels {
    grid-template-columns: 1fr;
  }

  .play-layout {
    padding: 8px;
  }

  .stage,
  #farmCanvas {
    min-height: 500px;
  }
}

/* Original Growing Farm landing page */
html {
  scroll-behavior: smooth;
}

body.is-loading {
  overflow: hidden;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  color: #fffdf0;
  background:
    linear-gradient(180deg, rgba(13, 44, 32, 0.38), rgba(13, 45, 31, 0.72)),
    url("assets/landing-hero-v1.png") center / cover no-repeat;
}

.loading-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(233, 255, 165, 0.2), transparent 32%),
    linear-gradient(90deg, rgba(13, 45, 31, 0.18), transparent 35% 65%, rgba(13, 45, 31, 0.18));
  pointer-events: none;
}

.loading-card {
  position: relative;
  width: min(520px, 100%);
  display: grid;
  justify-items: center;
  padding: clamp(30px, 6vw, 52px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 30px 30px 30px 10px;
  text-align: center;
  background: rgba(21, 58, 40, 0.78);
  box-shadow: 0 34px 90px rgba(10, 31, 21, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(18px);
}

.loading-logo {
  width: clamp(180px, 35vw, 250px);
  height: auto;
  margin: -34px 0 -10px;
  filter: drop-shadow(0 15px 24px rgba(7, 27, 17, 0.34));
  animation: loading-float 2.8s ease-in-out infinite;
}

.loading-kicker {
  color: #d9ef80;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.loading-card h1 {
  margin-top: 8px;
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 1000;
  letter-spacing: -0.055em;
}

.loading-message {
  min-height: 24px;
  margin-top: 12px;
  color: rgba(255, 255, 240, 0.76);
  font-size: 0.9rem;
  font-weight: 750;
}

.loading-progress {
  width: 100%;
  height: 13px;
  overflow: hidden;
  margin-top: 24px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(8, 33, 22, 0.52);
  box-shadow: inset 0 3px 7px rgba(7, 27, 18, 0.35);
}

.loading-progress span {
  position: relative;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #68c86f, #d9ee64, #ffc855);
  box-shadow: 0 0 18px rgba(218, 239, 100, 0.52);
  transition: width 240ms ease;
}

.loading-progress span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 15%, rgba(255, 255, 255, 0.58) 45%, transparent 70%);
  transform: translateX(-100%);
  animation: loading-shimmer 1.35s linear infinite;
}

.loading-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 9px;
  color: rgba(255, 255, 240, 0.62);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.loading-meta strong {
  color: #e7f88b;
}

@keyframes loading-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1deg); }
}

@keyframes loading-shimmer {
  to { transform: translateX(100%); }
}

.shell {
  min-height: 100vh;
  display: block;
  padding: 0;
}

.auth-screen {
  width: 100%;
  min-height: 100vh;
  display: block;
  overflow: hidden;
  color: #243528;
  background: #f8f1dc;
}

.game-frame {
  margin: 14px auto;
}

.landing-hero {
  position: relative;
  min-height: max(760px, 100svh);
  isolation: isolate;
  overflow: hidden;
  background-image: url("assets/landing-hero-v1.png");
  background-position: center center;
  background-size: cover;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(18, 52, 38, 0.76) 0%, rgba(23, 63, 44, 0.46) 34%, rgba(34, 67, 46, 0.08) 67%, rgba(29, 50, 35, 0.2) 100%),
    linear-gradient(180deg, rgba(11, 38, 31, 0.34) 0%, transparent 25%, transparent 72%, rgba(20, 38, 26, 0.48) 100%);
}

.landing-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 160px;
  background: linear-gradient(180deg, transparent, rgba(20, 41, 28, 0.24));
}

.landing-header {
  position: relative;
  z-index: 3;
  width: min(1280px, calc(100% - 48px));
  min-height: 96px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fffdf0;
  text-decoration: none;
  text-shadow: 0 2px 10px rgba(15, 37, 25, 0.28);
}

.landing-brand-logo {
  display: block;
  width: clamp(148px, 12vw, 184px);
  height: auto;
  filter: drop-shadow(0 10px 16px rgba(15, 37, 25, 0.3));
}

.landing-logo-mark,
.auth-seal {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px 18px 18px 7px;
  color: #fff8d6;
  font-weight: 1000;
  font-style: italic;
  letter-spacing: -0.08em;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(145deg, #45b873 0 52%, #ef774c 53% 100%);
  box-shadow: 0 12px 28px rgba(18, 65, 43, 0.28), inset 0 -5px 0 rgba(39, 78, 39, 0.22);
  transform: rotate(-2deg);
}

.landing-logo-mark::after,
.auth-seal::after {
  content: "";
  position: absolute;
  top: -10px;
  right: 6px;
  width: 17px;
  height: 11px;
  border-radius: 100% 0 100% 0;
  background: #bde760;
  transform: rotate(-28deg);
  box-shadow: 0 2px 0 rgba(33, 82, 41, 0.24);
}

.landing-brand-copy {
  display: grid;
  gap: 1px;
}

.landing-brand-copy strong {
  font-size: 1.18rem;
  font-weight: 1000;
  letter-spacing: -0.035em;
}

.landing-brand-copy small {
  color: rgba(255, 255, 240, 0.78);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.landing-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(35, 62, 41, 0.32);
  box-shadow: 0 12px 32px rgba(15, 38, 27, 0.16);
  backdrop-filter: blur(14px);
}

.landing-nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fffdf0;
  padding: 0 17px;
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

.landing-nav a:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

.landing-nav .nav-play {
  color: #28411f;
  background: linear-gradient(180deg, #e0f36c, #9fd447);
  box-shadow: inset 0 -3px 0 rgba(58, 105, 31, 0.22), 0 8px 18px rgba(34, 65, 33, 0.18);
}

.hero-layout {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 48px));
  min-height: calc(max(760px, 100svh) - 96px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 438px);
  align-items: center;
  gap: clamp(42px, 7vw, 110px);
  padding: 60px 0 108px;
}

.hero-copy {
  max-width: 660px;
  color: #fffef0;
  text-shadow: 0 3px 18px rgba(18, 45, 31, 0.35);
}

.hero-kicker,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #dbef8f;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.hero-kicker span {
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: #dcee72;
  box-shadow: 0 0 16px rgba(229, 246, 112, 0.65);
}

.hero-copy h1 {
  margin: 18px 0 20px;
  color: #fffdf1;
  font-size: clamp(3.9rem, 7vw, 7.2rem);
  font-weight: 1000;
  line-height: 0.82;
  letter-spacing: -0.075em;
}

.hero-copy h1 em {
  color: #dff169;
  font-size: 0.72em;
  font-style: normal;
  letter-spacing: -0.055em;
}

.hero-description {
  max-width: 590px;
  color: rgba(255, 255, 243, 0.9);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  font-weight: 650;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.hero-primary,
.hero-secondary {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 0 24px;
  font-weight: 950;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.hero-primary {
  color: #314323;
  background: linear-gradient(180deg, #e5f36f, #a7d840);
  box-shadow: 0 14px 30px rgba(33, 68, 31, 0.26), inset 0 -4px 0 rgba(64, 111, 32, 0.2);
}

.hero-secondary {
  border-color: rgba(255, 255, 255, 0.38);
  color: #fffdf0;
  background: rgba(29, 63, 44, 0.35);
  backdrop-filter: blur(10px);
}

.hero-primary:hover,
.hero-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(25, 55, 32, 0.3);
}

.hero-proof {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 32px;
  color: rgba(255, 255, 242, 0.72);
  font-size: 0.76rem;
  font-weight: 750;
}

.hero-proof span {
  display: grid;
  gap: 2px;
}

.hero-proof strong {
  color: #fffdf0;
  font-size: 0.9rem;
  font-weight: 950;
}

.auth-card {
  order: initial;
  min-height: auto;
  display: grid;
  align-content: center;
  gap: 17px;
  padding: clamp(25px, 3vw, 34px);
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px 28px 28px 9px;
  color: #26382e;
  background:
    radial-gradient(circle at 100% 0, rgba(220, 241, 132, 0.38), transparent 33%),
    linear-gradient(165deg, rgba(255, 254, 239, 0.97), rgba(249, 241, 211, 0.94));
  box-shadow: 0 34px 80px rgba(20, 45, 30, 0.35), inset 0 1px 0 #fff;
  backdrop-filter: blur(22px);
}

.auth-brand,
.brand,
.profile-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-seal {
  width: 52px;
  height: 52px;
  border-color: rgba(255, 255, 255, 0.82);
  border-radius: 16px 16px 16px 6px;
  font-size: 0.95rem;
  text-shadow: 0 1px 3px rgba(40, 65, 34, 0.24);
}

.auth-card .eyebrow {
  color: #70816c;
  font-size: 0.67rem;
  letter-spacing: 0.13em;
}

.auth-card h2 {
  margin-top: 3px;
  color: #24362b;
  font-size: clamp(1.65rem, 2.8vw, 2.15rem);
  font-weight: 1000;
  letter-spacing: -0.045em;
}

.auth-lead {
  color: #6c786a;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(56, 82, 58, 0.13);
  border-radius: 14px;
  background: rgba(236, 232, 201, 0.72);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  color: #586753;
  background: transparent;
  cursor: pointer;
  font-weight: 950;
}

.auth-tab.active {
  color: #fffdf0;
  background: linear-gradient(180deg, #45bd81, #24855f);
  box-shadow: 0 9px 20px rgba(29, 112, 77, 0.22), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.auth-form {
  display: grid;
  gap: 11px;
}

.signup-extras,
.consent-list {
  display: grid;
  gap: 10px;
}

.consent-list {
  gap: 8px;
}

.consent-option {
  display: grid;
  grid-template-columns: 19px 1fr;
  align-items: start;
  gap: 9px;
  color: #5e695b;
  font-size: 0.73rem;
  font-weight: 720;
  line-height: 1.45;
}

.consent-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #2d9c6d;
  cursor: pointer;
}

.legal-trigger {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  color: #267356;
  background: none;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-trigger:hover {
  color: #174d39;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 850;
}

.field span,
.field > label {
  color: #667362;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: #697768;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #217451;
  background: rgba(45, 156, 109, 0.1);
  outline: none;
}

.password-eye {
  position: relative;
  width: 21px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50% / 65%;
}

.password-eye::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.password-toggle[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 2px rgba(255, 255, 246, 0.88);
}

.password-strength {
  display: grid;
  gap: 5px;
}

.password-strength-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(67, 85, 68, 0.12);
}

.password-strength-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #aab2a5;
  transition: width 180ms ease, background 180ms ease;
}

.password-strength-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

.password-strength-copy strong {
  color: #778073;
}

.password-strength[data-level="weak"] .password-strength-track i {
  background: #df6659;
}

.password-strength[data-level="weak"] .password-strength-copy strong {
  color: #b94c42;
}

.password-strength[data-level="recommended"] .password-strength-track i {
  background: #e8ad41;
}

.password-strength[data-level="recommended"] .password-strength-copy strong {
  color: #9a6b20;
}

.password-strength[data-level="excellent"] .password-strength-track i {
  background: #35a875;
}

.password-strength[data-level="excellent"] .password-strength-copy strong {
  color: #1d7957;
}

.field input {
  width: 100%;
  min-height: 47px;
  border: 1px solid rgba(46, 77, 58, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 246, 0.92);
  color: #26382e;
  font-weight: 800;
  padding: 10px 13px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(60, 72, 45, 0.06), 0 1px 0 #fff;
}

.field input::placeholder {
  color: #a6ad9c;
  font-weight: 650;
}

.field input:focus {
  border-color: rgba(49, 161, 108, 0.72);
  box-shadow: 0 0 0 4px rgba(49, 161, 108, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.auth-status {
  min-height: 19px;
  color: #a64639;
  font-size: 0.8rem;
  font-weight: 850;
}

.auth-status.success {
  color: #187357;
}

.legal-dialog {
  width: min(620px, 100%);
  border-radius: 18px;
  background: #fffdf0;
}

.legal-copy {
  margin-top: 14px;
  color: #536052;
  line-height: 1.65;
}

.legal-copy ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0 20px;
}

.primary-action {
  min-height: 53px;
  border: 0;
  border-radius: 13px;
  color: #3c351e;
  cursor: pointer;
  font-weight: 1000;
  background: linear-gradient(180deg, #ffd969, #f2a73f);
  box-shadow: 0 14px 28px rgba(173, 105, 35, 0.25), inset 0 -4px 0 rgba(100, 63, 18, 0.16);
  transition: transform 160ms ease, filter 160ms ease;
}

.primary-action:hover {
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.primary-action:disabled {
  cursor: wait;
  filter: grayscale(0.4);
  opacity: 0.7;
}

.auth-note {
  color: #829079;
  font-size: 0.71rem;
  font-weight: 750;
  text-align: center;
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: rgba(255, 255, 240, 0.78);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-decoration: none;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.hero-scroll i {
  width: 22px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

.hero-scroll i::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  margin: 7px auto 0;
  border-radius: 999px;
  background: #e2ef78;
  animation: landing-scroll 1.7s ease-in-out infinite;
}

@keyframes landing-scroll {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(9px); opacity: 1; }
}

.landing-section {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 104px 0;
}

.section-heading {
  max-width: 720px;
  margin: 0 auto 52px;
  text-align: center;
}

.section-kicker {
  color: #508a52;
}

.section-heading h2,
.community-banner h2,
.preview-copy h2 {
  margin: 12px 0 14px;
  color: #263c2d;
  font-size: clamp(2.25rem, 4.5vw, 4rem);
  font-weight: 1000;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.section-heading p,
.preview-copy p {
  color: #6f7b6c;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.7;
}

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

.tour-feature {
  position: relative;
  min-height: 300px;
  padding: 32px;
  overflow: hidden;
  border: 1px solid rgba(68, 95, 60, 0.12);
  border-radius: 26px 26px 26px 8px;
  background: #fffdf0;
  box-shadow: 0 20px 46px rgba(57, 79, 51, 0.1);
}

.tour-feature::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -68px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(134, 188, 76, 0.1);
}

.feature-number {
  position: absolute;
  top: 24px;
  right: 26px;
  color: rgba(56, 85, 51, 0.17);
  font-size: 2.6rem;
  font-weight: 1000;
  letter-spacing: -0.08em;
}

.feature-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px 20px 20px 6px;
  color: #fffef0;
  font-size: 1.7rem;
  font-weight: 1000;
  background: linear-gradient(145deg, #50b779, #278259);
  box-shadow: inset 0 -5px 0 rgba(20, 87, 55, 0.2), 0 12px 24px rgba(37, 110, 67, 0.18);
}

.feature-care .feature-icon {
  background: linear-gradient(145deg, #ef8c63, #da5d4b);
}

.feature-build .feature-icon {
  background: linear-gradient(145deg, #58b5ce, #2c7eaa);
}

.tour-feature h3 {
  max-width: 240px;
  margin: 48px 0 12px;
  color: #2b3d30;
  font-size: 1.42rem;
  font-weight: 1000;
  letter-spacing: -0.035em;
}

.tour-feature p {
  color: #778174;
  font-weight: 650;
  line-height: 1.6;
}

.valley-preview {
  margin-top: 80px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: center;
  gap: clamp(40px, 7vw, 90px);
  padding: clamp(34px, 5vw, 66px);
  border-radius: 34px 34px 34px 10px;
  background:
    radial-gradient(circle at 92% 0, rgba(218, 239, 117, 0.26), transparent 38%),
    linear-gradient(145deg, #274735, #183829);
  box-shadow: 0 32px 76px rgba(32, 62, 42, 0.2);
}

.preview-copy .section-kicker {
  color: #d9eb78;
}

.preview-copy h2 {
  color: #fffced;
  font-size: clamp(2.1rem, 4vw, 3.5rem);
}

.preview-copy p {
  color: rgba(247, 248, 226, 0.72);
}

.text-link {
  display: inline-flex;
  gap: 9px;
  margin-top: 24px;
  color: #e2ef75;
  font-weight: 950;
  text-decoration: none;
}

.preview-window {
  overflow: hidden;
  border: 7px solid rgba(255, 252, 226, 0.9);
  border-radius: 24px 24px 24px 7px;
  background: #a9d6d2;
  box-shadow: 0 28px 60px rgba(4, 29, 19, 0.3), inset 0 0 0 1px rgba(31, 71, 49, 0.18);
  transform: rotate(1.4deg);
}

.preview-topbar {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6d765e;
  background: #fff8d9;
  padding: 0 14px;
  font-size: 0.68rem;
  font-weight: 900;
}

.preview-topbar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e36e55;
}

.preview-topbar i:nth-child(2) { background: #efbd52; }
.preview-topbar i:nth-child(3) { background: #69b966; }
.preview-topbar span { margin-left: auto; }

.preview-land {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, #ffef94 0 5%, transparent 6%),
    linear-gradient(180deg, #7ccce0 0 38%, #9ed76b 39% 100%);
}

.preview-land::before {
  content: "";
  position: absolute;
  inset: 39% -10% auto;
  height: 46%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(145deg, #79be5b, #3c8c43);
}

.preview-barn,
.preview-field,
.preview-pond,
.preview-tree {
  position: absolute;
  z-index: 2;
}

.preview-barn {
  left: 10%;
  top: 31%;
  width: 25%;
  height: 30%;
  border: 4px solid #fff0c8;
  border-radius: 10px 10px 5px 5px;
  background: #e26d4c;
  box-shadow: 10px 13px 0 #9b4737;
}

.preview-barn::before {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  top: -39%;
  height: 43%;
  background: #286b61;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.preview-field {
  width: 37%;
  height: 25%;
  border: 3px solid rgba(255, 237, 171, 0.7);
  background:
    linear-gradient(90deg, rgba(255, 226, 152, 0.5) 2px, transparent 2px) 0 0 / 17% 100%,
    linear-gradient(0deg, rgba(255, 226, 152, 0.5) 2px, transparent 2px) 0 0 / 100% 28%,
    #8a5738;
  transform: skewY(-10deg);
}

.field-one { right: 10%; bottom: 21%; }
.field-two { right: 27%; bottom: 4%; transform: skewY(8deg) scale(0.78); }

.preview-pond {
  left: 32%;
  bottom: 11%;
  width: 25%;
  height: 12%;
  border: 3px solid rgba(227, 251, 244, 0.8);
  border-radius: 50%;
  background: #43b6cc;
  box-shadow: 7px 8px 0 rgba(24, 93, 95, 0.18);
}

.preview-tree {
  width: 9%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #d9ed70, #3a8b43 68%);
  box-shadow: 6px 8px 0 #7a5231;
}

.tree-one { left: 44%; top: 33%; }
.tree-two { right: 4%; top: 42%; transform: scale(0.78); }

.news-section {
  padding-top: 38px;
}

.compact-heading {
  margin-bottom: 34px;
  text-align: left;
}

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

.news-grid article {
  min-height: 230px;
  padding: 28px;
  border-top: 4px solid #62a765;
  border-radius: 7px 7px 22px 22px;
  background: rgba(255, 253, 240, 0.92);
  box-shadow: 0 18px 42px rgba(61, 76, 51, 0.09);
}

.news-grid article:nth-child(2) { border-color: #e9835d; }
.news-grid article:nth-child(3) { border-color: #4ca6bd; }

.news-tag {
  color: #5c925a;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.news-grid h3 {
  margin: 38px 0 12px;
  color: #2e4033;
  font-size: 1.25rem;
  font-weight: 1000;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.news-grid p {
  color: #7a8476;
  font-weight: 650;
  line-height: 1.55;
}

.community-banner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: clamp(36px, 6vw, 68px);
  border-radius: 34px 34px 34px 10px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 231, 105, 0.7), transparent 28%),
    linear-gradient(135deg, #b9df58, #6eb65a);
  box-shadow: 0 28px 60px rgba(67, 111, 54, 0.2);
}

.community-banner > div {
  max-width: 760px;
}

.community-banner .section-kicker {
  color: #315d35;
}

.community-banner h2 {
  margin-bottom: 0;
}

.community-banner .hero-primary {
  flex: 0 0 auto;
  color: #fffdf0;
  background: #244f39;
  box-shadow: 0 16px 32px rgba(34, 70, 46, 0.26), inset 0 -4px 0 rgba(7, 37, 21, 0.18);
}

.landing-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 34px;
  padding: 38px max(24px, calc((100% - 1180px) / 2));
  color: rgba(245, 247, 226, 0.66);
  background: #173226;
}

.footer-brand .landing-logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px 13px 13px 5px;
  font-size: 0.78rem;
}

.footer-brand .landing-brand-logo {
  width: 142px;
}

.landing-footer p {
  font-size: 0.73rem;
  font-weight: 700;
  text-align: center;
}

.landing-footer nav {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
}

.landing-footer nav a {
  color: #f5f5dc;
  font-size: 0.75rem;
  font-weight: 850;
  text-decoration: none;
}

@media (max-width: 1050px) {
  .landing-header,
  .hero-layout {
    width: min(900px, calc(100% - 36px));
  }

  .landing-nav a:not(.nav-play) {
    display: none;
  }

  .hero-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 44px;
    padding: 70px 0 120px;
  }

  .hero-copy {
    max-width: 620px;
  }

  .auth-card {
    width: min(520px, 100%);
    justify-self: end;
  }

  .landing-hero {
    background-position: 42% center;
  }

  .tour-grid,
  .news-grid {
    grid-template-columns: 1fr;
  }

  .tour-feature {
    min-height: 230px;
  }

  .tour-feature h3 {
    margin-top: 32px;
  }

  .valley-preview {
    grid-template-columns: 1fr;
  }

  .landing-footer {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .landing-footer nav {
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .landing-hero {
    min-height: auto;
    background-position: 38% center;
  }

  .landing-hero::before {
    background:
      linear-gradient(180deg, rgba(18, 51, 37, 0.5), rgba(18, 51, 37, 0.22) 35%, rgba(18, 49, 35, 0.7) 100%),
      linear-gradient(90deg, rgba(18, 52, 38, 0.58), rgba(29, 50, 35, 0.1));
  }

  .landing-header {
    width: calc(100% - 28px);
    min-height: 104px;
  }

  .landing-brand-logo {
    width: 132px;
  }

  .landing-logo-mark {
    width: 47px;
    height: 47px;
    border-radius: 14px 14px 14px 5px;
    font-size: 0.82rem;
  }

  .landing-brand-copy strong {
    font-size: 1rem;
  }

  .landing-brand-copy small {
    font-size: 0.57rem;
  }

  .landing-nav {
    padding: 4px;
  }

  .landing-nav .nav-play {
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.72rem;
  }

  .hero-layout {
    width: calc(100% - 28px);
    gap: 36px;
    padding: 58px 0 100px;
  }

  .hero-copy h1 {
    margin-top: 14px;
    font-size: clamp(3.2rem, 18vw, 5rem);
  }

  .hero-description {
    font-size: 0.94rem;
  }

  .hero-actions,
  .hero-proof {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions a {
    width: 100%;
  }

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

  .hero-proof span {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: rgba(27, 65, 44, 0.26);
  }

  .auth-card {
    width: 100%;
    min-height: auto;
    justify-self: stretch;
    padding: 24px 20px;
    border-radius: 23px 23px 23px 8px;
  }

  .hero-scroll {
    display: none;
  }

  .landing-section,
  .community-banner {
    width: calc(100% - 28px);
  }

  .landing-section {
    padding: 72px 0;
  }

  .section-heading {
    margin-bottom: 34px;
  }

  .tour-feature {
    min-height: 250px;
    padding: 26px;
  }

  .valley-preview {
    margin-top: 48px;
    padding: 26px 20px;
    border-radius: 26px 26px 26px 8px;
  }

  .preview-land {
    min-height: 250px;
  }

  .community-banner {
    margin-bottom: 60px;
    align-items: stretch;
    flex-direction: column;
    padding: 34px 24px;
    border-radius: 26px 26px 26px 8px;
  }

  .community-banner .hero-primary {
    width: 100%;
  }

  .landing-footer {
    padding: 34px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .loading-logo,
  .loading-progress span::after { animation: none; }
  .loading-progress span { transition: none; }
  .hero-scroll i::after { animation: none; }
  .hero-primary,
  .hero-secondary,
  .primary-action,
  .landing-nav a { transition: none; }
}

/* Wide map mode: side content panels are hidden until they become image/button popups. */
.left-panels,
.right-panels {
  display: none !important;
}

.shell {
  padding: 0;
}

.game-frame {
  width: 100vw;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

.play-layout {
  grid-template-columns: 82px minmax(0, 1fr) 84px;
  gap: 8px;
  padding: 8px;
}

.stage,
#farmCanvas {
  min-height: calc(100vh - 164px);
}

.stage {
  border-radius: 8px;
}

.rail {
  position: relative;
  z-index: 4;
}



@media (max-width: 1460px) {
  .play-layout {
    grid-template-columns: 76px minmax(0, 1fr) 78px;
  }

  .right-rail {
    display: grid;
  }
}

@media (max-width: 1120px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .left-rail,
  .right-rail {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage,
  #farmCanvas {
    min-height: 620px;
  }
}

@media (max-width: 720px) {
  .stage,
  #farmCanvas {
    min-height: 520px;
  }
}


/* Image-backed buttons generated for the wide map UI. */
.image-button {
  min-height: 98px;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.image-button:hover {
  border-color: transparent;
  box-shadow: none;
}

.image-button img {
  display: block;
  width: min(82px, 100%);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 9px 10px rgba(86, 56, 15, 0.26));
}

.shop-cta.image-button {
  align-content: center;
  min-height: 104px;
}

@media (max-width: 1120px) {
  .shop-cta.image-button {
    min-height: 66px;
  }

  .shop-cta.image-button img {
    width: 66px;
  }
}

/* Bottom tool dock hidden until the tool buttons are rebuilt as image controls. */
.tooldock {
  display: none !important;
}


/* Large in-map XP bar. The fill width is driven from game.js using current XP. */
.stage-xp {
  position: absolute;
  left: clamp(12px, 1.6vw, 24px);
  top: clamp(10px, 1.4vw, 20px);
  z-index: 4;
  width: clamp(286px, 31vw, 500px);
  height: clamp(78px, 8vw, 116px);
  pointer-events: none;
  filter: drop-shadow(0 11px 13px rgba(45, 33, 14, 0.2));
}

.stage-xp-track {
  position: absolute;
  left: 17.5%;
  right: 0;
  top: 38%;
  height: 28%;
  overflow: hidden;
  border: clamp(3px, 0.35vw, 6px) solid #9d6517;
  border-radius: 999px;
  background: linear-gradient(180deg, #372205, #5d3907 54%, #281704);
  box-shadow:
    inset 0 2px 0 rgba(255, 226, 104, 0.22),
    inset 0 -3px 0 rgba(24, 10, 0, 0.36),
    0 2px 0 #513008;
}

.stage-xp-track::before {
  content: "";
  position: absolute;
  inset: 9% 2% auto 2%;
  height: 25%;
  border-radius: 999px;
  background: rgba(255, 224, 116, 0.14);
  z-index: 2;
}

.stage-xp-fill {
  position: relative;
  z-index: 1;
  display: block;
  width: 0%;
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 36%),
    linear-gradient(90deg, #fff07a 0%, #ffd23f 45%, #ffc107 100%);
  box-shadow:
    inset 0 -5px 0 rgba(198, 118, 0, 0.18),
    0 0 12px rgba(255, 209, 34, 0.32);
  transition: width 240ms ease;
}

.stage-level-badge {
  position: absolute;
  left: 0;
  top: 4%;
  z-index: 3;
  width: 23%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 61% 34%, 98% 35%, 68% 56%, 79% 92%, 50% 70%, 21% 92%, 32% 56%, 2% 35%, 39% 34%);
  color: #5b3306;
  font-size: clamp(1.28rem, 2.4vw, 2.32rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 244, 157, 0.9), 0 2px 0 rgba(113, 61, 0, 0.18);
  background:
    radial-gradient(circle at 34% 25%, #fffef2 0 7%, transparent 9%),
    radial-gradient(circle at 41% 32%, #fff58b 0 14%, transparent 18%),
    linear-gradient(145deg, #fff06c 0%, #ffc21d 56%, #e38a05 100%);
  filter:
    drop-shadow(0 0 0 #6f3f08)
    drop-shadow(0 4px 0 #714006)
    drop-shadow(0 8px 11px rgba(58, 28, 0, 0.32));
}

.stage-xp-text {
  position: absolute;
  left: 26%;
  top: 70%;
  min-width: 7.5em;
  padding: 3px 9px 4px;
  border-radius: 999px;
  color: #51300b;
  background: rgba(255, 246, 190, 0.88);
  border: 1px solid rgba(129, 81, 16, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 4px 8px rgba(65, 39, 10, 0.12);
  font-size: clamp(0.68rem, 0.92vw, 0.82rem);
  font-weight: 950;
  white-space: nowrap;
}

.action-hint {
  top: clamp(92px, 10vw, 134px);
}

.level-chip .xp-track span {
  background: linear-gradient(90deg, #fff06c, #ffc107);
}

@media (max-width: 720px) {
  .stage-xp {
    width: min(340px, calc(100% - 24px));
    height: 82px;
  }

  .action-hint {
    top: 96px;
  }
}

/* The large in-map XP bar replaces the compact header version. */
.hud .level-chip {
  display: none;
}


/* Asset-backed XP bar using the generated frame and fill images. */
.stage-xp {
  --xp-right: 79.4%;
  width: clamp(390px, 31vw, 620px);
  height: auto;
  aspect-ratio: 2172 / 724;
  filter: drop-shadow(0 11px 12px rgba(45, 33, 14, 0.2));
}

.stage-xp-base,
.stage-xp-fill-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.stage-xp-base {
  z-index: 1;
}

.stage-xp-fill-image {
  z-index: 2;
  opacity: 0;
  clip-path: inset(33.8% var(--xp-right, 79.4%) 31.2% 20.6% round 999px);
  transition: clip-path 240ms ease, opacity 180ms ease;
}

.stage-level-badge {
  left: 12.8%;
  top: 43.2%;
  transform: translate(-50%, -50%);
  width: 8.6%;
  height: 18%;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  clip-path: none;
  background: transparent;
  filter: none;
  color: #5f3605;
  font-size: clamp(1.32rem, 2vw, 2.55rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 239, 125, 0.82), 0 4px 0 rgba(119, 64, 0, 0.18);
}

.stage-xp-text {
  z-index: 4;
  left: 24.5%;
  top: 62%;
  padding: 4px 11px 5px;
  color: #563209;
  background: rgba(255, 244, 177, 0.9);
  border-color: rgba(129, 81, 16, 0.28);
  font-size: clamp(0.68rem, 0.82vw, 0.86rem);
}

.action-hint {
  top: clamp(122px, 10.8vw, 184px);
}

@media (max-width: 720px) {
  .stage-xp {
    width: min(390px, calc(100% - 18px));
  }

  .stage-level-badge {
    font-size: clamp(1.18rem, 7vw, 1.75rem);
  }

  .action-hint {
    top: 124px;
  }
}


/* Place XP amount inside the generated bar frame. */
.stage-xp-text {
  left: 26.2%;
  top: 45%;
  transform: none;
  z-index: 4;
  min-width: 7.2em;
  padding: 3px 10px 4px;
  border: 2px solid rgba(180, 111, 13, 0.78);
  border-radius: 999px;
  color: #4d2b05;
  background: linear-gradient(180deg, rgba(255, 250, 190, 0.98), rgba(255, 217, 85, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    inset 0 -2px 0 rgba(168, 97, 0, 0.18),
    0 2px 4px rgba(31, 18, 4, 0.22);
  font-size: clamp(0.66rem, 0.78vw, 0.82rem);
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 221, 0.75);
}

@media (max-width: 720px) {
  .stage-xp-text {
    left: 26.5%;
    top: 44%;
    min-width: 6.6em;
    padding: 2px 8px 3px;
    font-size: 0.64rem;
  }
}

/* Cleaner XP text: integrated into the generated bar instead of a separate pill. */
.stage-xp-text {
  left: 58%;
  top: 51.5%;
  transform: translate(-50%, -50%);
  z-index: 4;
  min-width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #fff0a8;
  background: transparent;
  box-shadow: none;
  font-size: clamp(0.76rem, 0.95vw, 1rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow:
    0 2px 0 #3b2103,
    0 -1px 0 rgba(255, 255, 224, 0.62),
    1px 0 0 #3b2103,
    -1px 0 0 #3b2103;
}

@media (max-width: 720px) {
  .stage-xp-text {
    left: 58%;
    top: 51.5%;
    min-width: auto;
    padding: 0;
    font-size: clamp(0.66rem, 3vw, 0.82rem);
  }
}


/* Avatar beside XP, matching the classic farm-game header composition. */
.stage-xp {
  --avatar-size: clamp(72px, 6.2vw, 102px);
  --avatar-gap: clamp(2px, 0.35vw, 8px);
  left: clamp(12px, 1.2vw, 20px);
  top: clamp(8px, 1.1vw, 16px);
  width: clamp(520px, 43vw, 760px);
  height: clamp(106px, 10.3vw, 172px);
  aspect-ratio: auto;
}

.stage-avatar {
  position: absolute;
  left: 0;
  top: 51%;
  z-index: 6;
  width: var(--avatar-size);
  height: var(--avatar-size);
  object-fit: contain;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 7px 8px rgba(46, 31, 10, 0.26));
}

.stage-xp-art {
  position: absolute;
  left: calc(var(--avatar-size) + var(--avatar-gap));
  top: 50%;
  width: calc(100% - var(--avatar-size) - var(--avatar-gap));
  aspect-ratio: 2172 / 724;
  transform: translateY(-50%);
}

.stage-xp-base,
.stage-xp-fill-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.action-hint {
  top: clamp(122px, 10.8vw, 184px);
}

@media (max-width: 720px) {
  .stage-xp {
    --avatar-size: clamp(58px, 15vw, 72px);
    width: min(480px, calc(100% - 16px));
    height: 116px;
  }

  .action-hint {
    top: 112px;
  }
}

/* Balance the avatar against the large XP star. */
.stage-xp {
  --avatar-size: clamp(96px, 8.8vw, 122px);
  --avatar-gap: clamp(0px, 0.18vw, 4px);
}

.stage-avatar {
  top: 50%;
}

@media (max-width: 720px) {
  .stage-xp {
    --avatar-size: clamp(82px, 21vw, 98px);
    --avatar-gap: 0px;
    height: 128px;
  }
}


/* Asset-backed currency counter. The middle section stretches with the number. */
.currency-stat {
  position: relative;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.currency-icon {
  position: relative;
  z-index: 3;
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-right: -13px;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 5px 5px rgba(63, 36, 7, 0.28));
}

.currency-frame {
  --coin-width: 78px;
  --counter-height: 32px;
  --counter-cap: 20px;
  position: relative;
  z-index: 2;
  width: var(--coin-width);
  height: var(--counter-height);
  display: grid;
  place-items: center;
  padding: 0 calc(var(--counter-cap) * 0.72) 0 calc(var(--counter-cap) * 0.96);
  isolation: isolate;
}

.currency-frame,
.currency-frame::before,
.currency-frame::after {
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.currency-frame {
  background-image: url("assets/coin-counter-middle.png");
}

.currency-frame::before,
.currency-frame::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--counter-cap);
  z-index: 0;
  pointer-events: none;
}

.currency-frame::before {
  left: 0;
  background-image: url("assets/coin-counter-left.png");
}

.currency-frame::after {
  right: 0;
  background-image: url("assets/coin-counter-right.png");
}

.currency-value {
  position: relative;
  z-index: 1;
  min-width: 1ch;
  color: #fff7df;
  font-size: 0.96rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-shadow:
    0 2px 0 #2d1a05,
    1px 0 0 #2d1a05,
    -1px 0 0 #2d1a05,
    0 -1px 0 rgba(255, 255, 229, 0.5);
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .currency-stat {
    min-height: 42px;
  }

  .currency-icon {
    width: 42px;
    height: 42px;
    margin-right: -11px;
  }

  .currency-frame {
    --counter-height: 29px;
    --counter-cap: 18px;
  }

  .currency-value {
    font-size: 0.86rem;
  }
}


/* Coins live beside the level/XP cluster, matching the original farm HUD layout. */
.stage-xp {
  --xp-art-width: clamp(390px, 31vw, 560px);
  --coin-gap: clamp(8px, 0.8vw, 18px);
  width: clamp(720px, 58vw, 980px);
}

.stage-xp-art {
  width: var(--xp-art-width);
}

.stage-coin-counter {
  position: absolute;
  left: calc(var(--avatar-size) + var(--avatar-gap) + var(--xp-art-width) + var(--coin-gap));
  top: 50%;
  z-index: 7;
  transform: translateY(-50%);
  pointer-events: none;
}

.stage-coin-counter .currency-icon {
  width: clamp(46px, 3.9vw, 58px);
  height: clamp(46px, 3.9vw, 58px);
  margin-right: clamp(-16px, -1vw, -12px);
}

.stage-coin-counter .currency-frame {
  --counter-height: clamp(30px, 2.45vw, 38px);
  --counter-cap: clamp(18px, 1.5vw, 24px);
}

.stage-coin-counter .currency-value {
  font-size: clamp(0.9rem, 1vw, 1.12rem);
}

@media (max-width: 1120px) {
  .stage-xp {
    --xp-art-width: clamp(320px, 44vw, 470px);
    width: min(760px, calc(100% - 18px));
  }
}

@media (max-width: 720px) {
  .stage-xp {
    --xp-art-width: min(330px, calc(100% - var(--avatar-size) - 6px));
    width: min(560px, calc(100% - 16px));
    height: 132px;
  }

  .stage-coin-counter {
    left: calc(var(--avatar-size) + 8px);
    top: 84%;
  }

  .stage-coin-counter .currency-icon {
    width: 38px;
    height: 38px;
    margin-right: -10px;
  }

  .stage-coin-counter .currency-frame {
    --counter-height: 27px;
    --counter-cap: 17px;
  }

  .stage-coin-counter .currency-value {
    font-size: 0.78rem;
  }
}


/* Rebalance coin counter beside XP so it reads as a full HUD element. */
.stage-xp {
  --coin-gap: clamp(6px, 0.55vw, 12px);
  --xp-art-width: clamp(390px, 31vw, 560px);
}

.stage-coin-counter {
  top: 51%;
}

.stage-coin-counter .currency-icon {
  width: clamp(64px, 4.7vw, 78px);
  height: clamp(64px, 4.7vw, 78px);
  margin-right: clamp(-24px, -1.35vw, -18px);
  filter: drop-shadow(0 7px 7px rgba(50, 31, 8, 0.28));
}

.stage-coin-counter .currency-frame {
  --coin-width: 124px;
  --counter-height: clamp(38px, 3.05vw, 48px);
  --counter-cap: clamp(25px, 2vw, 31px);
  padding-left: calc(var(--counter-cap) * 1.02);
  padding-right: calc(var(--counter-cap) * 0.9);
}

.stage-coin-counter .currency-value {
  font-size: clamp(1.04rem, 1.18vw, 1.34rem);
  transform: translateY(-2px);
}

@media (max-width: 1120px) {
  .stage-xp {
    --xp-art-width: clamp(310px, 42vw, 450px);
    width: min(790px, calc(100% - 18px));
  }

  .stage-coin-counter .currency-icon {
    width: 60px;
    height: 60px;
    margin-right: -18px;
  }

  .stage-coin-counter .currency-frame {
    --counter-height: 38px;
    --counter-cap: 25px;
  }
}

@media (max-width: 720px) {
  .stage-coin-counter {
    top: 84%;
  }

  .stage-coin-counter .currency-icon {
    width: 44px;
    height: 44px;
    margin-right: -12px;
  }

  .stage-coin-counter .currency-frame {
    --coin-width: 112px;
    --counter-height: 30px;
    --counter-cap: 19px;
  }

  .stage-coin-counter .currency-value {
    font-size: 0.88rem;
    transform: translateY(-1px);
  }
}


/* Use the complete coin counter artwork so the rounded right end stays clean. */
.currency-frame {
  --coin-width: 138px;
  --counter-height: 36px;
  --counter-cap: 0px;
  width: var(--coin-width);
  height: var(--counter-height);
  padding: 0 20px 0 31px;
  background: url("assets/coin-counter-full.png") center / 100% 100% no-repeat;
}

.currency-frame::before,
.currency-frame::after {
  display: none;
}

.stage-coin-counter {
  top: 50%;
}

.stage-coin-counter .currency-icon {
  width: clamp(56px, 4.05vw, 68px);
  height: clamp(56px, 4.05vw, 68px);
  margin-right: clamp(-18px, -1vw, -14px);
}

.stage-coin-counter .currency-frame {
  --counter-height: clamp(34px, 2.55vw, 42px);
  padding-left: clamp(30px, 2.1vw, 36px);
  padding-right: clamp(18px, 1.35vw, 23px);
}

.stage-coin-counter .currency-value {
  font-size: clamp(0.98rem, 1.02vw, 1.18rem);
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .stage-coin-counter {
    top: 84%;
  }

  .stage-coin-counter .currency-icon {
    width: 42px;
    height: 42px;
    margin-right: -12px;
  }

  .stage-coin-counter .currency-frame {
    --coin-width: 124px;
    --counter-height: 30px;
    padding-left: 27px;
    padding-right: 16px;
  }

  .stage-coin-counter .currency-value {
    font-size: 0.84rem;
  }
}

/* Keep HUD numeric values optically consistent across XP and currencies. */
.stage-xp-text,
.stage-coin-counter .currency-value {
  font-size: clamp(1rem, 1.05vw, 1.18rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
  color: #fff2b6;
  text-align: center;
  text-shadow:
    0 2px 0 #392003,
    1px 0 0 #392003,
    -1px 0 0 #392003,
    0 -1px 0 rgba(255, 255, 224, 0.6);
}

.stage-xp-text {
  top: 51%;
  min-width: 8.8em;
}

.stage-coin-counter .currency-value {
  min-width: 3ch;
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .stage-xp-text,
  .stage-coin-counter .currency-value {
    font-size: 0.84rem;
  }

  .stage-xp-text {
    min-width: 8.2em;
  }
}


/* Scale the coin counter artwork to match the XP track weight. */
.stage-xp {
  --coin-gap: clamp(16px, 1.05vw, 26px);
  width: clamp(790px, 63vw, 1080px);
}

.stage-coin-counter {
  top: 50%;
  transform: translateY(-50%);
}

.stage-coin-counter .currency-icon {
  width: clamp(72px, 5.05vw, 88px);
  height: clamp(72px, 5.05vw, 88px);
  margin-right: clamp(-25px, -1.35vw, -20px);
}

.stage-coin-counter .currency-frame {
  --counter-height: clamp(45px, 3.15vw, 56px);
  padding-left: clamp(41px, 2.75vw, 50px);
  padding-right: clamp(24px, 1.7vw, 31px);
}

.stage-xp-text,
.stage-coin-counter .currency-value {
  font-size: clamp(1.06rem, 1.08vw, 1.24rem);
}

@media (max-width: 1120px) {
  .stage-xp {
    width: min(860px, calc(100% - 18px));
  }

  .stage-coin-counter .currency-icon {
    width: 68px;
    height: 68px;
    margin-right: -20px;
  }

  .stage-coin-counter .currency-frame {
    --counter-height: 44px;
    padding-left: 39px;
    padding-right: 24px;
  }
}

@media (max-width: 720px) {
  .stage-xp {
    width: min(600px, calc(100% - 16px));
  }

  .stage-coin-counter {
    top: 84%;
  }

  .stage-coin-counter .currency-icon {
    width: 50px;
    height: 50px;
    margin-right: -15px;
  }

  .stage-coin-counter .currency-frame {
    --coin-width: 148px;
    --counter-height: 36px;
    padding-left: 32px;
    padding-right: 18px;
  }

  .stage-xp-text,
  .stage-coin-counter .currency-value {
    font-size: 0.9rem;
  }
}


/* Clean game frame: remove outer chrome and keep Shop inside the map. */
.game-frame {
  min-height: 100vh;
  overflow: hidden;
}

.game-tabs,
.hud,
.left-rail,
.right-rail,
.action-hint {
  display: none !important;
}

.play-layout {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
}

.stage {
  border: 0;
  border-radius: 0;
  min-height: 100vh;
  overflow: hidden;
}

.stage,
#farmCanvas {
  min-height: 100vh !important;
}

.stage-shop-button {
  position: absolute;
  right: clamp(18px, 2.2vw, 36px);
  bottom: clamp(16px, 2vw, 34px);
  z-index: 8;
  min-width: 0;
  min-height: 0;
  width: clamp(92px, 6.2vw, 124px);
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
}

.stage-shop-button:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: transparent;
  box-shadow: none;
}

.stage-shop-button img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 12px rgba(67, 45, 11, 0.28));
}

.friends-dock {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 9;
  width: min(980px, 72vw);
  min-height: 116px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px auto;
  align-items: center;
  gap: 10px;
  padding: 22px 14px 10px;
  border: 2px solid rgba(66, 113, 57, 0.58);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background:
    radial-gradient(circle at 50% 0, rgba(224, 244, 133, 0.36), transparent 42%),
    linear-gradient(180deg, rgba(255, 253, 226, 0.97), rgba(227, 217, 160, 0.97));
  box-shadow: 0 -12px 30px rgba(34, 68, 37, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.78);
  transform: translateX(-50%);
  pointer-events: auto;
}

.friends-dock-title {
  position: absolute;
  top: 0;
  left: 22px;
  margin: 0;
  padding: 7px 18px 8px;
  border: 2px solid rgba(49, 102, 45, 0.64);
  border-radius: 12px;
  color: #fffce7;
  font-size: 0.8rem;
  font-weight: 1000;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #64b84d, #33863e);
  box-shadow: 0 5px 12px rgba(35, 79, 39, 0.24), inset 0 -3px 0 rgba(25, 83, 39, 0.2);
  transform: translateY(-50%);
}

.friends-carousel {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow: hidden;
  padding: 3px 2px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.friends-carousel::-webkit-scrollbar {
  display: none;
}

.friends-arrow {
  width: 38px;
  height: 62px;
  border: 2px solid rgba(44, 114, 88, 0.42);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(180deg, #53b8a8, #258a7f);
  box-shadow: inset 0 -4px 0 rgba(10, 77, 70, 0.2), 0 5px 10px rgba(50, 85, 52, 0.16);
  cursor: pointer;
  font-size: 2rem;
  font-weight: 1000;
  line-height: 1;
}

.friends-arrow:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.friend-card {
  position: relative;
  flex: 0 0 78px;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 5px 3px;
  border: 1px solid rgba(99, 88, 47, 0.22);
  border-radius: 12px;
  color: #304632;
  background: rgba(255, 254, 237, 0.78);
  cursor: pointer;
  box-shadow: inset 0 1px 0 #fff, 0 4px 9px rgba(75, 77, 43, 0.1);
}

.friend-card:hover {
  border-color: rgba(52, 139, 80, 0.54);
  background: #fffdf0;
  transform: translateY(-2px);
}

.friend-level {
  position: absolute;
  top: -5px;
  left: -4px;
  z-index: 2;
  min-width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #fff3b2;
  border-radius: 50%;
  color: #4c3811;
  background: #ffc847;
  font-size: 0.66rem;
  font-weight: 1000;
  box-shadow: 0 2px 5px rgba(93, 57, 13, 0.24);
}

.friend-avatar {
  position: relative;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid #fff7cf;
  border-radius: 14px 14px 14px 5px;
  color: #fff;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.42), transparent 25%),
    linear-gradient(145deg, var(--friend-color), color-mix(in srgb, var(--friend-color), #203e2c 28%));
  box-shadow: 0 4px 8px rgba(52, 69, 39, 0.2);
  font-size: 0.78rem;
  font-weight: 1000;
}

.friend-avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -5px;
  width: 22px;
  height: 13px;
  border-radius: 100% 0;
  background: rgba(225, 247, 130, 0.72);
  transform: rotate(-20deg);
}

.friend-avatar span {
  position: relative;
  z-index: 1;
}

.friend-card strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-card small {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #71806d;
  font-size: 0.55rem;
  font-weight: 800;
}

.friend-card small i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #49b66d;
  box-shadow: 0 0 0 2px rgba(73, 182, 109, 0.16);
}

.friend-card small.offline i {
  background: #9aa295;
  box-shadow: 0 0 0 2px rgba(118, 128, 113, 0.14);
}

.friend-empty-state {
  display: flex;
  flex: 0 0 210px;
  min-height: 82px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed rgba(75, 125, 70, 0.32);
  border-radius: 13px;
  color: #445e42;
  background: rgba(255, 253, 226, 0.66);
  text-align: left;
}

.friend-empty-state > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #5cc97b, #2f9556);
  font-size: 1.6rem;
  font-weight: 900;
}

.friend-empty-state strong,
.friend-empty-state small {
  display: block;
}

.friend-empty-state small {
  margin-top: 2px;
  color: #73806f;
  font-size: 0.62rem;
  font-weight: 750;
}

.empty-friends-note {
  margin: 8px 0 0;
  color: #72806d;
  font-size: 0.74rem;
  font-weight: 750;
}

.friends-dock-actions {
  display: grid;
  gap: 6px;
}

.invite-friend-button,
.more-friends-button {
  min-width: 94px;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(180deg, #55b96d, #2f8d51);
  box-shadow: inset 0 -3px 0 rgba(22, 83, 43, 0.22);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 950;
}

.invite-friend-button span {
  margin-right: 3px;
  font-size: 1rem;
}

.more-friends-button {
  color: #38513a;
  background: rgba(255, 253, 232, 0.84);
  box-shadow: inset 0 0 0 1px rgba(55, 105, 57, 0.24);
}

.friend-request-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #e8573f;
  box-shadow: 0 2px 5px rgba(107, 35, 24, 0.22);
  font-size: 0.62rem;
}

.friend-request-count[hidden] {
  display: none;
}

.friend-message-input {
  width: 100%;
  min-height: 92px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid rgba(83, 116, 76, 0.3);
  border-radius: 11px;
  color: #2d4330;
  background: rgba(255, 255, 246, 0.88);
  font: inherit;
}

.friend-message-input:focus {
  border-color: #45a86a;
  outline: 3px solid rgba(69, 168, 106, 0.16);
}

.friend-request-status {
  margin: 9px 0 0;
  color: #60715d;
  font-size: 0.75rem;
  font-weight: 750;
}

.friend-requests-section + .friend-requests-section {
  margin-top: 18px;
}

.friend-requests-section h3 {
  margin: 0 0 8px;
  color: #3e593e;
  font-size: 0.85rem;
}

.friend-request-card,
.outgoing-friend-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(83, 116, 76, 0.2);
  border-radius: 11px;
  background: rgba(255, 255, 242, 0.72);
}

.friend-request-card + .friend-request-card,
.outgoing-friend-request + .outgoing-friend-request {
  margin-top: 7px;
}

.friend-request-card > div:first-child span,
.outgoing-friend-request small {
  display: block;
  margin-top: 2px;
  color: #768174;
  font-size: 0.67rem;
}

.friend-request-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.friend-request-actions button {
  min-width: 72px;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #d35645;
  cursor: pointer;
  font-weight: 850;
}

.friend-request-actions button[data-friend-action="accept"] {
  background: #3da766;
}

.outgoing-friend-request > span {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.outgoing-friend-request em {
  flex: 0 0 auto;
  color: #9a7734;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 850;
}

.friend-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.friend-avatar.large {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  font-size: 1rem;
}

@media (max-width: 720px) {
  .stage-shop-button {
    right: 12px;
    bottom: 128px;
    width: 84px;
  }

  .friends-dock {
    width: calc(100% - 16px);
    min-height: 108px;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 6px;
    padding: 21px 8px 8px;
  }

  .friends-dock-title {
    left: 14px;
    font-size: 0.68rem;
  }

  .friends-arrow {
    width: 32px;
    height: 58px;
  }

  .friends-dock-actions {
    position: absolute;
    top: -18px;
    right: 10px;
    display: flex;
    gap: 5px;
  }

  .invite-friend-button,
  .more-friends-button {
    min-width: auto;
    min-height: 30px;
    padding: 0 9px;
    font-size: 0.6rem;
  }

  .friend-card {
    flex-basis: 68px;
  }
}


/* Cash counter beside coins, sharing one aligned HUD row. */
.stage-resource-counters {
  position: absolute;
  left: calc(var(--avatar-size) + var(--avatar-gap) + var(--xp-art-width) + var(--coin-gap));
  top: 50%;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: clamp(14px, 1vw, 24px);
  transform: translateY(-50%);
  pointer-events: none;
}

.stage-resource-counters .currency-stat,
.stage-resource-counters .stage-coin-counter {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  z-index: auto;
  flex: 0 0 auto;
}

.stage-resource-counters .currency-frame {
  --counter-height: clamp(45px, 3.15vw, 56px);
  padding-left: clamp(41px, 2.75vw, 50px);
  padding-right: clamp(24px, 1.7vw, 31px);
}

.stage-resource-counters .cash-frame {
  background-image: url("assets/cash-counter-bg.png");
}

.stage-resource-counters .coin-counter-icon {
  width: clamp(72px, 5.05vw, 88px);
  height: clamp(72px, 5.05vw, 88px);
  margin-right: clamp(-25px, -1.35vw, -20px);
}

.stage-resource-counters .cash-counter-icon {
  width: clamp(86px, 6vw, 112px);
  height: clamp(64px, 4.7vw, 84px);
  margin-right: clamp(-31px, -1.8vw, -24px);
  transform: translateY(2px);
}

.stage-resource-counters .currency-value {
  font-size: clamp(1.06rem, 1.08vw, 1.24rem);
}

@media (max-width: 1120px) {
  .stage-resource-counters {
    gap: 12px;
  }

  .stage-resource-counters .currency-frame {
    --counter-height: 44px;
    padding-left: 39px;
    padding-right: 24px;
  }

  .stage-resource-counters .coin-counter-icon {
    width: 68px;
    height: 68px;
    margin-right: -20px;
  }

  .stage-resource-counters .cash-counter-icon {
    width: 92px;
    height: 68px;
    margin-right: -26px;
  }
}

@media (max-width: 720px) {
  .stage-resource-counters {
    left: calc(var(--avatar-size) + 8px);
    top: 84%;
    gap: 8px;
  }

  .stage-resource-counters .currency-frame {
    --coin-width: 148px;
    --counter-height: 36px;
    padding-left: 32px;
    padding-right: 18px;
  }

  .stage-resource-counters .coin-counter-icon {
    width: 50px;
    height: 50px;
    margin-right: -15px;
  }

  .stage-resource-counters .cash-counter-icon {
    width: 64px;
    height: 48px;
    margin-right: -18px;
  }

  .stage-resource-counters .currency-value {
    font-size: 0.9rem;
  }
}

/* Final resource scale: cash and coin counters should feel like the original HUD assets. */
.stage-resource-counters {
  gap: clamp(18px, 1.3vw, 30px);
}

.stage-resource-counters .currency-frame {
  --counter-height: clamp(54px, 3.75vw, 66px);
  padding-left: clamp(54px, 3.45vw, 64px);
  padding-right: clamp(28px, 1.9vw, 36px);
}

.stage-resource-counters .coin-counter-icon {
  width: clamp(86px, 6.1vw, 104px);
  height: clamp(86px, 6.1vw, 104px);
  margin-right: clamp(-34px, -2vw, -28px);
}

.stage-resource-counters .cash-counter-icon {
  width: clamp(118px, 8.2vw, 150px);
  height: clamp(90px, 6.2vw, 116px);
  margin-right: clamp(-58px, -3.55vw, -46px);
  transform: translateY(2px);
}

.stage-resource-counters .currency-value {
  font-size: clamp(1.18rem, 1.22vw, 1.42rem);
  transform: translateY(-1px);
}

@media (max-width: 1120px) {
  .stage-resource-counters {
    gap: 16px;
  }

  .stage-resource-counters .currency-frame {
    --counter-height: 54px;
    padding-left: 52px;
    padding-right: 28px;
  }

  .stage-resource-counters .coin-counter-icon {
    width: 86px;
    height: 86px;
    margin-right: -30px;
  }

  .stage-resource-counters .cash-counter-icon {
    width: 124px;
    height: 94px;
    margin-right: -50px;
  }

  .stage-resource-counters .currency-value {
    font-size: 1.18rem;
  }
}

@media (max-width: 720px) {
  .stage-resource-counters {
    gap: 10px;
  }

  .stage-resource-counters .currency-frame {
    --coin-width: 166px;
    --counter-height: 42px;
    padding-left: 40px;
    padding-right: 21px;
  }

  .stage-resource-counters .coin-counter-icon {
    width: 62px;
    height: 62px;
    margin-right: -22px;
  }

  .stage-resource-counters .cash-counter-icon {
    width: 86px;
    height: 66px;
    margin-right: -34px;
  }

  .stage-resource-counters .currency-value {
    font-size: 1rem;
  }
}

/* One final text treatment for every value inside the glossy HUD counters. */
.stage-xp-text,
.stage-resource-counters .currency-value,
.stage-coin-counter .currency-value,
.stage-cash-counter .currency-value {
  color: #fff2b6;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow:
    0 2px 0 #392003,
    1px 0 0 #392003,
    -1px 0 0 #392003,
    0 -1px 0 rgba(255, 255, 224, 0.6);
}


/* Pink B counter uses the same scale as the resource counters. */
.stage-resource-counters .bucks-frame {
  background-image: url("assets/cash-counter-bg.png");
}

.stage-resource-counters .bucks-counter-icon {
  width: clamp(86px, 6.1vw, 104px);
  height: clamp(86px, 6.1vw, 104px);
  margin-right: clamp(-34px, -2vw, -28px);
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .stage-resource-counters .bucks-counter-icon {
    width: 86px;
    height: 86px;
    margin-right: -30px;
  }
}

@media (max-width: 720px) {
  .stage-resource-counters .bucks-counter-icon {
    width: 62px;
    height: 62px;
    margin-right: -22px;
  }
}


/* Stage quick action buttons in the opposite corner of the resource HUD. */
.stage-actions {
  position: absolute;
  top: clamp(24px, 3vw, 48px);
  right: clamp(22px, 3vw, 52px);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: clamp(12px, 1vw, 20px);
  pointer-events: auto;
}

.stage-action-button {
  width: clamp(58px, 4.2vw, 76px);
  height: clamp(58px, 4.2vw, 76px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.stage-action-button img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(43, 34, 23, 0.28));
  pointer-events: none;
}

.stage-action-button:hover {
  transform: translateY(-2px) scale(1.04);
}

.stage-action-button:focus-visible {
  outline: 3px solid rgba(255, 241, 156, 0.9);
  outline-offset: 3px;
  border-radius: 14px;
}

@media (max-width: 720px) {
  .stage-actions {
    top: 14px;
    right: 12px;
    gap: 8px;
  }

  .stage-action-button {
    width: 46px;
    height: 46px;
  }
}


/* Mail notification badge over the envelope action button. */
.stage-action-button {
  position: relative;
}

.mail-notification-badge {
  position: absolute;
  top: -12%;
  right: -13%;
  width: clamp(24px, 1.8vw, 34px);
  height: clamp(24px, 1.8vw, 34px);
  display: grid;
  place-items: center;
  pointer-events: none;
  filter: drop-shadow(0 5px 5px rgba(74, 31, 7, 0.28));
}

.mail-notification-badge[hidden] {
  display: none !important;
}

.mail-notification-badge.is-wide {
  width: clamp(31px, 2.25vw, 43px);
}

.mail-notification-badge img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.mail-notification-badge span {
  position: relative;
  z-index: 1;
  color: #fff7df;
  font-size: clamp(0.72rem, 0.72vw, 0.92rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
  text-shadow:
    0 2px 0 #8b1b10,
    1px 0 0 #8b1b10,
    -1px 0 0 #8b1b10;
  transform: translateY(-1px);
}

.mail-notification-badge.is-wide span {
  font-size: clamp(0.66rem, 0.64vw, 0.82rem);
}

@media (max-width: 720px) {
  .mail-notification-badge {
    width: 22px;
    height: 22px;
    top: -10%;
    right: -10%;
  }

  .mail-notification-badge.is-wide {
    width: 29px;
  }

  .mail-notification-badge span {
    font-size: 0.68rem;
  }
}

/* Fine tune the mail action: envelope scale and badge placement. */
#stageMailButton > img:first-child {
  max-width: none;
  width: 112%;
  height: auto;
  transform: translateY(1px);
}

#stageMailButton .mail-notification-badge {
  top: -4%;
  right: -4%;
  width: clamp(25px, 1.75vw, 33px);
  height: clamp(25px, 1.75vw, 33px);
}

#stageMailButton .mail-notification-badge.is-wide {
  width: clamp(34px, 2.25vw, 44px);
}

@media (max-width: 720px) {
  #stageMailButton > img:first-child {
    width: 112%;
  }

  #stageMailButton .mail-notification-badge {
    top: -3%;
    right: -3%;
    width: 22px;
    height: 22px;
  }

  #stageMailButton .mail-notification-badge.is-wide {
    width: 30px;
  }
}
/* Compact stage HUD after map scale-up. */
.stage-xp {
  --avatar-size: clamp(56px, 4.15vw, 74px);
  --avatar-gap: clamp(0px, 0.14vw, 4px);
  --xp-art-width: clamp(280px, 22vw, 405px);
  --coin-gap: clamp(10px, 0.7vw, 16px);
  left: clamp(10px, 0.9vw, 16px);
  top: clamp(8px, 0.75vw, 14px);
  width: min(calc(100% - 210px), clamp(760px, 63vw, 1080px));
  height: clamp(88px, 7.2vw, 126px);
  filter: drop-shadow(0 7px 8px rgba(45, 33, 14, 0.18));
}

.stage-avatar {
  filter: drop-shadow(0 5px 5px rgba(46, 31, 10, 0.22));
}

.stage-xp-text,
.stage-resource-counters .currency-value,
.stage-coin-counter .currency-value,
.stage-cash-counter .currency-value {
  font-size: clamp(0.82rem, 0.78vw, 1rem);
  text-shadow:
    0 2px 0 #392003,
    1px 0 0 #392003,
    -1px 0 0 #392003,
    0 -1px 0 rgba(255, 255, 224, 0.58);
}

.stage-level-badge {
  font-size: clamp(1rem, 1.42vw, 1.7rem);
}

.stage-resource-counters {
  gap: clamp(10px, 0.8vw, 18px);
}

.stage-resource-counters .currency-frame {
  --coin-width: clamp(104px, 6.5vw, 124px);
  --counter-height: clamp(34px, 2.35vw, 42px);
  padding-left: clamp(31px, 2vw, 38px);
  padding-right: clamp(17px, 1.15vw, 22px);
}

.stage-resource-counters .coin-counter-icon,
.stage-resource-counters .bucks-counter-icon {
  width: clamp(56px, 3.85vw, 70px);
  height: clamp(56px, 3.85vw, 70px);
  margin-right: clamp(-22px, -1.28vw, -17px);
  filter: drop-shadow(0 5px 6px rgba(50, 31, 8, 0.24));
}

.stage-resource-counters .cash-counter-icon {
  width: clamp(78px, 5.25vw, 96px);
  height: clamp(59px, 4vw, 74px);
  margin-right: clamp(-38px, -2.35vw, -30px);
  transform: translateY(1px);
}

.stage-actions {
  top: clamp(12px, 1.25vw, 24px);
  right: clamp(14px, 1.5vw, 28px);
  gap: clamp(7px, 0.65vw, 12px);
}

.stage-action-button {
  width: clamp(42px, 3vw, 58px);
  height: clamp(42px, 3vw, 58px);
}

.stage-action-button img {
  filter: drop-shadow(0 5px 7px rgba(43, 34, 23, 0.23));
}

#stageMailButton .mail-notification-badge {
  top: -7%;
  right: -7%;
  width: clamp(20px, 1.35vw, 26px);
  height: clamp(20px, 1.35vw, 26px);
}

#stageMailButton .mail-notification-badge.is-wide {
  width: clamp(28px, 1.8vw, 36px);
}

.mail-notification-badge span {
  font-size: clamp(0.58rem, 0.55vw, 0.74rem);
}

@media (max-width: 1120px) {
  .stage-xp {
    --avatar-size: 58px;
    --xp-art-width: clamp(250px, 32vw, 330px);
    width: min(calc(100% - 138px), 760px);
    height: 94px;
  }

  .stage-resource-counters {
    gap: 8px;
  }

  .stage-resource-counters .currency-frame {
    --coin-width: 104px;
    --counter-height: 34px;
    padding-left: 30px;
    padding-right: 16px;
  }

  .stage-resource-counters .coin-counter-icon,
  .stage-resource-counters .bucks-counter-icon {
    width: 54px;
    height: 54px;
    margin-right: -17px;
  }

  .stage-resource-counters .cash-counter-icon {
    width: 74px;
    height: 56px;
    margin-right: -28px;
  }
}

@media (max-width: 720px) {
  .stage-xp {
    --avatar-size: 50px;
    --xp-art-width: min(255px, calc(100% - var(--avatar-size) - 6px));
    width: min(520px, calc(100% - 14px));
    height: 112px;
  }

  .stage-resource-counters {
    left: calc(var(--avatar-size) + 8px);
    top: 82%;
    gap: 7px;
  }

  .stage-resource-counters .currency-frame {
    --coin-width: 106px;
    --counter-height: 30px;
    padding-left: 27px;
    padding-right: 14px;
  }

  .stage-resource-counters .coin-counter-icon,
  .stage-resource-counters .bucks-counter-icon {
    width: 44px;
    height: 44px;
    margin-right: -13px;
  }

  .stage-resource-counters .cash-counter-icon {
    width: 58px;
    height: 44px;
    margin-right: -20px;
  }

  .stage-xp-text,
  .stage-resource-counters .currency-value {
    font-size: 0.78rem;
  }

  .stage-actions {
    top: 10px;
    right: 10px;
  }

  .stage-action-button {
    width: 40px;
    height: 40px;
  }
}
/* End compact stage HUD. */
/* Compact in-map asset buttons after map scale-up. */
.stage-shop-button {
  right: clamp(14px, 1.55vw, 26px);
  bottom: clamp(14px, 1.55vw, 26px);
  width: clamp(72px, 4.55vw, 94px);
}

.stage-shop-button img {
  filter: drop-shadow(0 7px 9px rgba(67, 45, 11, 0.24));
}

.stage-action-button {
  width: clamp(36px, 2.45vw, 48px);
  height: clamp(36px, 2.45vw, 48px);
}

.stage-actions {
  top: clamp(10px, 1vw, 18px);
  right: clamp(12px, 1.2vw, 22px);
  gap: clamp(6px, 0.45vw, 9px);
}

#stageMailButton .mail-notification-badge {
  width: clamp(18px, 1.15vw, 23px);
  height: clamp(18px, 1.15vw, 23px);
}

#stageMailButton .mail-notification-badge.is-wide {
  width: clamp(25px, 1.55vw, 31px);
}

@media (max-width: 720px) {
  .stage-shop-button {
    right: 10px;
    bottom: 120px;
    width: 64px;
  }

  .stage-action-button {
    width: 34px;
    height: 34px;
  }
}
/* End compact in-map asset buttons. */
