:root {
  --ink: #f7f2e8;
  --muted: #c8c0b5;
  --panel: rgba(14, 18, 24, 0.9);
  --panel-strong: rgba(12, 15, 20, 0.9);
  --gold: #f3b743;
  --red: #d74747;
  --blue: #53a7ff;
  --green: #70d37b;
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #090c10;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #030508;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.intro-overlay.hidden {
  display: grid !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-overlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-splash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 28px;
  background: radial-gradient(circle, rgba(85, 64, 38, 0.52), rgba(3, 5, 8, 0.96) 62%);
}

.logo-splash img {
  width: min(520px, 78vw);
  max-height: 58vh;
  object-fit: contain;
  filter: drop-shadow(0 22px 52px rgba(255, 114, 34, 0.26));
}

.logo-splash h1 {
  margin: 0;
  font-size: clamp(36px, 8vw, 82px);
  line-height: 0.95;
  text-align: center;
}

.device-choice {
  position: absolute;
  z-index: 2;
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  border: 3px solid rgba(255, 205, 64, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.96), rgba(12, 10, 14, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
  box-shadow:
    inset 0 0 0 3px rgba(63, 24, 6, 0.88),
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(242, 155, 35, 0.2);
  text-align: center;
}

.device-choice h2 {
  margin: 0 0 18px;
  color: #ffe27a;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #421707;
}

.device-choice div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.device-choice button {
  min-height: 56px;
  border: 2px solid rgba(255, 205, 64, 0.72);
  background: linear-gradient(180deg, rgba(89, 42, 12, 0.95), rgba(34, 17, 9, 0.95));
  color: #ffe27a;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707;
}

.dragon-loader {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 30px;
  height: 120px;
  overflow: hidden;
  pointer-events: none;
}

.boss-loader-track {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  gap: 22px;
  align-items: end;
  animation: boss-run 9s linear infinite;
}

.boss-loader-track img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(255, 130, 44, 0.28));
  transform: scaleX(-1);
  animation: boss-bob 520ms ease-in-out infinite alternate;
}

.boss-loader-track img:nth-child(2n) {
  animation-delay: 120ms;
}

.boss-loader-track img:nth-child(3n) {
  animation-delay: 240ms;
}

@keyframes boss-run {
  from { transform: translateX(-980px); }
  to { transform: translateX(calc(100vw + 120px)); }
}

@keyframes boss-bob {
  from { translate: 0 0; }
  to { translate: 0 -8px; }
}

button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--ink);
  background: rgba(23, 30, 40, 0.86);
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  touch-action: manipulation;
}

a.discord-button {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 70px;
  height: 70px;
  padding: 0;
  border-radius: 8px;
  text-decoration: none;
  display: block;
  touch-action: manipulation;
  overflow: hidden;
}

a.discord-button:hover {
  transform: translateY(-2px) scale(1.04);
}

.discord-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 183, 67, 0.68);
  background: rgba(45, 37, 29, 0.92);
}

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

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

.hidden {
  display: none !important;
}

.panel {
  position: fixed;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.home-menu {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(590px, calc(100vw - 32px));
  padding: 42px 36px 36px;
  border: 3px solid rgba(255, 205, 64, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.94), rgba(12, 10, 14, 0.97)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
  box-shadow:
    inset 0 0 0 3px rgba(63, 24, 6, 0.88),
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(242, 155, 35, 0.2);
  display: grid;
  justify-items: center;
}

.menu-settings-button {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 20px;
  background: rgba(12, 15, 20, 0.72);
}

.reset-menu-button {
  position: absolute;
  right: 62px;
  top: 14px;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.reset-menu-button:hover {
  background: transparent;
  transform: translateY(-1px) scale(1.05);
}

.reset-menu-button img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand {
  margin-bottom: 20px;
  text-align: center;
  width: 100%;
}

.brand img {
  width: min(320px, 82%);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(255, 110, 34, 0.24));
}

.menu-actions {
  display: grid;
  gap: 8px;
  width: min(500px, 100%);
  justify-items: center;
}

.menu-actions button {
  justify-content: center;
  text-align: center;
}

.menu-actions a {
  font-size: 18px;
}

.image-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
  border-radius: 8px;
  width: 100%;
}

.image-button:hover {
  background: transparent;
  transform: translateY(-2px) scale(1.01);
}

.image-button img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

#playBtn img {
  height: 72px;
  object-position: center;
}

.farming-menu-entry {
  width: min(260px, 62%);
  margin-top: 2px;
}

.farming-menu-entry img {
  height: 82px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 8px 18px rgba(255, 164, 58, 0.22));
}

.farming-screen {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  background: #090806;
}

.farming-map-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.farming-map-viewport.dragging {
  cursor: grabbing;
}

.farming-map-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.farming-map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.06) contrast(1.04);
  user-select: none;
  pointer-events: none;
}

.farming-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.55), transparent 34%, rgba(0, 0, 0, 0.42)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.44), transparent 38%, rgba(0, 0, 0, 0.36));
}

.farming-map-controls {
  position: absolute;
  z-index: 6;
  left: 16px;
  top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.farming-map-controls button,
.farming-quick-actions button {
  min-height: 38px;
  padding: 0 13px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.68);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(61, 31, 12, 0.95), rgba(17, 14, 12, 0.95));
  box-shadow: inset 0 0 0 2px rgba(92, 43, 12, 0.72), 0 6px 0 rgba(0, 0, 0, 0.24);
  text-shadow: 2px 2px 0 #421707;
}

.farming-map-controls button:hover,
.farming-quick-actions button:hover {
  color: #2a1204;
  background: linear-gradient(#ffe27a, #d98f24);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.farming-map-panel {
  position: absolute;
  z-index: 4;
  left: 18px;
  top: 110px;
  bottom: 132px;
  width: min(500px, calc(100vw - 36px));
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(20, 12, 8, 0.82);
  border: 2px solid rgba(243, 183, 67, 0.72);
}

.resource-bag-button {
  position: absolute;
  z-index: 6;
  right: 22px;
  bottom: 22px;
  width: 92px;
  min-height: 92px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.resource-bag-button:hover {
  background: transparent;
  transform: translateY(-3px) scale(1.04);
}

.resource-bag-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.44));
  pointer-events: none;
}

#resourceBagPanel {
  border: 3px solid rgba(255, 205, 64, 0.92);
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.94), rgba(12, 10, 14, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
  box-shadow:
    inset 0 0 0 3px rgba(63, 24, 6, 0.88),
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(242, 155, 35, 0.2);
}

#resourceBagPanel h2 {
  margin: 0 0 16px;
  padding: 8px 44px 10px 12px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(89, 42, 12, 0.95), rgba(34, 17, 9, 0.95));
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #421707;
}

.bag-stats {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 2px solid rgba(243, 183, 67, 0.72);
  border-radius: 8px;
  background: rgba(20, 12, 8, 0.86);
}

.farming-map-hotspots {
  position: absolute;
  z-index: 2;
  inset: 0;
}

.biome-marker {
  position: absolute;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  overflow: visible;
}

.biome-marker:hover {
  background: transparent;
  transform: translate(-50%, -54%) scale(1.04);
}

.biome-marker span {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 5px;
  border: 3px solid #fff2a3;
  border-radius: 50%;
  background: radial-gradient(circle, #5ff0ff 0 28%, #1678ff 29% 56%, #5b2708 57%);
  box-shadow:
    0 0 0 3px rgba(80, 31, 8, 0.92),
    0 0 20px rgba(255, 205, 64, 0.8);
}

.biome-marker strong {
  display: block;
  max-width: 150px;
  padding: 5px 8px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.72);
  border-radius: 8px;
  background: rgba(20, 12, 8, 0.88);
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707;
  white-space: normal;
}

.biome-preview {
  z-index: 8;
  left: 50%;
  top: 50%;
  width: min(430px, calc(100vw - 28px));
  padding: 18px;
  border: 3px solid rgba(255, 205, 64, 0.88);
  border-radius: 8px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.95), rgba(12, 10, 14, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
}

.biome-preview h2 {
  margin: 0 42px 12px 0;
  color: #ffe27a;
  text-shadow: 3px 3px 0 #421707;
  text-transform: uppercase;
}

.biome-preview img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border: 2px solid rgba(255, 205, 64, 0.48);
  border-radius: 8px;
}

.biome-resource-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 14px;
}

.biome-resource-tags span {
  padding: 5px 7px;
  color: #f8e6b8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.biome-scene {
  position: absolute;
  z-index: 7;
  inset: 0;
  overflow: hidden;
  background: #070504;
}

.biome-scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: none;
}

.biome-scene-top {
  position: absolute;
  z-index: 6;
  left: 18px;
  right: 18px;
  top: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(20, 12, 8, 0.88);
  border: 2px solid rgba(243, 183, 67, 0.72);
}

.biome-scene-top h2 {
  margin: 0;
  color: #ffe27a;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #421707;
}

.biome-resource-list {
  position: absolute;
  z-index: 6;
  inset: 96px 18px 112px;
  width: auto;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

.biome-resource-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  border: 2px solid rgba(243, 183, 67, 0.7);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.biome-resource-card img {
  width: 72px;
  height: 62px;
  object-fit: contain;
  border: 1px solid rgba(255, 205, 64, 0.42);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.biome-resource-card strong {
  color: #ffe27a;
  text-shadow: 2px 2px 0 #421707;
}

.biome-resource-card p {
  margin: 3px 0 0;
  color: #f4dfb8;
  font-size: 12px;
}

.biome-object {
  position: absolute;
  display: block;
  justify-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #ffe27a;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707, 0 3px 8px rgba(0, 0, 0, 0.78);
  transform: translate(-50%, -50%);
  transform-origin: center;
  pointer-events: auto;
  cursor: pointer;
}

.biome-object::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 62%;
  height: 12%;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  filter: blur(6px);
  transform: translateX(-50%);
  z-index: -1;
  display: none;
}

.biome-object:hover {
  background: transparent;
  transform: translate(-50%, -55%) scale(1.04);
}

.biome-object:disabled {
  opacity: 0.58;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

.biome-object img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: saturate(0.98) contrast(0.98) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.34));
}

.biome-object strong {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  width: max-content;
  max-width: 150px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 205, 64, 0.5);
  border-radius: 4px;
  background: rgba(20, 12, 8, 0.78);
  font-size: 10px;
  line-height: 1.08;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 0.16s ease;
}

.biome-object small {
  display: none;
}

.biome-object:hover strong,
.biome-object:hover small,
.biome-object:focus-visible strong,
.biome-object:focus-visible small {
  opacity: 1;
}

.biome-resource-object {
  width: 86px;
  height: 78px;
}

.biome-node-plant {
  width: 66px;
  height: 58px;
}

.biome-node-wood {
  width: 118px;
  height: 112px;
}

.biome-node-animal {
  width: 120px;
  height: 104px;
}

.biome-node-ore {
  width: 78px;
  height: 70px;
}

.biome-node-fish {
  width: 104px;
  height: 74px;
}

.biome-node-desert {
  width: 130px;
  height: 104px;
}

.audio-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.menu-audio-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(12, 15, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.device-mode-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
}

.device-mode-row button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 205, 64, 0.42);
  background: rgba(20, 12, 8, 0.78);
  color: #f8e6b8;
}

.device-mode-row button.active {
  color: #2a1204;
  background: linear-gradient(#ffe27a, #d98f24);
}

.icon-button {
  min-height: 34px;
  padding: 0 10px;
}

.hud {
  position: fixed;
  z-index: 3;
  left: 18px;
  right: 18px;
  top: 16px;
  display: grid;
  grid-template-columns: 220px 220px 1fr 58px;
  gap: 12px;
  align-items: center;
}

.stat-bar,
.hud-meta {
  border-radius: 8px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
}

.stat-bar {
  display: grid;
  gap: 7px;
}

.gear-button {
  width: 58px;
  min-height: 58px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  justify-self: end;
  background: var(--panel-strong);
}

.combat-bag-button {
  position: fixed;
  z-index: 4;
  right: 18px;
  top: 86px;
  width: 66px;
  min-height: 66px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.combat-bag-button:hover {
  background: transparent;
  transform: translateY(-2px) scale(1.04);
}

.combat-bag-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.44));
}

.combat-settings {
  z-index: 5;
  right: 18px;
  top: 158px;
  width: min(320px, calc(100vw - 28px));
  padding: 22px;
  border-radius: 8px;
}

.combat-settings h2 {
  margin: 0 0 16px;
}

.combat-settings p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-row {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.wide-button {
  width: 100%;
}

.speed-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.stat-bar span,
.stat-bar strong {
  font-size: 12px;
}

.stat-bar strong {
  justify-self: end;
  margin-top: -20px;
}

.stat-bar div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.stat-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #d23d42, #ff8d5c);
}

.mana-bar i {
  background: linear-gradient(90deg, #3988ee, #6ee3ff);
}

.hud-meta {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  font-weight: 800;
}

.summon-bar {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(980px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 10px;
}

.summon-card {
  position: relative;
  min-height: 82px;
  padding: 8px;
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
  background: rgba(13, 17, 22, 0.88);
}

.summon-card img {
  position: absolute;
  right: -5px;
  bottom: -10px;
  width: 64px;
  height: 64px;
  object-fit: contain;
  opacity: 0.88;
  pointer-events: none;
}

.summon-card strong,
.summon-card small {
  position: relative;
  z-index: 1;
  display: block;
}

.summon-card small {
  color: var(--muted);
  margin-top: 6px;
}

.side-panel {
  right: 22px;
  top: 86px;
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
}

#profilePanel,
#inventoryPanel {
  left: 50%;
  right: auto;
  top: 50%;
  transform: translate(-50%, -50%);
}

#profilePanel {
  border: 3px solid rgba(255, 205, 64, 0.92);
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.92), rgba(12, 10, 14, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
  box-shadow:
    inset 0 0 0 3px rgba(63, 24, 6, 0.88),
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(242, 155, 35, 0.2);
}

#inventoryPanel {
  border: 3px solid rgba(255, 205, 64, 0.92);
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.92), rgba(12, 10, 14, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
  box-shadow:
    inset 0 0 0 3px rgba(63, 24, 6, 0.88),
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(242, 155, 35, 0.2);
}

.side-panel h2 {
  margin: 0 0 14px;
  cursor: grab;
  user-select: none;
}

#profilePanel h2 {
  margin: 0 0 16px;
  padding: 8px 44px 10px 12px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(89, 42, 12, 0.95), rgba(34, 17, 9, 0.95));
  text-transform: uppercase;
  letter-spacing: 0;
  text-shadow: 3px 3px 0 #421707;
}

#inventoryPanel h2 {
  margin: 0 0 16px;
  padding: 8px 44px 10px 12px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(89, 42, 12, 0.95), rgba(34, 17, 9, 0.95));
  text-transform: uppercase;
  letter-spacing: 0;
  text-shadow: 3px 3px 0 #421707;
}

#profilePanel #profileStats {
  margin: 0 0 12px;
  padding: 9px 10px;
  color: #f8e6b8;
  border: 1px solid rgba(255, 205, 64, 0.38);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

#inventoryPanel #inventoryStats,
#inventoryPanel .tab-page p {
  color: #f8e6b8;
}

#inventoryPanel #inventoryStats {
  margin: 12px 0 12px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 205, 64, 0.38);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.farming-locked-panel {
  left: 50%;
  top: 50%;
  width: min(440px, calc(100vw - 28px));
  padding: 22px;
  border: 3px solid rgba(255, 205, 64, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(74, 36, 13, 0.94), rgba(12, 10, 14, 0.97)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px);
  box-shadow:
    inset 0 0 0 3px rgba(63, 24, 6, 0.88),
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(242, 155, 35, 0.2);
  text-align: center;
}

.farming-locked-panel h2 {
  margin: 0 0 14px;
  padding: 8px 44px 10px 12px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(89, 42, 12, 0.95), rgba(34, 17, 9, 0.95));
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #421707;
}

.farming-locked-panel img {
  width: min(240px, 68vw);
  max-height: 230px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.48));
}

.farming-locked-panel strong {
  display: block;
  margin-top: 8px;
  color: #ffe27a;
  font-size: 20px;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #421707;
}

.farming-locked-panel p {
  margin: 10px 0 0;
  color: #f8e6b8;
}

.progress-profile-card {
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 12px;
  padding: 12px;
  border: 2px solid rgba(243, 183, 67, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 199, 64, 0.12), transparent 34%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px),
    rgba(20, 12, 8, 0.9);
  box-shadow: inset 0 0 0 2px rgba(92, 43, 12, 0.86);
}

.avatar-block {
  display: grid;
  gap: 7px;
  align-content: start;
  text-align: center;
}

.avatar-block img {
  width: 104px;
  height: 118px;
  justify-self: center;
  object-fit: contain;
  image-rendering: pixelated;
  border: 2px solid rgba(255, 214, 92, 0.52);
  border-radius: 8px;
  background: radial-gradient(circle, rgba(243, 183, 67, 0.2), rgba(0, 0, 0, 0.34));
}

.avatar-block label {
  color: #ffe27a;
  font-size: 12px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707;
}

.avatar-block select {
  width: 100%;
  min-height: 34px;
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.5);
  border-radius: 8px;
  background: rgba(17, 14, 12, 0.96);
  font-weight: 800;
}

.progress-info {
  display: grid;
  gap: 10px;
  align-content: start;
}

.zen-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 205, 64, 0.38);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.zen-line img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(255, 205, 64, 0.48));
}

.zen-line strong,
.rank-grid strong {
  color: #ffe27a;
  text-shadow: 2px 2px 0 #421707;
}

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

.rank-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 205, 64, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
}

.rank-grid span {
  display: block;
  margin-bottom: 4px;
  color: #f4dfb8;
  font-size: 10px;
  text-transform: uppercase;
}

.rank-grid strong {
  display: block;
  font-size: 17px;
}

#inventoryBoostText {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(112, 211, 123, 0.32);
  border-radius: 8px;
  background: rgba(21, 53, 27, 0.28);
}

.rank-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#profilePanel .close-panel {
  border-color: rgba(255, 205, 64, 0.74);
  background: linear-gradient(#8e2f1a, #451109);
  color: #ffe27a;
}

#inventoryPanel .close-panel {
  border-color: rgba(255, 205, 64, 0.74);
  background: linear-gradient(#8e2f1a, #451109);
  color: #ffe27a;
}

#inventoryPanel .tab {
  color: #ffe27a;
  border: 2px solid rgba(255, 205, 64, 0.56);
  background: linear-gradient(180deg, rgba(61, 31, 12, 0.95), rgba(17, 14, 12, 0.95));
  text-shadow: 2px 2px 0 #421707;
}

#inventoryPanel .tab.active {
  color: #2a1204;
  background: linear-gradient(#ffe27a, #d98f24);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

#inventoryPanel .upgrade-row {
  border: 2px solid rgba(243, 183, 67, 0.82);
  background:
    linear-gradient(135deg, rgba(255, 199, 64, 0.1), transparent 32%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px),
    rgba(20, 12, 8, 0.9);
  box-shadow: inset 0 0 0 2px rgba(92, 43, 12, 0.86);
}

#inventoryPanel .info-card {
  margin-bottom: 10px;
  padding: 12px;
  border: 2px solid rgba(243, 183, 67, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 199, 64, 0.1), transparent 32%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px),
    rgba(20, 12, 8, 0.9);
  box-shadow: inset 0 0 0 2px rgba(92, 43, 12, 0.86);
}

#inventoryPanel .upgrade-row strong {
  color: #ffe27a;
  text-shadow: 2px 2px 0 #421707;
}

#inventoryPanel .info-card strong {
  display: block;
  margin-bottom: 7px;
  color: #ffe27a;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707;
}

#inventoryPanel .info-card p {
  margin: 0 0 7px;
  font-size: 13px;
  line-height: 1.4;
}

#inventoryPanel .info-card p:last-child {
  margin-bottom: 0;
}

#inventoryPanel .upgrade-row button,
#inventoryPanel #generationBtn,
#inventoryPanel #renaissanceBtn,
#inventoryPanel #giftCodeBtn {
  color: #2a1204;
  border-color: rgba(255, 225, 104, 0.9);
  background: linear-gradient(#ffe27a, #d98f24);
  box-shadow: inset 0 -3px 0 rgba(100, 45, 4, 0.4);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

#inventoryPanel .code-row input {
  border: 2px solid rgba(255, 205, 64, 0.48);
  background: rgba(0, 0, 0, 0.32);
}

.side-panel.dragging h2 {
  cursor: grabbing;
}

.close-panel {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  min-height: 34px;
  padding: 0;
}

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

.upgrade-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.troop-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 10px;
  border: 2px solid rgba(243, 183, 67, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 199, 64, 0.1), transparent 32%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px),
    rgba(20, 12, 8, 0.9);
  box-shadow:
    inset 0 0 0 2px rgba(92, 43, 12, 0.86),
    0 8px 0 rgba(0, 0, 0, 0.34),
    0 18px 32px rgba(0, 0, 0, 0.26);
}

.troop-card img {
  width: 96px;
  height: 112px;
  object-fit: contain;
  align-self: center;
  border-radius: 8px;
  image-rendering: pixelated;
  background: radial-gradient(circle, rgba(243, 183, 67, 0.18), rgba(0, 0, 0, 0.28));
  border: 2px solid rgba(255, 214, 92, 0.4);
}

.troop-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #ffe27a;
  text-shadow: 2px 2px 0 #4a1908;
  text-transform: uppercase;
}

.troop-card p {
  margin: 0 0 6px;
  color: #f4dfb8;
  font-size: 12px;
  line-height: 1.35;
}

.troop-card button {
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
  color: #2a1204;
  border-color: rgba(255, 225, 104, 0.9);
  background: linear-gradient(#ffe27a, #d98f24);
  box-shadow: inset 0 -3px 0 rgba(100, 45, 4, 0.4);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.upgrade-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.danger {
  background: rgba(118, 30, 33, 0.9);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  min-height: 38px;
  padding: 0 8px;
  font-size: 12px;
}

.tab.active {
  border-color: rgba(243, 183, 67, 0.8);
  background: rgba(73, 51, 25, 0.92);
}

.progress-line {
  height: 12px;
  margin: 12px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.progress-line i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #70d37b, #f3b743);
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.code-row input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.22);
}

.farming-header {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  border: 2px solid rgba(243, 183, 67, 0.82);
  border-radius: 8px;
  background: rgba(20, 12, 8, 0.9);
  box-shadow: inset 0 0 0 2px rgba(92, 43, 12, 0.86);
}

.farming-header img {
  width: 100%;
  height: 76px;
  object-fit: contain;
  image-rendering: pixelated;
}

.farming-header strong,
.farming-biome-card h3,
.farming-inventory-list strong {
  color: #ffe27a;
  text-shadow: 2px 2px 0 #421707;
}

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

.farming-biome-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 10px;
  border: 2px solid rgba(243, 183, 67, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 199, 64, 0.1), transparent 34%),
    rgba(20, 12, 8, 0.9);
}

.farming-biome-card img,
.farming-row > img,
.farming-item-spacer {
  width: 88px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 205, 64, 0.42);
}

.farming-item-spacer {
  display: block;
  background: radial-gradient(circle, rgba(243, 183, 67, 0.18), rgba(0, 0, 0, 0.26));
}

.farming-biome-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  text-transform: uppercase;
}

.farming-node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px;
}

.farming-node-grid button {
  min-height: 44px;
  padding: 5px 6px;
  color: #2a1204;
  border-color: rgba(255, 225, 104, 0.9);
  background: linear-gradient(#ffe27a, #d98f24);
  font-size: 11px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.farming-node-grid small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
}

.farming-inventory-list {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 205, 64, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.farming-inventory-list span {
  display: inline-block;
  margin: 3px 4px 3px 0;
  padding: 5px 7px;
  border-radius: 8px;
  color: #f8e6b8;
  background: rgba(255, 255, 255, 0.06);
}

.bag-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bag-tab {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 205, 64, 0.44);
  background: rgba(20, 12, 8, 0.76);
  color: #f8e6b8;
  font-size: 11px;
}

.bag-tab.active {
  color: #2a1204;
  background: linear-gradient(#ffe27a, #d98f24);
}

.bag-category {
  padding: 8px;
  border: 1px solid rgba(255, 205, 64, 0.3);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.bag-category strong {
  display: block;
  margin-bottom: 5px;
  color: #ffe27a;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707;
}

.bag-category-actions div {
  display: grid;
  gap: 8px;
}

.bag-category-actions span {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: center;
}

.bag-category-actions img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.bag-category-actions b {
  color: #fff0b6;
}

.bag-category-actions small {
  display: block;
  color: #d9c49b;
  font-size: 11px;
}

.bag-category-actions button {
  min-height: 32px;
  padding: 0 10px;
}

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

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

.merchant-npc,
.craft-table-npc {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(210px, 70%);
  margin: 14px auto;
  padding: 10px;
  border: 2px solid rgba(255, 205, 64, 0.72);
  border-radius: 8px;
  background: rgba(20, 12, 8, 0.72);
}

.merchant-npc:hover,
.craft-table-npc:hover {
  background: rgba(45, 37, 29, 0.86);
  transform: translateY(-3px) scale(1.03);
}

.merchant-npc img,
.craft-table-npc img {
  width: 140px;
  height: 160px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.46));
}

.merchant-npc strong,
.craft-table-npc strong {
  color: #ffe27a;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #421707;
}

.craft-table-npc img {
  width: 170px;
  height: 132px;
}

.biome-object.merchant-npc,
.biome-object.craft-table-npc {
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.biome-object.merchant-npc:hover,
.biome-object.craft-table-npc:hover {
  background: transparent;
  transform: translate(-50%, -55%) scale(1.04);
}

.biome-object.merchant-npc img {
  width: 150px;
  height: 170px;
}

.biome-object.craft-table-npc img {
  width: 180px;
  height: 138px;
}

.biome-merchant-object {
  width: 150px;
  height: 170px;
}

.biome-craft-object {
  width: 180px;
  height: 138px;
}

.toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(12, 15, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 800;
}

@media (max-width: 820px) {
  .home-menu {
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
  }

  .hud {
    grid-template-columns: 1fr;
    top: 10px;
  }

  .gear-button {
    justify-self: end;
  }

  .hud-meta {
    justify-content: space-between;
    min-height: 44px;
    font-size: 12px;
  }

  .summon-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .summon-card {
    min-height: 66px;
  }

  .farming-map-controls {
    left: 10px;
    right: 94px;
  }

  .farming-map-controls button,
  .farming-quick-actions button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .farming-map-panel {
    left: 10px;
    right: 10px;
    top: 188px;
    bottom: 124px;
    width: auto;
  }

  .resource-bag-button {
    right: 12px;
    bottom: 12px;
    width: 76px;
    min-height: 76px;
  }

  .farming-map-hotspots {
    inset: 0;
  }

  .biome-marker strong {
    max-width: 110px;
    font-size: 9px;
  }

  .biome-scene-top {
    grid-template-columns: 1fr;
    left: 10px;
    right: 10px;
  }

  .biome-resource-list {
    inset: 154px 10px 98px;
    width: auto;
  }

  .biome-object {
    padding: 5px;
  }

  .biome-object img {
    width: 100%;
    height: 100%;
  }

  .biome-object strong {
    max-width: 96px;
    font-size: 9px;
  }

  .biome-object small {
    display: none;
  }

  .biome-resource-object {
    width: 68px;
    height: 62px;
  }

  .biome-node-plant {
    width: 50px;
    height: 46px;
  }

  .biome-node-wood {
    width: 88px;
    height: 86px;
  }

  .biome-node-animal {
    width: 92px;
    height: 80px;
  }

  .biome-node-ore {
    width: 58px;
    height: 52px;
  }

  .biome-node-fish {
    width: 78px;
    height: 56px;
  }

  .biome-node-desert {
    width: 96px;
    height: 78px;
  }

  .biome-object.merchant-npc img {
    width: 116px;
    height: 132px;
  }

  .biome-object.craft-table-npc img {
    width: 132px;
    height: 100px;
  }

  .biome-merchant-object {
    width: 116px;
    height: 132px;
  }

  .biome-craft-object {
    width: 132px;
    height: 100px;
  }
}
