* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(180deg, #4a6b7c 0%, #38505c 100%);
  font-family: "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

#page-layout {
  width: 100%;
  height: 100%;
  display: flex;
}

#game-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
}

/* Skyscraper ad panels flank the game area, outside the playing field
   itself - see index.html's ADSENSE comment block for why this is
   web-build-only (Steam/Play need different or no ad integration).
   data-ad-format="auto" + data-full-width-responsive="true" on the <ins>
   means each ad sizes itself to fill this container, so the panel just
   needs a sensible fixed width and to center whatever height Google ends
   up giving it. */
.skyscraper-ad {
  width: 160px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
}

/* Below this width, showing 160px-wide ad columns on both sides would
   crowd out the game itself - hide them and let #game-wrap's flex:1 take
   the full width instead, same as if the ads weren't there at all. */
@media (max-width: 1200px) {
  .skyscraper-ad {
    display: none;
  }
}

#game-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 960 / 640;
  background: #6e5947;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  cursor: none;
  touch-action: none;
}

#round-complete-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 30, 35, 0.92);
  color: #fff;
  padding: 32px 48px;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  min-width: 280px;
  max-width: 92vw;
}

#round-complete-panel.hidden {
  display: none;
}

#round-complete-panel h2 {
  margin: 0 0 8px;
  font-size: 28px;
  color: #ffd166;
}

#round-complete-panel p {
  margin: 0 0 20px;
  font-size: 16px;
  color: #e0e0e0;
}

#round-complete-bonus {
  margin-top: -12px;
  font-size: 14px;
  color: #9fd8b8;
}

/* Inline "postbox" ad in the round-complete popup - see index.html's
   ADSENSE comment for why this is web-build-only. A 300px medium-rectangle
   footprint, capped to the popup's own width so it can't force the panel
   wider than the viewport on a small screen. */
.medium-rectangle-ad {
  width: 300px;
  max-width: 100%;
  margin: 4px auto 20px;
}

#next-round-btn {
  background: #4caf7d;
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#next-round-btn:hover {
  background: #5ac48f;
}

#next-round-btn:active {
  transform: scale(0.97);
}

.round-complete-exit-link {
  display: block;
  margin: 12px 0 0;
  text-align: center;
}

/* The Upgrades panel now renders directly on the canvas (see
   drawUpgradesPanel() in game.js) as a box on the left, mirroring the
   Stacks container on the right - no DOM styling needed for it here. */

/* Generic utility - anything can use this to hide/show itself. */
.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------------- */
/* Splash screen + game-over/statistics screen - both share the same       */
/* full-viewport overlay treatment, dynamic logo, and copyright line.      */
/* ---------------------------------------------------------------------- */

.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #3d5866 0%, #24363f 70%, #1a2830 100%);
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* Briefly fading out (see revealGameArea() in game.js) rather than
   disappearing instantly - the fade buys a moment for the audio engine to
   finish spinning up before the player can actually start scrubbing. */
.overlay-screen.fading-out {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  max-width: 640px;
  width: 90%;
  text-align: center;
  padding: 32px;
  color: #fff;
}

.dynamic-logo {
  margin: 0 0 6px;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffd166, #4caf7d, #6fc7ff, #ffd166);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-shimmer 5s ease-in-out infinite;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

@keyframes logo-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.copyright {
  margin: 0 0 22px;
  font-size: 13px;
  color: #9fb4bd;
}

.game-summary {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.6;
  color: #dce8ec;
}

.big-action-btn {
  background: #4caf7d;
  color: #fff;
  border: none;
  padding: 18px 48px;
  font-size: 22px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(76, 175, 125, 0.4);
  transition: background 0.15s ease, transform 0.1s ease;
}

.big-action-btn:hover {
  background: #5ac48f;
}

.big-action-btn:active {
  transform: scale(0.97);
}

/* "Continue" - only shown (see game.js) when a resumable save exists.
   Deliberately less prominent than Start Washing so a new player isn't
   drawn to it first. */
.secondary-action-btn {
  display: block;
  margin: 14px auto 0;
  background: transparent;
  color: #cfe8ff;
  border: 1.5px solid rgba(207, 232, 255, 0.5);
  padding: 10px 32px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.secondary-action-btn:hover {
  background: rgba(207, 232, 255, 0.08);
  border-color: rgba(207, 232, 255, 0.8);
}

.secondary-action-btn:active {
  transform: scale(0.97);
}

#game-over-stats {
  font-size: 16px;
  color: #e0e0e0;
  line-height: 1.8;
}

#game-over-stats p {
  margin: 0;
}

.game-over-upgrades-title {
  margin-top: 14px !important;
  font-weight: 600;
  color: #ffd166;
}

.game-over-upgrades-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  font-size: 14px;
  color: #cfe8ff;
}

/* ---------------------------------------------------------------------- */
/* Player name entry (splash screen) + highscore list (game-over screen). */
/* Both talk to the lightweight Pi server's /api routes - see game.js.    */
/* ---------------------------------------------------------------------- */

.player-name-block {
  margin: 0 0 20px;
  font-size: 14px;
  color: #cfe8ff;
}

.player-name-label {
  display: block;
  margin-bottom: 8px;
  color: #9fb4bd;
}

.player-name-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

#player-name-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(207, 232, 255, 0.35);
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  width: 180px;
}

#player-name-input:focus {
  outline: none;
  border-color: rgba(207, 232, 255, 0.8);
}

.tiny-action-btn {
  background: #4caf7d;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tiny-action-btn:hover {
  background: #5ac48f;
}

.tiny-link-btn {
  background: none;
  border: none;
  color: #6fc7ff;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 8px;
  padding: 0;
}

#highscore-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.highscore-title {
  margin: 0 0 8px !important;
  font-weight: 600;
  color: #ffd166;
}

#highscore-list {
  list-style: decimal;
  margin: 0;
  padding: 0 0 0 24px;
  text-align: left;
  font-size: 14px;
  color: #e0e0e0;
  line-height: 1.7;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

#highscore-list li strong {
  color: #cfe8ff;
}
