/* Where's Yang Yang? — game styles (builds on /assets/site.css) */
[hidden] { display: none !important; }

/* ---------- menu ---------- */
.menu-main { padding: 28px 0 60px; }
.menu-head { text-align: center; max-width: 660px; margin: 0 auto 22px; }
.menu-head h1 { font-size: clamp(2.3rem, 7vw, 3.6rem); margin-bottom: .15em; }
.menu-head p { color: var(--ink-soft); font-weight: 700; }
.menu-head b { color: var(--ink); }
.menu-music {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px;
  font: 800 .95rem var(--font-body); color: var(--ink); cursor: pointer;
  background: var(--card); border: 0; border-radius: 999px; padding: 8px 16px;
  box-shadow: 0 3px 0 rgba(59,42,30,.12);
}
.menu-music svg { width: 20px; height: 20px; }
.music-toggle .mt-slash { display: none; }
.music-toggle[aria-pressed="false"] .mt-slash { display: inline; }
.music-toggle[aria-pressed="false"] { opacity: .75; }

.levels { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.level {
  font: inherit; cursor: pointer; border: 3px solid transparent;
  background: var(--card); color: var(--ink); border-radius: 20px;
  padding: 10px 22px 12px; min-width: 160px; text-align: center;
  box-shadow: 0 4px 0 rgba(59,42,30,.12);
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
  transition: transform .12s ease;
}
.level:hover { transform: translateY(-2px); }
.level b { font-family: var(--font-display); font-size: 1.25rem; }
.level small { color: var(--ink-soft); font-weight: 700; }
.lv-stars { color: var(--yellow-deep); font-size: 1.2rem; letter-spacing: 2px; }
.level[aria-checked="true"] { border-color: var(--red); background: #fff3d6; box-shadow: 0 4px 0 var(--red-deep); }

.pick-title { text-align: center; font-size: 1.8rem; margin-bottom: 16px; }
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.scene-card {
  font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 0; border: 0;
  background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.scene-card:hover { transform: translateY(-4px) rotate(-.5deg); }
.scene-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.scene-card .sc-body { padding: 10px 14px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scene-card b { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.1; display: block; }
.scene-card small { color: var(--ink-soft); font-weight: 700; font-size: .8rem; }
.sc-stars { white-space: nowrap; font-size: 1.15rem; letter-spacing: 1px; color: #e3d3b4; }
.sc-stars .on { color: var(--yellow); text-shadow: 0 1px 0 var(--yellow-deep); }
.total-stars { text-align: center; font-weight: 800; color: var(--ink-soft); margin-top: 28px; }
@media (max-width: 520px) {
  .scene-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .scene-card b { font-size: 1rem; }
  .scene-card .sc-body { flex-direction: column; align-items: flex-start; padding: 8px 10px 10px; }
  .level { min-width: 0; flex: 1 1 0; padding: 8px 6px 10px; }
  .level b { font-size: 1.05rem; }
  .level small { font-size: .72rem; }
}

/* ---------- play ---------- */
#play { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--paper); overflow: hidden; }
.toolbar {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 8px max(10px, env(safe-area-inset-left)) 8px max(10px, env(safe-area-inset-right));
}
.tb-btn {
  flex: none; height: 46px; min-width: 46px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: 0 3px 0 rgba(59,42,30,.15);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px;
  font: 800 1rem var(--font-body);
}
.tb-btn svg { width: 24px; height: 24px; }
.tb-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(59,42,30,.15); }
.tb-btn.hint { background: var(--yellow); box-shadow: 0 3px 0 var(--yellow-deep); }
.tb-btn.hint:disabled { opacity: .5; cursor: default; }
#soundBtn .snd-off { display: none; }
#soundBtn[aria-pressed="false"] .snd-on { display: none; }
#soundBtn[aria-pressed="false"] .snd-off { display: block; }
.tb-title { flex: 1; min-width: 0; text-align: center; }
.tb-title span { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .tb-label { display: none; } .tb-btn { padding: 0 9px; } .toolbar { gap: 6px; } }

.stage {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  margin: 0 max(8px, env(safe-area-inset-left)); border-radius: 18px;
  background: #2b2140; box-shadow: inset 0 0 0 4px #fff;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  cursor: grab;
}
.stage.dragging { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.world canvas { display: block; }
.marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }

.zoom-btns { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.zb {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 250, 240, .95); color: var(--ink); font: 800 1.7rem/1 var(--font-body);
  box-shadow: 0 3px 0 rgba(59,42,30,.25); display: grid; place-items: center;
}
.zb svg { width: 22px; height: 22px; }
.zb:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(59,42,30,.25); }

.toast {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 3; margin: 0;
  background: rgba(255, 250, 240, .96); color: var(--ink); font-weight: 800; font-size: .95rem;
  padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  max-width: calc(100% - 24px); text-align: center; transition: opacity .3s; pointer-events: none;
}
.toast:empty { opacity: 0; }
.toast.nudge { color: var(--red); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font: 800 1.4rem var(--font-display); color: #fff; background: #2b2140; z-index: 4; }

.findbar {
  flex: none; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
}
.find {
  display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 16px;
  padding: 4px 12px 4px 6px; box-shadow: 0 3px 0 rgba(59,42,30,.12); font-weight: 800; font-size: .95rem;
  position: relative; transition: background .3s;
}
.find img { width: 44px; height: 44px; object-fit: contain; }
.find.found { background: #dff5d8; }
.find.found img { opacity: .55; }
.find .tick { display: none; position: absolute; left: 26px; top: 20px; width: 26px; height: 26px; border-radius: 50%; background: #2fbf4a; color: #fff; font-size: 17px; line-height: 26px; text-align: center; }
.find.found .tick { display: block; animation: pop .45s cubic-bezier(.3,1.8,.5,1); }
@media (max-width: 520px) {
  .findbar { gap: 6px; }
  .find { padding: 3px 8px 3px 4px; font-size: .8rem; gap: 4px; }
  .find img { width: 36px; height: 36px; }
  .find .tick { left: 18px; top: 16px; width: 22px; height: 22px; line-height: 22px; font-size: 14px; }
}

.stage.shake .world { animation: shake .35s; }
@keyframes shake { 0%,100% { translate: 0 0; } 25% { translate: -6px 0; } 75% { translate: 6px 0; } }

/* marks (SVG in scene coordinates; strokes stay the same on-screen width at any zoom) */
.marks * { vector-effect: non-scaling-stroke; }
.found-ring { fill: none; stroke: #2fbf4a; stroke-width: 6; }
.found-ring-bg { fill: none; stroke: #fff; stroke-width: 11; opacity: .9; }
.found-new { animation: ring-pop .5s cubic-bezier(.3,1.6,.5,1) both; transform-box: fill-box; transform-origin: center; }
@keyframes ring-pop { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.miss { stroke: var(--red); stroke-width: 6; stroke-linecap: round; animation: miss .9s ease-out forwards; }
@keyframes miss { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.hint-ring { fill: rgba(255, 214, 80, .22); stroke: #ffc21a; stroke-width: 6; stroke-dasharray: 14 10; animation: hint-pulse .8s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes hint-pulse { from { transform: scale(.94); } to { transform: scale(1.06); } }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- win ---------- */
.win { position: fixed; inset: 0; z-index: 50; background: rgba(40, 24, 10, .45); display: grid; place-items: center; padding: 16px; animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.win-card {
  background: var(--card); border-radius: 30px; padding: 26px 26px 22px; text-align: center;
  width: min(440px, 100%); box-shadow: 0 10px 0 rgba(59,42,30,.18), 0 30px 60px rgba(0,0,0,.25);
  animation: pop .5s cubic-bezier(.3,1.6,.5,1);
}
.win-card h2 { font-size: 2.4rem; margin: 4px 0 2px; color: var(--red); }
.win-card p { font-weight: 700; color: var(--ink-soft); }
.win-stars { font-size: 3.4rem; line-height: 1; letter-spacing: 6px; }
.win-stars span { color: #eadcc0; display: inline-block; }
.win-stars span.on { color: var(--yellow); text-shadow: 0 3px 0 var(--yellow-deep); animation: pop .5s cubic-bezier(.3,1.8,.5,1) both; }
.win-stars span.on:nth-child(2) { animation-delay: .25s; }
.win-stars span.on:nth-child(3) { animation-delay: .5s; }
.win-buttons { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin-top: 8px; }
.win-links { display: flex; justify-content: center; gap: 18px; }
.btn-link { background: none; border: 0; font: 800 1rem var(--font-body); color: var(--ink-soft); cursor: pointer; padding: 6px; text-decoration: underline; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
