:root {
  --bg: #000;
  --bg-gradient: radial-gradient(circle at center, #001122 0%, #000 100%);
  --play-bg-image: url('../images/bg.gif');
  --topbar-height: 60px;
  --panel: rgba(0, 0, 0, 0.8);
  --panel-border: #444;
  --text: #fff;
  --text-light: #ccc;
  --text-dark: #aaa;
  --accent: #4169e1;
  --accent-light: #6495ed;
  --good: #0f0;
  --bad: #f00;
  --cookie-brown: #c99764;
  --cookie-dark: #8b6914;
  --header-bg: #222;
  --shop-bg: #111;
  --button-bg: #333;
  --button-hover: #555;
  --button-active: #777;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Merriweather', Georgia, serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
  overflow-y: hidden;
}

body {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.1) 0%, transparent 50%);
}

/* Classic Cookie Clicker Header */
.topbar {
  background: var(--header-bg);
  border-bottom: 4px solid var(--accent);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 8px rgba(65, 105, 225, 0.3);
  position: relative;
  z-index: 100;
}

.stats {
  display: flex;
  gap: 20px;
  align-items: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--button-bg);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 100px;
  box-shadow:
    inset 0 1px 0 rgba(65, 105, 225, 0.2),
    0 0 10px rgba(65, 105, 225, 0.3);
}

.stat.big-stat {
  min-width: 140px;
  background: linear-gradient(to bottom, #444, #333);
  border-color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--accent-light);
  text-transform: uppercase;
  font-weight: bold;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 5px rgba(65, 105, 225, 0.5);
}

.stat-value {
  font-size: 16px;
  font-weight: bold;
  color: var(--accent-light);
  text-shadow: 0 0 8px rgba(65, 105, 225, 0.6);
}

.big-stat .stat-value {
  font-size: 18px;
  color: var(--accent-light);
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Classic Cookie Clicker Buttons */
button {
  background: linear-gradient(to bottom, var(--button-hover), var(--button-bg));
  color: var(--text);
  border: 2px solid var(--panel-border);
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 2px 4px rgba(0,0,0,0.3);
  transition: all 0.1s ease;
}

button:hover {
  background: linear-gradient(to bottom, var(--button-active), var(--button-hover));
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 3px 6px rgba(0,0,0,0.4);
}

button:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.3),
    0 1px 2px rgba(0,0,0,0.2);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: var(--button-bg);
  border-color: #666;
}

#settingsBtn {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 6px;
}

button.prestige-btn {
  background: linear-gradient(to bottom, #6a5acd, #483d8b);
  border-color: #9370db;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 2px 6px rgba(106,90,205,0.3);
}

button.prestige-btn:hover {
  background: linear-gradient(to bottom, #7b68ee, #6a5acd);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 3px 8px rgba(106,90,205,0.5);
}

/* Accessible focus: only show a clear focus ring to keyboard users (focus-visible),
   but avoid the odd horizontal artifact for mouse/active states. */
button.prestige-btn:focus { outline: none; }
button.prestige-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
  box-shadow: 0 0 0 6px rgba(147,112,219,0.08);
}

/* Small badge showing required prestige tier on locked upgrades */
/* prestige badge removed */

/* Tooltip fallback styling (native title will be used; this is available for custom tooltips later) */
.tooltip {
  position: absolute;
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 2000;
  pointer-events: none;
}

/* Layout */
main {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 0;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

.play {
  /* Use CSS var so users can swap between bg.jpg / bg.gif without editing rules */
  background: var(--bg);
  background-image: var(--play-bg-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Game Area Styling */
.bakery-name {
  text-align: center;
  margin-bottom: 20px;
}

.bakery-name h1 {
  font-size: 32px;
  color: var(--text);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  font-weight: bold;
  margin-bottom: 8px;
}

.flavor-text {
  font-style: italic;
  color: var(--text-light);
  font-size: 14px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.cookie-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Classic Cookie Clicker Cookie */
.cookie-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cookie {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: url('../images/cookie.png') center/cover no-repeat;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  user-select: none;
}

.cookie:active {
  transform: scale(0.95);
  box-shadow: 0 0 20px rgba(65, 105, 225, 0.8);
}

.cookie-face {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 128px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.3));
}

.click-power {
  text-align: center;
  margin-top: 16px;
  color: #fff !important;
  font-size: 14px;
  font-weight: bold;
  text-shadow: none !important;
}

.click-power span,
.click-power strong {
  color: #fff !important;
}

/* Combo counter styling */
.combo-counter {
  text-align: center;
  margin-top: 12px;
  padding: 8px 16px;
  background: rgba(255, 215, 0, 0.1);
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  backdrop-filter: blur(5px);
}

.combo-text {
  color: #ffd700 !important;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.combo-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.combo-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd700, #ffed4e);
  border-radius: 3px;
  transition: width 0.2s ease;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Shop Sidebar */
.shop {
  background: var(--shop-bg);
  border-left: 4px solid var(--accent);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  box-shadow: -4px 0 15px rgba(65, 105, 225, 0.2);
  position: fixed;
  right: 0;
  top: var(--topbar-height);
  bottom: 0;
  width: 350px;
  z-index: 50;
}

.shop-tabs {
  display: flex;
  background: var(--header-bg);
  border-bottom: 2px solid var(--accent);
}

.tab-btn {
  flex: 1;
  padding: 20px 8px;
  background: var(--button-bg);
  border: none;
  border-right: 1px solid var(--accent);
  color: var(--accent-light);
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.1s ease;
  text-shadow: 0 0 5px rgba(65, 105, 225, 0.5);
  line-height: 1.2;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.tab-btn.active,
.tab-btn:hover {
  background: var(--button-hover);
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

.shop-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-content {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.shop-header {
  background: var(--header-bg);
  padding: 8px 12px;
  border-bottom: 1px solid var(--panel-border);
  text-align: center;
}

.achievements-counter {
  color: var(--text-light);
  font-size: 12px;
  font-weight: bold;
}

.section-title {
  color: var(--text);
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
}

.shop-list,
.upgrades-list {
  padding: 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

/* Classic Shop Items */
.shop-item {
  background: var(--button-bg);
  border: 2px solid var(--panel-border);
  border-radius: 0;
  margin-bottom: 1px;
  padding: 8px;
  display: flex; /* row layout so text can take available width */
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
}

.shop-item:hover {
  background: var(--button-hover);
  border-color: var(--accent);
}

.shop-item.locked {
  opacity: 0.5;
  background: #222;
  border-color: #555;
  cursor: not-allowed;
}

.shop-item.purchased {
  background: linear-gradient(to right, #2d5016, #3d6020);
  border-color: #4d7030;
}

.shop-item .meta {
  flex: 1; /* allow text to take full remaining space */
  min-width: 0;
  margin-right: 8px;
}

.shop-item .name {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 2px;
}

.shop-item .desc {
  font-size: 10px;
  color: var(--text-dark);
  margin-bottom: 1px;
  line-height: 1.2;
}

.shop-item .cost {
  font-size: 11px;
  font-weight: bold;
  color: var(--accent-light);
}

.shop-item .owned {
  font-size: 10px;
  color: var(--text-light);
}

.shop-item .actions {
  flex-shrink: 0;
  margin-left: 8px; /* space between text and buy button */
}

.shop-item .buy {
  padding: 4px 8px;
  font-size: 11px;
  min-width: 50px;
}

/* Classic Cookie Clicker Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.cookie:hover {
  filter: none !important;
  background: url('../images/cookie.png') center/cover no-repeat !important;
  box-shadow: 0 0 30px rgba(65, 105, 225, 0.4) !important;
}

.modal-content {
  background: var(--shop-bg);
  border: 4px solid var(--panel-border);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.modal-header {
  background: var(--header-bg);
  padding: 12px 16px;
  border-bottom: 2px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  font-weight: bold;
}

.close-btn {
  background: var(--button-bg);
  border: 2px solid var(--panel-border);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.close-btn:hover {
  background: var(--button-hover);
  border-color: var(--accent);
}

.modal-body {
  padding: 16px;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section h4 {
  margin: 0 0 12px 0;
  color: var(--text);
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text-light);
  font-size: 12px;
}

.setting-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-group button {
  flex: 1;
  min-width: 120px;
}

/* Coming soon message */
.coming-soon {
  text-align: center;
  color: var(--text-dark);
  font-style: italic;
  padding: 20px;
  font-size: 12px;
}

@keyframes cookiePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.cookie-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 60%, rgba(255, 215, 0, 0.2) 100%);
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.cookie-shine {
  position: absolute;
  top: 20%;
  left: 25%;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(2px);
}

.cookie:active {
  transform: translateY(-2px) scale(0.95);
  animation: none;
}
.cookie:focus {
  outline: 3px solid var(--accent);
  outline-offset: 8px;
}
.cookie-face {
  font-size: 120px;
  transform: translateY(-8px) rotate(-5deg);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  animation: cookieBounce 4s ease-in-out infinite;
}

@keyframes cookieBounce {
  0%, 100% { transform: translateY(-8px) rotate(-5deg); }
  50% { transform: translateY(-12px) rotate(-3deg); }
}

/* click-power glow removed; see earlier override for white text */
.click-power {
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff !important;
  text-shadow: none !important;
  text-align: center;
}

#floatLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.shop {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 0;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  height: 80vh;
  max-height: 600px;
}

.shop-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 20px 20px 0 0;
  overflow: hidden;
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.tab-btn.active {
  background: rgba(255, 215, 0, 0.1);
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.shop-content {
  flex: 1;
  overflow: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tab-content {
  display: none;
  height: 100%;
  flex: 1;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.achievements-counter {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.shop-list {
  overflow: auto;
  display: grid;
  gap: 0.75rem;
  padding-right: 8px;
  flex: 1;
  height: 100%;
}

.shop-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 1rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.shop-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 215, 0, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.shop-item.locked {
  opacity: 0.4;
  filter: grayscale(0.6);
  pointer-events: none;
}

.shop-item.purchased {
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.3);
}

.shop-item.purchased .cost {
  color: var(--good);
  font-weight: 700;
}

.shop-item .icon {
  font-size: 2.5rem;
  text-align: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Prestige requirement label for upgrades */
.prestige-req {
  margin-top: 6px;
  font-size: 11px;
  color: #ffd166; /* gold-ish */
  font-weight: 700;
}

.shop-item .meta {
  display: grid;
  gap: 0.5rem;
}

.shop-item .name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.shop-item .desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.shop-item .cost {
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}

.shop-item .owned {
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.8;
}

.shop-item .actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.shop-item button {
  white-space: nowrap;
  min-width: 80px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.shop-item button.buy {
  background: linear-gradient(135deg, #4caf50, #45a049);
  border-color: #4caf50;
  color: white;
}

.shop-item button.buy:hover {
  background: linear-gradient(135deg, #45a049, #3e8e41);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.shop-item button.buy:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  opacity: 0.5;
}

.upgrades-list {
  display: grid;
  gap: 0.75rem;
  overflow: auto;
  flex: 1;
  height: 100%;
  padding-right: 8px;
}

.coming-soon {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 2rem;
}

.footer { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; color: var(--muted); opacity: 0.9; }

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.modal.show { display: flex; align-items: center; justify-content: center; }
.modal-content {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--accent);
}
.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  padding: 0.6rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}
.modal-body { padding: 1.5rem; }
.settings-section { margin-bottom: 2rem; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section h4 {
  margin: 0 0 1rem 0;
  color: var(--accent);
  font-size: 1.2rem;
}
.setting-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 0.2s ease;
}
.setting-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.setting-item input[type="checkbox"] {
  accent-color: var(--accent);
  transform: scale(1.2);
}
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.modal-btn {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}
.modal-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.modal-btn.warn {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  border-color: #f44336;
  color: white;
}
.modal-btn.warn:hover {
  background: linear-gradient(135deg, #d32f2f, #c62828);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.stat-item .stat-label {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-item .stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

#exportText {
  width: 100%;
  height: 120px;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
}

/* Tooltips */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  max-width: 300px;
  white-space: normal;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  pointer-events: none;
  margin-top: 5px;
}

.tooltip:hover::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(0, 0, 0, 0.9);
  margin-top: -1px;
  z-index: 1001;
  pointer-events: none;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
  }
  .shop {
    order: 2;
    max-height: 500px;
  }
  .play {
    order: 1;
  }
  .cookie {
    width: 260px;
    height: 260px;
  }
  .cookie-face {
    font-size: 100px;
  }
  .bakery-name h1 {
    font-size: 2rem;
  }
  .stats {
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  .stat {
    min-width: 85px;
  }
  .stat.big-stat {
    min-width: 120px;
  }
  .topbar {
    padding: 0.5rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 215, 0, 0.5);
}

/* ==== Final overrides to ensure classic fixed sidebar and clean shop layout ==== */
.shop {
  position: fixed !important;
  right: 0 !important;
  top: var(--topbar-height) !important;
  bottom: 0 !important;
  width: 350px !important;
  height: auto !important; /* height governed by top/bottom */
  border-radius: 0 !important;
  background: var(--shop-bg) !important;
}
.shop-tabs {
  background: var(--header-bg) !important;
  border-bottom: 2px solid var(--accent) !important;
}
.tab-btn {
  padding: 20px 8px !important;
  min-height: 60px !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.shop-content { min-height: 0 !important; }
.tab-content { height: 100% !important; overflow: hidden !important; }
.tab-content.active { display: flex !important; flex-direction: column !important; min-height: 0 !important; }
.shop-list, .upgrades-list { display: flex !important; flex-direction: column !important; flex: 1 1 auto !important; overflow-y: auto !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; }
.shop-item { display: flex !important; align-items: center !important; gap: 8px !important; border-radius: 0 !important; padding: 8px !important; }
.shop-item .meta { flex: 1 1 auto !important; min-width: 0 !important; margin-right: 8px !important; }
.shop-item .actions { flex-shrink: 0 !important; margin-left: 8px !important; }

/* Cookie: remove shiny outline/glow but keep click effect */
.cookie,
.cookie:hover {
  box-shadow: none !important;
  filter: none !important;
  background: url('../images/cookie.png') center/cover no-repeat !important;
}
.cookie:active {
  transform: scale(0.95) !important;
  box-shadow: none !important;
}
.cookie:focus { outline: none !important; }
