* { box-sizing: border-box; }

#parent-panel[hidden],
#player-mount[hidden] {
  display: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(180deg, #FFF4E8 0%, #FFE0EC 60%, #F8E5F5 100%);
  color: #2D1B5F;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  cursor: none;
}

#root {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  padding: 5vh 5vw;
  position: relative;
  z-index: 1;
}

#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-rainbow {
  position: absolute;
  bottom: -12vw;
  left: 50%;
  transform: translateX(-50%);
  width: 110vw;
  height: 60vw;
  opacity: 0.22;
}

.bg-flower {
  position: absolute;
  opacity: 0.32;
  filter: drop-shadow(0 1vw 2vw rgba(91, 58, 138, 0.08));
}

.bg-flower-tl { top: -10vw; left: -8vw; width: 30vw; height: 30vw; }
.bg-flower-tr { top: -8vw;  right: -7vw; width: 26vw; height: 26vw; }
.bg-flower-bl { bottom: 6vh; left: -9vw; width: 24vw; height: 24vw; opacity: 0.28; }
.bg-flower-br { bottom: 22vh; right: -10vw; width: 22vw; height: 22vw; opacity: 0.26; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4vh;
}

.title {
  font-family: "Modak", "Fredoka", system-ui, sans-serif;
  font-size: 6vw;
  font-weight: 400;
  letter-spacing: 0.2vw;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 1.2vw;
}

.title-text {
  /* Each letter colored individually via inline span — cartoon-rainbow */
  display: inline-block;
}

.title-text > span {
  display: inline-block;
  text-shadow:
    0.18vw 0.18vw 0 rgba(45, 27, 95, 0.18),
    0 0.4vw 0.8vw rgba(91, 58, 138, 0.12);
}

.title-text > span:nth-child(odd)  { transform: rotate(-4deg); }
.title-text > span:nth-child(even) { transform: rotate(4deg); }


.mode-badge {
  font-size: 1.4vw;
  font-weight: 600;
  background: rgba(91, 58, 138, 0.1);
  color: #5B3A8A;
  padding: 0.8vh 1.6vw;
  border-radius: 9999px;
  text-transform: capitalize;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3vw;
  align-content: start;
}

.tile, .detail-tile {
  border-radius: 1.6vw;
  background: white;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: flex-end;
  outline: none;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
  box-shadow: 0 0.8vw 2vw rgba(91, 58, 138, 0.12);
}

.tile { aspect-ratio: 16 / 9; }
.detail-tile { aspect-ratio: 2 / 3; }

.tile.focused, .detail-tile.focused {
  transform: scale(1.08);
  box-shadow:
    0 0 0 0.5vw #FF6B9D,
    0 1.6vw 3.2vw rgba(255, 107, 157, 0.35);
  z-index: 10;
}

.tile-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #FFF4E8;
}

.tile-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(45, 27, 95, 0.88) 0%,
    rgba(45, 27, 95, 0.05) 55%);
}

.tile-label {
  position: relative;
  z-index: 1;
  padding: 1.4vw 1.6vw;
  font-size: 2.2vw;
  font-weight: 700;
  line-height: 1.05;
  color: white;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2vw;
  align-content: start;
  flex: 1;
}

.detail-tile {
  background-size: cover;
  background-position: center;
  padding: 1.2vw;
  font-size: 1.4vw;
  font-weight: 600;
}

.detail-tile-label {
  position: relative;
  z-index: 1;
  background: rgba(45, 27, 95, 0.88);
  color: white;
  padding: 0.6vw 1vw;
  border-radius: 0.6vw;
  max-width: 100%;
}

#player-mount {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
}

#player-mount iframe,
#player-mount video {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: #000;
}

#parent-panel {
  position: fixed;
  inset: 0;
  background: rgba(91, 58, 138, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-card {
  background: linear-gradient(180deg, #FFF4E8 0%, #FFE5EC 100%);
  border-radius: 1.6vw;
  padding: 3vw;
  min-width: 40vw;
  box-shadow: 0 2vw 5vw rgba(45, 27, 95, 0.35);
}

.panel-card h2 {
  margin: 0 0 2vh;
  font-size: 2.4vw;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #5B3A8A;
}

.panel-option {
  padding: 1.2vh 1.6vw;
  border-radius: 0.8vw;
  font-size: 1.6vw;
  font-weight: 600;
  margin-bottom: 0.4vh;
  color: #5B3A8A;
  opacity: 0.55;
  transition: all 0.15s ease-out;
}

.panel-option.focused {
  background: #FF6B9D;
  color: white;
  opacity: 1;
  transform: translateX(0.4vw);
  box-shadow: 0 0.4vw 1.2vw rgba(255, 107, 157, 0.4);
}

#loading, .empty {
  font-size: 2.4vw;
  color: #5B3A8A;
  font-weight: 600;
  margin: auto;
  text-align: center;
  max-width: 60vw;
  line-height: 1.4;
  opacity: 0.65;
}
