:root {
  --rosa: #e5177e; --rosa2: #ff5fa8; --turq: #0aa5a5; --turq2: #067a80; --oro: #ffb81c; --oro2: #ffd466;
  --morado: #3b1352; --morado2: #5a1f78; --crema: #fff6e6; --ink: #2a1236; --verde: #3fbf5f;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b6f75; font-family: var(--font); color: var(--ink);
  touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
canvas#c { position: fixed; inset: 0; display: block; touch-action: none; }
.hidden { display: none !important; }

/* top bar */
#bar { position: fixed; left: 0; right: 0; top: 0; height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 6px;
  background: var(--morado); color: #fff; z-index: 5; box-shadow: 0 2px 0 rgba(0,0,0,.15); }
#picado { position: fixed; left: 0; right: 0; top: 48px; height: 14px; z-index: 5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='14'%3E%3Cpath d='M0 0h28v9l-4 5-5-4-5 4-5-4-5 4-4-5z' fill='%23e5177e'/%3E%3Cpath d='M30 0h28v9l-4 5-5-4-5 4-5-4-5 4-4-5z' fill='%23ffb81c'/%3E%3Cpath d='M60 0h28v9l-4 5-5-4-5 4-5-4-5 4-4-5z' fill='%2300c2c2'/%3E%3Cpath d='M90 0h28v9l-4 5-5-4-5 4-5-4-5 4-4-5z' fill='%2389e05a'/%3E%3Ccircle cx='14' cy='5' r='2' fill='%233b1352' opacity='.35'/%3E%3Ccircle cx='44' cy='5' r='2' fill='%233b1352' opacity='.35'/%3E%3Ccircle cx='74' cy='5' r='2' fill='%233b1352' opacity='.35'/%3E%3Ccircle cx='104' cy='5' r='2' fill='%233b1352' opacity='.35'/%3E%3C/svg%3E");
  background-repeat: repeat-x; filter: drop-shadow(0 2px 1px rgba(0,0,0,.25)); }
#info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
#pname { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#nums { display: flex; gap: 10px; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
#prog { color: var(--oro2); }
.grp { display: flex; gap: 4px; }
.ib { height: 40px; min-width: 40px; padding: 0 8px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; gap: 5px; cursor: pointer; font: 700 13px var(--font); }
.ib svg { width: 22px; height: 22px; flex: none; }
.ib:hover { background: rgba(255,255,255,.22); }
.ib.on { background: var(--oro); color: var(--morado); }
.ib.off { opacity: .55; }
.ib .slash, .ib .xm { display: none; }
.ib.off .slash, .ib.off .xm { display: inline; }
.ib.off .wave { display: none; }
@media (max-width: 760px) { .ib .t { display: none; } .ib { padding: 0; } }
@media (max-width: 380px) { .ib { min-width: 36px; } .grp { gap: 3px; } }

#hint { position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 4; pointer-events: none;
  background: rgba(59,19,82,.78); color: #fff; font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 999px;
  white-space: nowrap; max-width: calc(100vw - 20px); overflow: hidden; text-overflow: ellipsis; transition: opacity .3s; }
#zoom { position: fixed; z-index: 4; display: flex; gap: 6px; }
.zb { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--rosa); color: #fff; font: 900 24px/1 var(--font);
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.25); padding: 0; }
.zb svg { width: 20px; height: 20px; }
#toast { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.9); z-index: 9; pointer-events: none; opacity: 0;
  background: var(--crema); color: var(--morado); border: 4px solid var(--oro); font-weight: 900; font-size: 20px; padding: 10px 22px;
  border-radius: 18px; transition: opacity .25s, transform .25s; text-align: center; box-shadow: 0 6px 0 rgba(0,0,0,.2); }
#toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* overlays */
.ov { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 12px;
  background: radial-gradient(circle at 50% 30%, rgba(10,165,165,.55), rgba(42,18,54,.82)); overflow: auto; }
.panel { position: relative; background: var(--crema); border-radius: 26px; border: 5px solid var(--oro); padding: 18px 18px 16px;
  box-shadow: 0 10px 0 rgba(0,0,0,.22), 0 20px 40px rgba(0,0,0,.3); width: min(520px, 100%); text-align: center; margin: auto; }
h1 { margin: 0 0 4px; font-size: 40px; line-height: 1; color: var(--rosa); letter-spacing: .5px; text-shadow: 0 3px 0 var(--oro2); }
h1 span { display: block; font-size: 19px; color: var(--morado); text-shadow: none; margin-top: 4px; letter-spacing: 0; }
h2 { margin: 0 0 6px; font-size: 30px; color: var(--rosa); }
.sp #lolo { width: 104px; height: auto; margin: -62px auto -2px; display: block; filter: drop-shadow(0 6px 4px rgba(0,0,0,.25));
  animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.intro { margin: 8px 4px 12px; font-size: 14.5px; line-height: 1.35; color: #4a2b5a; }
.daily { display: flex; gap: 12px; align-items: center; background: #fff; border: 3px solid var(--turq); border-radius: 18px;
  padding: 8px; text-align: left; cursor: pointer; margin-bottom: 12px; }
.daily img { width: 112px; height: 75px; border-radius: 10px; object-fit: cover; flex: none; background: #ddd; }
.dinfo { min-width: 0; flex: 1; }
.dtitle { font-weight: 900; font-size: 17px; color: var(--turq2); }
.dsub { font-size: 13px; color: #6b4b78; margin: 1px 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.streak { display: flex; align-items: center; gap: 4px; font-weight: 900; color: var(--rosa); font-size: 15px; }
.streak svg { width: 20px; height: 20px; }
.week { display: flex; gap: 4px; margin-top: 4px; }
.week i { width: 22px; height: 22px; border-radius: 50%; background: #eee1f0; color: #8a6d96; font: 800 11px/22px var(--font);
  text-align: center; font-style: normal; }
.week i.ok { background: var(--oro); color: var(--morado); }
.week i.today { box-shadow: 0 0 0 2px var(--rosa); }
.big { display: block; width: 100%; border: 0; border-radius: 18px; padding: 14px 10px; margin: 8px 0 0; cursor: pointer;
  font: 900 22px var(--font); color: #fff; background: var(--rosa); box-shadow: 0 5px 0 #a10f58; transition: transform .08s; }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #a10f58; }
.big.alt { background: var(--turq); box-shadow: 0 5px 0 var(--turq2); font-size: 18px; padding: 11px 10px; }
#bPlay { font-size: 26px; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
.ctrl { margin: 12px 0 0; font-size: 12.5px; color: #6b4b78; display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.ctrl svg { width: 16px; height: 16px; }
.key { display: inline-block; border: 2px solid #b79cc2; border-bottom-width: 3px; border-radius: 6px; padding: 0 5px; font-weight: 800; font-size: 11px; }

/* gallery */
.gp { width: min(820px, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding-bottom: 12px; }
.close { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--morado);
  color: #fff; font: 900 26px/1 var(--font); cursor: pointer; }
.album { font-weight: 800; color: var(--turq2); font-size: 14px; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; flex: none; scrollbar-width: none; }
.tabs button { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; font: 800 14px var(--font); background: #f0dff3; color: var(--morado); cursor: pointer; }
.tabs button.sel { background: var(--morado); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; overflow-y: auto; padding: 8px 2px; flex: 1 1 auto; min-height: 120px;
  touch-action: pan-y; }
@media (max-width: 500px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
.th { position: relative; border: 3px solid transparent; border-radius: 12px; padding: 0; background: #fff; cursor: pointer; overflow: hidden; aspect-ratio: 3/2; }
.th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th.sel { border-color: var(--rosa); box-shadow: 0 0 0 3px var(--oro); }
.th .nm { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(42,18,54,.85)); color: #fff;
  font: 700 11.5px var(--font); padding: 10px 4px 3px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th .ok { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--oro); color: var(--morado);
  font: 900 14px/22px var(--font); text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.foto { padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1 1 auto; }
.foto p { margin: 0; font-size: 14px; color: #4a2b5a; }
.filebtn { width: auto; padding: 12px 22px; display: inline-block; }
.filebtn input { display: none; }
#fotoPrev { width: 240px; height: 160px; border-radius: 12px; background: #eee1f0; border: 3px dashed #b79cc2; }
.opts { flex: none; border-top: 2px dashed #e6cfe9; margin-top: 6px; padding-top: 8px; }
.lbl { font-weight: 900; color: var(--morado); font-size: 14px; margin-bottom: 4px; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.counts button { border: 0; border-radius: 12px; min-width: 52px; padding: 8px 8px; font: 900 16px var(--font); background: #f0dff3; color: var(--morado); cursor: pointer; }
.counts button.sel { background: var(--oro); box-shadow: 0 3px 0 #c98a00; }
.kids { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 800; color: var(--morado); cursor: pointer; font-size: 15px; }
.kids small { font-weight: 600; color: #7d5f89; }
.kids input { display: none; }
.sw { width: 44px; height: 26px; border-radius: 13px; background: #d8c3de; position: relative; transition: background .2s; flex: none; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.kids input:checked + .sw { background: var(--verde); }
.kids input:checked + .sw::after { left: 21px; }
#gPlay { flex: none; }

/* win */
.wp { width: min(440px, 100%); }
.wlolo { width: 110px; height: auto; margin: -70px auto 0; display: block; animation: jump .7s ease-in-out infinite alternate; filter: drop-shadow(0 6px 4px rgba(0,0,0,.25)); }
@keyframes jump { to { transform: translateY(-10px) rotate(4deg); } }
#wText { font-size: 20px; font-weight: 800; margin: 4px 0; color: var(--morado); }
.rec { color: var(--rosa); font-weight: 900; font-size: 18px; margin: 4px 0; min-height: 0; }
.rec:empty, .best:empty, .wstreak:empty { display: none; }
.best { margin: 2px 0; color: #6b4b78; }
.wstreak { margin: 6px 0 2px; font-weight: 900; color: var(--turq2); font-size: 16px; }
.row { display: flex; gap: 10px; }
.row .big { flex: 1; font-size: 18px; }
@media (max-height: 640px) { .sp #lolo { width: 70px; margin-top: -40px; } h1 { font-size: 32px; } .intro { font-size: 13px; margin: 4px 0 8px; } .big { padding: 10px; } }

/* embed-fit: small store frame (794x447, 640x360) */
.grid { grid-auto-rows: max-content; align-content: start; }
@media (max-height: 560px) {
  .ov { padding: 8px; }
  .panel { padding: 12px 14px 10px; border-radius: 20px; }
  .sp { width: min(620px, 100%); }
  .sp #lolo { width: 60px; margin: -34px auto -4px; }
  h1 { font-size: 30px; } h1 span { font-size: 16px; margin-top: 2px; }
  .intro { font-size: 12.5px; margin: 4px 4px 6px; }
  .daily { margin-bottom: 4px; padding: 6px; }
  .daily img { width: 96px; height: 64px; }
  .sp .btns { display: flex; gap: 10px; } .sp .btns .big { flex: 1; }
  .big { padding: 9px 10px; margin-top: 6px; font-size: 20px; }
  #bPlay { font-size: 22px; } .big.alt { padding: 9px 10px; font-size: 17px; }
  .ctrl { margin-top: 6px; }
  /* gallery */
  .gp { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 10px 12px 8px; }
  .gp h2 { font-size: 22px; margin: 0 40px 2px; }
  .close { width: 34px; height: 34px; font-size: 22px; top: 6px; }
  .album { font-size: 12.5px; margin-bottom: 4px; }
  .tabs button { padding: 6px 12px; font-size: 13px; }
  .grid { min-height: 60px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding: 6px 2px; }
  .opts { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; padding-top: 6px; }
  .lbl { margin: 0; }
  .counts button { min-width: 40px; padding: 6px 6px; font-size: 14px; }
  .kids { margin-top: 0; font-size: 13px; }
  #gPlay { font-size: 20px; padding: 8px 10px; }
  .foto { padding: 4px; gap: 4px; } #fotoPrev { width: 150px; height: 100px; }
  /* win */
  .wlolo { width: 80px; margin-top: -48px; }
  .wp h2 { font-size: 26px; }
}
@media (max-height: 420px) {
  .sp .intro { display: none; }
  .sp .ctrl { display: none; }
  h1 { font-size: 28px; }
  .wlolo { width: 64px; margin-top: -36px; }
  #wText { font-size: 17px; }
}
