/* Hidden Pictures (web). Same colours and feel as the desktop app. */
:root {
  --ink: #3B2A6B;
  --soft: #5C4A99;
  --pink: #E0569B;
  --gold: #FFC93C;
  --green: #2DB84D;
  --font: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", "Marker Felt", "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  --vh: 1vh;
  --bar: clamp(54px, min(calc(var(--vh) * 9), 13vw), 88px);
  --pad: clamp(6px, 1.2vmin, 18px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  font-family: var(--font); color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  touch-action: manipulation;
}
body { position: fixed; inset: 0; background: #C9EEFF; }
#bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,92,138,.15) 0 70px, transparent 71px),
    radial-gradient(circle at 85% 12%, rgba(79,195,247,.16) 0 90px, transparent 91px),
    radial-gradient(circle at 72% 78%, rgba(255,201,60,.17) 0 110px, transparent 111px),
    radial-gradient(circle at 20% 85%, rgba(124,219,92,.15) 0 80px, transparent 81px),
    radial-gradient(circle at 50% 45%, rgba(179,136,255,.12) 0 60px, transparent 61px),
    linear-gradient(#C9EEFF, #FFF1D6);
}
[hidden] { display: none !important; }

.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; padding: var(--pad) calc(var(--pad) * 2) calc(var(--pad) * 4); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font); font-weight: bold; color: #fff; cursor: pointer;
  font-size: clamp(17px, calc(var(--bar) * 0.36), 32px);
  height: calc(var(--bar) - 12px); min-height: 44px; padding: 0 1.1em;
  border: 4px solid #fff; border-radius: 999px;
  background: linear-gradient(var(--c2), var(--c1));
  box-shadow: 0 4px 10px rgba(0,0,0,.25); text-shadow: 0 2px 2px rgba(0,0,0,.35);
  transition: transform .12s ease, opacity .2s; white-space: nowrap; flex: none;
  --c1: #8E6CFF; --c2: #AA90FF;
}
.btn:active { transform: scale(.94); }
@media (hover: hover) { .btn:hover { transform: scale(1.05); } .btn:active { transform: scale(.94); } }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.purple { --c1: #8E6CFF; --c2: #AA90FF; }
.btn.orange { --c1: #FFB020; --c2: #FFC458; }
.btn.blue   { --c1: #29B6F6; --c2: #5EC8F8; }
.btn.green  { --c1: #2DB84D; --c2: #62CA7A; }
.btn.pink   { --c1: #FF6FA5; --c2: #FF93BC; }
.btn.round { width: calc(var(--bar) - 12px); min-width: 44px; padding: 0; font-size: clamp(20px, calc(var(--bar) * .4), 32px); }
.btn.small { height: 48px; font-size: 18px; }
.btn.ghost { --c1: rgba(92,74,153,.75); --c2: rgba(92,74,153,.55); box-shadow: none; }
.btn .short { display: none; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row.center { justify-content: center; margin-top: 24px; }

/* ---------- top bar ---------- */
.bar {
  height: var(--bar); flex: none; display: flex; align-items: center; gap: clamp(6px, 1.2vw, 18px);
  padding: 6px calc(var(--pad) * 1.5) 0;
}
.bar-title {
  flex: 1; min-width: 0; margin: 0; text-align: center; font-size: clamp(20px, calc(var(--bar) * .5), 52px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 3px 4px rgba(0,0,0,.15);
}

/* ---------- players ---------- */
.logo { text-align: center; margin: clamp(10px, 4vh, 60px) 0 0; font-size: clamp(44px, 9vmin, 110px); text-shadow: 0 5px 6px rgba(0,0,0,.2); line-height: 1.05; }
.sub { text-align: center; margin: 8px 0 clamp(14px, 3vh, 40px); font-size: clamp(22px, 4.2vmin, 54px); color: var(--soft); font-weight: bold; }
.player-list { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(14px, 3vw, 50px); }
.pcard {
  position: relative; width: clamp(150px, min(42vw, 34vh), 300px); min-height: calc(clamp(150px, min(42vw, 34vh), 300px) * 1.1);
  border: 6px solid #fff; border-radius: 36px; cursor: pointer;
  background: linear-gradient(var(--light), var(--col)); box-shadow: 0 8px 22px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 12px 10px; color: #fff; text-shadow: 0 3px 3px rgba(0,0,0,.35); transition: transform .12s;
  font-family: var(--font);
}
.pcard:active { transform: scale(.95); }
.pcard .pstars { position: relative; width: 48%; aspect-ratio: 1; margin-bottom: 6%; flex: none; }
.pcard .pstar { position: absolute; inset: 0; margin: auto; width: 100%; height: 100%; }
.pcard .pstar.inner { width: 68%; height: 68%; }
.pcard .pname { font-size: clamp(24px, 5vmin, 54px); font-weight: bold; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pdone { font-size: clamp(14px, 2.4vmin, 24px); font-weight: bold; margin-top: 4px; }
.pcard.add { background: rgba(255,255,255,.55); border-style: dashed; border-color: #8E6CFF; color: #8E6CFF; text-shadow: none; justify-content: center; }
.pcard.add .plus { font-size: clamp(60px, 12vmin, 130px); line-height: 1; font-weight: bold; }
.pcard .del {
  position: absolute; top: -14px; right: -14px; width: 50px; height: 50px; border-radius: 50%;
  border: 4px solid #fff; background: #FF5C8A; color: #fff; font-size: 26px; font-weight: bold; font-family: var(--font);
  box-shadow: 0 3px 8px rgba(0,0,0,.3); cursor: pointer; display: none;
}
.editing .pcard .del { display: block; }
.editing .pcard:not(.add) { animation: jiggle .4s ease-in-out infinite alternate; }
@keyframes jiggle { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }

/* ---------- gallery ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: clamp(14px, 2.4vw, 36px); max-width: 1860px; margin: 0 auto; }
.card {
  background: #fff; border: 6px solid #fff; border-radius: 30px; padding: 12px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.22); transition: transform .12s; font-family: var(--font); color: var(--ink); text-align: left;
}
.card:active { transform: scale(.97); }
@media (hover: hover) { .card:hover { transform: scale(1.03); } }
.card.done { border-color: var(--gold); }
.card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 20px; background: #eee; }
.card .crow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 6px 2px; }
.card .ctitle { font-size: clamp(20px, 2.2vw, 34px); font-weight: bold; }
.card .cprog { font-size: clamp(18px, 2vw, 30px); font-weight: bold; color: var(--soft); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.card.done .cprog { color: #E09A00; }
.star { display: inline-block; background: var(--gold); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.card .star { width: 1.5em; height: 1.5em; }
.empty { text-align: center; font-size: 26px; color: var(--soft); margin-top: 20vh; }

/* ---------- play ---------- */
.play-body { flex: 1; min-height: 0; display: flex; gap: var(--pad); padding: var(--pad); }
.frame { position: relative; flex: 1; min-width: 0; min-height: 0; background: #fff; border-radius: 26px; padding: 7px; box-shadow: 0 7px 22px rgba(0,0,0,.28); }
.frame.shake { animation: shake .36s linear; }
@keyframes shake { 0%,100% { transform: translateX(0); } 17% { transform: translateX(-6px); } 33% { transform: translateX(6px); } 50% { transform: translateX(-4px); } 67% { transform: translateX(4px); } 83% { transform: translateX(-2px); } }
.view { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 20px; touch-action: none; cursor: pointer; background: #f4f0ff; }
.layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.layer.glide { transition: transform .45s ease; }
.layer img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.marks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ring { position: absolute; border-radius: 50%; border: 3px solid #FFC400; box-shadow: 0 0 0 3px #fff, inset 0 0 0 2px #fff; transform: translate(-50%, -50%); }
.ring.pop { animation: popin .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes popin { from { transform: translate(-50%, -50%) scale(.2); } to { transform: translate(-50%, -50%) scale(1); } }
.hint-hole { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 4000px rgba(40,20,90,.28); animation: hintfade 4.2s linear forwards; }
.hint-glow {
  position: absolute; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(rgba(255,250,200,.28), rgba(255,236,120,.2) 75%, rgba(255,230,100,0));
  border: 4px dashed rgba(255,236,120,.85);
  animation: hintfade 4.2s linear forwards, pulse 1s ease-in-out 4;
}
@keyframes hintfade { 0% { opacity: 0; } 10% { opacity: 1; } 81% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulse { 50% { transform: translate(-50%, -50%) scale(1.08); } }
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.burst { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 6px solid #FFF59D; border-radius: 50%; animation: burst .6s ease-out forwards; }
@keyframes burst { to { transform: scale(var(--s, 6)); opacity: 0; } }
.spark { position: absolute; width: var(--z); height: var(--z); margin: calc(var(--z) / -2) 0 0 calc(var(--z) / -2); animation: fly .75s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes fly { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 55% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(200deg); opacity: 0; } }
.miss { position: absolute; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 6px solid #fff; background: rgba(255,255,255,.24); animation: wob .65s ease forwards; }
@keyframes wob { 0% { transform: scaleX(1); } 15% { transform: scaleX(1.3); } 30% { transform: scaleX(.8); } 45% { transform: scaleX(1.15); } 60% { transform: scaleX(.92); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.zoom-btns { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column-reverse; gap: 8px; opacity: .85; }
.zbtn:disabled { display: none; }
.zbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 4px solid #fff; background: rgba(142,108,255,.85); color: #fff;
  font: bold 30px/1 var(--font); box-shadow: 0 3px 8px rgba(0,0,0,.3); cursor: pointer; padding: 0;
}
.zbtn:active { transform: scale(.92); }

.panel {
  flex: none; display: flex; flex-direction: column; min-height: 0;
  background: rgba(255,255,255,.92); border: 5px solid #FFD66B; border-radius: 28px; box-shadow: 0 6px 18px rgba(0,0,0,.22);
  padding: 8px 10px 10px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: bold; font-size: clamp(17px, 2.6vmin, 36px); padding: 0 6px 4px; flex: none; white-space: nowrap; }
.count { color: var(--pink); }
.list { flex: 1; min-height: 0; display: grid; align-content: start; }
.cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 2px; }
.cell img { width: var(--icon); height: var(--icon); object-fit: contain; transition: opacity .3s; }
.cell .nm { font-weight: bold; font-size: var(--nm); line-height: 1.1; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .tick { position: absolute; top: 50%; left: 50%; width: calc(var(--icon) * .46); height: calc(var(--icon) * .46); margin: calc(var(--icon) * -.05) 0 0 calc(var(--icon) * .12); opacity: 0; }
.cell.found img { opacity: .45; }
.cell.found .nm { color: var(--green); }
.cell.found .tick { opacity: 1; }
.cell.pop, .cell.pop .tick { animation: cellpop .5s cubic-bezier(.3,1.6,.5,1); }
.cell.bounce { animation: bounce .6s ease-in-out 3; }
@keyframes cellpop { from { transform: scale(.2); } to { transform: scale(1); } }
@keyframes bounce { 50% { transform: scale(1.18); } }

/* landscape: list on the right; portrait: list under the picture */
@media (orientation: portrait) {
  .play-body { flex-direction: column; }
  .frame { flex: none; }
  .panel { flex: 1; }
  .btn .long { display: none; }
  .btn .short { display: inline; }
  .bar .btn { padding: 0 .7em; }
}
@media (max-width: 520px) { .bar-title { font-size: 20px; } }
@media (max-width: 640px) { #hello .long { display: none; } }

/* ---------- pop-up panels ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(30,10,60,.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.box {
  position: relative; width: min(94vw, 900px); max-height: 92%; overflow: auto;
  border-radius: 44px; padding: clamp(18px, 4vmin, 44px); border: 10px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, #FF8AC2, #8E6CFF) border-box;
  text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.4); animation: popbox .5s cubic-bezier(.3,1.5,.5,1);
}
@keyframes popbox { from { transform: scale(.3); } to { transform: scale(1); } }
.box h3 { margin: 0 0 10px; font-size: clamp(30px, 6vmin, 76px); }
.box p { margin: 0 0 20px; font-size: clamp(19px, 3.4vmin, 40px); color: var(--soft); font-weight: bold; }
.box p.pink { color: var(--pink); }
.box .row { justify-content: center; }
.box .btn { height: clamp(56px, 9vmin, 92px); font-size: clamp(20px, 3.4vmin, 36px); }
.box input {
  width: 100%; font: bold clamp(24px, 4.5vmin, 44px) var(--font); color: var(--ink); text-align: center;
  padding: 12px 16px; border: 5px solid #B9A6FF; border-radius: 24px; outline: none; margin-bottom: 18px;
  -webkit-user-select: text; user-select: text;
}
.box input:focus { border-color: #8E6CFF; }
.swatches { display: flex; justify-content: center; gap: 14px; margin-bottom: 22px; }
.swatch { width: 54px; height: 54px; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 0 0 3px transparent, 0 3px 8px rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 4px var(--ink), 0 3px 8px rgba(0,0,0,.25); }
.stars3 { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin-bottom: 8px; }
.stars3 .star { width: clamp(50px, 9vmin, 104px); height: clamp(50px, 9vmin, 104px); }
.stars3 .star.big { width: clamp(66px, 12vmin, 140px); height: clamp(66px, 12vmin, 140px); }

.confetti { position: fixed; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: 0; border-radius: 3px; animation: fall var(--d) linear forwards; }
@keyframes fall { from { transform: translate(0, var(--y0)) rotate(var(--r0)); } to { transform: translate(var(--dx), calc(var(--vh) * 100 + 60px)) rotate(var(--r1)); } }
@media (prefers-reduced-motion: reduce) { .editing .pcard:not(.add) { animation: none; } }
