/* ============================================================
   VALERIA THE FORTUNE TELLER — valeria.css
   ============================================================ */

@font-face {
  font-family: 'Showboat';
  src: url('font-library/Showboat.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Visibility utility ───────────────────────────────────── */
/* This is the ONLY place display:none lives for game elements */
.hidden { display: none !important; }

/* ── Body ────────────────────────────────────────────────── */
body {
  font-family: 'Showboat', sans-serif;
  color: rgb(42, 1, 1);
  text-shadow: 0 0 23px #f4bd1a;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f8e9d2;
  background-image:
    url('images/folk-pattern.png'),
    radial-gradient(circle, #f8e9d2, #e6d0b1);
  background-blend-mode: overlay;
  overflow-x: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  background-image: url('images/banner.png');
  background-size: cover;
  background-position: center;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.header-content h1 {
  color: rgb(14, 8, 1);
  font-size: clamp(1.8rem, 5vw, 4rem);
  text-shadow: 0 0 16px #ffd700;
  font-family: 'Showboat', sans-serif;
  font-weight: normal;
}

/* ── Main ────────────────────────────────────────────────── */
.main-content {
  flex-grow: 1;
  padding-top: 110px;
  padding-bottom: 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background-image: url('images/background.png');
  background-size: cover;
  background-position: center;
}

/* ── Game Container ──────────────────────────────────────── */
#game-container {
  position: relative;
  width: min(400px, 90vw);
  aspect-ratio: 2 / 3;
  margin: 0 auto 24px;
  background: #222;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* ── Machine ─────────────────────────────────────────────── */
#machine {
  position: absolute;
  inset: 0;
}

#fortune-machine {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* ── Curtains ────────────────────────────────────────────── */
#curtain {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
}

#left-curtain, #right-curtain {
  position: absolute;
  width: 50%; height: 55%;
  background-image: url('images/curtain.png');
  background-size: 200% 100%;
  background-repeat: no-repeat;
  z-index: 15;
}
#left-curtain  { left: 0; top: 0; }
#right-curtain { right: 0; top: 0; }

/* ── Image container ─────────────────────────────────────── */
/* No display:none here — .hidden class controls visibility */
#image-container {
  position: absolute;
  top: 8%; left: 10%;
  width: 80%; height: 48%;
  z-index: 30;
  overflow: hidden;
  border-radius: 8px;
  display: block;
}

.revealed-image {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  object-fit: contain;
  display: none;
}

/* ── Crystal ball button ─────────────────────────────────── */
/* No display:none here — .hidden class controls visibility */
#play-game {
  position: absolute;
  left: 50%; top: 25%;
  transform: translateX(-50%);
  width: 40%;
  aspect-ratio: 1;
  z-index: 100;
  cursor: pointer;
  display: block;
}

.crystal-ball {
  position: relative;
  width: 100%; height: 100%;
}

.crystal-ball::before {
  content: "PLAY";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.85);
  font-size: clamp(0.8rem, 3.5vw, 1.6rem);
  font-weight: bold;
  z-index: 10;
  text-shadow: 0 0 10px rgba(0,195,255,0.8);
  pointer-events: none;
}

.glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
    rgba(139,214,255,0.7) 0%,
    rgba(83,203,241,0.5) 40%,
    rgba(0,138,255,0.2) 60%,
    rgba(0,84,147,0.1) 80%,
    transparent 100%);
  border-radius: 50%;
  box-shadow:
    0 0 60px 20px rgba(0,195,255,0.3),
    inset 0 0 40px rgba(0,195,255,0.4);
  animation: glowPulse 4s infinite alternate;
  z-index: 2;
}

@keyframes glowPulse {
  from { opacity:0.7; box-shadow: 0 0 60px 20px rgba(0,195,255,0.3), inset 0 0 40px rgba(0,195,255,0.4); }
  to   { opacity:0.9; box-shadow: 0 0 80px 30px rgba(0,195,255,0.5), inset 0 0 60px rgba(0,195,255,0.6); }
}

.base {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 40%; height: 12%;
  background: linear-gradient(to bottom, #444, #222);
  border-radius: 8px 8px 4px 4px;
  z-index: 1;
}

.shadow {
  position: absolute;
  bottom: -5%; left: 50%;
  transform: translateX(-50%);
  width: 50%; height: 8%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.4) 0%, transparent 70%);
}

/* ── Coin mechanism ──────────────────────────────────────── */
.coin-mechanism {
  position: absolute;
  left: 6%; top: 65%;
  width: 26%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#coin-slot {
  width: 100%;
  aspect-ratio: 1 / 1.7;
  background: linear-gradient(to right, #b8860b, #ffd700, #b8860b);
  border-radius: 8px;
  border: 3px solid #8b5e3c;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  position: relative;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

#coin-slot::after {
  content: '';
  position: absolute;
  top: 15%; left: 50%;
  transform: translateX(-50%);
  width: 55%; height: 6%;
  background: #000;
  border-radius: 4px;
}

.coin-slot-hover,
#coin-slot:hover {
  box-shadow: 0 0 20px #ffd700, inset 0 0 10px rgba(0,0,0,0.5) !important;
}

/* ── Penny ───────────────────────────────────────────────── */
#penny {
  width: 75%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 35% 35%, #f48003, #8b5e3c);
  border-radius: 50%;
  margin-top: 10%;
  border: 2px solid #8b5e3c;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2f0404;
  font-weight: bold;
  font-size: clamp(0.55rem, 2.2vw, 0.95rem);
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#penny:hover, #penny:active {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

/* ── Penny hint ──────────────────────────────────────────── */
#penny-hint {
  font-family: 'Showboat', sans-serif;
  font-size: clamp(0.4rem, 1.8vw, 0.65rem);
  color: #fff;
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
  margin-top: 4%;
  opacity: 0.85;
  pointer-events: none;
}

/* ── Fortune scroll ──────────────────────────────────────── */
/* No display:none here — .hidden class controls visibility */
#fortune-scroll {
  position: absolute;
  bottom: 6%; left: 50%;
  transform: translateX(-50%);
  width: 64%;
  max-height: 36%;
  background: #8d8461;
  color: #3c2a1f;
  padding: 4% 5%;
  border: 3px solid #5d3f28;
  z-index: 40;
  border-radius: 10px;
  font-family: 'StyleScript', Georgia, serif;
  font-size: clamp(10px, 2.2vw, 15px);
  line-height: 1.5;
  text-align: justify;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  overflow-y: auto;
  display: block;
}

.signature {
  font-size: clamp(11px, 2.5vw, 18px);
  color: #3c2a1f;
  text-align: left;
  padding-top: 6%;
  display: block;
  font-style: italic;
}

/* ── Scroll slot ─────────────────────────────────────────── */
#scroll-slot {
  position: absolute;
  bottom: 15%; left: 50%;
  transform: translateX(-50%);
  width: 28%; height: 2%;
  background: goldenrod;
  border-radius: 4px;
  z-index: 30;
}

/* ── Play Again button ───────────────────────────────────── */
/* No display:none here — .hidden class controls visibility */
.reset-button {
  position: absolute;
  bottom: 1.5%; left: 50%;
  transform: translateX(-50%);
  background-color: #cf65a0;
  color: white;
  font-size: clamp(0.55rem, 2vw, 0.85rem);
  font-family: 'StyleScript', Georgia, serif;
  padding: 2.5% 5%;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 48%;
  z-index: 50;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  transition: background-color 0.3s ease;
  white-space: nowrap;
  display: block;
}

.reset-button:hover { background-color: #218838; }

/* ── Back to Arcade ──────────────────────────────────────── */
.arcade-button-container {
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.back-button {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kaleidoscope-button.large {
  width: clamp(110px, 28vw, 220px);
  height: clamp(110px, 28vw, 220px);
  filter: drop-shadow(0 0 10px rgba(255,105,180,0.7));
  transition: all 0.3s ease;
}

.kaleidoscope-button.large:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 15px rgba(255,105,180,0.9));
}

.button-label {
  margin-top: 10px;
  font-weight: bold;
  color: #3c2a1f;
  font-size: clamp(1rem, 3vw, 1.8rem);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background-color: #eaaf0c;
  color: #ee076b;
  font-family: 'Showboat', sans-serif;
  font-size: clamp(0.7rem, 2vw, 1rem);
  text-shadow: 0 0 13px #edece7;
  padding: 4px 0;
  text-align: center;
  position: fixed;
  left: 0; bottom: 0;
  width: 100%;
  z-index: 1000;
}

/* ── Landscape ───────────────────────────────────────────── */
@media screen and (max-height: 600px) and (orientation: landscape) {
  header { height: 55px; }
  .main-content {
    padding-top: 65px;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
  }
  #game-container { width: min(260px, 42vw); }
  .arcade-button-container { margin: 0; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .glow { animation: none; }
}
