/* Body & background */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 20px;
    text-align: center;
    color: white;
    overflow-x: hidden;
    background: linear-gradient(-45deg, #ff6a00, #ee0979, #8e2de2, #4a00e0);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {background-position:0% 50%;}
    50% {background-position:100% 50%;}
    100% {background-position:0% 50%;}
}

/* Container cards */
.card {
    background: rgba(0,0,0,0.5);
    border-radius: 25px;
    padding: 20px;
    margin: 20px auto;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/* Buttons */
.btn {
    padding: 12px 25px;
    margin: 10px 5px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    background: linear-gradient(45deg, #ff6a00, #ee0979);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* Hidden */
.hidden { display: none; }

/* Stats bars */
.stats { text-align: left; margin-top: 20px; }
.stat { margin-bottom: 15px; }
.stat span { font-weight: bold; display: block; margin-bottom: 5px; }

.bar {
    background: rgba(255,255,255,0.2);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.bar div {
    width: 0%;
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease;
}

#moneyBar { background: linear-gradient(90deg,#00ff00,#00cc00); }
#stressBar { background: linear-gradient(90deg,#ff0000,#cc0000); }
#focusBar { background: linear-gradient(90deg,#0000ff,#0000cc); }
#loveBar { background: linear-gradient(90deg,#ff69b4,#ff1493); }
#luckBar { background: linear-gradient(90deg,#ffff00,#cccc00); color:black; }
#confidenceBar { background: linear-gradient(90deg,#800080,#4b0082); }

/* Emoji container */
#emoji-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}
.emoji {
    position: absolute;
    font-size: 20px;
    animation: float 10s linear infinite;
    opacity: 0.8;
}

@keyframes float {
    0% {transform: translateY(100vh) scale(0.5);}
    50% {opacity:1;}
    100% {transform: translateY(-10vh) scale(1);}
}

/* ✅ Mobile-friendly base */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
}

/* Your main container/card (adjust class name if yours is different) */
.container, .card, .box, .main {
  width: min(95vw, 520px);
  margin: 16px auto;
  padding: 16px;
}

/* Inputs & selects */
input, select, textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px;
  font-size: 16px; /* prevents zoom on iPhone */
  border-radius: 10px;
}

/* Buttons */
button, .btn {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 12px;
  margin-top: 10px;
}

/* Bar container */
.bar {
  width: 100%;
  overflow: hidden;
}

/* Results text wrapping */
h1, h2, h3, p, span {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* ✅ Make layouts stack nicely on small screens */
@media (max-width: 600px) {
  body { padding: 10px; }

  .stats, .row, .grid {
    display: block !important;
  }

  /* If you have multiple buttons side-by-side, they’ll stack */
  .btn-row, .buttons, .actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
}

.ad-slot {
  margin: 12px auto 20px;
  padding: 10px;
  max-width: 320px;
  border-radius: 12px;
  text-align: center;
}

.ad-label {
  display: block;
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 6px;
}

.ad-box {
  display: flex;
  justify-content: center;
}

.ad-slot {
  margin: 20px auto;
  text-align: center;
}
.ad-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}
.ad-box {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
}

/* ✅ Overlay (Analyzing Screen) */
.hidden { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.overlay-card {
  width: min(92vw, 420px);
  border-radius: 18px;
  padding: 18px 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 35px rgba(0,0,0,0.25);
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.spinner {
  width: 44px;
  height: 44px;
  border: 5px solid rgba(0,0,0,0.12);
  border-top-color: rgba(0,0,0,0.6);
  border-radius: 50%;
  margin: 8px auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.mini-progress {
  width: 100%;
  height: 10px;
  background: rgba(0,0,0,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px;
}

.mini-progress-bar {
  width: 0%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.muted { opacity: 0.75; }
.tiny { font-size: 12px; }

/* ✅ Story results */
.story-results {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.story-card {
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  animation: fadeUp 0.35s ease both;
}

@keyframes fadeUp {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.story-title {
  font-weight: 700;
}

.story-score {
  font-weight: 800;
}

.story-bar {
  height: 10px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.18);
}

.story-bar > div {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  transition: width 0.6s ease;
}

/* ✅ Badge */
.badge-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.10);
}

.badge-title {
  font-weight: 900;
  font-size: 18px;
}

.badge-sub {
  margin-top: 4px;
  opacity: 0.8;
}

/* ✅ Challenge card */
.challenge-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.08);
}

.btn.secondary {
  margin-top: 10px;
  width: 100%;
}

/* ✅ Mobile polish */
@media (max-width: 600px) {
  .overlay-card { padding: 16px 14px; }
}

.story-card { border: 3px solid red; }

.bottom-ad {
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 14px;
}
.bottom-ad .ad-box {
  display: flex;
  justify-content: center;
}
