/* ============================================================
   糖果森林算术连连看 V2 — style.css
   目标：iPad Safari 优先，竖屏/横屏居中列布局
   ============================================================ */

:root {
  --pink-1: #ffd6e8;
  --pink-2: #ff9ec7;
  --pink-3: #ff6fa8;
  --mint-1: #d6fff2;
  --mint-2: #7be0c2;
  --lav-1:  #ead6ff;
  --lav-2:  #b98cf0;
  --sun-1:  #fff3d6;
  --sun-2:  #ffc266;
  --sky-1:  #d6f0ff;
  --sky-2:  #6bbfff;
  --rose-1: #ffe0ec;
  --rose-2: #ff8aad;
  --gold:   #ffd15c;
  --ink:    #5b4a63;
  --card-radius: 22px;
  --btn-size: 64px;
  --icon-size: 40px;
  --font-main: 'Comic Sans MS', 'Microsoft YaHei', 'PingFang SC', 'Heiti SC', sans-serif;
}

/* ---- global utility ---- */
.hidden { display: none !important; }

/* ---- reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--ink);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fdf0fa;
  position: relative;
}

/* ============================================================
   BACKGROUND LAYER
   ============================================================ */
#bgLayer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: background-image 0.6s ease;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
#bgLayer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 240, 250, 0.35);
}

/* CSS particle decorations (no emoji) */
#bgParticles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.4;
  animation: particleFloat 8s ease-in-out infinite;
}
.particle.star-shape {
  border-radius: 0;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.particle.heart-shape {
  border-radius: 0;
  clip-path: path('M12,21.593c-5.63-5.539-11-10.297-11-14.402c0-3.791,3.068-5.191,5.281-5.191c1.312,0,4.151,1.018,5.719,4.955c1.944-3.833,5.494-4.955,5.719-4.955c2.387,0,5.281,1.399,5.281,5.191c0,4.105-5.371,8.862-11,14.402z');
  width: 18px;
  height: 16px;
}
@keyframes particleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 0.4; }
  33%       { transform: translateY(-18px) rotate(15deg) scale(1.05); opacity: 0.55; }
  66%       { transform: translateY(-8px) rotate(-8deg) scale(0.95); opacity: 0.35; }
}

/* ============================================================
   MAIN APP WRAPPER
   ============================================================ */
#app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 12px 32px;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
}
.screen.active {
  display: flex;
}

/* ============================================================
   ICON BUTTON (base for all icon-only buttons)
   ============================================================ */
.icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  width: var(--btn-size);
  height: var(--btn-size);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(150, 100, 180, 0.22);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex-shrink: 0;
  padding: 0;
  -webkit-appearance: none;
}
.icon-btn:active {
  transform: scale(0.92);
  box-shadow: 0 2px 6px rgba(150, 100, 180, 0.15);
}
.icon-btn img {
  width: var(--icon-size);
  height: var(--icon-size);
  object-fit: contain;
  pointer-events: none;
}
.icon-btn.small {
  width: 48px;
  height: 48px;
}
.icon-btn.small img {
  width: 30px;
  height: 30px;
}
.icon-btn.large {
  width: 80px;
  height: 80px;
}
.icon-btn.large img {
  width: 56px;
  height: 56px;
}

/* ============================================================
   CHALLEN 王 BACK LINK (首页角落)
   ============================================================ */
#challenLink {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 100;
  opacity: 0.38;
  font-size: 11px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-main);
  padding: 4px 8px;
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  transition: opacity 0.2s;
}
#challenLink:hover { opacity: 0.7; }
#challenLink.hidden { display: none; }

/* ============================================================
   LOADING SCREEN  (内联 HTML 同步，此 CSS 仅补动画)
   ============================================================ */
#loadingScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 24px;
  padding: 32px 20px;
}
#loadTitle {
  font-size: 26px;
  font-weight: bold;
  color: #a15c9e;
  text-align: center;
  text-shadow: 0 2px 4px rgba(180,120,200,0.2);
}
/* race track */
#raceTrack {
  width: 100%;
  max-width: 500px;
  position: relative;
  height: 90px;
  background: linear-gradient(180deg, #f9e8ff 60%, #f0d8f5 100%);
  border-radius: 20px;
  border: 3px solid #e0b8ee;
  overflow: hidden;
}
#raceTrack .track-stripe {
  position: absolute;
  bottom: 14px;
  left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, #e8c4f5 0, #e8c4f5 18px, transparent 18px, transparent 36px);
}
#raceFlag {
  position: absolute;
  right: 8px;
  top: 6px;
  width: 22px;
  height: 28px;
}
/* flag drawn purely with CSS */
#raceFlag::before {
  content: '';
  display: block;
  width: 3px;
  height: 28px;
  background: #888;
  position: absolute;
  left: 0; top: 0;
}
#raceFlag::after {
  content: '';
  display: block;
  width: 14px;
  height: 10px;
  background: repeating-linear-gradient(90deg, #333 0, #333 7px, #fff 7px, #fff 14px);
  position: absolute;
  left: 3px; top: 0;
}
#spriteRabbit, #spriteTurtle {
  position: absolute;
  bottom: 18px;
  width: 54px;
  height: 54px;
  object-fit: contain;
  transition: left 0.3s ease;
}
#spriteRabbit { bottom: 22px; }
#spriteTurtle { bottom: 16px; }

#loadPct {
  font-size: 52px;
  font-weight: bold;
  color: #c86ab0;
  text-shadow: 0 2px 6px rgba(200,100,180,0.25);
}
#loadBar {
  width: 100%;
  max-width: 500px;
  height: 22px;
  background: rgba(255,255,255,0.7);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(180,100,200,0.18);
}
#loadBarInner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff9ec7, #b98cf0, #ff6fa8);
  border-radius: 14px;
  transition: width 0.25s ease;
}
#loadEnterBtn {
  display: none;
  margin-top: 8px;
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
#homeScreen {
  align-items: center;
  padding-top: 32px;
  gap: 20px;
}
#homeLogo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(180,100,200,0.35));
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}
#homeTitle {
  font-size: 28px;
  font-weight: bold;
  color: #a15c9e;
  text-align: center;
  margin: 0;
  text-shadow: 0 2px 6px rgba(180,100,200,0.2);
}
/* avatar in corner */
#homeAvatar {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffd6e8;
  box-shadow: 0 4px 12px rgba(180,100,200,0.3), 0 0 0 4px rgba(255,214,232,0.5);
  animation: avatarBob 4s ease-in-out infinite;
}
@keyframes avatarBob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%       { transform: translateY(-5px) rotate(3deg); }
}
.home-btn-row {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}
#homePlayBtn {
  width: 96px;
  height: 96px;
}
#homePlayBtn img {
  width: 68px;
  height: 68px;
}
.home-secondary-btns {
  display: flex;
  gap: 16px;
}

/* ============================================================
   MASCOT + SPEECH BUBBLE
   ============================================================ */
.mascot-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 4px;
  flex-shrink: 0;
}
.mascot-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12));
  animation: mascotBob 2.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes mascotBob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%       { transform: translateY(-8px) rotate(3deg); }
}
.speech-bubble {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: 0 3px 10px rgba(150, 110, 180, 0.18);
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.speech-bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 16px;
  border: 9px solid transparent;
  border-right-color: #fff;
}

/* ============================================================
   MUSIC PANEL
   ============================================================ */
#musicPanel {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: min(400px, 95vw);
  background: linear-gradient(160deg, #fff0fb, #f0e8ff);
  border-radius: 24px 24px 0 0;
  padding: 20px 24px 32px;
  box-shadow: 0 -6px 24px rgba(150,100,200,0.25);
  z-index: 200;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#musicPanel.open {
  transform: translateX(-50%) translateY(0);
}
#musicPanel h3 {
  margin: 0 0 16px;
  text-align: center;
  color: #a15c9e;
  font-size: 17px;
}
.music-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.music-track-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}
.track-btn {
  border: none;
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 15px;
  font-family: var(--font-main);
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(135deg, var(--pink-1), var(--pink-2));
  color: var(--ink);
  box-shadow: 0 3px 8px rgba(180,100,200,0.2);
  min-width: 64px;
  min-height: 48px;
  transition: transform 0.12s;
}
.track-btn.active {
  background: linear-gradient(135deg, var(--lav-1), var(--lav-2));
  color: #fff;
}
.track-btn:active { transform: scale(0.94); }
.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.volume-row img {
  width: 32px;
  height: 32px;
}
#volumeSlider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--pink-2), var(--lav-2));
  outline: none;
  cursor: pointer;
}
#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #ffaa00);
  box-shadow: 0 2px 6px rgba(180,100,0,0.3);
  cursor: pointer;
  border: 2px solid #fff;
}
#volumeSlider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #ffaa00);
  border: 2px solid #fff;
  cursor: pointer;
}
#musicPanelClose {
  display: block;
  margin: 12px auto 0;
}

/* floating music btn visible in game */
#floatMusicBtn {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 150;
}

/* ============================================================
   WORLD MAP SCREEN
   ============================================================ */
#mapScreen {
  padding-top: 12px;
}
.map-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.world-title {
  font-size: 20px;
  font-weight: bold;
  color: #a15c9e;
  text-align: center;
  flex: 1;
  text-shadow: 0 2px 4px rgba(180,100,200,0.15);
}
.map-world-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}
.world-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(180,100,200,0.25);
  transition: background 0.25s;
}
.world-dot.active {
  background: #b98cf0;
  transform: scale(1.3);
}
/* winding path grid */
.level-path {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 4px;
}
.level-row {
  display: flex;
  gap: 14px;
  justify-content: center;
}
.level-row.reverse {
  flex-direction: row-reverse;
}
/* connector lines (CSS only) */
.level-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
}
.level-node-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: bold;
  font-family: var(--font-main);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(150,100,180,0.25);
  transition: transform 0.15s;
  position: relative;
  background: linear-gradient(160deg, #fff, #ffe3f5);
  border: 3px solid rgba(255, 214, 232, 0.8);
}
.level-node:active .level-node-circle { transform: scale(0.92); }
.level-node.current .level-node-circle {
  animation: nodePulse 1.8s ease-in-out infinite;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255,209,92,0.35), 0 4px 12px rgba(150,100,180,0.3);
}
@keyframes nodePulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}
.level-node.locked .level-node-circle {
  background: linear-gradient(160deg, #e8e8e8, #d0d0d0);
  border-color: #ccc;
  cursor: not-allowed;
}
.level-node.cleared .level-node-circle {
  background: linear-gradient(160deg, #fff0fb, var(--pink-1));
}
.level-node-label {
  font-size: 11px;
  color: var(--ink);
  opacity: 0.7;
  max-width: 68px;
  text-align: center;
  line-height: 1.2;
}
.level-stars-row {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.level-stars-row img {
  width: 14px;
  height: 14px;
}
.level-node-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* ============================================================
   GAME SCREEN (局内)
   ============================================================ */
#gameScreen {
  padding-top: 10px;
}
.game-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.game-progress-wrap {
  flex: 1;
  height: 18px;
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.1);
}
.game-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink-2), var(--lav-2));
  border-radius: 12px;
  transition: width 0.4s ease;
}
.hearts-row {
  display: flex;
  gap: 4px;
  align-items: center;
  background: rgba(255,255,255,0.8);
  padding: 6px 10px;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(150,100,180,0.15);
}
.hearts-row img {
  width: 22px;
  height: 22px;
}

/* card board */
.board {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}
.tile {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 18px;
  font-size: 20px;
  font-weight: bold;
  font-family: var(--font-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  line-height: 1.2;
  box-shadow: 0 4px 10px rgba(120,90,140,0.22);
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.35s ease;
  color: var(--ink);
  background: linear-gradient(160deg, #ffffff, #f3e9ff);
  position: relative;
  overflow: hidden;
  -webkit-appearance: none;
  min-height: 64px;
  min-width: 64px;
}
.tile:active { transform: scale(0.93); }
.tile.selected {
  outline: 4px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(255,209,92,0.45), 0 6px 14px rgba(120,90,140,0.3);
  transform: scale(1.06);
}
.tile.wrong {
  animation: shake 0.42s ease;
  background: linear-gradient(160deg, #ffd6d6, #ffb3b3) !important;
  outline-color: #ff6666;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
.tile.matched {
  opacity: 0;
  transform: scale(0.2) rotate(25deg);
  pointer-events: none;
}

/* spark particles for correct match - CSS drawn */
.spark-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: sparkFly 0.6s ease forwards;
}
@keyframes sparkFly {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* world theme tints */
.theme-w1 .tile { background: linear-gradient(160deg, #fff, #ffe8f5); }
.theme-w2 .tile { background: linear-gradient(160deg, #fff, #e8fcf5); }
.theme-w3 .tile { background: linear-gradient(160deg, #fff, #e8f4ff); }
.theme-w4 .tile { background: linear-gradient(160deg, #fff, #f5eeff); }
.theme-w5 .tile { background: linear-gradient(160deg, #fff, #fff0e8); }

/* ============================================================
   RESULT MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(80, 50, 90, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-overlay.active {
  display: flex;
}
.modal-card {
  background: linear-gradient(160deg, #fff8fd, #fdf0ff);
  border-radius: 28px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(80,50,90,0.4);
  position: relative;
  overflow: hidden;
}
.modal-title {
  font-size: 22px;
  font-weight: bold;
  color: #a15c9e;
  margin: 6px 0 12px;
}
.modal-stars-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px 0;
}
.modal-star {
  width: 48px;
  height: 48px;
  opacity: 0;
  transform: scale(0);
  transition: none;
}
.modal-star.show {
  animation: popStar 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes popStar {
  to { opacity: 1; transform: scale(1); }
}
.modal-msg {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 8px;
  line-height: 1.5;
}
.modal-photo-frame {
  display: none;
  margin: 14px auto;
  width: 160px;
  height: 160px;
  position: relative;
  perspective: 600px;
}
.modal-photo-frame.show { display: block; }
.photo-card {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: rotateY(180deg);
}
.photo-card.flipped { transform: rotateY(0deg); }
.photo-front, .photo-back {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.photo-front {
  background: linear-gradient(160deg, var(--pink-1), var(--lav-1));
  border: 4px solid #fff;
  box-shadow: 0 4px 16px rgba(180,100,200,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-front img.photo-img {
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: cover;
  border-radius: 8px;
}
.photo-back {
  background: linear-gradient(160deg, var(--lav-1), var(--lav-2));
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #fff;
}
.photo-back::after {
  content: '';
  display: block;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
}
.modal-btns {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.modal-btns .icon-btn {
  background: rgba(255,255,255,0.9);
}

/* confetti - CSS drawn rectangles */
.confetti-piece {
  position: absolute;
  width: 9px;
  height: 15px;
  opacity: 0.9;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(480px) rotate(420deg); opacity: 0; }
}

/* ============================================================
   ALBUM SCREEN
   ============================================================ */
#albumScreen {
  padding-top: 12px;
}
.album-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.album-title {
  flex: 1;
  font-size: 20px;
  font-weight: bold;
  color: #a15c9e;
  text-align: center;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-bottom: 20px;
}
.album-cell {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(150,100,180,0.2);
  border: 3px solid rgba(255,214,232,0.7);
  transition: transform 0.15s;
  -webkit-appearance: none;
  background: none;
  border-style: solid;
  padding: 0;
}
.album-cell:active { transform: scale(0.93); }
.album-cell.locked {
  background: linear-gradient(160deg, #ede8f5, #ddd8ee);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}
.album-cell.locked img { width: 36px; height: 36px; opacity: 0.6; }
.album-cell img.album-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* fullscreen viewer */
#photoViewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#photoViewer.active { display: flex; }
#photoViewerImg {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 14px;
  box-shadow: 0 0 60px rgba(255,214,232,0.35);
  animation: viewerIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes viewerIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
#photoViewerClose {
  position: fixed;
  top: 20px;
  right: 20px;
}
.viewer-shimmer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  animation: shimmer 1.2s ease forwards;
  background: radial-gradient(ellipse at center, rgba(255,214,232,0.6) 0%, transparent 70%);
}
@keyframes shimmer {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================================
   TROPHY / SCORES SCREEN
   ============================================================ */
#trophyScreen {
  padding-top: 12px;
}
.trophy-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.trophy-title {
  flex: 1;
  font-size: 20px;
  font-weight: bold;
  color: #a15c9e;
  text-align: center;
}
.total-stars-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #fff8d6, var(--sun-1));
  border-radius: 20px;
  padding: 16px 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(200,150,0,0.2);
}
.total-stars-display img { width: 40px; height: 40px; }
.total-stars-num {
  font-size: 42px;
  font-weight: bold;
  color: #c8860a;
}
.total-cleared {
  font-size: 14px;
  color: var(--ink);
  opacity: 0.75;
}
.world-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 3px 10px rgba(150,100,180,0.12);
}
.world-thumb {
  width: 52px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.world-info { flex: 1; }
.world-name { font-size: 14px; font-weight: bold; color: var(--ink); }
.world-stars-text { font-size: 12px; opacity: 0.7; }
.world-trophy { width: 28px; height: 28px; }
.history-section h3 {
  font-size: 14px;
  color: var(--ink);
  opacity: 0.7;
  margin: 14px 0 8px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  margin-bottom: 6px;
  font-size: 12px;
}
.history-date { color: var(--ink); opacity: 0.55; flex-shrink: 0; }
.history-level { font-weight: bold; color: #a15c9e; }
.history-stars-row { display: flex; gap: 2px; margin-left: auto; }
.history-stars-row img { width: 14px; height: 14px; }

/* ============================================================
   RESPONSIVE — smaller phones
   ============================================================ */
@media (max-width: 480px) {
  :root { --btn-size: 56px; --icon-size: 34px; }
  .tile { font-size: 17px; }
  .album-grid { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  #homeTitle { font-size: 22px; }
  #homeLogo { width: 90px; height: 90px; }
}
@media (min-width: 760px) {
  .tile { font-size: 22px; }
  .album-grid { grid-template-columns: repeat(7, 1fr); }
}
@media (orientation: landscape) and (max-height: 500px) {
  #homeScreen { padding-top: 8px; gap: 10px; }
  .level-path { gap: 8px; }
  .level-node-circle { width: 56px; height: 56px; }
}
