/* ==========================================================================
   SEEDRUN — style.css
   Visual language: a bright, bouncy playground for kids. A sunny sky sits
   behind a friendly white "storybook" console with thick candy-colored
   borders and big, tappable buttons — every biome the generator produces
   still paints its own canvas world, so the chrome around it stays cheerful
   and consistent no matter what video was pasted in.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --sky-top:    #7fd7ff;
  --sky-bottom: #3aa9f0;
  --card:       #ffffff;
  --card-line:  #eaf2ff;
  --ink:        #24314f;
  --ink-soft:   #6c7a99;

  --sun:        #ffb703;   /* views / coins / warm highlight */
  --leaf:       #34d17c;   /* go / primary action */
  --coral:      #ff6b6b;   /* danger / dislikes / hearts */
  --grape:      #8c5cff;   /* energy boost / magic */
  --sky-accent: #2ec4f1;   /* links / interactive */

  --font-display: 'Baloo 2', 'Comic Sans MS', cursive, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Soft floating cloud shapes behind the stage for a playful feel */
#app::before,
#app::after {
  content: "";
  position: absolute;
  z-index: 1;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}
#app::before { width: 220px; height: 70px; top: 8%; left: 6%; box-shadow: 60px 20px 0 -6px rgba(255,255,255,0.4); }
#app::after  { width: 160px; height: 54px; bottom: 10%; right: 8%; box-shadow: -50px -10px 0 -4px rgba(255,255,255,0.35); }

/* --------------------------------------------------------------------- */
/* Stage / canvas                                                        */
/* --------------------------------------------------------------------- */
#stage {
  position: relative;
  z-index: 2;
  width: 960px;
  max-width: 100vw;
  height: 540px;
  max-height: 100vh;
  background: #000;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 0 0 8px #ffffff, 0 0 0 12px var(--sun), 0 30px 60px -20px rgba(20,40,80,0.45);
}

@media (min-aspect-ratio: 16/9) {
  #stage { height: 100vh; width: calc(100vh * 16 / 9); border-radius: 0; box-shadow: none; }
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* --------------------------------------------------------------------- */
/* Panels shared look                                                    */
/* --------------------------------------------------------------------- */
.panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
  z-index: 20;
  padding: 24px;
  text-align: center;
}
.panel.hidden { display: none; }

.console {
  width: min(440px, 100%);
  border: 5px solid var(--card-line);
  background: var(--card);
  border-radius: 26px;
  padding: 28px 24px;
  box-shadow: 0 16px 0 -6px rgba(20,40,80,0.15), 0 20px 40px rgba(20,40,80,0.25);
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 0.5px;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.2;
  text-shadow: 3px 3px 0 var(--card-line);
}
.logo span { color: var(--coral); }

.tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--sky-accent);
  margin: 0 0 24px;
}

.field-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#videoInput {
  flex: 1;
  min-width: 0;
  background: #f3f8ff;
  border: 3px solid var(--card-line);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  outline: none;
}
#videoInput::placeholder { color: #a9b6cf; font-weight: 600; }
#videoInput:focus { border-color: var(--sky-accent); }

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  border: none;
  background: #eef4ff;
  color: var(--ink);
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 4px 0 #d3e0f7;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d3e0f7; }

.btn-primary {
  width: 100%;
  background: var(--leaf);
  color: #ffffff;
  font-size: 16px;
  padding: 15px 16px;
  margin-bottom: 10px;
  box-shadow: 0 5px 0 #1fa85c;
}
.btn-primary:active { box-shadow: 0 1px 0 #1fa85c; }

.btn-secondary {
  width: 100%;
  background: #fff4de;
  color: #b5690a;
  margin-bottom: 4px;
  box-shadow: 0 4px 0 #f2d8a1;
}
.btn-secondary:active { box-shadow: 0 1px 0 #f2d8a1; }

.error-msg {
  color: var(--coral);
  font-weight: 700;
  font-size: 12px;
  min-height: 16px;
  margin: -4px 0 10px;
}

.divider {
  border: none;
  border-top: 3px dashed var(--card-line);
  margin: 18px 0 12px;
}

.recent-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
  text-align: left;
  margin: 0 0 8px;
}

#recentList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
}
#recentList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 12px;
  background: #f3f8ff;
  border: 2px solid var(--card-line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}
#recentList li:hover { border-color: var(--sky-accent); }
#recentList li .rid { color: var(--ink); font-family: var(--font-body); }
#recentList li .rtime { color: #d68a00; font-variant-numeric: tabular-nums; }
#recentList .empty { color: var(--ink-soft); justify-content: center; cursor: default; font-weight: 600; }
#recentList .empty:hover { border-color: var(--card-line); }

/* --------------------------------------------------------------------- */
/* Decoding panel                                                        */
/* --------------------------------------------------------------------- */
#decodePanel .logo { font-size: 22px; margin-bottom: 24px; color: #ffffff; text-shadow: 3px 3px 0 rgba(0,0,0,0.12); }
.decode-bar {
  width: 280px;
  max-width: 80vw;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.35);
}
.decode-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sun), var(--coral));
  animation: decodeFill 1.4s cubic-bezier(.2,.9,.3,1) forwards;
}
@keyframes decodeFill { to { width: 100%; } }

.decode-label {
  margin-top: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
}
.decode-seed {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  font-family: 'Nunito', monospace;
}

/* --------------------------------------------------------------------- */
/* HUD                                                                    */
/* --------------------------------------------------------------------- */
#hud {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  font-family: var(--font-body);
}
#hud.hidden { display: none; }

.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(to bottom, rgba(20,40,80,0.35), transparent);
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 0 rgba(20,40,80,0.15);
}
.hud-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.hud-chip.views .dot { background: var(--sun); }
.hud-chip.lives .dot { background: var(--coral); }
.hud-chip.timer .dot { background: var(--sky-accent); }
.hud-chip.energy .dot { background: var(--grape); }

.hud-group { display: flex; gap: 8px; flex-wrap: wrap; max-width: 70%; }

#pauseBtn {
  pointer-events: all;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  background: rgba(255,255,255,0.92);
  border: none;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(20,40,80,0.15);
}
#pauseBtn:active { transform: translateY(2px); box-shadow: none; }

.boss-bar-wrap {
  position: absolute;
  top: 58px; left: 50%;
  transform: translateX(-50%);
  width: 46%;
  min-width: 220px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.boss-bar-wrap.show { display: flex; }
.boss-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}
.boss-bar-track {
  width: 100%;
  height: 14px;
  background: rgba(255,255,255,0.4);
  border: 3px solid #ffffff;
  border-radius: 999px;
  overflow: hidden;
}
.boss-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--coral);
  transition: width 0.2s ease;
}

/* Energy boost banner */
.energy-banner {
  position: absolute;
  top: 58px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  background: var(--grape);
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(90,40,180,0.4);
  display: none;
  align-items: center;
  gap: 6px;
}
.energy-banner.show { display: flex; }

/* Touch controls */
#touchControls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 16px 18px;
  pointer-events: none;
}
#touchControls.show { display: flex; }
.touch-dpad, .touch-actions {
  display: flex;
  gap: 12px;
  pointer-events: all;
}
.touch-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  background: rgba(255,255,255,0.55);
  color: var(--ink);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  box-shadow: 0 4px 0 rgba(20,40,80,0.2);
}
.touch-btn:active, .touch-btn.active { background: var(--sun); border-color: #ffffff; transform: translateY(2px); box-shadow: none; }
#jumpBtn { width: 76px; height: 76px; font-size: 24px; background: rgba(52,209,124,0.5); }

/* --------------------------------------------------------------------- */
/* Pause / End panels                                                    */
/* --------------------------------------------------------------------- */
#pausePanel .console, #endPanel .console { width: min(380px, 100%); }
.panel-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  margin: 0 0 20px;
  color: var(--ink);
}
.panel-title.grade-S { color: var(--sun); }

.grade-badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 48px;
  margin: 6px 0 18px;
  color: var(--sun);
  text-shadow: 3px 3px 0 var(--card-line);
}

.stat-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.stat-list li {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 12px;
  background: #f3f8ff;
  border: 2px solid var(--card-line);
  border-radius: var(--radius-sm);
}
.stat-list li b { color: var(--sky-accent); font-weight: 800; }

.link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
#shareLink {
  flex: 1;
  min-width: 0;
  background: #f3f8ff;
  border: 2px solid var(--card-line);
  color: var(--ink-soft);
  font-size: 11px;
  padding: 11px;
  border-radius: var(--radius-sm);
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #ffffff;
  border: 3px solid var(--sun);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 999px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 6px 0 rgba(20,40,80,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.mini-note {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 10px;
}

/* --------------------------------------------------------------------- */
/* Confetti                                                               */
/* --------------------------------------------------------------------- */
.confetti-piece {
  position: absolute;
  z-index: 60;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall 1.4s ease-out forwards;
}
@keyframes confettiFall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), 220px) rotate(var(--rot)); opacity: 0; }
}

@media (max-width: 640px) {
  .console { padding: 22px 16px; }
  .logo { font-size: 26px; }
  #touchControls { display: flex; }
}
