* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(circle at center, #1b2f15 0%, #0a1308 100%);
  color: #fff;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
}

#game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 900px;
  max-width: 98vw;
}

/* Minimalist Clean Top Navigation Bar */
.top-nav-bar {
  width: 100%;
  background: linear-gradient(to bottom, #3e2723, #2a160c);
  border: 3px solid #5d4037;
  border-bottom: 2px solid #231209;
  border-radius: 10px 10px 0 0;
  padding: 4px 10px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  z-index: 10;
  box-sizing: border-box;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.btn-menu-main {
  background: linear-gradient(135deg, #e65100, #bf360c) !important;
  color: #fff !important;
  border-color: #ffb74d !important;
  font-size: 12px !important;
  padding: 5px 12px !important;
  box-shadow: 0 2px 6px rgba(230, 81, 0, 0.4) !important;
}

.btn-menu-main:hover {
  background: linear-gradient(135deg, #f57c00, #d84315) !important;
  border-color: #ffe082 !important;
  transform: translateY(-1px);
}

.btn-icon-nav {
  padding: 4px 10px;
  font-size: 11px;
}

.nav-btn {
  background: #2a160c;
  color: #ffeb3b;
  border: 1.5px solid #e09f3e;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nav-btn:hover {
  background: #422817;
  border-color: #ffd54f;
  transform: translateY(-1px);
}

.nav-btn:active {
  transform: translateY(1px);
}

/* User Profile Badge */
.profile-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #8d6e63;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  color: #c8e6c9;
}

.profile-badge span {
  font-weight: bold;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-mini {
  background: #4caf50;
  color: #fff;
  border: 1px solid #2e7d32;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-mini:hover {
  background: #66bb6a;
}

/* Main Game Canvas Container */
#game-container {
  position: relative;
  width: 100%;
  height: 600px;
  max-height: calc(95vh - 54px);
  aspect-ratio: 900 / 600;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(76, 175, 80, 0.3);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  border: 3px solid #5d4037;
  border-top: none;
  background-color: #388e3c;
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: none;
}

/* Overlays & Modals */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 8px;
  box-sizing: border-box;
}

.overlay.hidden {
  display: none;
  opacity: 0;
}

.banner-card {
  background: linear-gradient(135deg, #422817 0%, #2a160c 100%);
  border: 4px solid #e09f3e;
  border-radius: 16px;
  padding: 20px 28px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
  max-width: 500px;
  max-height: 96%;
  overflow-y: auto;
  animation: popIn 0.3s ease-out;
  box-sizing: border-box;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.banner-card h1 {
  font-size: 32px;
  margin-bottom: 8px;
  color: #ffeb3b;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  letter-spacing: 1px;
}

.banner-card p {
  font-size: 15px;
  color: #e0e0e0;
  margin-bottom: 16px;
  line-height: 1.35;
}

/* Start Screen Specific Card (Spacious & Fits 600px Canvas) */
.start-card {
  max-width: 840px;
  width: 95%;
  max-height: 565px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.start-header h1 {
  font-size: 24px;
  margin: 0 0 3px 0;
  color: #ffeb3b;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  letter-spacing: 1px;
}

.start-header p {
  font-size: 12px;
  color: #e0e0e0;
  margin: 0 0 8px 0;
  line-height: 1.25;
}

.start-record-line {
  font-size: 13px;
  color: #ffeb3b;
  margin-bottom: 8px;
}

.start-hero-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.btn-hero {
  padding: 8px 22px;
  font-size: 15px;
}

.start-activities-grid {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.btn-act {
  padding: 5px 11px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.btn-act:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.btn-act:active {
  transform: translateY(1px);
}

.btn-bugreport {
  background: linear-gradient(to bottom, #0288d1, #01579b);
  color: #fff;
  border: 1.5px solid #4fc3f7;
}
.btn-bugreport:hover {
  background: linear-gradient(to bottom, #039be5, #0288d1);
}

.btn {
  background: linear-gradient(to bottom, #8bc34a, #4caf50);
  color: #fff;
  border: 2px solid #2e7d32;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #1b5e20, 0 8px 15px rgba(0,0,0,0.4);
  transition: transform 0.1s, box-shadow 0.1s;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
}

.btn:hover {
  background: linear-gradient(to bottom, #9ccc65, #66bb6a);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1b5e20, 0 3px 5px rgba(0,0,0,0.4);
}

.btn-secondary {
  background: linear-gradient(to bottom, #6d4c41, #4e342e);
  border-color: #3e2723;
  box-shadow: 0 4px 0 #27140b, 0 8px 15px rgba(0,0,0,0.4);
  color: #ffeb3b;
}

.btn-secondary:hover {
  background: linear-gradient(to bottom, #795548, #5d4037);
}

.btn-secondary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #27140b;
}

.footer-info {
  margin-top: 6px;
  font-size: 11px;
  color: #81c784;
  opacity: 0.85;
  letter-spacing: 0.5px;
}

/* Mode Selectors */
.mode-selector {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.mode-btn {
  background: #2a160c;
  color: #ffeb3b;
  border: 1.5px solid #8d6e63;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn:hover, .mode-btn.active {
  background: #422817;
  border-color: #ffeb3b;
  box-shadow: 0 0 10px rgba(255, 235, 59, 0.4);
}

.btn-shop {
  background: linear-gradient(to bottom, #ff9800, #f57c00);
  border-color: #e65100;
  box-shadow: 0 4px 0 #bf360c, 0 8px 15px rgba(0,0,0,0.4);
}

.btn-shop:hover {
  background: linear-gradient(to bottom, #ffa726, #fb8c00);
}

/* Shop Modal Styles */
.shop-card {
  max-width: 520px;
  width: 90%;
}

.shop-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.shop-item {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #8d6e63;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.shop-item-info h3 {
  font-size: 15px;
  color: #ffeb3b;
  margin-bottom: 4px;
}

.shop-item-info p {
  font-size: 12px;
  color: #ccc;
  margin-bottom: 0;
  line-height: 1.2;
}

.btn-buy {
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-buy:hover:not(:disabled) {
  background: #66bb6a;
}

.btn-buy:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
}

/* Auth Modal & Profile Dashboard Styles */
.auth-card {
  max-width: 440px;
  width: 92%;
}

.auth-view.hidden {
  display: none;
}

.profile-header-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px solid #81c784;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.profile-avatar-icon {
  font-size: 32px;
  background: rgba(255, 255, 255, 0.1);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #81c784;
}

.profile-info-text {
  text-align: left;
}

.profile-username {
  font-size: 18px;
  font-weight: bold;
  color: #ffeb3b;
}

.profile-status-badge {
  font-size: 11px;
  color: #a5d6a7;
  margin-top: 2px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.profile-stat-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #5d4037;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-stat-box .stat-label {
  font-size: 11px;
  color: #bcaaa4;
}

.profile-stat-box .stat-value {
  font-size: 15px;
  font-weight: bold;
  color: #fff;
  margin-top: 2px;
}

.btn-pause {
  background: #37474f;
  color: #eceff1;
  border-color: #78909c;
}
.btn-pause:hover {
  background: #455a64;
  border-color: #b0bec5;
}
.btn-pause.active {
  background: #d84315 !important;
  border-color: #ffab91 !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(255, 87, 34, 0.6) !important;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #8d6e63;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
  border-color: #ffeb3b;
  box-shadow: 0 0 8px rgba(255, 235, 59, 0.4);
}

.auth-error {
  font-size: 13px;
  color: #ff8a80;
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid #e57373;
  border-radius: 4px;
  padding: 6px 10px;
  text-align: left;
}

.auth-error.hidden {
  display: none;
}

.btn-auth-submit {
  background: linear-gradient(to bottom, #8bc34a, #4caf50);
}

.btn-danger {
  background: linear-gradient(to bottom, #e53935, #c62828);
  border: 1px solid #ff5252;
  color: #fff;
}

.btn-danger:hover {
  background: linear-gradient(to bottom, #f44336, #d32f2f);
}

.btn-logout-mini {
  background: rgba(211, 47, 47, 0.85);
  color: #fff;
  border: 1px solid #ef5350;
  margin-left: 4px;
}

.btn-logout-mini:hover {
  background: #f44336;
}

/* Workshop / Garden Lab Styles */
.btn-workshop {
  background: linear-gradient(to bottom, #00897b, #004d40);
  border: 2px solid #64ffda;
  color: #fff;
}

.btn-workshop:hover {
  background: linear-gradient(to bottom, #00bfa5, #00695c);
}

.workshop-card {
  max-width: 820px;
  width: 94%;
  max-height: 550px;
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  overflow: hidden;
  box-sizing: border-box;
}

.workshop-header {
  flex-shrink: 0;
  text-align: center;
}

.materials-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #00897b;
  border-radius: 8px;
  padding: 6px 14px;
  margin-bottom: 10px;
}

.mat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: bold;
  color: #e0f2f1;
}

.mat-item span:nth-child(2) {
  color: #a7ffeb;
}

.mat-item.mat-coins span:nth-child(2) {
  color: #ffd54f;
}

.workshop-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ws-tab {
  background: rgba(0, 0, 0, 0.35);
  color: #b0bec5;
  border: 2px solid #546e7a;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.ws-tab.active {
  background: #00897b;
  color: #fff;
  border-color: #64ffda;
  box-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.ws-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  min-height: 250px;
  max-height: 310px;
}

.ws-content.hidden {
  display: none;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
}

.upgrade-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #00897b;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.15s, border-color 0.15s;
}

.upgrade-card:hover {
  border-color: #64ffda;
  background: rgba(0, 0, 0, 0.55);
}

.upgrade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upgrade-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
}

.upgrade-level-badge {
  font-size: 11px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 10px;
  background: #37474f;
  color: #eceff1;
}

.upgrade-level-badge.maxed {
  background: linear-gradient(135deg, #ffd700, #ff8f00);
  color: #212121;
}

.upgrade-desc {
  font-size: 12px;
  color: #cfd8dc;
  line-height: 1.3;
}

.upgrade-stats-next {
  font-size: 11px;
  color: #80cbc4;
  background: rgba(0, 77, 64, 0.35);
  border-left: 3px solid #26a69a;
  padding: 4px 8px;
  border-radius: 0 4px 4px 0;
}

.upgrade-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.cost-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #e0f2f1;
}

.cost-badge {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 2px 6px;
}

.cost-badge.insufficient {
  color: #ff8a80;
  border: 1px solid rgba(244, 67, 54, 0.4);
}

.btn-upgrade-action {
  background: #00897b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-upgrade-action:hover:not(:disabled) {
  background: #26a69a;
}

.btn-upgrade-action:disabled {
  background: #455a64;
  color: #90a4ae;
  cursor: not-allowed;
}

/* Zen Garden Styles */
.btn-zengarden {
  background: linear-gradient(to bottom, #558b2f, #33691e);
  border: 2px solid #aed581;
  color: #fff;
}
.btn-zengarden:hover {
  background: linear-gradient(to bottom, #689f38, #558b2f);
}

.zengarden-card {
  max-width: 820px;
  width: 94%;
  max-height: 550px;
  display: flex;
  flex-direction: column;
  padding: 12px 18px;
  overflow: hidden;
  box-sizing: border-box;
}

.zen-tools-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.btn-zen-tool {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #7cb342;
  border-radius: 6px;
  color: #f1f8e9;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-zen-tool:hover {
  background: rgba(124, 179, 66, 0.3);
  border-color: #aed581;
}

.btn-zen-tool.active {
  background: #558b2f;
  border-color: #dcedc8;
  box-shadow: 0 0 8px rgba(174, 213, 129, 0.5);
}

.zen-canvas-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1b3b22;
  border: 2px solid #558b2f;
  border-radius: 8px;
  overflow: hidden;
}

#zenCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: pointer;
}

/* Almanac Styles */
.btn-almanac {
  background: linear-gradient(to bottom, #ef6c00, #e65100);
  border: 2px solid #ffb74d;
  color: #fff;
}
.btn-almanac:hover {
  background: linear-gradient(to bottom, #f57c00, #ef6c00);
}

.almanac-card {
  max-width: 820px;
  width: 94%;
  max-height: 550px;
  display: flex;
  flex-direction: column;
  padding: 12px 18px;
  overflow: hidden;
  box-sizing: border-box;
}

.almanac-header {
  text-align: center;
  margin-bottom: 8px;
}

.almanac-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
}

.almanac-tab {
  background: rgba(0, 0, 0, 0.4);
  color: #cfd8dc;
  border: 2px solid #78909c;
  border-radius: 6px;
  padding: 5px 18px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.almanac-tab.active {
  background: #ef6c00;
  color: #fff;
  border-color: #ffb74d;
  box-shadow: 0 0 10px rgba(255, 183, 77, 0.4);
}

.almanac-body {
  display: flex;
  gap: 12px;
  height: 380px;
  overflow: hidden;
}

.almanac-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  overflow-y: auto;
  padding-right: 6px;
}

.almanac-slot {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #546e7a;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.almanac-slot:hover {
  border-color: #ffb74d;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.almanac-slot.selected {
  border-color: #ffeb3b;
  background: rgba(255, 235, 59, 0.2);
  box-shadow: 0 0 8px rgba(255, 235, 59, 0.4);
}

.almanac-slot-icon {
  font-size: 26px;
  margin-bottom: 4px;
}

.almanac-slot-name {
  font-size: 10px;
  font-weight: bold;
  color: #eceff1;
  text-align: center;
  line-height: 1.1;
}

.almanac-detail-card {
  width: 320px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #8d6e63;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.almanac-detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.almanac-detail-icon {
  font-size: 34px;
}

.almanac-detail-name {
  font-size: 17px;
  font-weight: bold;
  color: #ffd54f;
}

.almanac-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #cfd8dc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 0;
}

.almanac-stat-row strong {
  color: #fff;
}

.almanac-desc-text {
  font-size: 12px;
  color: #e0e0e0;
  line-height: 1.3;
}

.almanac-lore-quote {
  font-size: 11px;
  font-style: italic;
  color: #a7ffeb;
  background: rgba(0, 77, 64, 0.3);
  border-left: 3px solid #00bfa5;
  padding: 6px 8px;
  border-radius: 0 4px 4px 0;
  line-height: 1.25;
}

/* Achievements & Roguelike Styles */
.btn-achievements {
  background: linear-gradient(to bottom, #fbc02d, #f57f17);
  border: 2px solid #fff59d;
  color: #212121;
}
.btn-achievements:hover {
  background: linear-gradient(to bottom, #fff176, #fbc02d);
}

.achievements-card {
  max-width: 820px;
  width: 94%;
  max-height: 550px;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  overflow: hidden;
  box-sizing: border-box;
}

.achievements-header {
  text-align: center;
  margin-bottom: 8px;
}

.achievements-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-right: 6px;
}

.ach-item {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #795548;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: border-color 0.15s, background 0.15s;
}

.ach-item.completed {
  border-color: #ffd54f;
  background: rgba(255, 213, 79, 0.1);
}

.ach-icon {
  font-size: 30px;
  flex-shrink: 0;
}

.ach-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ach-title {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
}

.ach-desc {
  font-size: 11px;
  color: #cfd8dc;
  line-height: 1.2;
}

.ach-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}

.ach-progress-bar {
  height: 100%;
  background: linear-gradient(to right, #4caf50, #8bc34a);
  border-radius: 3px;
  transition: width 0.3s;
}

.btn-claim-ach {
  background: #ffb300;
  color: #212121;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-claim-ach:hover {
  background: #ffd54f;
}

.btn-claim-ach:disabled {
  background: #424242;
  color: #9e9e9e;
  cursor: default;
}

/* Achievement Toast Notification */
.achievement-toast {
  position: fixed;
  top: 20px;
  right: -350px;
  width: 300px;
  background: linear-gradient(135deg, #37474f 0%, #212121 100%);
  border: 2px solid #ffd54f;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 12px rgba(255, 213, 79, 0.4);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  transition: right 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: none;
}

.achievement-toast.visible {
  right: 20px;
}

.ach-toast-icon {
  font-size: 32px;
}

.ach-toast-subtitle {
  font-size: 10px;
  font-weight: bold;
  color: #ffd54f;
  letter-spacing: 0.5px;
}

.ach-toast-title {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
}

/* Roguelike Draft Card Styles */
.draft-card {
  max-width: 780px;
  width: 92%;
  text-align: center;
  padding: 20px 24px;
}

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

.draft-option-card {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #00897b;
  border-radius: 10px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.draft-option-card:hover {
  transform: translateY(-4px);
  border-color: #64ffda;
  box-shadow: 0 6px 18px rgba(100, 255, 218, 0.35);
  background: rgba(0, 0, 0, 0.65);
}

.draft-option-icon {
  font-size: 44px;
}

.draft-option-title {
  font-size: 15px;
  font-weight: bold;
  color: #ffd54f;
}

.draft-option-desc {
  font-size: 12px;
  color: #cfd8dc;
  line-height: 1.3;
}

.draft-badge-type {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #80cbc4;
}

/* Tree of Wisdom & Cheats Styling */
.btn-tree {
  background: linear-gradient(to bottom, #43a047, #2e7d32);
  color: #fff;
}
.btn-tree:hover {
  background: linear-gradient(to bottom, #4caf50, #388e3c);
}

.btn-leaderboard {
  background: linear-gradient(to bottom, #f57f17, #e65100);
  color: #fff;
}
.btn-leaderboard:hover {
  background: linear-gradient(to bottom, #fbc02d, #f57f17);
}

.tree-card {
  max-width: 680px;
  width: 92%;
  padding: 18px 24px;
}

.tree-display-box {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #4caf50;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.tree-visual-wrapper {
  font-size: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  filter: drop-shadow(0 0 12px rgba(129, 199, 132, 0.6));
}

.tree-wisdom-bubble {
  flex: 1;
  text-align: left;
}

.tree-wisdom-title {
  font-size: 16px;
  font-weight: bold;
  color: #a5d6a7;
  margin-bottom: 4px;
}

.tree-wisdom-quote {
  font-size: 13px;
  color: #fff;
  line-height: 1.4;
  font-style: italic;
}

.tree-cheats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tree-cheat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #757575;
  border-radius: 6px;
  padding: 6px 12px;
}

.tree-cheat-name {
  font-size: 13px;
  font-weight: bold;
  color: #ffd54f;
}

.tree-cheat-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  font-weight: bold;
}

.tree-cheat-btn.active {
  background: #4caf50;
  color: #fff;
}

.tree-cheat-btn.inactive {
  background: #616161;
  color: #e0e0e0;
}

/* Leaderboards Styling */
.leaderboard-card {
  max-width: 720px;
  width: 92%;
  padding: 18px 24px;
}

.leaderboard-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lb-tab {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #b78103;
  color: #ffe082;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.lb-tab:hover {
  background: rgba(255, 213, 79, 0.2);
  border-color: #ffd54f;
}

.lb-tab.active {
  background: #f57f17;
  color: #fff;
  border-color: #fff59d;
}

.leaderboard-table-wrapper {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #795548;
  border-radius: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.lb-table th {
  background: rgba(62, 39, 35, 0.8);
  color: #ffd54f;
  padding: 8px 12px;
  font-weight: bold;
}

.lb-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
}

.lb-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.lb-rank-badge {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
}

.lb-rank-1 { color: #ffd700; font-size: 15px; }
.lb-rank-2 { color: #c0c0c0; font-size: 14px; }
.lb-rank-3 { color: #cd7f32; font-size: 14px; }

/* ==========================================================================
   VISUAL SKINS & THEMES ENGINE (v2.1)
   ========================================================================== */

/* 1. Cyberpunk Neon Theme */
body.theme-cyberpunk {
  background: radial-gradient(circle at center, #0f051d 0%, #030008 100%);
  color: #00e5ff;
}
body.theme-cyberpunk .top-nav-bar {
  background: linear-gradient(to bottom, #1f0b35, #0d001a);
  border-color: #00e5ff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.4), inset 0 0 10px rgba(233, 30, 99, 0.25);
}
body.theme-cyberpunk .nav-btn {
  background: #0e021c;
  border-color: #e91e63;
  color: #00e5ff;
  box-shadow: 0 0 8px rgba(233, 30, 99, 0.35);
  text-shadow: 0 0 4px rgba(0, 229, 255, 0.8);
}
body.theme-cyberpunk .nav-btn:hover {
  background: #1d0537;
  border-color: #00e5ff;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
}
body.theme-cyberpunk #gameCanvas {
  border: 3px solid #00e5ff;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.4), 0 0 40px rgba(233, 30, 99, 0.2);
}
body.theme-cyberpunk .banner-card {
  background: linear-gradient(135deg, #18092b, #090014);
  border-color: #00e5ff;
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.35);
}

/* 2. Retro 8-bit Arcade Theme */
body.theme-retro8bit {
  background: #050505;
  font-family: 'Courier New', Courier, monospace;
}
body.theme-retro8bit .top-nav-bar {
  background: #111;
  border: 3px solid #10b981;
  border-radius: 0;
  box-shadow: 0 4px 0 #047857;
}
body.theme-retro8bit .nav-btn {
  border-radius: 0;
  border: 2px solid #10b981;
  background: #000;
  color: #34d399;
  box-shadow: none;
}
body.theme-retro8bit .nav-btn:hover {
  background: #10b981;
  color: #000;
}
body.theme-retro8bit #gameCanvas {
  border: 4px solid #10b981;
  border-radius: 0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
body.theme-retro8bit .banner-card {
  border-radius: 0;
  border: 4px solid #10b981;
  background: #0a0a0a;
}

/* 3. Winter Frost Theme */
body.theme-winter {
  background: radial-gradient(circle at center, #1a237e 0%, #0d1326 100%);
  color: #e0f7fa;
}
body.theme-winter .top-nav-bar {
  background: linear-gradient(to bottom, #1e3c72, #2a5298);
  border-color: #80deea;
  box-shadow: 0 0 15px rgba(128, 222, 234, 0.35);
}
body.theme-winter .nav-btn {
  background: #152b52;
  border-color: #b2ebf2;
  color: #e0f7fa;
}
body.theme-winter .nav-btn:hover {
  background: #25467f;
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
body.theme-winter #gameCanvas {
  border: 3px solid #80deea;
  box-shadow: 0 0 25px rgba(128, 222, 234, 0.4);
}
body.theme-winter .banner-card {
  background: linear-gradient(135deg, #132442, #0b1528);
  border-color: #80deea;
  box-shadow: 0 0 25px rgba(128, 222, 234, 0.3);
}

/* Boss Rush Button Accent */
#btn-mode-bossrush.active {
  border-color: #ff1744 !important;
  background: linear-gradient(135deg, #d50000, #b71c1c) !important;
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.6) !important;
}

/* Campaign Level Select Modal & Cards */
.btn-campaign {
  background: linear-gradient(to bottom, #2e7d32, #1b5e20);
  border: 2px solid #81c784;
  color: #fff;
}
.btn-campaign:hover {
  background: linear-gradient(to bottom, #388e3c, #2e7d32);
  box-shadow: 0 0 10px rgba(129, 199, 132, 0.4);
}

.campaign-card {
  max-width: 860px;
  width: 95%;
  max-height: 560px;
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  overflow: hidden;
  box-sizing: border-box;
}

.campaign-header {
  flex-shrink: 0;
  text-align: center;
}

.campaign-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.campaign-tab {
  background: rgba(0, 0, 0, 0.4);
  color: #cfd8dc;
  border: 2px solid #37474f;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.campaign-tab:hover {
  border-color: #81c784;
  color: #fff;
}

.campaign-tab.active {
  background: #2e7d32;
  color: #fff;
  border-color: #81c784;
  box-shadow: 0 0 10px rgba(129, 199, 132, 0.4);
}

.campaign-levels-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 4px;
}

.campaign-level-card {
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid #388e3c;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.campaign-level-card:not(.locked):hover {
  transform: translateY(-2px);
  border-color: #81c784;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.campaign-level-card.current {
  border-color: #ffeb3b;
  box-shadow: 0 0 12px rgba(255, 235, 59, 0.35);
  background: rgba(46, 125, 50, 0.2);
}

.campaign-level-card.locked {
  opacity: 0.55;
  border-color: #455a64;
  background: rgba(0, 0, 0, 0.65);
}

.level-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.level-code {
  font-size: 16px;
  font-weight: bold;
  color: #ffeb3b;
}

.level-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
}

.level-badge.badge-done {
  background: #2e7d32;
  color: #a5d6a7;
  border: 1px solid #4caf50;
}

.level-badge.badge-current {
  background: #f57f17;
  color: #fffde7;
  border: 1px solid #fbc02d;
}

.level-badge.badge-unlocked {
  background: #1565c0;
  color: #bbdefb;
  border: 1px solid #42a5f5;
}

.level-badge.badge-locked {
  background: #37474f;
  color: #b0bec5;
  border: 1px solid #78909c;
}

.level-card-body {
  margin-bottom: 8px;
}

.level-title {
  font-size: 14px;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 4px;
}

.level-desc {
  font-size: 11px;
  color: #b0bec5;
  line-height: 1.35;
}

.level-card-info {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #ffd54f;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.btn-play-level {
  width: 100%;
  padding: 7px 0;
  font-size: 12px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #81c784;
  background: linear-gradient(to bottom, #43a047, #2e7d32);
  color: #fff;
  transition: all 0.2s;
}

.btn-play-level:not(.locked):hover {
  background: linear-gradient(to bottom, #4caf50, #388e3c);
  box-shadow: 0 0 8px rgba(129, 199, 132, 0.5);
}

.btn-play-level.locked {
  background: #37474f;
  color: #78909c;
  border-color: #546e7a;
  cursor: not-allowed;
}

/* Bug Reporting & Feedback Modal Styles */
.bugreport-card {
  max-width: 780px;
  width: 95%;
  max-height: 570px;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  overflow: hidden;
  box-sizing: border-box;
}

.bug-header {
  flex-shrink: 0;
  margin-bottom: 8px;
}

.bug-count-badge {
  background: #0277bd;
  color: #e1f5fe;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid #4fc3f7;
}

.bug-filter-tabs {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 6px;
}

.bug-tab {
  background: rgba(0, 0, 0, 0.4);
  color: #b0bec5;
  border: 1.5px solid #455a64;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.bug-tab:hover {
  border-color: #4fc3f7;
  color: #fff;
}

.bug-tab.active {
  background: #0288d1;
  border-color: #4fc3f7;
  color: #fff;
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.4);
}

.bugreport-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #37474f;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  max-height: 250px;
  min-height: 140px;
}

.bug-empty {
  text-align: center;
  color: #90a4ae;
  font-size: 13px;
  padding: 24px 0;
}

.bug-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #455a64;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.bug-card.is-fixed {
  border-color: #2e7d32;
  background: rgba(46, 125, 50, 0.12);
}

.bug-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.bug-author {
  color: #fff;
  font-size: 12px;
}

.bug-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}

.bug-category {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 10px;
}
.cat-bug { background: #b71c1c; color: #ffcdd2; }
.cat-feature { background: #e65100; color: #ffe0b2; }
.cat-visual { background: #4a148c; color: #e1bee7; }
.cat-balance { background: #004d40; color: #b2dfdb; }

.bug-status {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
}
.status-new { background: #c62828; color: #fff; }
.status-progress { background: #f57f17; color: #fffde7; }
.status-done { background: #2e7d32; color: #e8f5e9; }

.bug-time {
  color: #90a4ae;
  font-size: 10px;
}

.bug-text {
  font-size: 12px;
  color: #eceff1;
  line-height: 1.35;
  word-break: break-word;
}

.bug-reply {
  margin-top: 4px;
  padding: 6px 8px;
  background: rgba(2, 136, 209, 0.15);
  border-left: 3px solid #0288d1;
  border-radius: 0 4px 4px 0;
}
.reply-tag {
  font-size: 10px;
  font-weight: bold;
  color: #4fc3f7;
  display: block;
  margin-bottom: 2px;
}
.reply-text {
  font-size: 11px;
  color: #e1f5fe;
}

.bugreport-form {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bug-form-row {
  display: flex;
  gap: 8px;
}

.bug-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid #546e7a;
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  outline: none;
}
.bug-input:focus {
  border-color: #4fc3f7;
}

.bug-select {
  background: #263238;
  border: 1.5px solid #546e7a;
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.bug-textarea {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid #546e7a;
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  outline: none;
  resize: none;
  font-family: inherit;
}
.bug-textarea:focus {
  border-color: #4fc3f7;
}

.btn-bug-send {
  background: linear-gradient(to bottom, #0288d1, #01579b);
  color: #fff;
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  padding: 6px 16px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-bug-send:hover {
  background: linear-gradient(to bottom, #039be5, #0288d1);
  box-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
}

.bug-status-msg {
  font-size: 11px;
  padding: 4px;
  border-radius: 4px;
  text-align: center;
}
.bug-status-msg.success {
  background: rgba(46, 125, 50, 0.4);
  color: #a5d6a7;
  border: 1px solid #4caf50;
}
.bug-status-msg.error {
  background: rgba(183, 28, 28, 0.4);
  color: #ffcdd2;
  border: 1px solid #e53935;
}

/* ==========================================================================
   📱 Mobile Slide-out Drawer Menu & Backdrop
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  transition: opacity 0.25s ease;
  opacity: 1;
}

.drawer-backdrop.hidden {
  display: none;
  opacity: 0;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 290px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, #3e2723 0%, #1a0d05 100%);
  border-left: 3px solid #e09f3e;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.85);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}

.mobile-drawer.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.drawer-header {
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 2px solid #5d4037;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h2 {
  font-size: 16px;
  color: #ffeb3b;
  margin: 0;
}

.btn-drawer-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #8d6e63;
  color: #fff;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-drawer-close:hover {
  background: #d32f2f;
  border-color: #f44336;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-item {
  width: 100%;
  background: #2a160c;
  color: #ffeb3b;
  border: 1.5px solid #8d6e63;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-item:hover, .drawer-item:active {
  background: #422817;
  border-color: #ffd54f;
  transform: translateX(-2px);
}

.btn-drawer-bug {
  border-color: #0288d1;
  color: #e1f5fe;
  margin-top: 6px;
}
.btn-drawer-bug:hover {
  background: #0277bd;
}

/* ==========================================================================
   📱 Comprehensive Mobile & Tablet Responsive Rules (@media)
   ========================================================================== */

/* Tablets & Mobile Screens (<= 768px) */
@media screen and (max-width: 768px) {
  body {
    padding: 0;
    justify-content: flex-start;
  }

  #game-wrapper {
    width: 100%;
    max-width: 100vw;
  }

  .top-nav-bar {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 4px 6px;
    padding-top: max(4px, env(safe-area-inset-top));
  }

  /* Hide long list of top links; use drawer button instead */
  .desktop-nav-links {
    display: none !important;
  }

  .btn-drawer-toggle {
    display: inline-flex !important;
  }

  .nav-btn {
    font-size: 10px;
    padding: 4px 6px;
  }

  .profile-badge {
    padding: 2px 4px;
    font-size: 10px;
  }
  .profile-badge span {
    max-width: 70px;
  }

  #game-container {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    max-height: calc(100dvh - 42px);
    width: 100vw;
  }

  /* Fullscreen & Bottom-sheet style modals for mobile */
  .overlay {
    padding: 4px;
  }

  .banner-card {
    max-width: 96vw;
    width: 96vw;
    padding: 14px 12px;
    max-height: 94dvh;
  }

  .start-card h1 {
    font-size: 22px;
  }
  .start-card p {
    font-size: 11px;
    margin-bottom: 8px;
  }

  .mode-selector {
    gap: 4px;
    margin-bottom: 8px;
  }
  .mode-btn {
    font-size: 11px;
    padding: 6px 8px;
  }

  .start-hero-row {
    flex-direction: column;
    gap: 6px;
  }
  .btn-hero {
    font-size: 14px;
    padding: 10px 16px;
    width: 100%;
  }

  .start-activities-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .btn-act {
    font-size: 11px;
    padding: 8px 6px;
  }

  /* Modal Grids responsive */
  .shop-items {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .almanac-layout {
    flex-direction: column;
    max-height: 80vh;
  }
  .almanac-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .almanac-details {
    width: 100%;
  }

  .workshop-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  .workshop-tab {
    font-size: 11px;
    padding: 5px 8px;
    flex: 1;
    text-align: center;
  }

  .campaign-levels-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4px !important;
  }
}

/* Landscape Mode for Smartphones (< 540px height) */
@media screen and (orientation: landscape) and (max-height: 540px) {
  body {
    padding: 0;
  }

  .top-nav-bar {
    padding: 2px 6px;
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
  }

  .nav-btn {
    padding: 2px 5px;
    font-size: 9px;
  }

  #game-container {
    height: calc(100dvh - 30px);
    max-height: calc(100dvh - 30px);
  }

  .banner-card {
    max-height: 96dvh;
    padding: 10px 14px;
  }
}

