/* FROG MERGE — pop-up panels (src/panels.js renders them into #modal).
   Builds on style.css: .db-btn (.go .warn .blue .danger .big), .db-panel, .ico and the Endesga 32 palette variables.
   Every class here starts with pn- (the only other selectors are #modal and .db-btn modifiers). */

/* ---------- backdrop + panel ---------- */
#modal { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center;
  padding: calc(.4em + var(--safe-t)) calc(.4em + var(--safe-r)) calc(.4em + var(--safe-b)) calc(.4em + var(--safe-l));
  background: rgba(24,20,37,.66); font-size: max(13px, var(--u)); color: var(--ink); animation: pnFade .15s ease-out; }
#modal[hidden] { display: none; }
@keyframes pnFade { from { background: rgba(24,20,37,0); } }

.pn { position: relative; display: flex; flex-direction: column; width: min(94vw, 36em); max-height: 86vh; max-height: 86dvh;
  padding: 0; outline: none; animation: pnPop .24s steps(4); }
@keyframes pnPop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
.pn canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.pn [hidden] { display: none !important; }

/* title bar */
.pn-head { flex: none; display: flex; align-items: center; gap: .5em; padding: .5em .55em .5em .75em; background: var(--night);
  box-shadow: 0 .16em 0 0 var(--ink); position: relative; z-index: 1; }
.pn-head .pn-hico { width: 1.9em; height: 1.9em; }
.pn-title { flex: 1; min-width: 0; margin: 0; padding-top: .2em; font-family: var(--font-title); font-weight: 400; font-size: 1.05em; line-height: 1.3;
  color: var(--lemon); text-shadow: .14em .14em 0 var(--ink); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-info { flex: none; display: inline-flex; align-items: center; gap: .3em; background: var(--ink); color: var(--lemon); font-weight: 700;
  padding: .3em .6em .35em .45em; box-shadow: 0 0 0 .12em var(--slate); white-space: nowrap; }
.pn-info .ico { width: 1.35em; height: 1.35em; }
.pn-x { flex: none; width: 2.4em; height: 2.4em; padding: 0 0 .1em; margin: 0 .15em 0 .25em; font-family: var(--font-title); font-weight: 400; font-size: .95em; }

/* scrolling body + footer */
.pn-body { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  -webkit-overflow-scrolling: touch; padding: 1em .85em 1.1em; scrollbar-width: thin; scrollbar-color: var(--steel) transparent; }
.pn-body::-webkit-scrollbar { width: .6em; }
.pn-body::-webkit-scrollbar-thumb { background: var(--steel); box-shadow: inset 0 0 0 .14em var(--sand); }
.pn-foot { flex: none; display: flex; align-items: center; justify-content: center; gap: .45em; padding: .5em 1em .6em;
  border-top: .14em dashed var(--tan); font-weight: 700; color: var(--brown); }
.pn-foot .ico { width: 1.4em; height: 1.4em; }

/* buttons inside panels (sized from the panel's font, not --u) */
.pn .db-btn { margin: 0; min-height: 2.75em; font-size: 1em; }
.pn .db-btn.big { font-size: 1.2em; }
.pn-num { font-family: var(--font-title); font-weight: 400; font-size: .82em; letter-spacing: 0; line-height: 1.2; }
.pn-info .pn-num { font-size: .85em; }
.pn .db-btn .ico { width: 1.35em; height: 1.35em; }
.db-btn.pn-dim { opacity: .55; filter: grayscale(.7); cursor: not-allowed; }
.db-btn.pn-dim:active { transform: none; }
.db-btn.pn-busy { cursor: progress; filter: brightness(.92); }
.db-btn.pn-lock { background: var(--mist); }
.db-btn.pn-cdb { background: var(--mist); font-variant-numeric: tabular-nums; }
.pn-shake { animation: pnShake .3s steps(6); }
@keyframes pnShake { 20%, 60% { transform: translateX(-.22em); } 40%, 80% { transform: translateX(.22em); } }
.pn-pulse { animation: pnPulse 1.1s steps(2) infinite; }
@keyframes pnPulse { 50% { filter: brightness(1.18); } }

/* ---------- list rows (quests, upgrades, shop, boosts) ---------- */
.pn-list { display: flex; flex-direction: column; gap: .8em; padding: .15em .25em .35em .15em; }
.pn-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5em .75em; padding: .55em .65em; background: rgba(255,255,255,.42);
  box-shadow: 0 0 0 .14em var(--ink), .14em .22em 0 .14em rgba(24,20,37,.22); }
.pn-pic { flex: none; position: relative; display: grid; place-items: center; width: 2.6em; min-height: 2.6em; }
.pn-pic .ico { width: 2.3em; height: 2.3em; }
.pn-mid { flex: 1 1 9.5em; min-width: 0; display: flex; flex-direction: column; gap: .2em; }
.pn-name { display: flex; flex-wrap: wrap; align-items: center; gap: .15em .45em; font-weight: 700; font-size: 1.08em; line-height: 1.15; }
.pn-lv { font-size: .78em; background: var(--ink); color: var(--lemon); padding: .2em .45em .25em; letter-spacing: .02em; }
.pn-tn { color: var(--steel); }
.pn-desc { font-weight: 600; line-height: 1.22; }
.pn-next { font-weight: 600; font-size: .92em; line-height: 1.22; color: var(--leaf); }
.pn-nx { font-weight: 700; color: var(--forest); }
.pn-inc { display: inline-flex; align-items: center; gap: .25em; font-weight: 700; color: var(--leaf); }
.pn-inc .ico { width: 1.25em; height: 1.25em; }
.pn-act { flex: none; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: .35em; }
.pn-act .db-btn { min-width: 6.4em; }
.pn-max { font-family: var(--font-title); font-size: .85em; background: var(--lemon); color: var(--ink); padding: .55em .8em .5em; box-shadow: 0 0 0 .16em var(--ink); }
.pn-row.max { background: rgba(254,231,97,.32); }

/* progress bar */
.pn-bar { position: relative; height: 1.45em; margin: .3em .15em .1em; background: var(--slate); box-shadow: 0 0 0 .13em var(--ink); overflow: hidden; }
.pn-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--grass);
  box-shadow: inset 0 -.22em 0 rgba(24,20,37,.28), inset 0 .16em 0 rgba(255,255,255,.35); transition: width .25s steps(4); }
.pn-bar.full i { background: var(--lemon); }
.pn-bar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .88em; color: var(--white);
  text-shadow: .1em 0 0 var(--ink), -.1em 0 0 var(--ink), 0 .1em 0 var(--ink), 0 -.1em 0 var(--ink), .1em .12em 0 var(--ink); font-variant-numeric: tabular-nums; }

/* quests */
.pn-rew { display: inline-flex; align-items: center; gap: .25em; font-weight: 700; color: var(--brown); white-space: nowrap; }
.pn-rew .ico { width: 1.35em; height: 1.35em; }
.pn-quest.done { background: rgba(254,231,97,.45); }
.pn-quest .pn-act { min-width: 6.4em; }
.pn-new { animation: pnIn .3s steps(3); }
@keyframes pnIn { from { transform: translateX(-1.2em); opacity: 0; } }

/* shop */
.pn-shop .pn-pic { width: 4.4em; }
.pn-shop .pn-mid { flex-basis: 6em; }
.pn-up .pn-mid { flex-basis: 8em; }
.pn-shop .pn-por { width: 4.4em; height: 3.6em; }
.pn-row.locked { background: rgba(58,68,102,.12); box-shadow: 0 0 0 .14em var(--steel); }
.pn-row.locked .pn-name { color: var(--slate); }
.pn-row.locked .pn-por { opacity: .7; }
.pn-pic .ico.pn-lk { position: absolute; right: -.2em; bottom: 0; width: 1.5em; height: 1.5em; }
.pn-notice { display: flex; align-items: center; gap: .5em; margin: 0 .2em 1em; padding: .5em .7em; background: var(--gold); font-weight: 700;
  box-shadow: 0 0 0 .14em var(--ink); }
.pn-notice .ico { width: 1.6em; height: 1.6em; }

/* ---------- 1. Frogdex ---------- */
.pn-dex { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.3em, 1fr)); gap: .8em; padding: .15em .25em .35em .15em; }
.pn-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: .12em; margin: 0; border: 0; padding: .45em .25em .55em;
  font: inherit; color: var(--ink); text-align: center; background: rgba(255,255,255,.42); box-shadow: 0 0 0 .14em var(--ink), .14em .22em 0 .14em rgba(24,20,37,.22); }
button.pn-cell { cursor: pointer; touch-action: manipulation; }
button.pn-cell:hover { background: rgba(255,255,255,.72); }
button.pn-cell:active { transform: translateY(.12em); }
button.pn-cell:focus-visible { outline: .16em dashed var(--leaf); outline-offset: .25em; }
.pn-no { position: absolute; left: .4em; top: .3em; font-size: .8em; font-weight: 700; color: var(--steel); }
.pn-cell .pn-por { width: 4.4em; height: 3.6em; margin-top: .55em; }
.pn-nm { display: flex; align-items: center; justify-content: center; min-height: 2.3em; font-weight: 700; font-size: .95em; line-height: 1.12; }
.pn-cell .pn-inc { font-size: .88em; }
.pn-cell.unk { background: rgba(58,68,102,.12); box-shadow: 0 0 0 .14em var(--steel); }
.pn-nm.pn-q { font-family: var(--font-title); font-weight: 400; font-size: .8em; color: var(--steel); }
.pn-cell.hint { background: rgba(254,231,97,.4); box-shadow: 0 0 0 .14em var(--ink), .14em .22em 0 .14em rgba(24,20,37,.22); }
.pn-cell.hint .pn-nm.pn-q { color: var(--brown); min-height: 1.6em; }
.pn-how { font-size: .85em; font-weight: 700; line-height: 1.12; color: var(--brown); }
.pn-detail { display: flex; flex-direction: column; align-items: center; gap: .35em; text-align: center; padding: .1em .3em .4em; }
.pn-detail .pn-big { width: 10em; height: 8.2em; margin: .3em 0 .2em; }
.pn-dno { font-weight: 700; color: var(--steel); }
.pn-dname { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 1.2em; line-height: 1.4; }
.pn-blurb { margin: .1em 0 .2em; max-width: 24em; font-size: 1.12em; font-weight: 600; line-height: 1.3; }
.pn-dinc { display: inline-flex; align-items: center; gap: .3em; margin-bottom: .7em; font-weight: 700; font-size: 1.05em; color: var(--leaf); }
.pn-dinc .ico { width: 1.5em; height: 1.5em; }

/* ---------- 3. Daily gift ---------- */
.pn-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.05em .75em; padding: .65em .25em .35em .15em; }
.pn-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: .2em; padding: .5em .3em .6em; text-align: center;
  background: rgba(255,255,255,.42); box-shadow: 0 0 0 .14em var(--ink), .14em .22em 0 .14em rgba(24,20,37,.22); }
.pn-day.d7 { grid-column: span 2; background: rgba(254,174,52,.3); }
.pn-dlab { font-weight: 700; font-size: .8em; letter-spacing: .08em; text-transform: uppercase; color: var(--brown); }
.pn-day .pn-dico { width: 2.5em; height: 2.5em; margin: .1em 0; }
.pn-dtxt { font-weight: 700; font-size: .9em; line-height: 1.12; }
.pn-dval { display: inline-flex; align-items: center; gap: .2em; font-weight: 700; font-size: .9em; color: var(--leaf); }
.pn-dval .ico { width: 1.25em; height: 1.25em; }
.pn-dval.pn-crn { color: var(--rust); }
.pn-day.got { background: rgba(58,68,102,.12); box-shadow: 0 0 0 .14em var(--steel); }
.pn-day.got > :not(.pn-chk) { opacity: .45; }
.pn-day .ico.pn-chk { position: absolute; right: -.45em; top: -.45em; width: 1.9em; height: 1.9em; }
.pn-day.stamp .pn-chk { animation: pnStamp .4s steps(4); }
@keyframes pnStamp { from { transform: scale(2.6) rotate(-20deg); opacity: 0; } }
.pn-day.today, .pn-day.next { padding-top: 1.05em; }
.pn-day.today { background: var(--lemon); animation: pnBob 1s steps(2) infinite; }
@keyframes pnBob { 50% { transform: translateY(-.18em); } }
.pn-day.next { box-shadow: 0 0 0 .14em var(--ink), .14em .22em 0 .14em rgba(24,20,37,.22); outline: .14em dashed var(--leaf); outline-offset: .3em; }
.pn-tag { position: absolute; left: 50%; top: -.85em; transform: translateX(-50%); padding: .15em .45em .2em; background: var(--red); color: var(--white);
  font-weight: 700; font-size: .78em; white-space: nowrap; box-shadow: 0 0 0 .12em var(--ink); }
.pn-tag.next { background: var(--leaf); }
.pn-claimrow { display: flex; flex-direction: column; align-items: center; gap: .3em; margin: 1.1em 0 .2em; text-align: center; }
.pn-claimrow .db-btn.big { min-width: 11em; }
.pn-claimrow .db-btn.big .ico { width: 1.5em; height: 1.5em; }
.pn-wt { font-family: var(--font-title); font-size: .9em; line-height: 1.4; }
.pn-ws { display: inline-flex; align-items: center; gap: .35em; font-weight: 700; color: var(--slate); font-variant-numeric: tabular-nums; }
.pn-ws .ico { width: 1.5em; height: 1.5em; }
.pn-note { margin: .9em .5em 0; font-size: .88em; font-weight: 600; line-height: 1.3; color: var(--steel); text-align: center; }

/* ---------- 6. Boosts ---------- */
.pn-active { display: flex; flex-wrap: wrap; align-items: center; gap: .45em .5em; margin: 0 .2em 1em .1em; padding: .5em .65em; background: var(--ink); color: var(--white);
  box-shadow: .14em .22em 0 0 rgba(24,20,37,.25); font-weight: 700; }
.pn-ah { color: var(--mist); text-transform: uppercase; font-size: .8em; letter-spacing: .08em; margin-right: .2em; }
.pn-none { color: var(--fog); font-weight: 600; }
.pn-chip { display: inline-flex; align-items: center; gap: .3em; padding: .2em .5em .25em .3em; background: var(--lemon); color: var(--ink);
  box-shadow: 0 0 0 .12em var(--ink); font-variant-numeric: tabular-nums; }
.pn-chip .ico { width: 1.3em; height: 1.3em; }
.pn-chip.auto { background: var(--sky); } .pn-chip.gold { background: var(--gold); }

/* ---------- 7. Settings ---------- */
.pn-sets { display: flex; flex-direction: column; }
.pn-set { display: flex; flex-wrap: wrap; align-items: center; gap: .5em .7em; padding: .5em .2em; border-bottom: .14em dashed var(--tan); }
.pn-set > .ico { width: 1.7em; height: 1.7em; }
.pn-lbl { flex: 1; font-weight: 700; font-size: 1.08em; }
.db-btn.pn-tog { min-width: 5.2em; }
.db-btn.pn-toff { background: var(--mist); color: var(--slate); }
.pn-rwrap { display: inline-flex; align-items: center; gap: .6em; flex: 0 1 15em; min-width: 9em; }
.pn-rv { min-width: 2.8em; text-align: right; font-variant-numeric: tabular-nums; }
.pn-range { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 2.4em; margin: 0; background: transparent; cursor: pointer; touch-action: none; --v: 70%; }
.pn-range:focus { outline: none; }
.pn-range:focus-visible { outline: .16em dashed var(--leaf); outline-offset: .2em; }
.pn-range::-webkit-slider-runnable-track { height: .6em; background: linear-gradient(90deg, var(--grass) var(--v), var(--steel) var(--v)); box-shadow: 0 0 0 .13em var(--ink); }
.pn-range::-moz-range-track { height: .6em; background: linear-gradient(90deg, var(--grass) var(--v), var(--steel) var(--v)); box-shadow: 0 0 0 .13em var(--ink); }
.pn-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 1.3em; height: 1.75em; margin-top: -.575em; border: 0; border-radius: 0;
  background: var(--lemon); box-shadow: 0 0 0 .14em var(--ink), .1em .2em 0 .14em rgba(24,20,37,.4); }
.pn-range::-moz-range-thumb { width: 1.3em; height: 1.75em; border: 0; border-radius: 0; background: var(--lemon); box-shadow: 0 0 0 .14em var(--ink); }
.pn-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65em; margin: 1.1em .1em .3em; }
.pn-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35em; padding: .55em .35em .6em; text-align: center;
  background: var(--ink); color: var(--white); box-shadow: .14em .22em 0 0 rgba(24,20,37,.25); }
.pn-stat span { font-size: .85em; font-weight: 700; color: var(--mist); line-height: 1.1; }
.pn-stat b { font-family: var(--font-title); font-weight: 400; font-size: .92em; color: var(--lemon); line-height: 1.3; word-break: break-word; }
.pn-stat small { font-size: .8em; font-weight: 600; color: var(--fog); }
.pn-cta { display: flex; justify-content: center; margin: 1.1em 0 .2em; }
.pn-confirm { margin: 1.1em .1em .2em; padding: .75em .8em .85em; text-align: center; background: rgba(228,59,68,.12); box-shadow: 0 0 0 .14em var(--crimson); }
.pn-ctext { margin: 0 0 .75em; font-weight: 700; font-size: 1.05em; line-height: 1.3; }
.pn-cbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: .6em .8em; }
.pn-credits { margin: 1.2em .5em 0; font-size: .82em; font-weight: 600; line-height: 1.3; color: var(--steel); text-align: center; }

/* ---------- 8. Migration ---------- */
.pn-explain { display: flex; align-items: flex-start; gap: .75em; padding: 0 .2em; }
.pn-explain .pn-eico { width: 2.8em; height: 2.8em; margin-top: .15em; }
.pn-explain p { margin: 0; font-weight: 600; font-size: 1.08em; line-height: 1.35; }
.pn-lockbox { display: flex; align-items: center; gap: .8em; margin: 1.1em .1em .2em; padding: .5em .8em .5em .4em; background: rgba(58,68,102,.12);
  box-shadow: 0 0 0 .14em var(--steel); }
.pn-lockbox .pn-por { flex: none; width: 4.4em; height: 3.6em; }
.pn-lbt { display: flex; flex-direction: column; gap: .25em; line-height: 1.25; }
.pn-p-migrate .pn-cta .db-btn.big { min-width: 10em; }
.pn-p-migrate .pn-confirm { background: rgba(254,174,52,.25); box-shadow: 0 0 0 .14em var(--rust); }

/* ---------- phones ---------- */
@media (orientation: portrait) {
  #modal { font-size: clamp(14px, 3.8vw, 19px); }
  .pn { width: min(95vw, 32em); }
}
@media (max-width: 520px) {
  .pn-days { grid-template-columns: repeat(3, 1fr); }
  .pn-day.d7 { grid-column: span 3; }
  .pn-body { padding-left: .7em; padding-right: .7em; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .pn-head { padding-top: .35em; padding-bottom: .35em; }
  .pn-body { padding-top: .8em; }
}
@media (prefers-reduced-motion: reduce) {
  .pn-pulse, .pn-day.today { animation: none !important; }
}
