/* =====================================================================
   WAKEBOAT.io — stylesheet
   Ocean palette: deep navy background, sea-foam accents, warm coral CTA
   ===================================================================== */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07203a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #eaf6ff;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #0e6fad;
}

/* ---------------------------------------------------------------
   Overlays (start screen / game over screen)
--------------------------------------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  padding: 20px 16px 78px;
  background: rgba(4, 16, 32, 0.72);
  backdrop-filter: blur(2px);
  z-index: 20;
  overflow-y: auto;
}

/* ── Game-over overlay keeps centered single column ── */
#game-over-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(420px, 90vw);
  background: #0e2f52;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.panel h1 {
  font-size: 2.1rem;
  letter-spacing: 1px;
  white-space: nowrap;
}

.panel h1 .dot {
  color: #5ad1c4;
}

.panel h2 {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.tagline {
  margin: 6px 0 20px;
  color: #a9c7e0;
  font-size: 0.95rem;
}

#name-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0a2440;
  color: #eaf6ff;
  font-size: 1rem;
  margin-bottom: 12px;
  outline: none;
}

#name-input:focus {
  border-color: #5ad1c4;
}

#play-button,
#respawn-button {
  width: 100%;
  padding: 13px 14px;
  border: none;
  border-radius: 10px;
  background: #ff7a59;
  color: #1a1a1a;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

#play-button:hover,
#respawn-button:hover {
  background: #ff8f72;
  transform: translateY(-1px);
}

.how-to-play {
  margin-top: 20px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #cfe3f4;
}

.how-to-play ul {
  margin: 6px 0 0 18px;
}

#final-score {
  font-weight: 700;
  color: #5ad1c4;
}

/* ---------------------------------------------------------------
   In-game HUD
--------------------------------------------------------------- */
#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

#hud.hidden {
  display: none;
}

#score-box {
  background: rgba(7, 32, 58, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 110px;
}

#score-box .label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8fb6d6;
}

#score-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #5ad1c4;
}

.boat-class-label {
  margin-top: 8px;
}

#boat-class-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffb454;
}

#leaderboard {
  background: rgba(7, 32, 58, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 16px 10px 32px;
  min-width: 170px;
  font-size: 0.85rem;
  line-height: 1.6;
}

#leaderboard li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#leaderboard li.me {
  color: #ff7a59;
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Ad placeholders (no real ads until AdSense is approved)
--------------------------------------------------------------- */
.ad-placeholder {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(728px, 96vw);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px 8px 0 0;
  font-size: 0.78rem;
  color: #8fb6d6;
  z-index: 15;
}

.ad-placeholder-button {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed rgba(90, 209, 196, 0.6);
  background: rgba(90, 209, 196, 0.08);
  color: #5ad1c4;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ad-placeholder-button:hover {
  background: rgba(90, 209, 196, 0.16);
}

.ad-tag {
  font-size: 0.65rem;
  letter-spacing: 1px;
  background: rgba(90, 209, 196, 0.25);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ---------------------------------------------------------------
   Boat-upgrade toasts
   Pop in from the top center when a player levels up to a new
   boat class, then fade back out. Pure CSS transition driven by
   game.js toggling the `.show` class.
--------------------------------------------------------------- */
#toast-layer {
  position: absolute;
  /* Toasts sit at bottom-center so they don't compete with the top kill feed */
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column-reverse; /* newest toast appears closest to center */
  align-items: center;
  gap: 6px;
  pointer-events: none;
  max-height: 160px;
  overflow: hidden;
}

.level-up-toast {
  background: rgba(14, 47, 82, 0.92);
  border: 1px solid rgba(255, 180, 84, 0.45);
  border-radius: 10px;
  padding: 7px 16px;
  font-size: 0.82rem;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);   /* slides up from below */
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.level-up-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.level-up-toast .tier-pill {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  background: rgba(255, 180, 84, 0.2);
  color: #ffb454;
  border-radius: 6px;
  padding: 2px 7px;
}

/* ---------------------------------------------------------------
   Lobby selector (start screen)
   Sits above the name input. The overlay has padding-bottom to
   keep the panel above the AdSense banner — no overlap.
--------------------------------------------------------------- */

/* Keep panels scrollable and above the bottom ad banner */
.panel {
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

/* ── Side panels (Ad + Profile) — same visual as .panel, narrower ── */
.side-panel {
  width: 200px;
  flex-shrink: 0;
}

/* Ad panel gets a standard skyscraper-style slot */
#ad-left-panel {
  width: 180px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.side-ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 420px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 16px 10px;
}

.ad-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #6fa0c4;
}

.ad-sub {
  font-size: 0.75rem;
  color: #8fb6d6;
}

.ad-size {
  font-size: 0.65rem;
  color: #4a7090;
  margin-top: 4px;
}

/* Profile panel title */
.profile-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 14px;
  color: #eaf6ff;
}

#lobby-section {
  margin: 0 0 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  padding: 12px 14px;
}

#lobby-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

#lobby-region-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #eaf6ff;
}

.lobby-header-note {
  font-size: 0.72rem;
  color: #6fa0c4;
}

/* Continent tabs */
#region-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.region-tab {
  flex: 1;
  min-width: 36px;
  padding: 5px 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  background: transparent;
  color: #8fb6d6;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.region-tab:hover {
  background: rgba(90,209,196,0.12);
  color: #5ad1c4;
  border-color: #5ad1c4;
}

.region-tab.active {
  background: rgba(90,209,196,0.18);
  color: #5ad1c4;
  border-color: #5ad1c4;
}

/* Lobby buttons grid */
#lobby-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.lobby-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  color: #cfe3f4;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}

.lobby-btn:hover:not(.lobby-full) {
  background: rgba(255,122,89,0.14);
  border-color: rgba(255,122,89,0.55);
  transform: translateY(-1px);
}

.lobby-btn.selected {
  background: rgba(255,122,89,0.22);
  border-color: #ff7a59;
  color: #fff;
}

.lobby-btn.lobby-full {
  opacity: 0.42;
  cursor: not-allowed;
}

.lobby-num {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.lobby-count {
  font-size: 0.68rem;
  color: #6fa0c4;
}

.lobby-btn.selected .lobby-count {
  color: #ffb454;
}

/* Play button disabled state */
#play-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---------------------------------------------------------------
   Panel ad strip — thin placeholder at the bottom of the main panel
--------------------------------------------------------------- */
.panel-ad-strip {
  margin-top: 14px;
  padding: 8px 10px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 7px;
  font-size: 0.70rem;
  color: #6fa0c4;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ---------------------------------------------------------------
   Profile panel — right column, matches main panel style.
   Inherits .panel and .side-panel; override width and text-align.
--------------------------------------------------------------- */
#profile-card {
  width: 256px;
  flex-shrink: 0;
  text-align: left;
  /* remove old absolute override if any — position is static in flow */
}

/* ── Responsive: stack to column on narrow screens ── */
@media (max-width: 960px) {
  .overlay {
    flex-direction: column;
    align-items: center;
    padding: 16px 16px 78px;
  }
  /* hide the ad panel on narrow screens to keep it simple */
  #ad-left-panel {
    display: none;
  }
  #profile-card,
  .side-panel {
    width: min(380px, 90vw);
  }
}

/* ── Google login button ── */
.google-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 9px;
  background: #fff;
  color: #3c4043;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
.google-login-btn:hover {
  background: #f8f8f8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.profile-note {
  margin-top: 8px;
  font-size: 0.77rem;
  color: #6fa0c4;
  text-align: center;
}

/* ── Logged-in profile header ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

#profile-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #eaf6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffb454;
  background: rgba(255,180,84,0.15);
  border-radius: 5px;
  padding: 1px 7px;
  align-self: flex-start;
}

.profile-logout-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 7px;
  background: transparent;
  color: #8fb6d6;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.profile-logout-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #eaf6ff;
}

/* ── XP progress bar ── */
.xp-bar-wrap {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5ad1c4, #a8e8f0);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.xp-bar-label {
  font-size: 0.71rem;
  color: #6fa0c4;
  margin-bottom: 10px;
}

/* ── Facebook share button ── */
.share-fb-btn {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(24,119,242,0.5);
  border-radius: 8px;
  background: rgba(24,119,242,0.12);
  color: #5fa8f8;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.12s;
}
.share-fb-btn:hover {
  background: rgba(24,119,242,0.22);
}

/* ── Skin selector grid ── */
.skin-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8fb6d6;
  margin-bottom: 7px;
}

.skin-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.skin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 3px 5px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.skin-btn:hover:not(.locked) {
  border-color: rgba(90,209,196,0.55);
  background: rgba(90,209,196,0.1);
}
.skin-btn.active {
  border-color: #5ad1c4;
  background: rgba(90,209,196,0.18);
}
.skin-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.skin-swatch {
  width: 22px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
}
.skin-btn span {
  font-size: 0.58rem;
  color: #a9c7e0;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
}
.skin-btn.active span {
  color: #5ad1c4;
}

/* ---------------------------------------------------------------
   Death-screen XP summary
--------------------------------------------------------------- */
#xp-summary {
  margin: 14px 0 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
}

.death-xp-gain {
  font-size: 1.4rem;
  font-weight: 800;
  color: #5ad1c4;
  letter-spacing: 0.5px;
}

.death-xp-detail {
  font-size: 0.78rem;
  color: #8fb6d6;
  margin: 3px 0 8px;
}

.death-level-text {
  font-size: 0.80rem;
  font-weight: 700;
  color: #ffb454;
  margin-top: 5px;
  transition: color 0.4s ease;
}

/* ---------------------------------------------------------------
   Kill feed  — centered top of HUD, entries slide in and fade out
--------------------------------------------------------------- */
#kill-feed {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  /* Prevent entries from stacking up and overflowing vertically */
  max-height: 120px;
  overflow: hidden;
}

.kill-feed-entry {
  background: rgba(4, 16, 32, 0.84);
  border: 1px solid rgba(255, 122, 89, 0.38);
  color: #cfe3f4;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.kill-feed-entry.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------------
   Daily challenge widget — profile panel, always visible
--------------------------------------------------------------- */
.daily-challenge-widget {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.challenge-header {
  font-size: 10px;
  font-weight: 700;
  color: #ffc107;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}

.challenge-desc {
  font-size: 12px;
  color: #cfe3f4;
  margin-bottom: 7px;
  line-height: 1.4;
}

.challenge-bar-wrap {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
  margin-bottom: 5px;
}

.challenge-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffc107, #ff9800);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.challenge-footer {
  font-size: 11px;
  color: rgba(200, 230, 255, 0.65);
}

.challenge-done .challenge-footer {
  color: #66bb6a;
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Power-up HUD  —  left side, below the score-box
--------------------------------------------------------------- */
#powerup-hud {
  position: absolute;
  /* #hud starts at top:16px. Score-box is ~138px tall. 138+8 gap = 146px from #hud top. */
  top: 146px;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  pointer-events: none;
  z-index: 30;
}

/* Active power-up panel */
#active-powerup {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(4,16,32,0.88);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 5px 12px;
  color: #eaf6ff;
  font-size: 12px;
  font-weight: 600;
  min-width: 150px;
  max-width: 180px;
}
.pu-active-icon { font-size: 20px; }
.pu-active-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pu-active-name { font-size: 12px; color: #cfe3f4; white-space: nowrap; }
.pu-timer-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  overflow: hidden;
}
.pu-timer-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.25s linear;
}

/* Stored slot queue */
#pu-slots {
  display: flex;
  gap: 6px;
}
.pu-slot {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(4,16,32,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pu-slot.pu-filled {
  background: rgba(4,16,32,0.88);
}
.pu-slot.pu-next {
  /* First slot pulses — will be activated on F key */
  animation: pu-pulse 1.6s ease-in-out infinite;
}
.pu-slot-icon { font-size: 18px; }

@keyframes pu-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.pu-key-hint {
  font-size: 10px;
  color: rgba(200,230,255,0.5);
  letter-spacing: 0.5px;
}
.pu-key-hint kbd {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 10px;
}

/* ---------------------------------------------------------------
   Dev mode badge — hard to miss, impossible to ship accidentally
--------------------------------------------------------------- */
#dev-badge {
  position: fixed;
  top: 0;
  right: 0;
  background: #e53935;
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-bottom-left-radius: 6px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.9;
}

/* ---------------------------------------------------------------
   Bottom banner ad — fixed at bottom center, only during gameplay
--------------------------------------------------------------- */
#ad-slot-728x90 {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: none; /* hidden by default (start screen / game over) */
}

/* Show only when HUD is active (gameplay in progress) */
#hud:not(.hidden) ~ #ad-slot-728x90 {
  display: block;
}

/* ---------------------------------------------------------------
   Utility
--------------------------------------------------------------- */
.hidden {
  display: none !important;
}
