@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --text: #F5F5F5;
  --muted: rgba(255,255,255,.8);
  --line: rgba(255,255,255,.15);
  --app-scale: 1;
  --result-offset: 0%;
  --app-offset: 0px;
  --shiny-opacity: 1;
}

/* Base */
body {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  background: #000;
  color: var(--text);
  text-align: center;
  font-size: 12px;
}
h1, h2, h3, p, footer, button, a {
  font-family: 'Press Start 2P', monospace !important;
  text-transform: uppercase;
  text-shadow: 2px 2px 1px rgba(0,0,0,0.75);
}
h1 { font-size: 20px; margin: 20px 0; }
h2 { font-size: 35px; margin: 16px 0; }
p  { font-size: 28px; margin: 20px 0; }
footer { font-size: 10px; }

/* Background */
.bg { position: fixed; inset: 0; z-index: -20; }
.bg-img {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0,0,0,0.15), rgba(0,0,0,.3)),
    url('/bg/mylovebot-bg.jpg') center/cover no-repeat;
}

/* Stage and Frame (linked scaling) */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding-bottom: 60px;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.stage * { pointer-events: auto; }

.frame {
  position: absolute;
  inset: 0;
  background: url('/frame/frame.png') center/contain no-repeat;
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}

/* App inside frame (scales together) */
.wrap {
  position: relative;
  z-index: 2;
  max-width: 600px;
  width: 80%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translateY(var(--app-offset, 0px)) scale(var(--app-scale, 1));
  transition: transform 0.3s ease-in-out;
}
.wrap * { pointer-events: auto; }

/* Footer */
.site-footer {
  margin-top: -100px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.8;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.7);
  text-align: center;
  z-index: 2;
  position: relative;
}

/* Cards */
.card { background: transparent; padding: 16px; margin-top: 20px; }

/* Logo */
.logo {
  display: block;
  margin: 0 auto 30px;
  max-width: 800px;
  width: 140%;
}

/* Question prompt */
.card h2 {
  font-size: 35px !important;
  margin: 24px 0;
}

/* Question grid */
.qgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
  justify-items: center;
}
.qbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('/buttons/question.png') no-repeat center/cover;
  border: none;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  width: 150%;
  max-width: 400px;
  aspect-ratio: 840 / 382;
  transform: translateY(-5%);
  margin: 0 auto;
  position: relative;
}
.qbtn span { transform: translateY(-6px); }
.qbtn:hover { filter: brightness(1.15); }

/* Stream / Share / Retry buttons */
.sgrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
@media (max-width: 600px) {
  .sgrid { grid-template-columns: 1fr; }
}
.stream-btn,
.share-btn,
.retry-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  width: 300px;
  max-width: 130%;
  aspect-ratio: 2654 / 812;
  border: none;
  background-size: cover;
  background-position: center;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.stream-btn span,
.share-btn span,
.retry-btn span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
}
.stream-btn:hover,
.share-btn:hover,
.retry-btn:hover { filter: brightness(1.15); }
.share-btn { background: url('/buttons/share.png') no-repeat center/cover; }
.retry-btn { background: url('/buttons/tryagain.png') no-repeat center/cover; }

/* Generating screen */
.generating {
  font-size: 16px;
  line-height: 1.4;
  color: #adffe1;
  background: rgba(0,0,0,0.8);
  padding: 16px 20px;
  border: 1px solid #00ff88;
  border-radius: 6px;
  display: inline-block;
  margin-top: 20px;
  box-shadow:
    0 0 12px rgba(0,255,136,0.35),
    inset 0 0 10px rgba(0,255,136,0.25);
  text-align: left;
}
.generating span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  border-right: 2px solid #00ff88;
  width: 0;
  animation: typing 1.5s steps(30, end) forwards, blink 0.7s step-end infinite;
}
.generating span:nth-child(1) { animation-delay: 0s, 0s; }
.generating span:nth-child(2) { animation-delay: 1.6s, 1.6s; }
.generating span:nth-child(3) { animation-delay: 3.2s, 3.2s; }

@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blink { 50% { border-color: transparent; } }

/* Character result card */
.result-card {
  transform: scale(0.85) translateY(var(--result-offset, 0));
  transform-origin: top center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-height: 90vh;
  overflow: visible;
}
.botimg {
  display: block;
  margin: 0 auto 12px;
  width: 16%;
  max-width: 120px;
}

/* Player bar */
.player-bar {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: 40px;
  background: rgba(173, 216, 230, 0.2);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 9px;
  z-index: 10000;
  pointer-events: auto;
  transition: background 0.2s ease;
}
.player-bar:hover { background: rgba(173, 216, 230, 0.35); }
.player-btn {
  background: rgba(173,216,230,0.25);
  border: 1px solid rgba(173,216,230,0.4);
  border-radius: 4px;
  color: #ADD8E6;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  transition: background 0.2s ease, border 0.2s ease;
}
.player-btn:hover {
  background: rgba(173,216,230,0.4);
  border-color: rgba(173,216,230,0.6);
}
.player-progress {
  flex: 1;
  height: 6px;
  background: rgba(173,216,230,0.25);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
#progressFill {
  height: 100%;
  width: 0%;
  background: #ADD8E6;
  box-shadow: 0 0 10px #ADD8E6, 0 0 20px #ADD8E6;
}
.player-time {
  margin-left: 60px;
  margin-right: 50px;
  flex-shrink: 0;
  color: #ADD8E6;
}

/* Share modal */
.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.share-modal img {
  width: 400px;
  height: auto;
  border: none;
  border-radius: 0;
  box-shadow: 0 0 2px #000;
  cursor: pointer;
}

/* Shiny effects */
.shiny-glow {
  animation: shinyPulse 1.5s infinite;
  filter: drop-shadow(0 0 12px rgba(255,255,255,var(--shiny-opacity)))
          drop-shadow(0 0 30px rgba(255,255,255,var(--shiny-opacity)))
          drop-shadow(0 0 50px rgba(255,255,255,var(--shiny-opacity)));
}
@keyframes shinyPulse {
  0%,100% { filter: drop-shadow(0 0 10px rgba(255,255,255,var(--shiny-opacity)))
                   drop-shadow(0 0 25px rgba(255,255,255,var(--shiny-opacity)))
                   drop-shadow(0 0 40px rgba(255,255,255,var(--shiny-opacity))); }
  50% { filter: drop-shadow(0 0 25px rgba(255,255,255,var(--shiny-opacity)))
                 drop-shadow(0 0 50px rgba(255,255,255,var(--shiny-opacity)))
                 drop-shadow(0 0 80px rgba(255,255,255,var(--shiny-opacity))); }
}
.frame.shiny-frame { animation: framePulse 1.5s infinite; }
@keyframes framePulse {
  0%,100% { filter: drop-shadow(0 0 10px rgba(255,255,255,var(--shiny-opacity)))
                   drop-shadow(0 0 20px rgba(255,255,255,var(--shiny-opacity))); }
  50% { filter: drop-shadow(0 0 40px rgba(255,255,255,var(--shiny-opacity)))
                 drop-shadow(0 0 80px rgba(255,255,255,var(--shiny-opacity))); }
}

/* Mobile fixes */
@media (max-width: 768px) {
  .frame { display: none !important; }
  body { font-size: 10px; }
  h1 { font-size: 14px; margin: 12px 0; }
  h2 { font-size: 18px !important; margin: 12px 0; }
  p  { font-size: 14px; margin: 12px 0; }
  .logo { max-width: 250px; margin-bottom: 20px; }
  .wrap { width: 95%; padding: 10px; transform: none; }
  .qgrid { grid-template-columns: 1fr; gap: 16px; }
  .qbtn { font-size: 16px; width: 100%; max-width: 260px; aspect-ratio: 840 / 382; transform: none; }
  .sgrid { grid-template-columns: 1fr; gap: 12px; }
  .stream-btn, .share-btn, .retry-btn { width: 200px; font-size: 12px; max-width: 100%; }
  .result-card { transform: scale(0.75); margin-top: 200px; }
  .botimg { width: 30%; max-width: 100px; }
  .site-footer { margin-top: 10px; font-size: 9px; }
  .player-bar { height: 36px; font-size: 8px; padding: 4px 8px; }
  .player-time { margin-left: 20px; margin-right: 20px; }
}
