/* Chrome Dino Runner Styles */
html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background-color: #f7f7f7;
  color: #5f6368;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
  transition: background-color 1.2s ease, color 1.2s ease;
}

.offline {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.offline .interstitial-wrapper {
  position: relative;
  box-sizing: border-box;
  color: #2b2b2b;
  font-size: 1em;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 620px;
  padding: 50px 20px 40px;
  width: 100%;
}

/* Dinosaur Icon (Static before game start) */
.icon {
  -webkit-user-select: none;
  user-select: none;
  display: inline-block;
}

.icon-offline {
  width: 44px;
  height: 47px;
  background-image: -webkit-image-set(
    url(assets/default_100_percent/100-offline-sprite.png) 1x,
    url(assets/default_200_percent/200-offline-sprite.png) 2x
  );
  background-position: -848px -2px;
  background-repeat: no-repeat;
  position: absolute;
  top: 143px;
  left: 20px;
  cursor: pointer;
}

/* Canvas & Game Container */
.offline .runner-container {
  height: 150px;
  max-width: 600px;
  overflow: hidden;
  position: absolute;
  top: 50px;
  left: 20px;
  width: 44px;
  z-index: 5;
}

.offline .runner-canvas {
  height: 150px;
  max-width: 600px;
  opacity: 1;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.offline .controller {
  background: transparent;
  height: 100vh;
  left: 0;
  position: fixed;
  top: 0;
  width: 100vw;
  z-index: 1;
}

#offline-resources {
  display: none;
}

/* Intro Animation */
@-webkit-keyframes intro {
  from { width: 44px; }
  to { width: 600px; }
}
@keyframes intro {
  from { width: 44px; }
  to { width: 600px; }
}

/* Offline Page Text Styling */
#main-content {
  margin-top: 155px;
  transition: opacity 0.4s ease;
}

h1 {
  color: #202124;
  font-size: 24px;
  font-weight: 500;
  margin: 18px 0 10px;
  letter-spacing: -0.2px;
}

p {
  color: #5f6368;
  font-size: 14px;
  margin: 0 0 8px;
}

ul {
  color: #5f6368;
  font-size: 14px;
  margin: 0 0 14px;
  padding-left: 20px;
}

li {
  margin-bottom: 5px;
}

.error-code {
  color: #5f6368;
  font-size: 12px;
  text-transform: uppercase;
  margin-top: 14px;
}

/* Character Selector */
.char-selector-box {
  position: relative;
  z-index: 10;
  margin: 12px 0;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(60,64,67,0.08);
  transition: background-color 0.5s, border-color 0.5s;
}

/* Hide selection box and error text when game is running to prevent obstruction */
body.game-running .char-selector-box:not(.force-show),
body.game-running #error-title,
body.game-running #main-content > p,
body.game-running #main-content > ul,
body.game-running .error-code {
  display: none !important;
}

.char-selector-box.force-show {
  display: block !important;
  animation: fadeIn 0.2s ease;
}

body.game-crashed .char-selector-box {
  display: block !important;
  animation: fadeIn 0.3s ease;
}

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

.char-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.char-selector-title {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.char-card {
  position: relative;
  padding: 12px 10px;
  background: #f8f9fa;
  border: 2px solid #e8eaed;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.char-card:hover {
  transform: translateY(-2px);
  border-color: #bdc1c6;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.char-card.active {
  border-color: #1a73e8;
  background: #e8f0fe;
  box-shadow: 0 2px 8px rgba(26,115,232,0.25);
}

.char-card.fire.active {
  border-color: #ff3d00;
  background: #fbe9e7;
  box-shadow: 0 2px 8px rgba(255,61,0,0.25);
}

.char-card.fly.active {
  border-color: #0288d1;
  background: #e1f5fe;
  box-shadow: 0 2px 8px rgba(2,136,209,0.25);
}

.char-icon {
  font-size: 26px;
  line-height: 1.2;
}

.char-name {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
}

.char-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 99px;
  background: #e8eaed;
  color: #5f6368;
  font-weight: 500;
}

.char-card.active .char-tag {
  background: #1a73e8;
  color: #ffffff;
}

.char-card.fire.active .char-tag {
  background: #ff3d00;
  color: #ffffff;
}

.char-card.fly.active .char-tag {
  background: #0288d1;
  color: #ffffff;
}

.char-desc {
  font-size: 11px;
  color: #5f6368;
  line-height: 1.4;
  margin-top: 4px;
}

/* In-Game Dynamic HUD */
.game-active-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  z-index: 10;
}

.hud-switch-btn {
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  color: #1a73e8;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hud-switch-btn:hover {
  background: #f1f3f4;
  border-color: #bdc1c6;
}

.hud-switch-btn:active {
  transform: scale(0.96);
}

.inverted .hud-switch-btn {
  background: #35363a;
  color: #8ab4f8;
  border-color: #5f6368;
}

.inverted .hud-switch-btn:hover {
  background: #3c4043;
}

.hud-fire-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d84315;
}

.hud-fly-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0277bd;
}

.stamina-outer {
  width: 90px;
  height: 8px;
  background: #cfd8dc;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.stamina-inner {
  height: 100%;
  background: linear-gradient(90deg, #29b6f6, #0288d1);
  width: 100%;
  transition: width 0.08s linear;
}

/* Mobile Action Buttons */
.mobile-controls {
  position: relative;
  z-index: 10;
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.mobile-btn {
  flex: 1;
  max-width: 180px;
  padding: 12px 14px;
  border: 1.5px solid #dadce0;
  background: #ffffff;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.mobile-btn:active {
  transform: scale(0.96);
  background: #f1f3f4;
}

.mobile-btn.fire-btn {
  background: #ff5722;
  color: #ffffff;
  border-color: #ff3d00;
  box-shadow: 0 2px 10px rgba(255,87,34,0.35);
}

.mobile-btn.fire-btn:active {
  background: #e64a19;
}

.mobile-btn.fire-btn.disabled {
  opacity: 0.5;
  filter: grayscale(1);
  pointer-events: none;
}

.mobile-btn.jump-btn {
  background: #1a73e8;
  color: #ffffff;
  border-color: #1765cc;
  box-shadow: 0 2px 10px rgba(26,115,232,0.3);
}

.mobile-btn.jump-btn:active {
  background: #1557b0;
}

/* Inverted / Night Mode */
.inverted {
  background-color: #202124 !important;
  color: #bdc1c6 !important;
}

.inverted .interstitial-wrapper {
  color: #bdc1c6 !important;
}

.inverted h1 {
  color: #e8eaed !important;
}

.inverted p, .inverted ul, .inverted li, .inverted .error-code {
  color: #9aa0a6 !important;
}

.inverted .runner-canvas {
  filter: invert(1);
}

.inverted .char-selector-box {
  background: #292a2d;
  border-color: #3c4043;
}

.inverted .char-selector-title {
  color: #e8eaed;
}

.inverted .char-card {
  background: #35363a;
  border-color: #484a4d;
}

.inverted .char-card:hover {
  background: #3c4043;
  border-color: #5f6368;
}

.inverted .char-card .char-name {
  color: #e8eaed;
}

.inverted .char-card .char-desc {
  color: #9aa0a6;
}

.inverted .char-card.active {
  background: #172b4d;
  border-color: #8ab4f8;
}

.inverted .char-card.fire.active {
  background: #3c1e19;
  border-color: #ff7043;
}

.inverted .char-card.fly.active {
  background: #0f2c42;
  border-color: #4fc3f7;
}

.inverted .game-active-hud {
  background: rgba(255, 255, 255, 0.08);
}

.inverted .mobile-btn {
  background: #292a2d;
  color: #e8eaed;
  border-color: #3c4043;
}

.inverted .mobile-btn:active {
  background: #35363a;
}

/* Mobile Screens */
@media (max-width: 600px) {
  .offline .interstitial-wrapper {
    padding-top: 36px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .offline .runner-container {
    left: 14px;
    top: 36px;
  }
  .icon-offline {
    left: 14px;
    top: 129px;
  }
  .char-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .char-card {
    flex-direction: row;
    text-align: left;
    padding: 10px 12px;
    justify-content: flex-start;
  }
  .char-desc {
    margin-top: 0;
  }
  .char-card-body {
    flex: 1;
    margin-left: 10px;
  }
}
