html, body {
  min-height: 100vh;
  width: 100vw;
  background: #120e22;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}
.bg-orbs { position: fixed; left: 0; top: 0; width: 120vw; height: 140vh; min-width: 100vw; min-height: 100vh; z-index: 0; pointer-events: none; background: none !important; overflow: hidden; }
.bg-orbs .orb { position: absolute; border-radius: 80vw; opacity: 0.50; filter: blur(35px); mix-blend-mode: screen; will-change: transform; }
.bg-orbs .orb1 { width: 70vw; height: 70vw; left: 0; top: 0; background: #241356; transform: translate(0,0); animation: orbMove1 5s linear infinite alternate; }
.bg-orbs .orb2 { width: 85vw; height: 85vw; left: 20vw; top: 20vh; background: #003866; transform: translate(0,0); animation: orbMove2 7s linear infinite alternate; }
.bg-orbs .orb3 { width: 75vw; height: 60vw; left: 40vw; top: 40vh; background: #5f38ce; transform: translate(0,0); animation: orbMove3 9s linear infinite alternate; }
@keyframes orbMove1 { to { transform: translate(36vw, -16vh); } }
@keyframes orbMove2 { to { transform: translate(-26vw, 24vh); } }
@keyframes orbMove3 { to { transform: translate(-24vw, -20vh); } }
.landing, #card-page { min-height: 100vh; width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center; background: none !important; box-shadow: none !important; position: relative; z-index: 2; }
#name-page { min-height: 100vh; width: 100vw; display: flex; align-items: center; justify-content: center; background: none !important; box-shadow: none !important; position: relative; z-index: 2; }
.name-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; margin: 0; }
.page-title { font-family: 'Tangerine', cursive; font-size: 2rem; color: #f9f6ee; margin-top: 0; margin-bottom: 0.12em; text-align: center; text-shadow: 0 0 4px #282861, 0 0 16px #120e22, 0 1px 0 #000a; }
.name-input { margin-bottom: 0.17em; font-size: 1.45rem; padding: 0.5em 1.1em; border: 2px solid #d4b249; background: rgba(40,44,97,0.58); color: #fff; border-radius: 1.2em; text-align: center; width: 100%; max-width: 270px; }
.enter-mystic { margin: 0.13em auto 0 auto; font-family: 'Cinzel', serif; font-size: 2rem; font-weight: 700; letter-spacing: 0.14em; background: linear-gradient(90deg,#ffe66d 10%,#d4b249 54%,#f9ead8 95%); color: transparent; -webkit-background-clip: text; background-clip: text; text-shadow: 0 2px 18px #ffe66da0, 0 2px 12px #d4b24944; border-radius: 1em; cursor: pointer; border: none; outline: none; display: block; width: 96vw; max-width: 340px; filter: drop-shadow(0 8px 22px #d4b24955); transition: transform 0.11s; pointer-events: auto; touch-action: manipulation; z-index: 10; }
.main-title { font-family: 'Tangerine', cursive; font-size: 6rem; color: #f9f6ee; letter-spacing: 0.13em; text-align: center; text-shadow: 0 0 4px #282861, 0 0 16px #120e22, 0 3px 28px #282861B3, 0 1px 0 #000a; margin-top: 0; margin-bottom: 0.2em; line-height: 1.05; word-break: break-word; max-width: 98vw;}
.sub-header { font-family: 'Tangerine', cursive; font-size: 2.2rem; color: #f9f6ee; text-shadow: 0 0 4px #282861, 0 0 16px #120e22, 0 1px 14px #33336688, 0 1px 0 #000a; text-align: center; margin-bottom: 1rem; margin-top: 0; }
.start-mystic { font-family: 'Cinzel', serif !important; font-size: 2.2rem; font-weight:700; letter-spacing:0.14em; background: linear-gradient(90deg,#ffe66d 10%,#d4b249 54%,#f9ead8 95%); color: transparent; -webkit-background-clip: text; background-clip: text; text-shadow: 0 2px 18px #ffe66da0,0 2px 12px #d4b24944; border-radius: 1em; cursor: pointer; border: none; outline: none; transition: transform 0.11s; filter: drop-shadow(0 8px 22px #d4b24955); pointer-events: auto; touch-action: manipulation; }
.start-mystic:hover, .start-mystic:focus { transform: scale(1.07) rotate(-1deg);}
.dynamic-greeting { font-family: 'Tangerine', cursive; font-size: 2.1rem; color: #f9f6ee; text-align: center; margin-top: 0.6em; margin-bottom: 0.85em; padding-left: 2vw; padding-right: 2vw; text-shadow: 0 0 4px #282861, 0 0 12px #120e22, 0 1px 0 #000a; }
.pick-label { font-family: 'Cinzel', serif; color: #f9f6ee; text-shadow: 0 2px 12px #18145e29; font-size: 1.2rem; margin-bottom: 0.85em; letter-spacing: 0.08em; text-align: center; }
.shuffle-area { margin-bottom: 0.8em; display: flex; flex-direction: row; align-items: center; }
.shuffle-btn, .home-btn {
  font-size: 1.6em;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.12em 0.23em;
  color: #d4b249;
  filter: drop-shadow(0px 2px 7px #d4b24933);
  opacity: 0.8;
  outline: none;
  border-radius: 16px;
  box-shadow: none;
  transition: transform 0.11s, color 0.12s;
  margin-right: 0.5em;
}
.shuffle-btn:last-child, .home-btn:last-child {
  margin-right: 0;
}
.shuffle-btn:hover, .shuffle-btn:focus,
.home-btn:hover, .home-btn:focus {
  transform: scale(1.15);
  opacity: 1;
  border: none;
  box-shadow: none;
  color: #ffe66d;
}

/* --- ONLY THE CARD GRID PART (card-deck-inner) animates during shuffle --- */
.card-deck-wrapper { 
  width: 100%; display: flex; justify-content: center; align-items: center; 
  margin: 0 auto; padding: 0; box-sizing: border-box; 
}
.card-deck-inner {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.card-deck { 
  display: grid; 
  grid-template-columns: repeat(5, minmax(0, 1fr)); 
  grid-template-rows: repeat(2, 13vw); 
  column-gap: 1.1em;
  row-gap: 1em;
  margin: 0 auto; 
  padding: 0; 
  justify-items: center;
  align-items: center;
  box-sizing: border-box; 
  width: auto; 
  max-width: 96vw; 
}

.card-back {
  perspective: 1200px; width: 91%; height: 100%; aspect-ratio: 0.7 / 1; border-radius: 0;
  background: none;
  transition: transform 0.45s cubic-bezier(.58,.15,.31,1.13), box-shadow 0.22s, outline 0.18s;
  box-shadow: none; outline: none;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  border: none; cursor: pointer; will-change: transform;
}
.card-back:hover, .card-back:focus { box-shadow: 0 12px 33px #ffe66de0, 0 2px 8px #d4b249aa; outline: 4px solid #ffe66d; outline-offset: -4px; z-index: 12; transition: box-shadow 0.22s, outline 0.18s; }
.card-back.shuffling { transition: all 0.7s cubic-bezier(.53,1.57,.6,.91); z-index: 300 !important;}
.card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(.58,.15,.31,1.13); will-change: transform; }
.card-back.flipping .card-inner { transform: rotateY(180deg);}
.card-front, .card-message {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; /* Fills the card region always*/
  backface-visibility: hidden; border-radius: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card-front { background: url('https://i.imgur.com/Kqdo0o6.png') center center / cover no-repeat; z-index: 2; }

.card-message {
  background: #141b4d;
  color: #f9f6ee;
  font-family: 'Tangerine', cursive;
  font-size: 3.2vw;
  text-align: center;
  justify-content: center;
  align-items: center;
  padding: 0.8em 0.6em 0.7em 0.6em;
  z-index: 3;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  line-height: 1.23;
  box-sizing: border-box;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  max-height: 100%;
  overflow-y: auto;
}

.card-message span { width: 100%; display: block; word-break: break-word; }

.close-btn {
  position: absolute;
  top: 0.3em; right: 0.5em;
  background: none;
  border: none;
  color: #ffe66d;
  font-size: 2em;
  cursor: pointer;
  z-index: 20;
  filter: drop-shadow(0 1px 4px #120e22c2);
  transition: color 0.15s, transform 0.11s;
  padding: 0;
  margin: 0;
  outline: none;
}
.close-btn:hover, .close-btn:focus {
  color: #fff9d2;
  transform: scale(1.15) rotate(12deg);
}
.card-back.selected {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 222 !important;
  aspect-ratio: 0.7 / 1 !important;
  width: auto !important;
  height: min(88vh, calc(100vw * 1.43)) !important;
  min-width: 140px !important;
  min-height: 120px !important;
  max-width: 90vw !important;
  max-height: 88vh !important;
  transform: translate(-50%, -50%) scale(1.02) !important;
  transition: transform 0.7s cubic-bezier(.58,.15,.31,1.13), width 0.75s, height 0.75s, left 0.4s, top 0.4s;
}
.card-back.unselected { opacity: 0; pointer-events: none; transform: scale(0.9); transition: opacity 0.25s, transform 0.45s;}

@media (max-width: 700px) {
  .main-title { font-size: 2.8rem; max-width: 91vw; }
  .sub-header { font-size: 1.16rem; }
  .card-deck-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    box-sizing: border-box;
  }
  .shuffle-area {
    display: flex !important;
    justify-content: center !important;
    width: 100vw;
    padding: 0;
    margin: 0;
  }
  .card-deck-inner {
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
  }
  .card-deck {
    display: grid !important;
    width: 100vw !important;
    max-width: 100vw !important;
    grid-template-columns: repeat(5, 1fr) !important;
    grid-template-rows: repeat(2, 1fr) !important;
    column-gap: 0.12em !important;
    row-gap: 0.6em !important;
    justify-items: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    box-sizing: border-box;
  }
  .card-back,
  .card-inner {
    width: 94%;
    aspect-ratio: 0.7 / 1;
    height: auto;
    font-size: 1rem;
  }
  .card-message { 
    font-size: 2.6rem; 
    padding: 0.6em 0.5em 0.6em 0.5em;
    max-height: 100%;
  }
  .card-back.selected {
    width: auto !important;
    height: min(72vh, calc(95vw * 1.43)) !important;
    max-width: 97vw !important;
    max-height: 72vh !important;
    font-size: 1.12rem;
  }
  .close-btn { font-size: 1.5em; top: 0.12em; right: 0.32em;}
}
#star-container { pointer-events: none; position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 10;}
.steel-star { position: absolute; left: 0; top: 0; width: 1em; height: 2.2em; display: flex; align-items: center; justify-content: center; z-index: 11; opacity: 0.92; animation: starTwinkle 2.2s linear forwards; pointer-events: none;}
@keyframes starTwinkle { 0% { opacity: 0; transform: scale(0.5) rotate(0);} 28% { opacity:1; transform: scale(1.1) rotate(9deg);} 60% { opacity:1;} 99% { opacity: 0.5;} 100% {opacity:0; transform: scale(0.1) rotate(-22deg);}
}
.steel-star-glow { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; border-radius: 45%/50%; background: radial-gradient(circle, #f9f6ee 55%, #a6d7ff44 82%, #fff0 100%); filter: blur(13px) brightness(1.7); opacity: 0.7; z-index: 0;}
.steel-star-shape { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 0.26em; height: 2.1em; background: linear-gradient(180deg, #f9f6ee 60%, #bfe5ff 100%); border-radius: 60%/40%; filter: blur(1.2px) brightness(1.5); opacity: 0.95;}
.steel-star-shape::before { content: ""; position: absolute; left: 50%; top: 50%; width: 2.2em; height: 0.13em; background: linear-gradient(90deg, #f9f6ee 60%, #bfe5ff 100%); border-radius: 50%/45%; filter: blur(0.8px) brightness(1.2); transform: translate(-50%, -50%); opacity: 0.92;}
