body {
  background: var(--dark-grey);
}


#add-art-link {
  /* width: 90%; */
  margin: 0;
  padding: 1px;
  color: var(--hot-pink);
  text-decoration: none;
  margin: 0;
  padding: 0;
  font-size: 1.2rem;
  cursor: pointer;
  text-transform: capitalize;
  letter-spacing: 0.5rem;
}

#add-art-link:hover {
  font-weight: 600;
  color: #63f863;
}

@media (min-width: 600px) {
  #add-art-link {
    /* width: 90%; */
    margin: 0;
    padding: 7px 0;
  }
}

.grid-cell {
  display: inline-block;
  width: 1vw;
  height: 2vh;

  width: 1ch; /* One character width exactly */
  height: 1.2em; /* Use em for consistent ratio */
  /* border: 0.1px solid rgba(146, 124, 124, 0.2); */
  text-align: center;

  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  word-spacing: 0;
  font-variant-east-asian: normal; /* Prevents CJK double-width */
  -webkit-font-smoothing: antialiased; /* Consistent rendering */
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%; /* Prevents mobile zoom issues */
  -webkit-text-size-adjust: 100%;
}

/* @media (min-height: 600px) {
  .grid-cell {
    width: 0.6rem;
    height: 1rem;
  }
} */

/* makes each character take up 1% of the viewport width and 2% of the viewport height. */
.grid-cell {
  display: inline-block;
  width: calc(100vw / 42); /* 42 is your CONFIG.GAME.WIDTH */
  height: calc(2vh);

  width: 1ch; /* One character width exactly */
  height: 1.2em; /* Use em for consistent ratio */
  text-align: center;
  box-sizing: border-box;
}

@viewport {
  width: device-width;
  initial-scale: 1;
  maximum-scale: 1;
  user-scalable: no;
}

#game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0; */
  overflow: hidden;
  box-sizing: border-box;
  background: var(--dark-grey);
  /* border: 5px solid red; */
  margin: 0;
  padding: 0;
}
#game-screen {
  font-family: "Courier New", "Consolas", "Monaco", "Lucida Console", monospace;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  text-rendering: geometricPrecision;
  letter-spacing: 0;
  word-spacing: 0;
  background: var(--dark-grey);
  width: 44ch;
  max-width: 100vw;
  overflow: hidden;
  white-space: pre;
  box-sizing: border-box;
  transition: dark-grey 0.1s;
  padding: 0;
  margin: 0;
  line-height: 1.2;
}

/* Target ONLY the building class spans, not all spans */
#game-screen .building {
  display: inline-block;
  width: 0.6em;
  text-align: center;
  /* overflow: hidden; */
}

@media (max-height: 600px) {
  #game-screen {
    /* font-size: 14px; */
  }
}

@media (min-width: 600px) {
  #game-screen {
    /* margin: auto; */
    width: auto;
  }
}

@media screen and (max-width: 600px) {
  #game-screen {
    /* font-size: 0.7em; Adjust this value based on testing */
  }

  .grid-cell {
    width: calc(100vw / 42);
    height: 1.5vh;

    width: 1ch; /* One character width exactly */
    height: 1.2em; /* Use em for consistent ratio */
  }
}

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  display: flex;
  z-index: 15;
  touch-action: manipulation; /* Better touch handling */
  pointer-events: auto;
}

#move-left {
  left: 0;
}

#move-right {
  right: 0;
}

/* Add subtle visual feedback for taps */
.control-area:active {
  dark-grey: rgba(255, 255, 255, 0.1);
}

.control-area {
  top: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex: 1;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}

#game-info-container {
  display: flex;
  align-items: center;
  /* gap: 10px; */
  justify-content: space-between;
  padding: 8px 0;
  color: var(--light-blue);
  visibility: hidden;
  flex-direction: column;
  text-align: center;
  z-index: 100;
  /* border: 1px double var(--dark-yellow); */
  /* width: var(--game-width); */
  width: 100vw;
  margin: 0;
}

@media (min-width: 600px) {
  #game-info-container {
    width: 25rem;
    /* width: var(--game-width); */
  }
}

#game-info-box {
  /* border-bottom: 2px dashed var(--dark-yellow); */
  padding: 7px;
  margin: 0;
  /* margin-bottom: 10px; */
  border: 1px double var(--dark-yellow);
  width: 100%;
}

#game-score-box {
  display: flex;
  align-items: flex-end;
  flex-direction: row;
  justify-content: space-evenly;
  /* width: 100vw; */
  /* dark-grey: var(--dark-grey); */
  /* padding: 8px 0; */
  color: var(--light-blue);
  width: 100%;
  /* border: 3px dashed var(--light-purp); */
}

#game-title {
  color: var(--green);
  font-size: 1.85rem;
  letter-spacing: 18px;
  /* border: 3px dashed var(--light-purp); */
  /* padding: 10px; */
}

#time-alive {
  font-size: 1.3rem;
  color: var(--hot-pink);
}

.bike-art-title {
  color: var(--hot-pink);
  font-weight: bolder;
}

.bike-art-left,
.bike-art-right {
  color: var(--dark-yellow);
  font-size: 0.6rem;
  line-height: 1;
  text-align: center;
  font-weight: bolder;
}

.title-text {
  text-align: center;
  font-size: 1rem;
}

#main-msg-box {
  background-color: var(--dark-grey);
  color: var(--dark-yellow);
  display: flex;
  font-size: 3rem;
  z-index: 200;
}

.message-reason {
  color: var(--hot-pink);
  font-size: 1.5rem;
  letter-spacing: 10px;
}

.cute-death-face {
  font-size: 1rem;
  color: var(--dark-yellow);
  /* text-align: center; */
}

.bike {
  font-weight: bolder;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-image: linear-gradient(45deg, red, orange, cyan, violet);
  animation: rainbow 6s linear infinite;
}

.bike-banking-left {
  transform: rotate(-20deg);
  transition: transform 0.1s ease-in-out;
}

.bike-banking-right {
  transform: rotate(20deg);
  transition: transform 0.1s ease-in-out;
}

/* Fix the invincible styles */
.invincible-mode .bike {
  animation: invincible-pulse 1s infinite;
  background-image: none;
  background-color: red;
  color: red;
}

@keyframes invincible-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

.wanderer {
  /* color: lightblue; */
  /* background-color: yellow; */
  animation: wanderer-glow 2s infinite; /* Glow effect */
}

.ttc-passenger {
  /* background-color: rgba(0, 128, 255, 0.2); Slightly different background */
  /* animation: passenger-move 1s infinite; Another animation */
}

/* .sidewalk-wanderer {
  color: orange;
}

.ttc-passenger {
  color: green;
} */

.sidewalk-wanderer {
  margin: 0;
  background-color: #333333;
  /* animation: wander-animation 2s infinite; */
}

.ttc-passenger {
  background-color: var(--dark-grey);
  /* animation: passenger-animation 2s infinite; */
}

@keyframes wander-animation {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes passenger-animation {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(1px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes rainbow {
  from {
    filter: hue-rotate(0deg);
  }
  to {
    filter: hue-rotate(360deg);
  }
}

.bike-highlight {
  dark-grey: rgba(255, 255, 150, 0.1);
  color: #ffbb00;
  background-clip: text;
  position: relative;
  overflow: hidden;
}

.bike-highlight::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: sparkle 2s infinite;
}

@keyframes sparkle {
  0% {
    left: -150%;
  }
  100% {
    left: 150%;
  }
}
*/ .bike-highlight {
  background-color: var(--dark-grey);
  color: transparent;
  background-image: linear-gradient(45deg, #f06, #4a90e2, #50e3c2);
  background-size: 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
  display: inline-block;

  animation: wave 1.5s ease-in-out infinite;
}

@keyframes wave {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

button {
  color: var(--dark-grey);
  width: 10rem;
  height: 2.5rem;
  outline: 2px solid #666;
  padding: 10px 15px;
  margin: 5px;
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  letter-spacing: 1px;
  box-shadow: 4px 4px #666;
  border: none;
  transition: background-colour 0.3s ease;
  transition: transform 0.1s, box-shadow 0.1s;
  background-color: var(--dark-yellow);
}

button:hover {
  color: #fff; /* White text on hover */
  box-shadow: 6px 6px #333;
  background-color: var(--hot-pink);
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px #333;
}

.button-container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  justify-content: center;
}

.button-container button {
  background-color: var(--dark-grey);
  color: var(--light-blue);
  width: auto;
}

.button-container button:hover {
  background: var(--dark-yellow);
  color: #fff;
}
.button-container button:hover {
  background: var(--dark-yellow);
  color: #fff;
}

@supports (-webkit-touch-callout: none) {
  #game-container {
    height: -webkit-fill-available;
  }
}

/* Subtle animation keyframes */
@keyframes slowPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes gentleWiggle {
  0%,
  100% {
    /* letter-spacing: 1px; */
    /* font-size: 1rem; */
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(15deg);
  }
  75% {
    /* letter-spacing: 2px; */
    /* font-size: 3rem; */

    transform: rotate(-0.5deg);
  }
}

@keyframes softFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes tinyBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.5px);
  }
}

/* Base entity styles */
.entity {
  transition: text-shadow 0.3s ease;
  display: inline-block; /* Needed for transforms */
  will-change: transform, text-shadow;
}

/* TTC - subtle red danger glow + slow pulse */
.TTC {
  /* text-shadow: 0 0 1px rgba(255, 0, 0, 0.2); */
  animation: slowPulse 4s ease-in-out infinite;
}
.TTC:hover {
  text-shadow: 0 0 3px rgba(255, 0, 0, 3);
}

/* Deathmachines - slight headlight effect + gentle wiggle */
.car {
  /* text-shadow: 1px 1px 0 rgb(255, 181, 181); */
  animation: gentleWiggle 6s ease-in-out infinite;
  /* background-color: rgba(19, 16, 83, 0.25); */
}

/* Opening doors - warning effect + soft float */
.door-opening {
  text-shadow: 0 0 1px rgba(255, 165, 0, 1);
  /* animation: softFloat 3s ease-in-out infinite; */
}

/* Buildings - ambient light + very slow pulse */
.building {
  /* text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.585); */
  animation: slowPulse 8s ease-in-out infinite;
  background-color: rgba(19, 16, 83, 0.15);
}

/* Wanderers - make them pop slightly + tiny bounce */
.wanderer {
  /* text-shadow: 0 0 0 rgba(24, 233, 167, 0.476); */
  animation: tinyBounce 2s ease-in-out infinite;
}

/* Danger state - more noticeable but not overwhelming */
.danger {
  /* text-shadow: 0 0 1px rgba(255, 0, 0, 0.698); */
  animation: gentleWiggle 1s ease-in-out infinite;
}
/* Base entity styling */
.entity {
  display: inline-block;
  transform-origin: center;
  will-change: transform;
  backface-visibility: hidden;
}

/* Screen shake effect */
@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

.screen-shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Death flash overlay */
.death-flash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 0, 0, 0.3);
  z-index: 1000;
  pointer-events: none;
}

/* Character glitch animations */
.char-glitch {
  display: inline-block !important;
  animation: tilt 0.4s steps(1) 3;
}

.char-glitch.edge {
  animation-name: tiltEdge;
}

.char-glitch.body {
  animation-name: tiltBody;
}

@keyframes tiltEdge {
  0%,
  5% {
    transform: rotate(0deg);
  }
  10%,
  90% {
    transform: rotate(8deg);
  }
  95%,
  100% {
    transform: rotate(20deg);
  }
}

@keyframes tiltBody {
  0%,
  5% {
    transform: rotate(0deg);
  }
  10%,
  90% {
    transform: rotate(10deg);
  }
  95%,
  100% {
    transform: rotate(0deg);
  }
}

.lang-toggle-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.lang-toggle-container:hover {
  opacity: 1;

}

.lang-toggle {
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 1.3rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  font-family: var(--font-main);
  color: var(--green);
  letter-spacing: 1px;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  text-shadow: none;
}

.lang-toggle:hover {
  color: var(--hot-pink);
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;

}

.lang-toggle:focus {
  background: transparent;
}

.mute-button-container {
  position: fixed;
  top: 20px;
  right: 80px;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.mute-button-container:hover {
  opacity: 1;
}

#mute-button {
  background: transparent;
  border: none;
  outline: none;
  padding: 8px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: none;
}

#mute-button:hover .sound-icon {
  stroke: var(--hot-pink);
}

.sound-icon {
  width: 24px;
  height: 24px;
  stroke: var(--green);
  transition: stroke 0.2s ease;
  filter: none;
}

#mute-button.muted .sound-icon {
  stroke: var(--hot-pink);
}

/* Hide mute X by default */
.mute-x {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Show mute X when muted */
#mute-button.muted .mute-x {
  opacity: 1;
}

/* Hide sound waves when muted */
#mute-button.muted .sound-waves {
  opacity: 0;
}

/* Info Button - matches lang-toggle and mute-button style */
.info-button-container {
  position: fixed;
  top: 20px;
  right: 140px; /* After mute (80px) and lang (20px) */
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.info-button-container:hover {
  opacity: 1;
}

.info-toggle {
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 1.3rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  font-family: "Courier New", monospace;
  color: var(--green);
  letter-spacing: 1px;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  text-shadow: none;
  font-weight: bold;
}

.info-toggle:hover {
  color: var(--hot-pink);
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
}

.info-toggle:focus {
  background: transparent;
}

/* Info Popup */
.info-popup {
  display: none;
  position: fixed;
  top: 70px;
  right: 20px;
  background: var(--dark-grey);
  border: 2px solid var(--dark-yellow);
  padding: 20px;
  max-width: 300px;
  z-index: 1001;
  box-shadow: 0 0 20px rgba(231, 169, 0, 0.1);
  font-family: "Courier New", monospace;
}

.info-popup.show {
  display: block;
}

.info-popup p {
  color: var(--light-blue);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.info-popup a {
  color: var(--hot-pink);
  text-decoration: none;
  transition: color 0.2s ease;
}

.info-popup a:hover {
  color: var(--green);
  text-decoration: underline;
}

.info-close {
  position: absolute;
  top: 5px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--hot-pink);
  font-size: 1.5rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  box-shadow: none;
  margin: 0;
}

.info-close:hover {
  color: var(--green);
  background: transparent;
  box-shadow: none;
  transform: none;
}

/* Responsive */
@media (max-width: 600px) {
  .info-button-container {
    right: 120px;
  }
  
  .info-popup {
    right: 10px;
    left: 10px;
    max-width: calc(100vw - 20px);
  }
}