/* =========================================================================
 * Honey Go Fix It — shared brand styles
 *
 * Every HGFI game loads this file first, then its own game.css on top.
 * The pieces in here are things that should look identical across every
 * game in the site (tokens, HUD pill shape, mascot, screens, buttons,
 * popups, leaderboard). Game-specific art and mechanics live in game.css.
 * ========================================================================= */

/* ---------- Brand tokens ---------- */
:root {
  --navy:      #3C3C78;
  --navy-dark: #2a2a5c;
  --navy-deep: #1e1e44;
  --honey:     #F0C864;
  --honey-lt:  #ffe29a;
  --honey-dk:  #d6ad46;
  --white:     #FFFFFF;
  --hit:       #7ee081;
  --miss:      #e86a6a;
  --water:     #6ec6ff;
}

/* ---------- Page shell ---------- */
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--navy-deep);
  color: var(--white);
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  touch-action: manipulation;
}

/* ---------- Custom wrench cursor ---------- */
/* Applied site-wide with !important so it overrides element-level
   cursor rules. On touch devices this is silently ignored. */
* {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><g fill='%23e6e6f4' stroke='%23141428' stroke-width='2.2' stroke-linejoin='round' stroke-linecap='round'><path d='M2 2 L8 2 L8 6 L12 6 L12 2 L18 2 L18 14 L2 14 Z'/><path d='M14 10 L18 14 L30 26 L26 30 L14 18 L10 14 Z'/></g></svg>") 6 4, auto !important;
}

/* ---------- 1080x1920 virtual stage ---------- */
/* Games are drawn in a 1080x1920 virtual box and CSS-scaled to the
   viewport, so layout math stays identical on every device. */
#stage { position: fixed; inset: 0; overflow: hidden; }

#game {
  position: absolute;
  left: 50%; top: 50%;
  width: 1080px; height: 1920px;
  transform-origin: center center;
  background-color: var(--navy);
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.35) 0, rgba(0,0,0,0) 340px),
    linear-gradient(0deg,   rgba(0,0,0,0.35) 0, rgba(0,0,0,0) 340px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='112' height='194' viewBox='0 0 112 194'><g fill='none' stroke='%234a4aa0' stroke-width='3' stroke-opacity='0.55'><path d='M56 2 L108 32 L108 96 L56 126 L4 96 L4 32 Z'/><path d='M0 128 L4 130 L4 162'/><path d='M112 128 L108 130 L108 162'/><path d='M56 128 L56 162 L4 192'/><path d='M56 162 L108 192'/></g></svg>");
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 224px 388px;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,0,0,0.6);
  animation: honeyDrift 120s linear infinite;
}
@keyframes honeyDrift {
  0%   { background-position: 0 0, 0 0, 0 0; }
  100% { background-position: 0 0, 0 0, 672px 1164px; }
}

#gameInner { position: absolute; inset: 0; }
#gameInner.shake { animation: shake 400ms cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate(-6px, 0); }
  20%, 80% { transform: translate(10px, 0); }
  30%, 50%, 70% { transform: translate(-18px, 0); }
  40%, 60% { transform: translate(18px, 0); }
}

/* ---------- Top brand bar ---------- */
#brandBar {
  position: absolute; top: 36px; left: 0; right: 0;
  display: flex; justify-content: center;
  z-index: 6;
  pointer-events: none;
}
#brandBar .wordmark {
  background: linear-gradient(180deg, var(--honey) 0%, var(--honey-dk) 100%);
  color: var(--navy-deep);
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 42px;
  letter-spacing: 3px;
  padding: 14px 48px 10px;
  border-radius: 999px;
  border: 5px solid var(--navy-deep);
  box-shadow: 0 8px 0 var(--navy-deep), 0 14px 24px rgba(0,0,0,0.35);
  text-shadow: 0 2px 0 rgba(255,255,255,0.4);
}

/* ---------- HUD pill row ---------- */
#hud {
  position: absolute; top: 130px; left: 0; right: 0;
  padding: 20px 60px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 5;
}
#hud .pill {
  background: rgba(30,30,68,0.72);
  border: 4px solid var(--honey);
  padding: 14px 22px 8px;
  border-radius: 28px;
  min-width: 150px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(0,0,0,0.35);
}
#hud .label {
  display: block;
  font-size: 20px;
  color: var(--honey-lt);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2px;
  font-weight: 700;
}
#hud .value {
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 44px;
  color: var(--white);
  line-height: 1;
}
#hud .pill.danger .value { color: var(--miss); }

/* Combo pill — lights up when multiplier > 1 */
#hud .pill.combo { border-color: #6ec6ff; }
#hud .pill.combo.active {
  background: linear-gradient(180deg, rgba(110,198,255,0.35), rgba(30,30,68,0.72));
  border-color: #fff;
  animation: comboPulse 500ms ease-out infinite alternate;
}
#hud .pill.combo.active .value { color: #e8f6ff; }
@keyframes comboPulse {
  0%   { transform: scale(1);    box-shadow: 0 6px 0 rgba(0,0,0,0.35), 0 0 0 rgba(110,198,255,0); }
  100% { transform: scale(1.06); box-shadow: 0 6px 0 rgba(0,0,0,0.35), 0 0 40px rgba(110,198,255,0.8); }
}

/* ---------- Floating popup text layer ---------- */
#popups {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 8;
}
.popup {
  position: absolute;
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 84px;
  color: var(--honey);
  text-shadow:
    -4px 0 0 var(--navy-deep),
    4px 0 0 var(--navy-deep),
    0 -4px 0 var(--navy-deep),
    0 4px 0 var(--navy-deep),
    0 10px 0 rgba(0,0,0,0.35);
  transform: translate(-50%, -50%);
  animation: rise 800ms ease-out forwards;
  white-space: nowrap;
}
.popup.miss { color: var(--miss); }
@keyframes rise {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  15%  { opacity: 1; transform: translate(-50%, -55%) scale(1.15); }
  80%  { opacity: 1; transform: translate(-50%, -90%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.9); }
}

/* Tap splash ring (spawned in #popups at tap location) */
.splash {
  position: absolute;
  width: 80px; height: 80px;
  margin-left: -40px; margin-top: -40px;
  border-radius: 50%;
  border: 10px solid rgba(200,235,255,0.95);
  box-shadow: 0 0 24px rgba(110,198,255,0.8);
  pointer-events: none;
  animation: splashRing 520ms ease-out forwards;
}
@keyframes splashRing {
  0%   { transform: scale(0.3); opacity: 1; border-width: 14px; }
  100% { transform: scale(2.6); opacity: 0; border-width: 1px;  }
}

/* ---------- Bee Boy mascot ---------- */
#mascot {
  position: absolute;
  bottom: 40px; right: 40px;
  width: 300px; height: 300px;
  z-index: 7;
  pointer-events: none;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.55));
  transition: transform 200ms ease-out;
}
#mascot img { width: 100%; height: 100%; object-fit: contain; }
#mascot.pop { animation: mascotPop 320ms ease-out; }
@keyframes mascotPop {
  0%   { transform: scale(1) rotate(0); }
  40%  { transform: scale(1.18) rotate(-4deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- Level-up banner ---------- */
#levelUp {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 140px;
  color: var(--honey);
  text-shadow:
    -6px 0 0 var(--navy-deep),
    6px 0 0 var(--navy-deep),
    0 -6px 0 var(--navy-deep),
    0 6px 0 var(--navy-deep),
    0 16px 0 rgba(0,0,0,0.45);
  letter-spacing: 4px;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  z-index: 9;
}
#levelUp.show { animation: levelBanner 1400ms ease-out forwards; }
@keyframes levelBanner {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  40%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

/* ---------- Screens (title / game over) ---------- */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse at center, rgba(60,60,120,0.92) 0%, rgba(30,30,68,0.96) 100%);
  z-index: 10;
  padding: 80px;
  overflow-y: auto;
}
.screen.show { display: flex; }

.screen .bigLogo {
  font-family: "Luckiest Guy", sans-serif;
  font-size: 56px;
  color: var(--honey);
  letter-spacing: 4px;
  text-shadow: 0 6px 0 var(--navy-deep);
  margin-bottom: 30px;
}
.screen h1 {
  font-family: "Luckiest Guy", sans-serif;
  font-size: 160px;
  line-height: 0.95;
  margin: 0 0 20px;
  color: var(--honey);
  text-shadow:
    -6px 0 0 var(--navy-deep),
    6px 0 0 var(--navy-deep),
    0 -6px 0 var(--navy-deep),
    0 6px 0 var(--navy-deep),
    0 14px 0 rgba(0,0,0,0.45);
  letter-spacing: 3px;
}
.screen h1 .small { display: block; font-size: 80px; color: var(--honey-lt); }
.screen p {
  font-size: 44px;
  margin: 14px 0;
  font-weight: 600;
}
.screen p .hi { color: var(--honey); font-family: "Luckiest Guy", sans-serif; letter-spacing: 2px; }

.screen .beeBig {
  width: 420px; height: 420px;
  object-fit: contain;
  margin: 10px 0 20px;
  filter: drop-shadow(0 20px 30px rgba(0,0,0,0.5));
  animation: hover 2200ms ease-in-out infinite;
}
@keyframes hover {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-18px) rotate(2deg); }
}

/* ---------- Buttons ---------- */
/* Works for both <button> and <a> elements — the text-decoration + display
   rules below make anchors behave like proper buttons. */
.btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  margin-top: 50px;
  padding: 40px 100px;
  background: linear-gradient(180deg, var(--honey-lt) 0%, var(--honey) 60%, var(--honey-dk) 100%);
  color: var(--navy-deep);
  border: 6px solid var(--navy-deep);
  border-radius: 999px;
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 64px;
  letter-spacing: 3px;
  box-shadow: 0 14px 0 var(--navy-deep), 0 20px 30px rgba(0,0,0,0.4);
  min-width: 520px; min-height: 140px;
}
.btn:active { transform: translateY(8px); box-shadow: 0 6px 0 var(--navy-deep), 0 10px 20px rgba(0,0,0,0.4); }
.btn.secondary {
  font-size: 42px;
  padding: 26px 70px;
  min-height: 90px;
  min-width: 420px;
  margin-top: 28px;
  background: linear-gradient(180deg, #fff 0%, #dcdcf0 100%);
}

.tag {
  font-size: 30px;
  opacity: 0.85;
  margin-top: 50px;
  color: var(--honey-lt);
  letter-spacing: 2px;
}

/* ---------- High score display ---------- */
.highScore {
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 46px;
  color: var(--honey);
  letter-spacing: 3px;
  text-shadow: 0 5px 0 var(--navy-deep), 0 0 24px rgba(240,200,100,0.6);
  margin: 8px 0 0;
}
.highScore.hidden { display: none; }

.newHigh {
  display: none;
  font-family: "Luckiest Guy", "Fredoka", sans-serif;
  font-size: 62px;
  color: var(--honey);
  letter-spacing: 4px;
  text-shadow:
    -4px 0 0 var(--navy-deep),
    4px 0 0 var(--navy-deep),
    0 -4px 0 var(--navy-deep),
    0 4px 0 var(--navy-deep),
    0 0 40px rgba(240,200,100,0.95);
  margin: 10px 0;
}
.newHigh.show {
  display: block;
  animation: newHighPulse 900ms ease-in-out infinite alternate;
}
@keyframes newHighPulse {
  0%   { transform: scale(1);    filter: brightness(1); }
  100% { transform: scale(1.1);  filter: brightness(1.35); }
}

/* ---------- Public leaderboard ---------- */
/* Used by both the game title screen (inside the 1080x1920 virtual canvas)
   and by the gallery home page — so min-width is 0 with a max-width cap,
   letting the host layout decide how wide. Width hint below matches the
   in-game look without breaking mobile. */
.leaderboard {
  margin: 20px auto 10px;
  width: min(100%, 720px);
  background: rgba(30,30,68,0.72);
  border: 4px solid var(--honey);
  border-radius: 24px;
  padding: 20px 32px 24px;
  box-sizing: border-box;
  box-shadow: 0 8px 0 rgba(0,0,0,0.35);
}
.leaderboard h3 {
  margin: 0 0 14px;
  font-family: "Luckiest Guy", sans-serif;
  font-size: 38px;
  color: var(--honey);
  letter-spacing: 3px;
  text-shadow: 0 3px 0 var(--navy-deep);
}
.leaderboard ol {
  list-style: none;
  margin: 0; padding: 0;
}
.leaderboard li {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 6px 4px;
  font-size: 32px;
  color: var(--white);
  border-bottom: 2px solid rgba(240,200,100,0.15);
}
.leaderboard li:last-child { border-bottom: none; }
.leaderboard li .rank {
  font-family: "Luckiest Guy", sans-serif;
  color: var(--honey-lt);
  text-align: right;
}
.leaderboard li .ini {
  font-family: "Luckiest Guy", sans-serif;
  letter-spacing: 4px;
  color: var(--white);
}
.leaderboard li .pts {
  font-family: "Luckiest Guy", sans-serif;
  color: var(--honey);
  justify-self: end;
}
.leaderboard .empty {
  font-size: 26px;
  color: var(--honey-lt);
  opacity: 0.7;
  padding: 18px 4px;
}

/* ---------- Initials entry (game over) ---------- */
.initialsEntry {
  margin: 20px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.initialsEntry label {
  font-family: "Luckiest Guy", sans-serif;
  font-size: 38px;
  color: var(--honey-lt);
  letter-spacing: 3px;
  text-shadow: 0 4px 0 var(--navy-deep);
}
.initialsEntry input {
  width: 280px;
  font-family: "Luckiest Guy", sans-serif;
  font-size: 100px;
  letter-spacing: 18px;
  text-align: center;
  text-transform: uppercase;
  color: var(--honey);
  background: rgba(30,30,68,0.82);
  border: 6px solid var(--honey);
  border-radius: 20px;
  padding: 14px 24px 8px 38px;  /* extra left padding to visually offset letter-spacing */
  outline: none;
  box-shadow: 0 8px 0 rgba(0,0,0,0.45), inset 0 4px 10px rgba(0,0,0,0.4);
}
.initialsEntry input:focus { border-color: var(--white); }
.initialsEntry.hidden { display: none; }

.submitStatus {
  min-height: 40px;
  font-size: 32px;
  color: var(--honey-lt);
  margin: 6px 0 0;
  letter-spacing: 2px;
}
.submitStatus.ok  { color: var(--hit); }
.submitStatus.err { color: var(--miss); }
