html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Arial, sans-serif;
  background: #111;
  color: white;
  text-align: center;
  margin: 0;
}

.left-panel {
  border-right: 2px solid #222;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.center-panel {
  flex: 1;
  position: relative;
  background: #111;
  border-left: 2px solid #222;
  border-right: 2px solid #222;
  padding: 0;
  overflow-y: scroll;
  font-size: 1.1rem;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

#clockWrapper {
  width: calc(100% + 40px);
  height: 36px;
  margin-left: -20px;
  margin-right: -20px;
  margin-top: -20px;
  background: #0d0d0d;
  border-bottom: 2px solid #222;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: visible;
}

#gameClock {
  font-size: 16px;
}

.weather-display {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ccc;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s;
  white-space: nowrap;
}

.weather-display:hover {
  background: #1a1a1a;
}

.weather-display .tooltip {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 110%;
  bottom: auto;
  width: 240px;
  background: #1e1e1e;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  z-index: 9999;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  outline: 3px solid white;
  text-align: left;
  color: white;
  pointer-events: none;
}

.weather-display.show-tooltip .tooltip { display: block; }

@media (hover: hover) {
  .weather-display:hover .tooltip { display: block; }
}

.weather-display .weather-icon {
  font-size: 14px;
  line-height: 1;
}

.weather-display .weather-label {
  font-size: 12px;
  letter-spacing: 0.03em;
}

body.weather-windy .weather-display { color: #a8d8ea; }
body.weather-cloudy .weather-display { color: #aaa; }
body.weather-rainy .weather-display { color: #7ab8d4; }
body.weather-snow .weather-display { color: #d0eaff; }
body.weather-storm .weather-display { color: #bf9fff; }

.grid-name {
  font-size: 25px;
  margin-bottom: 10px 0;
  cursor: pointer;
  transition: 0.2s;
}

.grid-name:hover {
  opacity: 1;
  transform: scale(1.05);
}

.handcrank {
  width: 256px;
  height: 256px;
  margin: 8px auto;
  flex-shrink: 0;
  cursor: pointer;
  background-image: url("../assets/ui/handcrank-sprite.png");
  background-repeat: no-repeat;
  image-rendering: pixelated;
  background-size: 2048px 256px;
  position: relative;
}

#newsTickerWrapper {
  width: 100%;
  height: 36px;
  overflow: hidden;
  background: #0d0d0d;
  border-bottom: 2px solid #222;
  display: flex;
  align-items: center;
}

#newsTickerTrack {
  display: flex;
  gap: 80px;
  white-space: nowrap;
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.tickerItem {
  font-size: 16px;
  contain: layout style;
}

#settingsBar {
  container-type: inline-size;
  container-name: settings-bar;
  width: calc(100% + 40px);
  height: 36px;
  margin-right: -20px;
  margin-left: -20px;
  margin-top: -20px;
  background: #0d0d0d;
  border-bottom: 2px solid #222;
  display: flex;
  align-items: center;
  overflow-x: visible;
  overflow-y: visible;
}

.arg-link,
#settingsBar button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  line-height: 1;
  padding: 0 8px;
  box-sizing: border-box;
  border: none;
  border-right: 1px solid #222;
  background: none;
  color: white;
  font-size: 14px;
  font-family: Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: background 0.15s;
}

.arg-link:last-child,
#settingsBar button:last-child { border-right: none; }

.arg-link { color: #a944bd; }
.arg-link:hover { background: #1a1a1a; }
#settingsBar button { color: white; }
#settingsBar button:hover { background: #1a1a1a; opacity: 1; }

.settings-bar-label { display: inline; }
.settings-bar-icon  { display: none; }

@container settings-bar (max-width: 320px) {
  .arg-link,
  #settingsBar button {
    flex: 0 0 auto;
    width: 44px;
    padding: 0;
    font-size: 18px;
  }
  .settings-bar-label { display: none; }
  .settings-bar-icon  { display: inline; }
}

#settingsMenu {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
}

#settingsMenu.hidden {
  display: none;
}

.settings-content {
  margin-left: 20px;
  width: 420px;
  max-width: 92%;
  text-align: left;
  font-size: 14px;
  gap: 8px;
}

.settings-content h2 {
  margin-bottom: 20px;
}

.settings-content > h2 {
  font-size: 22px;
  margin: 0 0 12px 0;
}

.settings-subtitle {
  font-size: 16px;
  margin: 6px 0 10px 0;
  opacity: 0.95;
}

.audio-section {
  margin-bottom: 16px;
}

.audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid #1e1e1e;
}

.audio-row label {
  width: 40%;
  font-weight: 600;
}

.audio-row input[type="range"] {
  width: 60%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 6px;
  background: #333;
  outline: none;
}

.audio-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255,255,255,0.1);
  cursor: pointer;
}

.audio-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.settings-content .secotion button,
.settings-content button {
  padding: 6px 10px;
  font-size: 12px;
  margin: 0;
}

#buildingDisplay {
  display: flex;
  flex-direction: column;
}

.building-section {
  position: relative;
  height: 86px;
  overflow: hidden;
}

.building-section:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

.building-banner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  pointer-events: none;
  transition: filter 1.5s ease;
}

.building-row {
  position: absolute;
  top: 20px;
  left: 10px;
  right: 0;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
}

.building-icon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  transition: filter 1.5s ease;
}

.building-icon:hover {
  transform: scale(1.1);
}

.right-panel {
  border-left: 2px solid #222;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  text-align: left;
  overflow-y: scroll;
    min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.game {
  display: grid;
  grid-template-columns: 0.9fr 1.2fr 350px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button {
  padding: 15px 40px;
  font-size: 20px;
  margin: 20px;
  cursor: pointer;
}

.section {
  margin-top: 30px;
}

.secotion button {
  margin: 5px;
  padding: 10px 20px;
  font-size: 14px;
  background: 1e1e1e;
  border-radius: 6px;
  outline: 3px solid white;
}

.item {
  background: #222;
  padding: 10px;
  margin: 8px auto;
  width: 300px;
  cursor: pointer;
  border-radius: 6px;
  transition: 0.2s;
}

.item {
  position: relative;
}

.tooltip {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 110%;
  width: 260px;
  background: #1e1e1e;
  padding: 10px;
  border-radius: 6px; 
  font-size: 14px;
  line-height: 1.4;
  z-index: 999;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  outline: 3px solid white;
}

@media (hover: hover) {
  .item:hover .tooltip {
    display: block;
  }
}

.item.show-tooltip .tooltip {
  display: block;
}

.item:hover {
  background: #333;
}

.item.disabled > :not(.tooltip) {
  opacity: 0.4;
}

.hidden {
  display: none;
}

.locked-building {
  filter: grayscale(100%) brightness(0.2);
  opacity: 0.1;
  border: 3px solid white;
  pointer-events: none;
  background: black;
  color: black;
}

.night .building-banner {
  filter: brightness(0.4);
}

.night .building-icon {
  filter: brightness(0.6);
}

@keyframes solarPulse {
  0% {
    box-shadow: inset 0 12px 0 rgba(255, 0, 0, 0.25);
  }
  50% {
    box-shadow: inset 0 12px 0 rgba(255, 0, 0, 1);
  }
  100% {
    box-shadow: inset 0 12px 0 rgba(255, 0, 0, 0.25);
  }
}

.solar-night {
  animation: solarPulse 1.5s infinite ease-in-out;
}

.floating-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: bold;
  font-size: 20px;
  pointer-events: none;
  white-space: nowrap;
}

#floatingTextContainer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#leaderboardSection {
  margin-top: 10px;
  font-size: 14px;
  text-align: left;
}

#leaderboardList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

.leaderboard-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b1b1b;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #333;
  font-size: 13px;
  transition: 0.2s;
}

.leaderboard-card:hover {
  background: #222;
  transform: scale(1.02);
}

.leaderboard-card.gold {
  background: linear-gradient(90deg, #3a2a00, #1b1b1b);
  border-color: #ffd700;
  box-shadow: 0 0 6px rgba(255,215,0,0.4);
}

.leaderboard-card.silver {
  background: linear-gradient(90deg, #2a2a2a, #1b1b1b);
  border-color: #cfcfcf;
  box-shadow: 0 0 6px rgba(200,200,200,0.3);
}

.leaderboard-card.bronze {
  background: linear-gradient(90deg, #3a1f00, #1b1b1b);
  border-color: #cd7f32;
  box-shadow: 0 0 6px rgba(205,127,50,0.4);
}

.lb-rank {
  width: 30px;
  font-weight: bold;
  opacity: 0.8;
}

.lb-name {
  flex: 1;
  text-align: left;
  padding-left: 4px;
}

.lb-score {
  font-weight: bold;
  opacity: 0.9;
}

#cloudSection {
  margin-top: 15px;
  padding: 10px;
  background: #1b1b1b;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 13px;
}

#cloudSection h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  text-align: left;
}

.cloud-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.cloud-label {
  font-weight: bold;
  opacity: 0.8;
}

.cloud-code {
  font-family: monospace;
  font-size: 12px;
  background: #111;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #333;
  flex: 1;
  filter: blur(6px);
  transition: 0.2s ease;
  cursor: pointer;
}

.cloud-code:hover {
  filter: blur(0);
}

#cloudLoadInput {
  flex: 1;
  padding: 6px;
  font-size: 12px;
  background: #111;
  color: white;
  border: 1px solid #333;
  border-radius: 4px;
}

#cloudSection button {
  padding: 6px 10px;
  font-size: 12px;
  margin: 0;
  background: #222;
  color: white;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
}

#cloudSection button:hover {
  background: #333;
}

.cloud-status {
  font-size: 11px;
  min-height: 14px;
  opacity: 0.85;
}

.daily-receipt {
  position: fixed;
  right: 20px;
  bottom: -380px;
  width: 320px;
  background-image: url("../assets/ui/receipt-paper.png");
  background-size: cover;
  background-repeat: no-repeat;
  padding: 12px;
  color: #111;
  font-size: 14px;
}

@keyframes receiptPrint {
  0% { transform: translateY(100%); }
  10% { transform: translateY(90%); }
  20% { transform: translateY(80%); }
  30% { transform: translateY(70%); }
  40% { transform: translateY(60%); }
  50% { transform: translateY(50%); }
  60% { transform: translateY(40%); }
  70% { transform: translateY(30%); }
  80% { transform: translateY(20%); }
  90% { transform: translateY(10%); }
  100% { transform: translateY(0%); }
}

.daily-receipt.show {
  bottom: 20px;
  animation: receiptPrint 1.2s steps(10);
}

.daily-receipt .receipt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 8px;
}

.daily-receipt .receipt-close {
  background: none;
  border: none;
  color: #000;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
}

.daily-receipt .receipt-close:hover {
  background: rgba(255,255,255,0.03);
  color: #111111;
}

.daily-receipt .receipt-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.daily-receipt .receipt-row {
  display:flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
}

.daily-receipt .receipt-row.total {
  margin-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.06);
  padding-top: 10px;
  font-weight: 800;
}

.daily-receipt .receipt-row span { opacity: 0.9; }
.daily-receipt .receipt-row strong { font-weight: 800; }

.daily-receipt-entry {
  display: flex;
  justify-content: space-between;
  font-family: monospace;
}

.positive {
  color: #297019;
}

.negative {
  color: #911616;
}

body.light-mode {
  background: #f5f5f5;
  color: #111;
}

body.light-mode .center-panel {
  background: #f5f5f5;
}

body.light-mode #clockWrapper,
body.light-mode #newsTickerWrapper,
body.light-mode #settingsBar {
  background: #e6e6e6;
  border-color: #ccc;
}

body.light-mode #settingsMenu {
  background: rgba(255,255,255,0.95) !important;
  color: #111 !important;
}

body.light-mode #settingsMenu .settings-content {
  color: #111;
}

body.light-mode button,
body.light-mode .secotion button,
body.light-mode #cloudSection button {
  background: #f0f0f0;
  color: #111;
  border: 1px solid #cfcfcf;
}

body.light-mode .item {
  background: #eaeaea;
  color: #111;
}

body.light-mode .item:hover {
  background: #dcdcdc;
}

body.light-mode .tooltip {
  background: #ffffff;
  color: #111;
  outline: 2px solid #000;
}

body.light-mode .leaderboard-card {
  background: #f7f7f7;
  color: #111;
  border-color: #ccc;
}

body.light-mode #profitChart {
  outline: 1px solid rgba(0,0,0,0.06);
}

body.light-mode .ach-cell-unlocked {
  background: #fff7dc;
  border-color: #c8902a;
}

body.light-mode .ach-cell-locked {
  background: #e0e0e0;
  border-color: #bbb;
}

body.light-mode .ach-tooltip {
  background: #fff;
  border-color: #c8902a;
  color: #111;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

body.light-mode .ach-tooltip-desc {
  color: #333;
}

body.light-mode .ach-toast {
  background: #fff8e8;
  border-color: #c8902a;
}

body.light-mode .ach-toast-name {
  color: #8a5c00;
}

body.light-mode .weather-display .tooltip {
  background: #f0f0f0;
  color: #111;
  outline-color: #333;
}

body.light-mode #customizationMenu { background: rgba(255,255,255,0.97); color: #111; }
body.light-mode .custom-tabs { background: #e6e6e6; border-color: #ccc; }
body.light-mode .custom-tab { color: #666; }
body.light-mode .custom-tab.custom-tab-active,
body.light-mode .custom-tab:hover { color: #111; background: #f0f0f0; }
body.light-mode .skin-card { background: #f0f0f0; border-color: #ccc; }
body.light-mode .skin-card:hover:not(.skin-card-locked):not(.skin-card-active) { border-color: #999; }
body.light-mode .skin-card-name { color: #111; }
body.light-mode .skin-card-btn { background: #e4e4e4; border-color: #ccc; color: #444; }
body.light-mode .skin-card-btn:hover:not(:disabled) { background: #d8d8d8; border-color: #999; color: #111; }

body.light-mode .shop-pl-row { background: #f0f0f0; border-color: #ccc; }
body.light-mode .shop-pl-row:hover { background: #e8e8e8; }
body.light-mode .shop-pl-name { color: #111; }
body.light-mode .shop-pl-body { background: #f8f8f8; border-color: #ccc; }
body.light-mode .shop-pl-track { border-color: #e8e8e8; }
body.light-mode .shop-pl-track-name { color: #333; }
body.light-mode .shop-pl-price { color: #555; }

.changelog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.changelog.hidden {
  display: none;
}

.changelog-content {
  background: #1b1b1b;
  border: 2px solid #fff;
  border-radius: 10px;
  color: white;
  width: 500px;
  max-width: 92%;
  max-height: 300px;
  padding: 22px;
  box-shadow: 0 0 25px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  text-align: left;
}

.changelog-content h2 {
  margin: 0 0 14px 0;
  font-size: 22px;
  color: white;
  border-bottom: 1px solid #333;
  padding-bottom: 6px;
}

.changelog-content ul {
  color: white;
  margin: 10px 0;
  padding-left: 20px;
  overflow-y: auto;
  max-height: 250px;
}

.changelog-content li {
  color: white;
  margin-bottom: 6px;
  line-height: 1.4;
}

.changelog-content button {
  align-self: flex-end;
  background: #222;
  border: 1px solid #444;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  padding: 8px 16px;
  margin-top: 15px;
  cursor: pointer;
  transition: 0.2s;
  align-self: flex-end;
}

.changelog-content button:hover {
  background: #333;
  transform: scale(1.05);
}

#profitChart {
  display: block;
  width: 100%;
  max-width: 360px;
  height: 120px;
  border-radius: 6px;
  margin-top: 8px;
  background: #1b1b1b;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px;
}

#statsSection {
  margin-top: 16px;
  padding-bottom: 16px;
}

#statsSection h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  opacity: 0.85;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #1e1e1e;
  font-size: 13px;
}

.stats-label {
  opacity: 0.75;
}

.stats-value {
  font-weight: bold;
  color: #fff;
}

#achievementsSection {
  margin-top: 30px;
  padding: 0 20px 24px 20px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.ach-counter {
  font-size: 12px;
  opacity: 0.6;
  margin-bottom: 8px;
  text-align: left;
}

.ach-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
}

.ach-cell {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.ach-cell-unlocked {
  background: #2a1f00;
  border: 1px solid #c8902a;
  box-shadow: inset 0 0 6px rgba(200, 144, 42, 0.35);
}

.ach-cell-locked {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  filter: grayscale(1);
  opacity: 0.55;
}

.ach-cell-icon {
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

.ach-tooltip {
  display: none;
  position: fixed;
  width: 180px;
  background: #1e1e1e;
  border: 2px solid #c8902a;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  z-index: 99999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  text-align: left;
  white-space: normal;
  color: #fff;
}

.ach-tooltip-locked-box {
  border-color: #444;
}

.ach-tooltip-locked {
  color: #888;
  text-align: center;
  font-style: italic;
}

.ach-tooltip-name {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #f5c842;
  margin-bottom: 4px;
}

.ach-tooltip-divider {
  border-top: 1px solid #444;
  margin: 4px 0;
}

.ach-tooltip-desc {
  font-size: 11px;
  opacity: 0.85;
  color: #ddd;
}

@media (hover: hover) {
  .ach-cell:hover .ach-tooltip {
    display: block;
  }
}

.ach-cell.ach-open .ach-tooltip {
  display: block;
}

#achievementToastContainer {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.ach-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1400;
  border: 2px solid #c8902a;
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 240px;
  max-width: 300px;
  box-shadow: 0 0 18px rgba(200, 144, 42, 0.45);
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ach-toast.ach-toast-show {
  opacity: 1;
  transform: translateX(0);
}

.ach-toast-icon {
  font-size: 28px;
  line-height: 1;
}

.ach-toast-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #c8902a;
  opacity: 0.9;
}

.ach-toast-name {
  font-size: 14px;
  font-weight: bold;
  color: #f5c842;
}

body.rabbit-hole-active::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(120, 0, 220, 0.10);
  pointer-events: none;
  z-index: 9998;
  animation: rabbitHolePulse 4s ease-in-out infinite;
}

@keyframes rabbitHolePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.left-panel.rabbit-hole-panel {
  background-image: url('../assets/ui/events/rabbitHole.png');
  background-size: cover;
  background-position: center;
  transition: background-image 0.6s ease;
}

body.lost-library-active::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.40);
  pointer-events: none;
  z-index: 9998;
}

.left-panel.lost-library-panel {
  background-image: url('../assets/ui/events/lostLibrary.png');
  background-size: cover;
  background-position: center;
  transition: background-image 0.6s ease;
  image-rendering: pixelated;
}

.game.collared-filter {
  filter: grayscale(60%) sepia(20%) brightness(0.88) contrast(1.07);
  animation: collaredFlicker 11s steps(1) infinite;
}

@keyframes collaredFlicker {
  0%, 84% { filter: grayscale(60%) sepia(20%) brightness(0.88) contrast(1.07); }
  85% { filter: grayscale(60%) sepia(20%) brightness(0.62) contrast(1.07); }
  86% { filter: grayscale(60%) sepia(20%) brightness(0.88) contrast(1.07); }
  92% { filter: grayscale(60%) sepia(20%) brightness(0.95) contrast(1.07); }
  93% { filter: grayscale(60%) sepia(20%) brightness(0.85) contrast(1.07); }
  94%, 100% { filter: grayscale(60%) sepia(20%) brightness(0.88) contrast(1.07); }
}

#collaredVideoOverlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: auto;
  z-index: 9999;
}

.left-panel.collared-panel {
  background-image: url('../assets/ui/events/collared.png');
  background-size: cover;
  background-position: center;
}

.left-panel::-webkit-scrollbar,
.center-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar, 
.settings-content::-webkit-scrollbar {
  display: none;
}

.left-panel,
.center-panel,
.right-panel, 
.settings-content {
  scrollbar-width: none;
}

#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease;
}

#loadingScreen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #e0e0e0;
  font-family: inherit;
  text-align: center;
}

.loading-content h2 {
  font-size: 2rem;
  margin: 0;
}

.loading-bar-track {
  width: 280px;
  height: 12px;
  background: #222;
  border-radius: 6px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4fc3f7, #0288d1);
  border-radius: 6px;
  transition: width 0.2s ease;
}

@media (max-width: 700px) {

  .game {
    grid-template-columns: 1fr;
    position: relative;
  }

  .left-panel,
  .center-panel,
  .right-panel {
    display: none;
    height: calc(100dvh - 48px);
    overflow-y: auto;
  }

  .left-panel.mobile-active,
  .center-panel.mobile-active,
  .right-panel.mobile-active {
    display: flex;
    flex-direction: column;
  }

  .handcrank {
    width: 160px;
    height: 160px;
    background-size: 1280px 160px;
  }

  #newsTickerWrapper {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
  }

  #mobileTabBar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: #0d0d0d;
    border-top: 2px solid #222;
    z-index: 100;
  }

  #mobileTabBar button {
    flex: 1;
    background: none;
    border: none;
    color: #aaa;
    font-size: 12px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: color 0.2s;
  }

  #mobileTabBar button.active {
    color: #fff;
    border-top: 2px solid #4fc3f7;
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .game {
    grid-template-columns: 1fr 1.4fr 1fr;
  }

  .handcrank {
    width: 200px;
    height: 200px;
    background-size: 1600px 200px;
  }
}

#customizationMenu {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  overflow-x: hidden;
}

#customizationMenu::-webkit-scrollbar { display: none; }

#customizationMenu.hidden { display: none; }

.radio-content {
  margin-left: 20px;
  width: 420px;
  max-width: 92%;
  text-align: left;
  font-size: 14px;
  padding-bottom: 24px;
}

.radio-content > h2 {
  font-size: 22px;
  margin: 0 0 12px 0;
}

.radio-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#radioSelect {
  flex: 1;
  position: relative;
  user-select: none;
}

.radio-select-current {
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.radio-select-current::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.6;
  margin-left: 8px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.radio-select-current.open::after {
  transform: rotate(180deg);
}

.radio-select-current:hover,
.radio-select-current.open {
  border-color: #777;
  background: #252525;
}

.radio-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.radio-select-dropdown.open { display: block; }

.radio-select-option {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background 0.15s;
}

.radio-select-option:hover  { background: #2a2a2a; }
.radio-select-option:not(:last-child) { border-bottom: 1px solid #2a2a2a; }

.radio-select-option.selected { color: #4fc3f7; }

.radio-play-btn {
  padding: 7px 16px !important;
  font-size: 13px !important;
  margin: 0 !important;
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.radio-play-btn:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #777;
}

.radio-play-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.radio-download-status {
  font-size: 12px;
  color: #4fc3f7;
  margin-bottom: 10px;
  animation: radioPulse 1.4s ease-in-out infinite;
}

.radio-download-status.hidden { display: none; }

@keyframes radioPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.radio-song-list {
  border-top: 1px solid #222;
  padding-top: 6px;
  max-height: 7000px;
  overflow: hidden;
  scrollbar-width: none;
}

.radio-song-list::-webkit-scrollbar { display: none; }

.radio-song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 13px;
  transition: background 0.15s;
  border-radius: 3px;
}

.radio-song-item:hover { background: #181818; }

.radio-song-num {
  opacity: 0.35;
  font-size: 11px;
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}

.radio-song-name { color: #ddd; }

.radio-song-playing .radio-song-name { color: #4fc3f7; }

.custom-tabs {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 36px;
  flex-shrink: 0;
  background: #0d0d0d;
  border-bottom: 2px solid #222;
}

.custom-tab {
  flex: 0 0 auto;
  width: 100px;
  height: 100%;
  background: none;
  border: none;
  border-right: 1px solid #222;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  margin: 0 !important;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.custom-tab:last-child { border-right: none; }

.custom-tab:hover {
  color: #ccc;
  background: #161616;
}

.custom-tab.custom-tab-active {
  color: #fff;
  background: #161616;
  box-shadow: inset 0 -2px 0 #4fc3f7;
}

.custom-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 20px 24px 20px;
  scrollbar-width: none;
}
.custom-content::-webkit-scrollbar { display: none; }

.custom-tab-panel { width: 100%; }
.custom-tab-panel.hidden { display: none; }

.skin-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px 0;
}

.skin-inventory-grid {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.skin-inventory-grid::-webkit-scrollbar { height: 4px; }
.skin-inventory-grid::-webkit-scrollbar-track { background: transparent; }
.skin-inventory-grid::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.skin-card {
  flex: 0 0 auto;
  width: 110px;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.skin-card:hover:not(.skin-card-locked):not(.skin-card-active) {
  border-color: #555;
}

.skin-card-active {
  border-color: #4fc3f7;
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.2);
  cursor: default;
}

.skin-card-locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.skin-card-preview {
  width: 100%;
  height: 90px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}

.skin-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 7px 7px 7px;
  gap: 2px;
}

.skin-card-name {
  font-size: 12px;
  font-weight: 700;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skin-card-rarity {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.skin-rarity-common { color: #777; }
.skin-rarity-uncommon { color: #00ff00; }
.skin-rarity-rare { color: #4fc3f7; }
.skin-rarity-epic { color: #d900ff; }
.skin-rarity-legendary { color: #f5c842; }
.skin-rarity-mythic { color: #ff00d4; }
.skin-rarity-achievement { color: #ff810a; }

.skin-card-btn {
  width: 100%;
  padding: 4px 0 !important;
  font-size: 11px !important;
  font-weight: 600;
  margin: 5px 0 0 0 !important;
  background: #222;
  border: 1px solid #383838;
  border-radius: 4px;
  color: #aaa;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.skin-card-btn:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #555;
  color: #fff;
}
.skin-card-btn:disabled { cursor: default; opacity: 0.55; }
.skin-card-btn.btn-equipped {
  color: #4fc3f7;
  border-color: rgba(79, 195, 247, 0.35);
  background: rgba(79, 195, 247, 0.05);
}

#customPanelRadio { padding-top: 2px; }

.shop-refresh-timer {
  font-size: 11px;
  color: #555;
  margin: -6px 0 10px 0;
  letter-spacing: 0.03em;
}

.skin-card-price {
  font-size: 11px;
  color: #aaa;
  margin: 3px 0 0 0;
}

.skin-card-btn.btn-buy {
  color: #fff;
  background: #1a3a1a;
  border-color: #2e6b2e;
}
.skin-card-btn.btn-buy:hover:not(:disabled) {
  background: #224d22;
  border-color: #4caf50;
  color: #fff;
}
.skin-card-btn.btn-buy:disabled {
  opacity: 0.35;
}
.skin-card-btn.btn-owned {
  color: #4fc3f7;
  border-color: rgba(79, 195, 247, 0.35);
  background: rgba(79, 195, 247, 0.05);
}

.shop-section-divider {
  width: 100%;
  border: none;
  border-top: 1px solid #222;
  margin: 16px 0 12px 0;
}

.shop-pl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.shop-pl-row:hover { background: #202020; border-color: #444; }
.shop-pl-row.pl-owned { border-color: #2e4a2e; }

.shop-pl-name {
  font-size: 13px;
  font-weight: 700;
  color: #ddd;
}
.shop-pl-arrow {
  font-size: 11px;
  color: #555;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}
.shop-pl-row.pl-open .shop-pl-arrow { transform: rotate(180deg); }

.shop-pl-body {
  display: none;
  background: #141414;
  border: 1px solid #2e2e2e;
  border-top: none;
  border-radius: 0 0 6px 6px;
  margin-top: -6px;
  margin-bottom: 6px;
  padding: 6px 0 10px 0;
}
.shop-pl-row.pl-open + .shop-pl-body { display: block; }

.shop-pl-track {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  color: #888;
  border-bottom: 1px solid #1a1a1a;
}
.shop-pl-track:last-of-type { border-bottom: none; }
.shop-pl-track-num { opacity: 0.4; font-size: 10px; min-width: 16px; text-align: right; }
.shop-pl-track-name { color: #bbb; }

.shop-pl-buy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 0 12px;
}
.shop-pl-price {
  font-size: 12px;
  color: #aaa;
}
.shop-pl-buy-btn {
  padding: 5px 14px !important;
  font-size: 12px !important;
  font-weight: 600;
  margin: 0 !important;
  background: #1a3a1a;
  border: 1px solid #2e6b2e;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.shop-pl-buy-btn:hover:not(:disabled) { background: #224d22; border-color: #4caf50; }
.shop-pl-buy-btn:disabled { opacity: 0.45; cursor: default; }
.shop-pl-owned-badge {
  font-size: 11px;
  font-weight: 600;
  color: #4fc3f7;
  padding: 4px 0;
}

/* ---- Skin Themes ----------------------------------------- */
body.skin-butcherVanity .left-panel,
body.skin-butcherVanity .right-panel {
  background-image: url("../assets/ui/skins/butcherVanity.png");
  background-color: #fff10c;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: top right;
}
body.skin-butcherVanity .center-panel {
  background-color: #fff10c;
}

body.skin-flopEra .left-panel,
body.skin-flopEra .right-panel {
  background-image: url("../assets/ui/skins/flopEra.png");
  background-size: cover;
  background-position: center;
}
body.skin-flopEra .center-panel {
   background-color: #fffabc;
}

body.skin-mesmerizer .left-panel {
  background-image: url("../assets/ui/skins/mesmerizerLeft.png");
  background-size: cover;
  background-position: center;
}
body.skin-mesmerizer .right-panel {
  background-image: url("../assets/ui/skins/mesmerizerRight.png");
  background-size: cover;
  background-position: center;
}
body.skin-mesmerizer .center-panel {
  background-color: #f80233;
}

body.skin-tetotetotetotetoteto .left-panel,
body.skin-tetotetotetotetoteto .right-panel,
body.skin-tetotetotetotetoteto .center-panel {
  background-image: url("../assets/ui/skins/tetotetotetotetoteto.png");
  background-size: cover;
  background-position: center;
}

body.skin-rabbitHole .left-panel,
body.skin-rabbitHole .right-panel {
  background-image: url("../assets/ui/events/rabbitHole.png");
  background-size: cover;
  background-position: center;
}
body.skin-rabbitHole .center-panel {
  background-color: #d036e6;
}

body.skin-collared {
  filter: grayscale(60%) sepia(20%) brightness(0.88) contrast(1.07);
  animation: collaredFlicker 11s steps(1) infinite;

  position: fixed;
  background-image: url('../assets/ui/events/collaredOverlay.png');
  background-size: 100% 100%;
  background-position: center;
  opacity: 0.52;
  z-index: 9997;

}
body.skin-collared .left-panel,
body.skin-collared .right-panel {
  background-image: url('../assets/ui/events/collared.png');
  background-size: cover;
  background-position: center;
}
body.skin-collared .center-panel {
  background-color: #232323;
}

body.skin-space .left-panel,
body.skin-space .right-panel,
body.skin-space .center-panel {
  background-image: url("../assets/ui/skins/space.png");
}

body.skin-portugal .left-panel,
body.skin-portugal .right-panel,
body.skin-portugal .center-panel {
  background-image: url("../assets/ui/skins/portugal.png");
  background-size: cover;
  background-position: center;
}

body.skin-backrooms .left-panel,
body.skin-backrooms .right-panel,
body.skin-backrooms .center-panel {
  background-image: url("../assets/ui/skins/backrooms.png");
  image-rendering: pixelated;
}

body.skin-lostLibrary .left-panel,
body.skin-lostLibrary .right-panel {
  background-image: url("../assets/ui/events/lostLibrary.png");
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}
body.skin-lostLibrary .center-panel {
  background-color: #211d57;
}

body.skin-ducks .left-panel,
body.skin-ducks .right-panel,
body.skin-ducks .center-panel {
  background-image: url("../assets/ui/skins/ducks.png");
  image-rendering: pixelated;
}

body.skin-plains .left-panel,
body.skin-plains .right-panel,
body.skin-plains .center-panel {
  background-image: url("../assets/ui/skins/plains.png");
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}

body.skin-neon .left-panel,
body.skin-neon .center-panel,
body.skin-neon .right-panel {
  background: linear-gradient(180deg, #0d0d1a 0%, #1a003a 60%, #00391a 100%);
}

body.skin-ocean .left-panel,
body.skin-ocean .center-panel,
body.skin-ocean .right-panel {
  background: linear-gradient(180deg, #001a2e 0%, #003366 60%, #004080 100%);
}

body.skin-desert .left-panel,
body.skin-desert .center-panel,
body.skin-desert .right-panel {
  background: linear-gradient(180deg, #1a1500 0%, #3d3300 60%, #665800 100%);
}

body.skin-forest .left-panel,
body.skin-forest .center-panel,
body.skin-forest .right-panel {
  background: linear-gradient(180deg, #001a05 0%, #003d10 60%, #005c18 100%);
}

body.skin-cherryBlossom .left-panel,
body.skin-cherryBlossom .center-panel,
body.skin-cherryBlossom .right-panel {
  background: linear-gradient(180deg, #1a0011 0%, #3d0029 60%, #660045 100%);
}

body.skin-volcano .left-panel,
body.skin-volcano .center-panel,
body.skin-volcano .right-panel {
  background: linear-gradient(180deg, #1a0000 0%, #3d0000 60%, #660000 100%);
}

body.skin-sunSet .left-panel,
body.skin-sunSet .center-panel,
body.skin-sunSet .right-panel {
  background: linear-gradient(180deg, #1a0a00 0%, #3d1f00 60%, #663400 100%);
}

body.skin-galaxy .left-panel,
body.skin-galaxy .center-panel,
body.skin-galaxy .right-panel {
  background: linear-gradient(180deg, #0d001a 0%, #25003d 60%, #3a0066 100%);
}