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

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#fullscreen-btn {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 50;
  background: rgba(22, 33, 62, 0.85);
  color: #4ade80;
  border: 1px solid #4ade80;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  opacity: 0.6;
}

#fullscreen-btn:hover {
  opacity: 1;
  background: rgba(74, 222, 128, 0.25);
}

.hidden {
  display: none !important;
}

#game {
  width: 1113px;
  height: 626px;
  position: relative;
  transform: scale(var(--ui-scale, 1));
  transform-origin: center center;
  flex-shrink: 0;
}

/* All game screens fill the container */
.game-screen {
  width: 100%;
  height: 100%;
}

/* Main screen with background art */
#main-screen {
  position: relative;
}

/* Server screen */
#server-screen {
  position: relative;
}

#server-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}


/* Ambient idle glitch on normal server screen */
.server-bg-glitch-idle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('server upgrades/Server locations 4 blur.webp');
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
}

#server-bg-glitch-idle-1 {
  transform: translateX(3px);
  animation: glitch-idle-1 10s steps(1) infinite;
}

#server-bg-glitch-idle-2 {
  transform: translateX(-3px);
  animation: glitch-idle-2 12s steps(1) infinite;
}

/* Hide idle glitch during connection mode (connection mode has its own) */
#server-screen.connection-mode .server-bg-glitch-idle {
  animation: none;
  opacity: 0;
}

@keyframes glitch-idle-1 {
  0%, 93%    { opacity: 0; }
  93.5%      { opacity: 0.35; clip-path: inset(42% 0 48% 0); }
  94%        { opacity: 0.35; clip-path: inset(85% 0 2% 0); }
  94.5%      { opacity: 0.35; clip-path: inset(12% 0 78% 0); }
  95%        { opacity: 0; }
  95.5%      { opacity: 0.35; clip-path: inset(68% 0 16% 0); }
  96%        { opacity: 0.35; clip-path: inset(30% 0 52% 0); }
  96.5%      { opacity: 0; }
  97%        { opacity: 0.35; clip-path: inset(5% 0 63% 0); }
  97.5%      { opacity: 0.35; clip-path: inset(90% 0 5% 0); }
  98%, 100%  { opacity: 0; }
}

@keyframes glitch-idle-2 {
  0%, 90%     { opacity: 0; }
  90.5%       { opacity: 0.3; clip-path: inset(65% 0 20% 0); }
  91%         { opacity: 0.3; clip-path: inset(8% 0 80% 0); }
  91.5%       { opacity: 0; }
  92%         { opacity: 0.3; clip-path: inset(52% 0 33% 0); }
  92.5%       { opacity: 0.3; clip-path: inset(88% 0 3% 0); }
  93%         { opacity: 0; }
  93.5%       { opacity: 0.3; clip-path: inset(28% 0 58% 0); }
  94%         { opacity: 0.3; clip-path: inset(72% 0 12% 0); }
  94.5%, 100% { opacity: 0; }
}

/* Glitch layers for connection mode */
.server-bg-glitch {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('server upgrades/Server locations 4 blur.webp');
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
}

#server-screen.connection-mode #server-bg-glitch-1 {
  opacity: 0.7;
  transform: translateX(4px);
  animation: glitch-bg-1 2s steps(1) infinite;
}

#server-screen.connection-mode #server-bg-glitch-2 {
  opacity: 0.7;
  transform: translateX(-4px);
  animation: glitch-bg-2 2.5s steps(1) infinite reverse;
}

@keyframes glitch-bg-1 {
  0%   { clip-path: inset(42% 0 48% 0); }
  5%   { clip-path: inset(12% 0 78% 0); }
  10%  { clip-path: inset(85% 0 2% 0); }
  15%  { clip-path: inset(5% 0 63% 0); }
  20%  { clip-path: inset(68% 0 16% 0); }
  25%  { clip-path: inset(30% 0 52% 0); }
  30%  { clip-path: inset(92% 0 1% 0); }
  35%  { clip-path: inset(18% 0 70% 0); }
  40%  { clip-path: inset(55% 0 30% 0); }
  45%  { clip-path: inset(3% 0 82% 0); }
  50%  { clip-path: inset(75% 0 10% 0); }
  55%  { clip-path: inset(22% 0 60% 0); }
  60%  { clip-path: inset(48% 0 38% 0); }
  65%  { clip-path: inset(90% 0 5% 0); }
  70%  { clip-path: inset(8% 0 73% 0); }
  75%  { clip-path: inset(62% 0 22% 0); }
  80%  { clip-path: inset(35% 0 55% 0); }
  85%  { clip-path: inset(15% 0 68% 0); }
  90%  { clip-path: inset(78% 0 8% 0); }
  95%  { clip-path: inset(50% 0 40% 0); }
  100% { clip-path: inset(25% 0 58% 0); }
}

@keyframes glitch-bg-2 {
  0%   { clip-path: inset(65% 0 20% 0); }
  5%   { clip-path: inset(8% 0 80% 0); }
  10%  { clip-path: inset(38% 0 45% 0); }
  15%  { clip-path: inset(88% 0 3% 0); }
  20%  { clip-path: inset(15% 0 72% 0); }
  25%  { clip-path: inset(52% 0 33% 0); }
  30%  { clip-path: inset(72% 0 12% 0); }
  35%  { clip-path: inset(2% 0 85% 0); }
  40%  { clip-path: inset(45% 0 42% 0); }
  45%  { clip-path: inset(82% 0 8% 0); }
  50%  { clip-path: inset(20% 0 65% 0); }
  55%  { clip-path: inset(58% 0 28% 0); }
  60%  { clip-path: inset(95% 0 1% 0); }
  65%  { clip-path: inset(28% 0 58% 0); }
  70%  { clip-path: inset(70% 0 15% 0); }
  75%  { clip-path: inset(5% 0 78% 0); }
  80%  { clip-path: inset(42% 0 48% 0); }
  85%  { clip-path: inset(80% 0 5% 0); }
  90%  { clip-path: inset(32% 0 55% 0); }
  95%  { clip-path: inset(60% 0 25% 0); }
  100% { clip-path: inset(10% 0 75% 0); }
}

#server-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* z-3: never raise above side panels (z-10) — children would eat panel clicks. Use #hover-tooltip-layer (z-45) for above-panel elements */
  z-index: 3;
  pointer-events: none;
}

#server-content > * {
  pointer-events: auto;
}

/* Server node */
.server-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.server-node:hover {
  z-index: 500;
}

.server-output-popup {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: bold;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 6px currentColor, 0 1px 3px rgba(0, 0, 0, 0.9);
  animation: serverOutputFloat 1.2s ease-out forwards;
  z-index: 50;
}

@keyframes serverOutputFloat {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px);
  }
}

.server-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: rgba(42, 58, 94, 0.85);
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.3);
}

.server-btn::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(22, 33, 62, 0.95);
}

.server-btn-icon {
  position: relative;
  z-index: 1;
}
.icon-stack {
  position: relative;
  display: inline-block;
}
.icon-stack-top {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.55em;
  line-height: 1;
  z-index: 1;
}

.server-node[data-type="reformed_abyssnet"] .server-btn-icon {
  position: relative;
  top: -6px;
}

.server-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.server-btn:active {
  transform: scale(0.9);
}

.server-btn.critical {
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.4);
  animation: serverPulse 1s ease-in-out infinite;
}

@keyframes serverPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 24px rgba(248, 113, 113, 0.7); }
}

.server-overclock-badge {
  position: absolute;
  bottom: 8px;
  left: -6px;
  font-size: 12px;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(249, 115, 22, 0.7));
  z-index: 2;
}

.server-icepack-badge {
  position: absolute;
  bottom: 8px;
  right: -6px;
  font-size: 12px;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.7));
  z-index: 2;
}

.server-maintenance-bar {
  width: 56px;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
}

.server-maintenance-fill {
  height: 100%;
  width: 100%;
  background: #38bdf8;
  border-radius: 3px;
  transition: width 0.1s linear, background 0.3s;
}

/* Tooltip on hover */
.server-tooltip {
  display: none;
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(22, 33, 62, 0.95);
  border: 1px solid #4ade80;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  min-width: 200px;
  pointer-events: none;
  z-index: 300;
}

.server-node:hover .server-tooltip {
  display: block;
}

.server-tooltip-name {
  color: #4ade80;
  font-weight: bold;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.server-tooltip-lore {
  color: #aaa;
  font-size: 0.7rem;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.server-tooltip-status {
  color: #e0e0e0;
  font-size: 0.7rem;
}

.server-tooltip-output {
  color: #34d399;
  font-size: 0.7rem;
  margin-top: 0.2rem;
}

#bg-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#fg-art {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 20;
  pointer-events: none;
}

/* Moisturize button with built-in moisture bar */
#moisturize-btn {
  position: absolute;
  top: 70%;
  left: 34%;
  width: 12%;
  height: 14%;
  z-index: 30;
  background: rgba(186, 230, 253, 0.85);
  color: #ffffff;
  border: 2px solid #bae6fd;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.7rem;
  cursor: pointer;
  transition: transform 0.1s;
  text-align: center;
  overflow: hidden;
  padding: 0;
}

.moist-btn-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: rgba(74, 222, 128, 0.9);
  transition: height 0.1s linear, background 0.3s;
  pointer-events: none;
}

.moist-btn-label {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.nanolube-drop {
  position: absolute;
  bottom: 46%;
  right: 19.2%;
  width: 12px;
  text-align: center;
  font-size: 22px;
  line-height: 1;
  z-index: 11;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#squirt-origin {
  position: absolute;
  top: 25%;
  right: 21%;
  width: 0;
  height: 0;
  z-index: 50;
  pointer-events: none;
}

#bottle-nanolube {
  position: absolute;
  top: 50%;
  right: 18%;
  width: 12px;
  height: 27%;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
  border-radius: 2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 15, 30, 0.35);
}

.nanolube-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background: linear-gradient(180deg, #bae6fd 0%, #1d4ed8 100%);
  transition: height 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

#moisturize-btn.moisture-empty {
  animation: moisture-blink 0.333s steps(1) infinite;
}

@keyframes moisture-blink {
  0%, 50% { background: #facc15; border-color: #facc15; }
  50.01%, 100% { background: rgba(186, 230, 253, 0.85); border-color: #bae6fd; }
}

#moisturize-btn:hover {
  border-color: #4ade80;
}

#moisturize-btn:active:not(:disabled) {
  transform: scale(0.95);
}

#moisturize-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #4b5563;
}

#dev-cheat-btn,
#dev-phase-panel {
  display: none;
}

/* Nav arrows removed — unified single screen */

/* Screen titles for non-inbox screens */
.screen-title {
  color: #333;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.screen-placeholder {
  color: #666;
  font-size: 0.8rem;
  text-align: center;
  padding: 2rem 1rem;
}

/* Old #screen-content styles removed — inbox now in side panel */

#currency-badge {
  background: rgba(22, 33, 62, 0.9);
  border: 1px solid #2a3a5e;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.3rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
}

.currency-label {
  color: #facc15;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1px;
}

#currency-display {
  color: #facc15;
  font-weight: bold;
  font-size: 1rem;
  white-space: nowrap;
}

/* Hacker token badge (left of meters) */
#hacker-badge {
  background: rgba(22, 33, 62, 0.9);
  border: 1px solid #2a3a5e;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.3rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
}

.hacker-label {
  color: #dc2626;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1px;
  white-space: nowrap;
}

#hacker-display {
  color: #dc2626;
  font-weight: bold;
  font-size: 1rem;
  white-space: nowrap;
}

/* Twin competing meters + research meter */
#top-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 42;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 4px;
  padding: 0 233px 0 228px;
  pointer-events: none;
}

#top-hud > * {
  pointer-events: auto;
}

#objective-hint {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  font-family: 'Arial Black', 'Arial Bold', Arial, sans-serif;
  font-style: italic;
  font-size: 0.75rem;
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
  letter-spacing: 1px;
  white-space: nowrap;
  padding: 0.3rem 0.8rem;
  animation: objective-cycle 20s ease-in-out infinite;
  pointer-events: none;
}

#objective-hint.hidden {
  display: none;
}

@keyframes objective-cycle {
  0%        { opacity: 0; }
  2.5%      { opacity: 1; }
  5%, 20%   { opacity: 1; text-shadow: 0 0 12px rgba(250, 204, 21, 0.8); }
  10%, 15%  { opacity: 0.6; text-shadow: 0 0 6px rgba(250, 204, 21, 0.4); }
  22.5%     { opacity: 1; }
  25%       { opacity: 0; }
  25.1%, 100% { opacity: 0; }
}

#top-meters {
  position: relative;
  background: rgba(22, 33, 62, 0.9);
  border-radius: 0 0 8px 8px;
  border: 1px solid #2a3a5e;
  border-top: none;
  padding: 0.3rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

/* ========= TUG-OF-WAR METER ========= */
.tug-meter {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  position: relative;
}

.tug-endcap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: radial-gradient(circle at 35% 30%, #3a4a78 0%, #1a2440 60%, #0a0f1e 100%);
  border: 2px solid;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.7);
}

.tug-endcap-left {
  border-color: #4ade80;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(74, 222, 128, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.7);
}

.tug-endcap-right {
  border-color: #f87171;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -2px 3px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(248, 113, 113, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.7);
}

.tug-track {
  flex: 1;
  position: relative;
  height: 21px;
  margin: 0 -16px;
  z-index: 1;
  background: linear-gradient(180deg, #0a0f1e 0%, #111a33 50%, #0a0f1e 100%);
  border: 2px solid #1a2440;
  border-radius: 5px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.08);
}

.tug-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: width 0.3s ease;
  transform: skewX(-22deg);
}

.tug-fill-left {
  left: 0;
  width: 50%;
  transform-origin: bottom left;
  background:
    linear-gradient(
      180deg,
      #4ade80 0%,
      #4ade80 45%,
      #15803d 46%,
      #15803d 100%
    );
}

.tug-fill-left::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  height: 3px;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  box-shadow: 0 5px 0 -1px rgba(255, 255, 255, 0.45);
}

.tug-fill-right {
  right: 0;
  width: 50%;
  transform-origin: bottom left;
  background:
    linear-gradient(
      180deg,
      #f87171 0%,
      #f87171 45%,
      #991b1b 46%,
      #991b1b 100%
    );
}

.tug-fill-right::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  height: 3px;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  box-shadow: 0 5px 0 -1px rgba(255, 255, 255, 0.45);
}

.tug-value {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 5;
}

.tug-value-left {
  left: 22px;
  color: #ffffff;
}

.tug-value-right {
  right: 22px;
  color: #ffffff;
}

.tug-label {
  font-size: 0.45rem;
  opacity: 0.7;
  letter-spacing: 1px;
}

#timer-display {
  color: #38bdf8;
  font-weight: bold;
}

/* ========= 2000s CORPORATE EMAIL SKIN ========= */

.inbox-title {
  color: #003c74;
  font-family: Tahoma, Verdana, 'MS Sans Serif', sans-serif;
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 0.4rem;
  padding: 0.2rem 0.4rem;
  background: linear-gradient(180deg, #d6dfe8 0%, #b8c7d6 100%);
  border: 1px solid #8ca0b8;
  border-radius: 2px;
  letter-spacing: normal;
  text-transform: none;
}

#inbox {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px inset #b8c4d0;
  background: #fff;
  border-radius: 0;
}

/* Inbox list */
.email-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: none;
  border-bottom: 1px solid #d4dae0;
  border-radius: 0;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  animation: slideIn 0.2s ease-out;
  transition: background 0.1s;
  color: #000;
  font-family: Tahoma, Verdana, 'MS Sans Serif', sans-serif;
}

.email-row--blink {
  animation: slideIn 0.2s ease-out, email-blink 2s steps(1) infinite;
}
@keyframes email-blink {
  0%, 50% { background: #ffdd00; }
  50.1%, 100% { background: #fff; }
}

.email-row:last-child {
  border-bottom: none;
}

.email-row:hover {
  background: #dce8f5;
}

.hint-arrow-svg {
  width: 160px;
  height: 45px;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.6));
}

#email-open-hint {
  position: absolute;
  right: 215px;
  top: 30px;
  pointer-events: none;
  z-index: 44;
  animation: hint-bounce-right 0.8s ease-in-out infinite;
}

.tutorial-arrow--right {
  animation: hint-bounce-right 0.8s ease-in-out infinite;
}
.tutorial-arrow--left {
  animation: hint-bounce-left 0.8s ease-in-out infinite;
}

@keyframes hint-bounce-right {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(12px); }
}
@keyframes hint-bounce-left {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-12px); }
}

.email-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  filter: saturate(0.6);
}

.email-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #a78bfa;
  flex-shrink: 0;
  object-fit: cover;
}

.email-meta {
  min-width: 0;
  overflow: hidden;
}

.email-sender {
  font-size: 0.6rem;
  color: #666;
  margin-bottom: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-size: 0.72rem;
  color: #003399;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-empty {
  color: #888;
  text-align: center;
  padding: 1rem;
  font-family: Tahoma, Verdana, sans-serif;
  font-size: 0.75rem;
  font-style: italic;
}

/* Email modal popup */
#email-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.email-modal-window {
  position: relative;
  background: #ece9d8;
  border: 3px outset #d4d0c8;
  border-radius: 0;
  padding: 0;
  width: 420px;
  max-width: 90%;
  max-height: 500px;
  overflow: visible;
  animation: modalIn 0.15s ease-out;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.4);
  font-family: Tahoma, Verdana, 'MS Sans Serif', sans-serif;
  display: flex;
  flex-direction: column;
}

.email-modal-scroll {
  overflow-y: auto;
  max-height: 500px;
  display: flex;
  flex-direction: column;
}

.modal-avatar {
  position: absolute;
  top: -20px;
  left: -20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #a78bfa;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.5);
  object-fit: cover;
  z-index: 10;
  pointer-events: none;
}

body.drying-out .email-modal-window {
  animation: modalIn 0.15s ease-out, modalWobble var(--wobble-speed, 2.3s) ease-in-out 0.15s infinite;
}

@keyframes modalWobble {
  0%   { transform: rotate(0deg) translateX(0); }
  20%  { transform: rotate(calc(0.5deg * var(--wobble-scale, 1))) translateX(calc(2px * var(--wobble-scale, 1))); }
  40%  { transform: rotate(calc(-0.7deg * var(--wobble-scale, 1))) translateX(calc(-3px * var(--wobble-scale, 1))); }
  60%  { transform: rotate(calc(0.4deg * var(--wobble-scale, 1))) translateX(calc(1px * var(--wobble-scale, 1))); }
  80%  { transform: rotate(calc(-0.3deg * var(--wobble-scale, 1))) translateX(calc(-1px * var(--wobble-scale, 1))); }
  100% { transform: rotate(0deg) translateX(0); }
}

/* Window titlebar */
.modal-titlebar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem;
  background: linear-gradient(180deg, #0a246a 0%, #3a6ea5 40%, #0a246a 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: bold;
  user-select: none;
}

.modal-titlebar-icon {
  font-size: 0.8rem;
}

.modal-titlebar-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.modal-close-btn {
  background: linear-gradient(180deg, #c86464 0%, #a03030 100%);
  border: 1px outset #daa;
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  line-height: 1;
  padding: 0;
  position: static;
}

.modal-close-btn:hover {
  background: linear-gradient(180deg, #e07070 0%, #c04040 100%);
}

.modal-close-btn:active {
  border-style: inset;
}

/* Toolbar */
.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  background: #ece9d8;
  border-bottom: 1px solid #aca899;
  font-size: 0.62rem;
}

.toolbar-btn {
  color: #003399;
  cursor: default;
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
}

.toolbar-btn:hover {
  background: #c8d8ec;
}

.toolbar-sep {
  color: #aca899;
  font-size: 0.7rem;
}

/* Email fields (From/To/Subject) */
.email-fields {
  padding: 0.4rem 0.6rem;
  background: #fff;
  border-bottom: 1px solid #aca899;
  font-size: 0.65rem;
  color: #333;
  line-height: 1.6;
}

.email-field-label {
  font-weight: bold;
  color: #003c74;
}

.email-body {
  background: #fff;
  border: none;
  border-radius: 0;
  padding: 0.8rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.55;
  margin: 0;
  color: #222;
  font-family: Tahoma, Verdana, 'MS Sans Serif', sans-serif;
  white-space: pre-line;
}

.email-body-image {
  display: block;
  max-width: 55%;
  margin: 0.6rem auto 0.2rem;
  border: 1px solid #888;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25);
}

.email-choices {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.6rem;
  background: #ece9d8;
  border-top: 1px solid #aca899;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.reply-btn {
  background: linear-gradient(180deg, #f0efe3 0%, #d4d0c8 100%);
  color: #003399;
  border: 2px outset #d4d0c8;
  padding: 0.55rem 0.9rem;
  border-radius: 0;
  font-family: Tahoma, Verdana, 'MS Sans Serif', sans-serif;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
}

.reply-btn:hover {
  background: linear-gradient(180deg, #e8eaf0 0%, #c8d4e4 100%);
  color: #0055cc;
}

.reply-btn:active {
  border-style: inset;
  background: #c8c4b8;
}

.reply-btn:disabled {
  color: #888;
  background: #d4d0c8;
  cursor: not-allowed;
  opacity: 0.75;
}

.reply-btn-cost {
  float: right;
  color: #facc15;
  background: #1a1a1a;
  padding: 0.05rem 0.4rem;
  border-radius: 2px;
  font-size: 0.62rem;
  margin-left: 0.5rem;
  text-shadow: 0 0 3px #000;
}

.reply-btn:disabled .reply-btn-cost {
  color: #888;
  background: #333;
}

/* Wavy wobble when moisture is critically low — applies to all UI windows */
@keyframes wavy {
  0%   { transform: skewX(0deg) skewY(0deg); }
  25%  { transform: skewX(calc(1.2deg * var(--wobble-scale, 1))) skewY(calc(-0.6deg * var(--wobble-scale, 1))); }
  50%  { transform: skewX(calc(-0.9deg * var(--wobble-scale, 1))) skewY(calc(0.9deg * var(--wobble-scale, 1))); }
  75%  { transform: skewX(calc(0.6deg * var(--wobble-scale, 1))) skewY(calc(-0.3deg * var(--wobble-scale, 1))); }
  100% { transform: skewX(0deg) skewY(0deg); }
}

body.drying-out #token-market,
body.drying-out #bufo-wallet,
body.drying-out #side-panels,
body.drying-out .build-panel,
body.drying-out .server-status-bar,
body.drying-out #frog-panel {
  animation: wavy var(--wobble-speed, 3s) ease-in-out infinite;
}

/* Server status bar */
/* ===== Anthropolypse news ticker ===== */

#news-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 38px;     /* clears the status bar (content-sized, ~38px tall) */
  height: 57px;     /* 1.5× status bar height */
  z-index: 13;      /* below status bar (14) so it never covers the lights */
  background: #ff0000;
  border-top: 1px solid #7a1010;
  border-bottom: 1px solid #7a1010;
  pointer-events: none;
}

/* Two stacked tracks inside the banner. Each clip-path fixes one horizontal
   strip of the banner in banner-space; headlines scroll through the fixed clip
   so the garbled text only ever shows in the rightmost 180 px, and the english
   text only ever shows in the left 933 px. */
.news-track {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
#news-track-english { clip-path: inset(0 180px 0 0); }
#news-track-garbled { clip-path: inset(0 0 0 calc(100% - 180px)); }

#news-scoring-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 180px;
  width: 2px;
  background: #f87171;
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.8);
  z-index: 2;
}

/* Translation marker — mirrors the scoring marker. Headlines are garbled to
   the right of this line, readable English to the left. Yellow to distinguish
   it from the red scoring marker. */
#news-translation-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 180px;
  width: 2px;
  background: #facc15;
  box-shadow: 0 0 6px rgba(250, 204, 21, 0.8);
  z-index: 2;
}

.news-headline {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  white-space: nowrap;
  color: #00ff00;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-shadow: 2px -2px 0 #ffffff;
  will-change: transform;
  pointer-events: none;
}

@keyframes newsScoreFloat {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -40px); }
}

.news-score-popup {
  position: absolute;
  top: -10px;
  color: #f87171;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  font-size: 18px;
  text-shadow: 0 0 6px rgba(248, 113, 113, 0.9);
  pointer-events: none;
  z-index: 15;
  white-space: nowrap;
  animation: newsScoreFloat 1.2s ease-out forwards;
}

.server-status-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 14;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 0.2rem 1rem;
  background: rgba(10, 15, 30, 0.85);
  border-top: 1px solid #2a3a5e;
}

.status-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.status-label {
  color: #5a6a8e;
  font-size: 0.5rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.status-value {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.8rem;
}

.multiplier-value {
  color: #a78bfa;
}

.multiplier-value.pest-penalized {
  color: #f87171;
  text-shadow: 0 0 6px rgba(248, 113, 113, 0.5);
}

.rps-value {
  color: #34d399;
}

.rps-row {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.server-lights-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.server-light {
  width: 18px;
  height: 7px;
  border-radius: 2px;
  border: 1px solid #2a3a5e;
  transition: background 0.3s, box-shadow 0.3s;
}

.server-light.on {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.server-light.off {
  background: #1a2440;
  box-shadow: none;
}

#maintain-all-btn {
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid #2a3a5e;
  background-color: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
  color: #0a0f1e;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

#maintain-all-btn:hover {
  background-color: #fde047;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.8);
}

#maintain-all-btn:active {
  background-color: #eab308;
}

/* Build panel */
/* Server shop (build panel) — bottom-left */
.build-panel {
  position: absolute;
  top: 309px;
  bottom: 97px;
  left: 10px;
  z-index: 15;
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  padding: 0.4rem;
  width: 215px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.build-panel-header {
  color: #4ade80;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
  font-size: 0.6rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid #2a3a5e;
  margin-bottom: 0.3rem;
}

.build-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.build-options-list::-webkit-scrollbar {
  width: 4px;
}

.build-options-list::-webkit-scrollbar-thumb {
  background: #5a6a8e;
  border-radius: 2px;
}

.build-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(42, 58, 94, 0.6);
  border: 1px solid #2a3a5e;
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  transition: border-color 0.15s;
}

.build-option:hover {
  border-color: #4ade80;
}

.build-option-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.build-option-name {
  color: #e0e0e0;
  font-weight: bold;
  font-size: 0.55rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.build-buy-btn {
  flex-shrink: 0;
  background: rgba(250, 204, 21, 0.9);
  color: #1a1a2e;
  border: 1px solid #eab308;
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.55rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.build-buy-btn:hover:not(:disabled) {
  background: #eab308;
}

.build-buy-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.build-buy-btn:disabled {
  background: rgba(100, 100, 100, 0.5);
  color: #888;
  border-color: #555;
  cursor: not-allowed;
}

/* Old tech tree styles removed — now uses tech shop in side panels */

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Effect popups — float up and fade after email choices */
.effect-popup {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, 0);
  font-family: Tahoma, Verdana, 'MS Sans Serif', sans-serif;
  font-size: 1.2rem;
  font-weight: bold;
  pointer-events: none;
  z-index: 200;
  text-shadow: 0 0 6px currentColor, 0 1px 3px rgba(0, 0, 0, 0.8);
  opacity: 0;
  animation: effectFloat 1.4s ease-out forwards;
}

@keyframes effectFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.8);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -10px) scale(1.1);
  }
  30% {
    transform: translate(-50%, -18px) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60px);
  }
}

/* ========= TOKEN MARKET ========= */

#token-market {
  position: absolute;
  top: 1px;
  left: 10px;
  z-index: 10;
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  min-width: 215px;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
}

.market-header {
  color: #dc2626;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

#market-graph {
  background: rgba(15, 23, 41, 0.8);
  border: 1px solid #1e2d4d;
  border-radius: 4px;
  display: block;
}

.market-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.market-price-label {
  color: #5a6a8e;
  font-size: 0.6rem;
  font-weight: bold;
}

#market-price {
  color: #dc2626;
  font-size: 0.88rem;
  font-weight: bold;
}

.market-currency {
  color: #facc15;
  font-size: 0.75rem;
  font-weight: bold;
}

#market-buy-btn {
  width: 100%;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #dc2626;
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

#market-buy-btn:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.3);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.4);
}

#market-buy-btn:active:not(:disabled) {
  transform: scale(0.97);
}

#market-buy-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========= BUFO WALLET ========= */

#bufo-wallet {
  position: absolute;
  top: 138px;
  left: 10px;
  z-index: 10;
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  min-width: 215px;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
}

#bufo-wallet.hidden {
  display: none;
}

.bufo-header {
  color: #38bdf8 !important;
}

.bufo-balance-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.bufo-balance-label {
  color: #5a6a8e;
  font-size: 0.6rem;
  font-weight: bold;
}

#bufo-balance {
  color: #38bdf8;
  font-size: 0.88rem;
  font-weight: bold;
}

.bufo-coin {
  color: #38bdf8;
  font-size: 0.65rem;
  font-weight: bold;
  opacity: 0.7;
}

#bufo-graph {
  background: rgba(15, 23, 41, 0.8);
  border: 1px solid #1e2d4d;
  border-radius: 4px;
  display: block;
}

#bufo-price {
  color: #38bdf8;
  font-size: 0.88rem;
  font-weight: bold;
}

.bufo-btn-row {
  display: flex;
  gap: 0.3rem;
  width: 100%;
}

#bufo-buy-btn,
#bufo-sell-btn {
  flex: 1;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  border: 1px solid #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

#bufo-buy-btn:hover:not(:disabled),
#bufo-sell-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

#bufo-buy-btn:active:not(:disabled),
#bufo-sell-btn:active:not(:disabled) {
  transform: scale(0.97);
}

#bufo-buy-btn:disabled,
#bufo-sell-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========= PEST SYSTEM ========= */

.pest-icon {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  z-index: 8;
  cursor: pointer;
  animation: pestBob 2s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(248, 113, 113, 0.6));
  transition: filter 0.15s;
}

.pest-icon:hover {
  filter: drop-shadow(0 0 12px rgba(248, 113, 113, 0.9));
  transform: translate(-50%, -50%) scale(1.15);
}

.pest-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pest-icon--mega {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.9));
  animation: pestBob 1.6s ease-in-out infinite;
  z-index: 9;
}

.pest-icon--mega:hover {
  filter: drop-shadow(0 0 16px rgba(220, 38, 38, 1));
}

.pest-hp-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 12px;
  color: #ffffff;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.9),
    0 1px 2px rgba(0, 0, 0, 1),
    -1px 0 2px rgba(0, 0, 0, 1),
    1px 0 2px rgba(0, 0, 0, 1);
  pointer-events: none;
  z-index: 2;
}

.pest-hp-label--buffed {
  color: #fecaca;
  text-shadow:
    0 0 4px rgba(220, 38, 38, 0.9),
    0 0 8px rgba(220, 38, 38, 0.7),
    0 1px 2px rgba(0, 0, 0, 1);
}

.drone-icon {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 22px;
  pointer-events: none;
  z-index: 7;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.8));
  user-select: none;
}

.pest-hp-label--mega {
  font-size: 18px;
  color: #fef2f2;
  text-shadow:
    0 0 5px rgba(220, 38, 38, 1),
    0 0 10px rgba(220, 38, 38, 0.8),
    0 2px 3px rgba(0, 0, 0, 1);
}

.shrimp-particle {
  position: fixed;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
  z-index: 100000;
  user-select: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 4px rgba(248, 113, 113, 0.85));
}

.water-drop-particle {
  position: absolute;
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  z-index: 7;
  user-select: none;
  will-change: transform;
  filter: drop-shadow(0 0 4px rgba(186, 230, 253, 0.8));
}

.pest-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #f87171;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.7);
  pointer-events: none;
}

@keyframes pestBob {
  0%, 100% { margin-top: -20px; }
  50% { margin-top: -14px; }
}

/* Pest battle popup */
#pest-battle {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pest-battle.hidden {
  display: none;
}

.pest-battle-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
}

.pest-battle-window {
  position: relative;
  width: 360px;
  background: #0a0e1a;
  border: 2px solid #1e3a2a;
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.15), inset 0 0 60px rgba(0, 0, 0, 0.5);
  font-family: 'Courier New', monospace;
  overflow: hidden;
}

/* ========= FEATURE POPUP ========= */

/* --- Attachment mode — server selection on map --- */
#server-screen.attachment-mode::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2;
  pointer-events: none;
}
.attachment-mode .server-btn.attachable {
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.5) !important;
  animation: attachPulse 1.5s ease-in-out infinite !important;
  cursor: pointer;
}
.attachment-mode .server-btn.attachable-disabled {
  box-shadow: none !important;
  animation: none !important;
  opacity: 0.35;
  cursor: not-allowed;
}
@keyframes attachPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(249, 115, 22, 0.3); }
  50% { box-shadow: 0 0 20px rgba(249, 115, 22, 0.7); }
}
#attachment-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 2px;
  color: #f97316;
  text-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
  background: rgba(15, 23, 41, 0.85);
  border: 1px solid #f97316;
  border-radius: 6px;
  padding: 6px 16px;
  z-index: 20;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
   Tech Shop Unlock Popup
   ═══════════════════════════════════════════════════════════════════ */

#tech-unlock-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 105;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tech-unlock-popup.hidden {
  display: none;
}

.tech-unlock-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}

.tech-unlock-window {
  position: relative;
  width: 300px;
  padding: 1.2rem 1.4rem 1rem;
  background: linear-gradient(180deg, #1a0f33 0%, #0d0820 100%);
  border: 2px solid #a78bfa;
  border-radius: 6px;
  box-shadow:
    0 0 40px rgba(167, 139, 250, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: 'Courier New', monospace;
  color: #e0e0e0;
  text-align: center;
  transform: scale(0.9);
  opacity: 0;
  animation: tech-unlock-in 0.3s ease-out forwards;
}

@keyframes tech-unlock-in {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.tech-unlock-title {
  color: #a78bfa;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 3px;
  margin-bottom: 0.6rem;
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
}

.tech-unlock-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.6));
}

.tech-unlock-body {
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1.5;
  margin-bottom: 0.8rem;
}

.tech-unlock-hint {
  font-size: 0.55rem;
  color: #6b5fa0;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  animation: headline-hint-fade 0.5s ease 1s forwards;
}

#feature-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#feature-popup.hidden {
  display: none;
}

.feature-popup-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(2px);
}

.feature-popup-window {
  position: relative;
  width: 380px;
  padding: 1.4rem 1.6rem 1.2rem;
  background: linear-gradient(180deg, #0f1a33 0%, #080f1f 100%);
  border: 2px solid #4ade80;
  border-radius: 6px;
  box-shadow:
    0 0 40px rgba(74, 222, 128, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: 'Courier New', monospace;
  color: #e0e0e0;
  text-align: center;
}

.feature-popup-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.6));
}

.feature-popup-title {
  color: #4ade80;
  font-size: 0.95rem;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 0.8rem;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.feature-popup-body {
  color: #cbd5e1;
  font-size: 0.75rem;
  line-height: 1.5;
  margin-bottom: 1.1rem;
}

.feature-popup-ok-btn {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  border: 1px solid #4ade80;
  border-radius: 4px;
  padding: 0.5rem 1.8rem;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.feature-popup-ok-btn:hover {
  background: rgba(74, 222, 128, 0.4);
}

.feature-popup-ok-btn:active {
  transform: scale(0.97);
}

.pest-battle-header {
  background: #0d1a0d;
  border-bottom: 1px solid #1e3a2a;
  padding: 0.5rem 0.8rem;
  position: relative;
}

.pest-battle-title {
  color: #00ff41;
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

.pest-battle-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
}

.pest-battle-body {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  align-items: center;
}

.pest-battle-pest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.pest-battle-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.6));
  animation: pestPulse 1.5s ease-in-out infinite;
}

@keyframes pestPulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.6)); }
  50% { filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.9)); }
}

.pest-battle-strength {
  text-align: center;
}

.pest-str-label {
  color: #dc2626;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1px;
  display: block;
}

#pest-str-value {
  color: #dc2626;
  font-size: 1.4rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(220, 38, 38, 0.7);
}

.pest-battle-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.pest-battle-prompt {
  color: #00ff41;
  font-size: 0.6rem;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.4);
}

.pest-slider-area {
  display: flex;
  gap: 0.4rem;
  height: 180px;
  align-items: stretch;
}

.pest-slider-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #3a5a3a;
  font-size: 0.6rem;
  font-weight: bold;
  padding: 2px 0;
}

.pest-slider-track {
  width: 36px;
  background: #0d1a0d;
  border: 1px solid #1e3a2a;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  touch-action: none;
}

.pest-slider-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(to top, #00ff41, #38bdf8);
  opacity: 0.6;
  border-radius: 0 0 3px 3px;
  transition: height 0.05s;
}

.pest-slider-thumb {
  position: absolute;
  bottom: 0%;
  left: 50%;
  transform: translate(-50%, 50%);
  width: 32px;
  height: 8px;
  background: #00ff41;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
  transition: bottom 0.05s;
  pointer-events: none;
}

.pest-commit-display {
  text-align: center;
}

.pest-commit-label {
  color: #00ff41;
  font-size: 0.6rem;
  font-weight: bold;
}

#pest-commit-value {
  color: #dc2626;
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0 0.3rem;
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

.pest-commit-avail {
  color: #3a5a3a;
  font-size: 0.55rem;
}

/* Battle result */
#pest-battle-result {
  padding: 0.8rem;
  text-align: center;
  border-top: 1px solid #1e3a2a;
  background: #0d1a0d;
}

#pest-battle-result.hidden {
  display: none;
}

.battle-win {
  color: #00ff41;
  font-size: 0.85rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.6);
}

.battle-lose {
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(220, 38, 38, 0.6);
}

.battle-detail {
  color: #5a6a5a;
  font-size: 0.6rem;
}

/* ========= SERVER CONNECTION SYSTEM ========= */

/* Connection lines SVG overlay */
.connection-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.connection-dotted {
  stroke: #a78bfa;
  stroke-width: 2;
  stroke-dasharray: 8 6;
  opacity: 0.4;
}

.connection-building {
  stroke: #c084fc;
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(192, 132, 252, 0.5));
}

.connection-complete {
  stroke: #a78bfa;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8 6;
  animation: connectionFlow 2s linear infinite;
}

@keyframes connectionFlow {
  to { stroke-dashoffset: -14; }
}

/* Connect button in status bar */
.connect-btn {
  padding: 4px 10px;
  border-radius: 2px;
  border: 1px solid #a78bfa;
  background-color: #a78bfa;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
  color: #0a0f1e;
  font-family: 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.connect-btn:hover {
  background-color: #c084fc;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.8);
}

.connect-btn.active {
  background-color: #f87171;
  border-color: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

.connect-btn.active:hover {
  background-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
}

.connect-btn.building,
.connect-btn:disabled {
  background-color: #374151;
  border-color: #4b5563;
  color: #6b7280;
  cursor: not-allowed;
  box-shadow: none;
}

.connect-btn.building:hover,
.connect-btn:disabled:hover {
  background-color: #374151;
  box-shadow: none;
}

#server-screen.connection-mode::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2;
  pointer-events: none;
}

/* Connection mode — server selection */
.connection-mode .server-btn.connectable {
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.5) !important;
  animation: connectPulse 1.5s ease-in-out infinite !important;
}

.connection-mode .server-btn.connection-selected {
  box-shadow: 0 0 24px rgba(192, 132, 252, 0.9) !important;
  animation: none !important;
  outline: 3px solid #c084fc;
  outline-offset: 3px;
}

@keyframes connectPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(167, 139, 250, 0.3); }
  50% { box-shadow: 0 0 24px rgba(167, 139, 250, 0.7); }
}

/* ========= UNIFIED SCREEN: SIDE PANELS ========= */

.game-panel {
  background: rgba(10, 15, 30, 0.9);
  border: 1px solid #2a3a5e;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
}

.panel-header {
  color: #4ade80;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
  font-size: 0.6rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #2a3a5e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgrades-clear-btn {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
  border: 1px solid #dc2626;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-family: 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.upgrades-clear-btn:hover {
  background: rgba(248, 113, 113, 0.4);
}

.upgrades-clear-btn:active {
  transform: scale(0.95);
}

#side-panels {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 97px;
  width: 215px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

/* Inbox panel (inside side-panels) */
#inbox-panel {
  flex: 0 0 auto;
  max-height: 45%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes inboxShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10%  { transform: translate(-3px, -1px) rotate(-0.8deg); }
  20%  { transform: translate(3px, 1px) rotate(0.8deg); }
  30%  { transform: translate(-3px, 1px) rotate(-0.6deg); }
  40%  { transform: translate(3px, -1px) rotate(0.6deg); }
  50%  { transform: translate(-2px, 0) rotate(-0.4deg); }
  60%  { transform: translate(2px, 1px) rotate(0.4deg); }
  70%  { transform: translate(-2px, -1px) rotate(-0.3deg); }
  80%  { transform: translate(1px, 0) rotate(0.2deg); }
  90%  { transform: translate(-1px, 0) rotate(-0.1deg); }
}

#inbox-panel.inbox-shake {
  animation: inboxShake 1s ease-in-out;
}

#inbox-panel #inbox {
  flex: 1;
  overflow: hidden auto;
  border: none;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.95);
  clip-path: inset(0 0 0 0 round 0 0 8px 8px);
}

#inbox-panel .email-row {
  padding: 0.25rem 0.4rem;
  gap: 0.35rem;
}

#inbox-panel .email-avatar {
  width: 22px;
  height: 22px;
}

#inbox-panel .email-sender {
  font-size: 0.5rem;
}

#inbox-panel .email-subject {
  font-size: 0.6rem;
}

#inbox-panel .inbox-empty {
  font-size: 0.6rem;
  padding: 0.6rem;
}

/* Scrollbar for inbox panel */
#inbox-panel #inbox::-webkit-scrollbar {
  width: 4px;
}

#inbox-panel #inbox::-webkit-scrollbar-track {
  background: transparent;
}

#inbox-panel #inbox::-webkit-scrollbar-thumb {
  background: #aaa;
  border-radius: 2px;
}

/* Tech shop panel (inside side-panels) */
#thinktank-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.4rem;
}

#thinktank-body {
  padding: 0.4rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#thinktank-progress-bar {
  position: relative;
  height: 14px;
  border: 1px solid #a78bfa;
  border-radius: 3px;
  background: rgba(22, 33, 62, 0.8);
  overflow: hidden;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.4);
}

#thinktank-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c084fc, #a78bfa);
  box-shadow: 0 0 6px rgba(192, 132, 252, 0.7);
  transition: width 100ms linear;
}

#thinktank-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  font-size: 10px;
  color: #ffffff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.5px;
  pointer-events: none;
}

#thinktank-activate-btn {
  font-family: 'Courier New', monospace;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #a78bfa;
  border-radius: 3px;
  background: rgba(167, 139, 250, 0.18);
  color: #c084fc;
  cursor: pointer;
  transition: background 120ms, color 120ms, transform 80ms;
}

#thinktank-activate-btn:hover:not(:disabled) {
  background: rgba(167, 139, 250, 0.35);
  color: #ffffff;
}

#thinktank-activate-btn:active:not(:disabled) {
  transform: translateY(1px);
}

#thinktank-activate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.upgrade-empty-hint {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #7a8bb4;
  text-align: center;
  padding: 1rem 0.5rem;
  letter-spacing: 0.5px;
  font-style: italic;
}

#tech-shop-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#thinktank-lock-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: rgba(10, 12, 18, 0.92);
  border: 1px solid #ff4455;
  border-radius: 4px;
}
.thinktank-lock-icon { font-size: 2rem; }
.thinktank-lock-label {
  color: #ff4455; font-weight: bold; font-size: 13px;
  font-family: 'Arial Black', Arial, sans-serif;
  letter-spacing: 1px;
}
.thinktank-unlock-btn {
  background: #ffdd00; color: #000;
  border: 1px solid #ccb000; border-radius: 3px;
  padding: 4px 12px; cursor: pointer;
  font-family: 'Arial Black', Arial, sans-serif; font-size: 12px; font-weight: bold;
}
.thinktank-unlock-btn:hover:not(:disabled) {
  background: #ffe944; color: #000;
}
.thinktank-unlock-btn:disabled {
  opacity: 0.4; cursor: not-allowed;
}

#tech-shop-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#tech-shop-list::-webkit-scrollbar {
  width: 4px;
}

#tech-shop-list::-webkit-scrollbar-track {
  background: transparent;
}

#tech-shop-list::-webkit-scrollbar-thumb {
  background: #5a6a8e;
  border-radius: 2px;
}

.tech-shop-item {
  background: rgba(22, 33, 62, 0.8);
  border: 1px solid #2a3a5e;
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  transition: border-color 0.15s;
}

.tech-shop-item:hover:not(.purchased) {
  border-color: #a78bfa;
}

.tech-shop-item.purchased {
  opacity: 0.5;
  border-color: #22c55e;
}

.tech-shop-item.locked {
  opacity: 0.4;
}

.tech-shop-name {
  color: #c084fc;
  font-size: 0.6rem;
  font-weight: bold;
  margin-bottom: 0.15rem;
}

.tech-shop-item.purchased .tech-shop-name {
  color: #4ade80;
}

.tech-shop-desc {
  color: #8a9ab5;
  font-size: 0.5rem;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.tech-buy-btn {
  width: 100%;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #a78bfa;
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
  font-family: 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.tech-buy-btn:hover:not(:disabled) {
  background: rgba(167, 139, 250, 0.3);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

.tech-buy-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.tech-buy-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tech-shop-locked {
  color: #5a6a8e;
  font-size: 0.48rem;
  font-style: italic;
}

/* ========= UPGRADE CARDS (4-card draft pool) ========= */

.upgrade-card {
  background: rgba(22, 33, 62, 0.85);
  border: 1px solid #2a3a5e;
  border-left: 3px solid #a78bfa;
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.upgrade-card:hover {
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.3);
}

.upgrade-card--cursed {
  border-left-color: #dc2626;
}

.upgrade-card--cursed:hover {
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

.upgrade-card--special {
  border-left-color: #facc15;
}

.upgrade-card--special:hover {
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

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

.upgrade-card-name {
  color: #c084fc;
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.3px;
}

.upgrade-card--cursed .upgrade-card-name {
  color: #f87171;
}

.upgrade-card--special .upgrade-card-name {
  color: #facc15;
}

.upgrade-card-tag {
  font-size: 0.42rem;
  font-weight: bold;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tag-repeatable {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.5);
}

.tag-cursed {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.5);
}

.tag-special {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.5);
}

.tag-locked {
  background: rgba(100, 100, 120, 0.2);
  color: #555;
  border: 1px solid rgba(100, 100, 120, 0.4);
}

.tag-applied {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.5);
}

.upgrade-card--next {
  border-left: 3px solid #c084fc;
  background: rgba(22, 33, 62, 0.85);
  border-color: #3a4a7e;
}

.upgrade-card--next:hover {
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.3);
}

.upgrade-card--next .upgrade-card-name {
  color: #e0d0ff;
}

.tag-next {
  background: rgba(192, 132, 252, 0.2);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.5);
}

.upgrade-card--locked {
  background: rgba(15, 20, 35, 0.6);
  border: 1px solid #1a2030;
  border-left: 3px solid #333;
  opacity: 0.5;
}

.upgrade-card--locked:hover {
  box-shadow: none;
}

.upgrade-card--locked .upgrade-card-name {
  color: #555;
}

.upgrade-card-desc {
  color: #8a9ab5;
  font-size: 0.5rem;
  line-height: 1.35;
}

.upgrade-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.2rem;
}

.upgrade-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(15, 20, 35, 0.8);
  border: 1px solid #2a3a5e;
  border-radius: 3px;
  overflow: hidden;
}

.upgrade-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #c084fc);
  border-radius: 2px;
  transition: width 0.15s linear;
}

.upgrade-research-btn {
  width: 100%;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #c084fc;
  background: rgba(192, 132, 252, 0.18);
  color: #c084fc;
  font-family: 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.upgrade-research-btn:hover:not(:disabled) {
  background: rgba(192, 132, 252, 0.35);
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.5);
}

.upgrade-research-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.upgrade-pick-btn {
  width: 100%;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #a78bfa;
  background: rgba(167, 139, 250, 0.18);
  color: #a78bfa;
  font-family: 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  margin-top: 0.15rem;
}

.upgrade-pick-btn:hover:not(:disabled) {
  background: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
}

.upgrade-card--cursed .upgrade-pick-btn {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

.upgrade-card--cursed .upgrade-pick-btn:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.3);
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

.upgrade-card--special .upgrade-pick-btn {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.upgrade-card--special .upgrade-pick-btn:hover:not(:disabled) {
  background: rgba(250, 204, 21, 0.3);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

.upgrade-pick-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.upgrade-pick-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========= TECH SHOP ROWS (server type list) ========= */

.tech-shop-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(42, 58, 94, 0.6);
  border: 1px solid #2a3a5e;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  transition: border-color 0.15s;
}

.tech-shop-row:hover:not(.tech-shop-row--unimplemented) {
  border-color: #4ade80;
}

.tech-shop-row--unimplemented {
  opacity: 0.4;
}

.tech-shop-row-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.tech-shop-row-name {
  color: #e0e0e0;
  font-weight: bold;
  font-size: 0.6rem;
  line-height: 1.15;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.tech-shop-row-count {
  color: #8a9ab5;
  font-size: 0.5rem;
  font-weight: bold;
  margin-right: 0.2rem;
}

.tech-shop-buy-btn {
  flex-shrink: 0;
  background: rgba(250, 204, 21, 0.9);
  color: #1a1a2e;
  border: 1px solid #eab308;
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.6rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.tech-shop-buy-btn:hover:not(:disabled) {
  background: #eab308;
}

.tech-shop-buy-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.tech-shop-buy-btn:disabled {
  background: rgba(100, 100, 100, 0.5);
  color: #888;
  border-color: #555;
  cursor: not-allowed;
}

#hover-tooltip-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 45;
}

.fx-currency-particle {
  position: fixed;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  font-size: 22px;
  line-height: 1;
  color: #facc15;
  text-shadow: 0 0 6px rgba(250, 204, 21, 0.9), 0 0 12px rgba(250, 204, 21, 0.5);
  pointer-events: none;
  z-index: 100000;
  will-change: transform, opacity;
  user-select: none;
}

.hover-tooltip {
  display: none;
  position: absolute;
  transform: translateY(-50%);
  width: 220px;
  background: rgba(10, 15, 30, 0.96);
  border: 1px solid #4ade80;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hover-tooltip--unimpl {
  border-color: #8a9ab5;
}

.hover-tooltip--unimpl .tech-shop-tooltip-name {
  color: #8a9ab5;
}

.tech-shop-floating-tooltip {
  display: none;
  position: absolute;
  transform: translateY(-50%);
  width: 220px;
  background: rgba(10, 15, 30, 0.96);
  border: 1px solid #4ade80;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tech-shop-floating-tooltip--unimpl {
  border-color: #8a9ab5;
}

.tech-shop-floating-tooltip--unimpl .tech-shop-tooltip-name {
  color: #8a9ab5;
}

.tech-shop-tooltip-name {
  color: #4ade80;
  font-weight: bold;
  font-size: 0.65rem;
  letter-spacing: 0.3px;
  margin-bottom: 0.3rem;
}

.tech-shop-tooltip-lore {
  color: #aaa;
  font-size: 0.52rem;
  line-height: 1.45;
  font-style: italic;
  margin-bottom: 0.4rem;
}

.tech-shop-tooltip-stats {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-top: 1px solid #2a3a5e;
  padding-top: 0.3rem;
}

.tech-shop-tooltip-stat {
  color: #e0e0e0;
  font-size: 0.52rem;
  line-height: 1.3;
}

.tech-shop-tooltip-unimpl {
  color: #f87171;
  font-size: 0.5rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-top: 0.35rem;
  text-transform: uppercase;
}

/* ========= FROG PANEL (bottom center) ========= */

#frog-panel {
  position: absolute;
  bottom: 34px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

#frog-thumb {
  height: 240px;
  object-fit: contain;
  pointer-events: none;
}

/* Moisturize button centered over the frog image */
#frog-panel #moisturize-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -11%;
  right: 0;
  margin: auto;
  width: 100px;
  height: 30px;
  z-index: 11;
  pointer-events: auto;
  font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
}

/* Drying-out wobble now handled by body.drying-out selectors above */

/* ═══════════════════════════════════════════════════════════════════
   Milestone Headline Overlay — newspaper spin-in
   ═══════════════════════════════════════════════════════════════════ */

#victory-screen {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  animation: victory-fade-in 1.5s ease-out;
}
@keyframes victory-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.victory-content {
  text-align: center;
  color: #4ade80;
  font-family: 'Arial Black', Arial, sans-serif;
}
.victory-title {
  font-size: 2.5rem;
  font-style: italic;
  letter-spacing: 3px;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
  animation: victory-glow 2s ease-in-out infinite alternate;
}
@keyframes victory-glow {
  from { text-shadow: 0 0 10px rgba(74, 222, 128, 0.4); }
  to { text-shadow: 0 0 30px rgba(74, 222, 128, 0.8), 0 0 60px rgba(74, 222, 128, 0.3); }
}
.victory-link {
  margin-bottom: 1.5rem;
}
.victory-link a {
  color: #4ade80;
  font-size: 1rem;
  font-family: Tahoma, Verdana, sans-serif;
  text-decoration: underline;
  pointer-events: auto;
}
.victory-link a:hover {
  color: #a3e635;
}
.victory-stats {
  font-size: 0.85rem;
  color: #94a3b8;
  font-family: Tahoma, Verdana, sans-serif;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}
.victory-message {
  font-size: 0.9rem;
  color: #e2e8f0;
  font-family: Tahoma, Verdana, sans-serif;
  font-style: italic;
}

#headline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
}

#headline-overlay.hidden {
  display: none;
}

.headline-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.15) 2px,
      rgba(0, 0, 0, 0.15) 3px
    ),
    rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  animation: backdrop-glitch 8s step-end infinite;
}

@keyframes backdrop-glitch {
  0%, 90% { background-position: 0 0; }
  91% { background-position: 0 1px; }
  92% { background-position: 0 -1px; }
  93% { background-position: 0 0; }
}

/* — The Zine — */
.headline-newspaper {
  position: relative;
  width: 500px;
  max-width: 90vw;
  padding: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 100, 255, 0.04) 2px,
      rgba(0, 100, 255, 0.04) 3px
    ),
    #050510;
  border: 2px solid #ff0040;
  border-left: 4px solid #0044ff;
  border-right: 4px solid #0044ff;
  box-shadow:
    0 0 20px rgba(255, 0, 64, 0.3),
    0 0 60px rgba(0, 68, 255, 0.2),
    inset 0 0 80px rgba(0, 68, 255, 0.04);
  font-family: 'Helvetica Neue', 'Arial', sans-serif;
  color: #e0e0e0;
  transform: scale(0.03) rotate(-720deg);
  opacity: 0;
  overflow: hidden;
}

.headline-newspaper.spin-in {
  animation: newspaper-spin-in 1.5s cubic-bezier(0.15, 0.85, 0.25, 1) forwards,
             zine-glitch-box 4s step-end 1.5s infinite;
}

@keyframes zine-glitch-box {
  0%, 93% { transform: scale(1) rotate(0deg); }
  94% { transform: scale(1) rotate(0deg) translate(3px, 0); }
  95% { transform: scale(1) rotate(0deg) translate(-2px, 1px); }
  96% { transform: scale(1) rotate(0deg) translate(0, -1px); }
  97% { transform: scale(1) rotate(0.3deg) translate(1px, 0); }
  98% { transform: scale(1) rotate(0deg); }
}

@keyframes newspaper-spin-in {
  0% {
    transform: scale(0.03) rotate(-720deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  82% {
    transform: scale(1.06) rotate(4deg);
  }
  91% {
    transform: scale(0.98) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* — Masthead — */
.headline-masthead {
  text-align: center;
  font-family: 'Impact', 'Arial Black', 'Helvetica Neue', sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 12px;
  text-transform: uppercase;
  color: #00ffff;
  background: #ff0040;
  padding: 8px 0 6px;
  margin: 0;
  position: relative;
  animation: masthead-flicker 3s step-end infinite;
}

@keyframes masthead-flicker {
  0%, 89% { opacity: 1; }
  90% { opacity: 0.7; }
  91% { opacity: 1; }
  95% { opacity: 0.85; }
  96% { opacity: 1; }
}

.headline-rule {
  height: 0;
  border-top: 1px solid #ff0040;
  border-bottom: none;
  margin: 0;
  padding-top: 0;
}

/* — Headline title — */
.headline-title {
  text-align: left;
  font-family: 'Impact', 'Arial Black', 'Helvetica Neue', sans-serif;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  color: #bf00ff;
  margin: 0;
  padding: 18px 24px 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-style: italic;
  text-shadow: 0 0 12px rgba(191, 0, 255, 0.4);
  position: relative;
  animation: glitch-text 5s step-end infinite;
}

.headline-title::before,
.headline-title::after {
  content: attr(data-text);
  position: absolute;
  top: 18px;
  left: 24px;
  right: 24px;
  overflow: hidden;
  pointer-events: none;
  font-style: italic;
  text-transform: uppercase;
}

.headline-title::before {
  color: #ff0040;
  text-shadow: none;
  animation: glitch-rgb-r 4s step-end infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  opacity: 0.7;
}

.headline-title::after {
  color: #00d4ff;
  text-shadow: none;
  animation: glitch-rgb-b 4s step-end infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  opacity: 0.7;
}

@keyframes glitch-text {
  0%, 87% { transform: none; }
  88% { transform: skewX(-2deg); }
  89% { transform: skewX(1deg) translateX(2px); }
  90% { transform: none; }
  95% { transform: skewX(0.5deg); }
  96% { transform: none; }
}

@keyframes glitch-rgb-r {
  0%, 85% { transform: none; opacity: 0; }
  86% { transform: translate(-3px, -1px); opacity: 0.7; }
  88% { transform: translate(2px, 1px); opacity: 0.6; }
  90% { transform: none; opacity: 0; }
  94% { transform: translate(-1px, 0); opacity: 0.5; }
  96% { transform: none; opacity: 0; }
}

@keyframes glitch-rgb-b {
  0%, 85% { transform: none; opacity: 0; }
  87% { transform: translate(3px, 1px); opacity: 0.7; }
  89% { transform: translate(-2px, -1px); opacity: 0.6; }
  90% { transform: none; opacity: 0; }
  93% { transform: translate(2px, 0); opacity: 0.5; }
  95% { transform: none; opacity: 0; }
}

/* — Image — */
.headline-image-container {
  width: 100%;
  height: 220px;
  margin: 0 0 0;
  background: #111;
  border-top: 1px solid #0044ff;
  border-bottom: 1px solid #0044ff;
  overflow: hidden;
  position: relative;
}

.headline-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.1) saturate(1.1);
}

.headline-image-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.2) 2px,
    rgba(0, 0, 0, 0.2) 3px
  );
  z-index: 2;
  pointer-events: none;
  animation: scanline-roll 8s linear infinite;
}

.headline-image-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 68, 255, 0.12) 0%, transparent 30%, transparent 70%, rgba(255, 0, 64, 0.1) 100%);
  z-index: 3;
  pointer-events: none;
  animation: img-flicker 6s step-end infinite;
}

@keyframes scanline-roll {
  0% { background-position: 0 0; }
  100% { background-position: 0 300px; }
}

@keyframes img-flicker {
  0%, 91% { opacity: 1; }
  92% { opacity: 0.6; }
  93% { opacity: 1; }
  97% { opacity: 0.8; }
  98% { opacity: 1; }
}

.headline-image-placeholder {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0, 68, 255, 0.06) 3px,
      rgba(0, 68, 255, 0.06) 4px
    ),
    #050510;
}

/* — Caption — */
.headline-caption {
  margin: 0;
  padding: 14px 24px 16px;
}

.headline-caption-text {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #bf00ff;
  text-align: left;
  text-indent: 0;
}

.headline-subcaption {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #bf00ff;
  font-style: normal;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 0, 64, 0.4);
}

/* — Dismiss hint — */
.headline-dismiss-hint {
  text-align: center;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 9px;
  color: rgba(0, 255, 255, 0.4);
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 8px 0 12px;
  margin-top: 0;
  opacity: 0;
  animation: headline-hint-fade 0.5s ease 2s forwards;
  border-top: 1px solid rgba(0, 68, 255, 0.2);
}

@keyframes headline-hint-fade {
  to { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   ANNOYING AD POPUPS — maximum ugly
   ═══════════════════════════════════════════════════════════════════ */

.ad-popup {
  position: absolute;
  width: 280px;
  border: 3px solid #ff00ff;
  outline: 3px solid #00ffff;
  outline-offset: 2px;
  box-shadow:
    0 0 20px rgba(255, 0, 255, 0.8),
    0 0 40px rgba(0, 255, 255, 0.4),
    inset 0 0 10px rgba(255, 255, 0, 0.3),
    5px 5px 0 #000;
  background: linear-gradient(135deg, #1a0033 0%, #330033 30%, #003300 70%, #1a0033 100%);
  border-radius: 0;
  font-family: 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
  transform: rotate(var(--ad-rot, 0deg));
  animation: ad-popup-entrance 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             ad-popup-glow 1.5s ease-in-out infinite;
  cursor: default;
  user-select: none;
}

.ad-popup-closing {
  animation: ad-popup-exit 0.2s ease-in forwards !important;
}

.ad-popup-titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  background: linear-gradient(90deg, #0000cc 0%, #cc00cc 50%, #cc0000 100%);
  border-bottom: 2px solid #ffff00;
}

.ad-popup-title {
  flex: 1;
  font-size: 10px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000, 0 0 6px #ff00ff;
  letter-spacing: 1px;
}

.ad-popup-title-blink {
  font-size: 9px;
  font-weight: bold;
  color: #ffff00;
  animation: ad-blink 0.5s step-end infinite;
  text-shadow: 0 0 4px #ff0000;
}

.ad-popup-x {
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  color: #000;
  background: #c0c0c0;
  border: 2px outset #ffffff;
  cursor: pointer;
  padding: 0;
  font-family: 'Arial', sans-serif;
  animation: ad-x-wiggle 2s ease-in-out infinite;
}

.ad-popup-x:hover {
  background: #ff0000;
  color: #fff;
  animation: ad-x-dodge 0.3s ease-in-out infinite;
}

.ad-popup-x:active {
  border-style: inset;
  animation: none;
}

.ad-popup-body {
  padding: 0;
  border-top: 1px dashed #00ff00;
  border-bottom: 1px dashed #00ff00;
}

.ad-popup-img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}

.ad-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  background: linear-gradient(90deg, #330000, #003300);
  border-top: 2px solid #ff00ff;
}

.ad-popup-footer-blink {
  font-size: 10px;
  font-weight: bold;
  color: #00ff00;
  text-decoration: underline;
  animation: ad-blink-rainbow 1s step-end infinite;
  cursor: pointer;
  text-shadow: 0 0 4px #00ff00;
}

.ad-popup-footer-text {
  font-size: 7px;
  color: #666;
  font-style: italic;
}

/* Animations */

@keyframes ad-popup-entrance {
  0% { transform: rotate(var(--ad-rot, 0deg)) scale(0.1); opacity: 0; }
  60% { transform: rotate(var(--ad-rot, 0deg)) scale(1.15); opacity: 1; }
  100% { transform: rotate(var(--ad-rot, 0deg)) scale(1); opacity: 1; }
}

@keyframes ad-popup-exit {
  0% { transform: rotate(var(--ad-rot, 0deg)) scale(1); opacity: 1; }
  100% { transform: rotate(var(--ad-rot, 0deg)) scale(0) rotate(720deg); opacity: 0; }
}

@keyframes ad-popup-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 255, 0.8), 0 0 40px rgba(0, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 0, 0.3), 5px 5px 0 #000; border-color: #ff00ff; }
  33% { box-shadow: 0 0 25px rgba(0, 255, 255, 0.9), 0 0 50px rgba(255, 255, 0, 0.5), inset 0 0 15px rgba(255, 0, 255, 0.3), 5px 5px 0 #000; border-color: #00ffff; }
  66% { box-shadow: 0 0 25px rgba(255, 255, 0, 0.9), 0 0 50px rgba(255, 0, 255, 0.5), inset 0 0 15px rgba(0, 255, 255, 0.3), 5px 5px 0 #000; border-color: #ffff00; }
}

@keyframes ad-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes ad-blink-rainbow {
  0% { color: #00ff00; }
  25% { color: #ff00ff; }
  50% { color: #ffff00; }
  75% { color: #00ffff; }
}

@keyframes ad-x-wiggle {
  0%, 85%, 100% { transform: rotate(0deg); }
  88% { transform: rotate(8deg); }
  91% { transform: rotate(-8deg); }
  94% { transform: rotate(5deg); }
  97% { transform: rotate(-5deg); }
}

@keyframes ad-x-dodge {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(2px, -1px); }
  50% { transform: translate(-1px, 2px); }
  75% { transform: translate(1px, -2px); }
}

/* ---- Double-or-Nothing mini-game ---- */

.don-body {
  padding: 10px 8px;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.don-bet-msg {
  font-size: 11px;
  font-weight: bold;
  color: #ff00ff;
  text-shadow: 0 0 6px #ff00ff, 0 0 12px #ffff00;
  animation: ad-blink-rainbow 0.8s step-end infinite;
  padding: 4px;
  border: 1px dashed #ffff00;
}

.don-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.don-btn {
  width: 100px;
  height: 50px;
  font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;
  font-size: 18px;
  font-weight: bold;
  color: #000;
  background: #00ff00;
  border: 4px outset #ffffff;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.3);
  user-select: none;
}

.don-btn:hover {
  border-style: inset;
  box-shadow: 0 0 25px rgba(255, 255, 0, 0.9), inset 0 0 12px rgba(255, 255, 255, 0.5);
}

.don-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.don-spinner {
  display: flex;
  gap: 8px;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: #ffff00;
  text-shadow: 0 0 8px #ff00ff;
}

.don-reel {
  width: 60px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  background: #000;
  border: 2px solid #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  overflow: hidden;
}

.don-reel.don-reel-stopped {
  border-color: #ffff00;
  box-shadow: 0 0 15px rgba(255, 255, 0, 0.8);
}

.don-spinning {
  animation: don-flash-bg 0.15s step-end infinite;
}

@keyframes don-flash-bg {
  0%   { background-color: rgba(255, 0, 255, 0.15); }
  25%  { background-color: rgba(0, 255, 255, 0.15); }
  50%  { background-color: rgba(255, 255, 0, 0.15); }
  75%  { background-color: rgba(0, 255, 0, 0.15); }
}

.don-result {
  font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;
  font-size: 20px;
  font-weight: bold;
  padding: 15px 8px;
  text-align: center;
}

.don-win {
  color: #00ff00;
  text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 0 0 40px #00ff00;
  animation: don-win-flash 0.3s step-end infinite;
}

.don-payout {
  font-size: 24px;
  color: #ffff00;
  text-shadow: 0 0 12px #ffff00, 0 0 24px #ff00ff;
}

.don-lose {
  color: #ff0000;
  text-shadow: 0 0 10px #ff0000, 0 0 20px #660000;
  animation: don-lose-flash 0.5s step-end infinite;
}

.don-taunt {
  font-size: 10px;
  color: #ff00ff;
  font-style: italic;
}

.don-result-win {
  border-color: #00ff00 !important;
  outline-color: #00ff00 !important;
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.9), 0 0 60px rgba(0, 255, 0, 0.5), inset 0 0 20px rgba(0, 255, 0, 0.3), 5px 5px 0 #000 !important;
}

.don-result-lose {
  border-color: #ff0000 !important;
  outline-color: #ff0000 !important;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.9), 0 0 60px rgba(255, 0, 0, 0.5), inset 0 0 20px rgba(255, 0, 0, 0.3), 5px 5px 0 #000 !important;
}

@keyframes don-win-flash {
  0%, 50% { opacity: 1; }
  25%, 75% { opacity: 0.7; }
}

@keyframes don-lose-flash {
  0%, 50% { opacity: 1; }
  25% { opacity: 0.6; }
}

.don-broke-msg {
  font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;
  font-size: 12px;
  color: #666;
  font-style: italic;
  padding: 20px 8px;
  text-align: center;
}

/* ====== INTRO SEQUENCE ====== */

#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-start-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-start-btn {
  font-family: 'Arial Black', 'Arial Bold', Arial, sans-serif;
  font-style: italic;
  font-size: 1.6rem;
  color: #00ff00;
  background: none;
  border: 2px solid #00aa00;
  padding: 1rem 2.5rem;
  cursor: pointer;
  letter-spacing: 3px;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
  transition: background 0.2s, box-shadow 0.2s;
}

.intro-start-btn:hover {
  background: rgba(0, 80, 0, 0.4);
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.3);
}

.intro-stage-1 {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: pointer;
  overflow: hidden;
}

.intro-glitch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('server upgrades/Server locations 4 blur.webp');
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}

.intro-glitch-1 {
  transform: translateX(3px);
  animation: glitch-idle-1 10s steps(1) infinite;
}

.intro-glitch-2 {
  transform: translateX(-3px);
  animation: glitch-idle-2 12s steps(1) infinite;
}

.intro-garble-line,
.intro-connect-btn {
  position: relative;
  z-index: 1;
}

.intro-garble-line {
  font-family: 'Arial Black', 'Arial Bold', Arial, sans-serif;
  font-style: italic;
  font-size: 1.4rem;
  color: #00ff00;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
  letter-spacing: 1.5px;
  margin-bottom: 1.2rem;
  white-space: pre-wrap;
  text-align: center;
  max-width: 700px;
}

.intro-char.resolved {
  animation: intro-char-flash 0.3s ease-out;
}

@keyframes intro-char-flash {
  0% { color: #ffffff; text-shadow: 0 0 12px rgba(255, 255, 255, 0.8); }
  100% { color: #00ff00; text-shadow: 0 0 8px rgba(0, 255, 0, 0.4); }
}

.intro-connect-btn {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(0, 80, 0, 0.6);
  border: 2px solid #00aa00;
  color: #00ff00;
  font-family: 'Arial Black', 'Arial Bold', Arial, sans-serif;
  font-style: italic;
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease-in, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.15);
  position: fixed;
  left: 8vw;
  top: 50%;
  transform: translateY(0%);
}

.intro-connect-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.intro-connect-btn:hover {
  background: rgba(0, 120, 0, 0.7);
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.35);
}

.intro-stage-2 {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  cursor: pointer;
}

.intro-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.intro-tap-to-play {
  position: absolute;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  cursor: pointer;
}

.intro-stage-3 {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #041a08;
  overflow: hidden;
  animation: intro-stage3-fadein 0.6s ease-out, intro-stage3-darken 2s ease-in-out 0.6s forwards;
}

.intro-stage-3::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(0, 180, 60, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 70%, rgba(0, 140, 50, 0.10) 0%, transparent 70%);
  animation: intro-green-drift 8s ease-in-out infinite alternate;
}

.intro-stage-3::after {
  content: '';
  position: absolute;
  inset: -50% -50%;
  width: 200%;
  height: 200%;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(0, 255, 80, 0.03) 28px, rgba(0, 255, 80, 0.03) 29px),
    repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(0, 255, 80, 0.03) 28px, rgba(0, 255, 80, 0.03) 29px);
  animation: intro-grid-scroll 20s linear infinite;
}

@keyframes intro-stage3-fadein {
  from { opacity: 0; background: #1a6b30; }
  to { opacity: 1; background: #1a6b30; }
}

@keyframes intro-stage3-darken {
  from { background: #1a6b30; }
  to { background: #041a08; }
}

@keyframes intro-green-drift {
  0% { transform: translate(0, 0) scale(1); opacity: 0.8; }
  50% { transform: translate(3%, -2%) scale(1.05); opacity: 1; }
  100% { transform: translate(-2%, 3%) scale(0.98); opacity: 0.9; }
}

@keyframes intro-grid-scroll {
  from { transform: translate(0, 0); }
  to { transform: translate(28px, 28px); }
}

.intro-green-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 255, 80, 0.6), transparent 70%);
  box-shadow: 0 0 6px rgba(0, 255, 80, 0.4);
  pointer-events: none;
  animation: intro-particle-float 6s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes intro-particle-float {
  0% { transform: translate(0, 0); opacity: 0.3; }
  25% { opacity: 0.7; }
  50% { transform: translate(20px, -30px); opacity: 0.5; }
  75% { opacity: 0.8; }
  100% { transform: translate(-15px, 25px); opacity: 0.3; }
}

.intro-letter {
  position: relative;
  z-index: 1;
  width: 520px;
  max-width: 90vw;
  background: #faf8f0;
  border-radius: 4px;
  padding: 2.5rem 2.5rem 2rem;
  box-shadow: 0 4px 40px rgba(0, 60, 20, 0.6), 0 0 80px rgba(0, 180, 60, 0.15);
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  color: #1a1a1a;
  animation: intro-letter-grow 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards,
             intro-letter-breathe 4s ease-in-out 1.2s infinite;
}

@keyframes intro-letter-grow {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes intro-letter-breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.012) translateY(-3px); }
}

.intro-letter-logo {
  display: block;
  max-width: 300px;
  margin: 0 auto 1.5rem;
}

.intro-letter-text {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  text-align: left;
  color: #333;
}

.intro-letter-list {
  text-align: left;
  color: #333;
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0 0 1rem 1.2rem;
  padding-left: 0.5rem;
}

.intro-letter-big {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.3rem;
  font-weight: bold;
  color: #1a1a1a;
  text-align: center;
  margin: 1rem 0;
}

.intro-splorb-btn {
  background: #00b33c;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.7rem 2.2rem;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s, transform 0.1s;
}

.intro-splorb-btn:hover {
  background: #00cc44;
}

.intro-splorb-btn:active {
  transform: scale(0.97);
}
