/* Fredoka, served from this site (not Google's servers, so visitors' addresses aren't sent to Google).
   SIL Open Font License, see fonts/OFL.txt. One variable file covers weights 400 to 700. */
@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/fredoka-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/fredoka-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #12233f;
  --ink-soft: #3b5277;
  --paper: #f4f9ff;
  --ice: #d7efff;
  --ice-deep: #7cc7ff;
  --panel: rgba(244, 249, 255, 0.96);
  --line: #a9cbe8;
  --primary: #2f8fe0;
  --primary-dark: #1d5f9e;
  --gold: #ffc23d;
  --gold-dark: #b9811a;
  --bad: #ff6b6b;
  --shadow: 0 6px 0 rgba(18, 35, 63, 0.25), 0 12px 30px rgba(18, 35, 63, 0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9fd3f5;
  font-family: Fredoka, 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#view { position: fixed; inset: 0; touch-action: none; display: block; }

.screen { position: fixed; inset: 0; pointer-events: none; }
[hidden] { display: none !important; }
.screen > * { pointer-events: auto; }

.small { font-size: 0.85rem; }
.muted { opacity: 0.7; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 3px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.06s, box-shadow 0.06s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#5fb3ff, var(--primary)); color: #fff; }
.btn.gold { background: linear-gradient(#ffe08a, var(--gold)); }
.btn.big { font-size: 1.3rem; padding: 12px 26px; border-radius: 18px; }
.btn.icon { padding: 6px 10px; font-size: 1.1rem; }
.btn:focus-visible, .tool:focus-visible, .tab:focus-visible, .entry:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
}
.coin {
  display: inline-block; width: 1em; height: 1em; border-radius: 50%; vertical-align: -0.12em;
  background: radial-gradient(circle at 35% 30%, #fff6c8 0 18%, #ffd34a 40%, #c98a12 100%);
  box-shadow: inset 0 0 0 2px #9a6a0c;
  position: relative;
}
.coin::after { content: '❄'; position: absolute; inset: 0; font-size: 0.62em; line-height: 1.62em; text-align: center; color: #8a5a00; }

/* ---------- title ---------- */
#title { display: grid; place-items: start center; padding-top: 7vh; }
.title-card { text-align: center; padding: 0 16px; }
.logo {
  margin: 0;
  font-size: clamp(3.2rem, 12vw, 7rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink), 0 10px 30px rgba(18, 35, 63, 0.35);
  background: linear-gradient(#ffffff 30%, #bfe6ff 70%);
  -webkit-background-clip: text;
  background-clip: text;
}
.tagline { font-size: clamp(1rem, 3.4vw, 1.35rem); font-weight: 500; max-width: 30em; margin: 10px auto 22px; text-shadow: 0 1px 0 #fff; }
.title-card .small { margin-top: 16px; }
.linkish { font: inherit; background: none; border: none; color: var(--ink-soft); text-decoration: underline; cursor: pointer; padding: 4px; }
.privacy p { max-width: 60ch; line-height: 1.5; }

/* ---------- top bar ---------- */
.bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  flex-wrap: wrap;
}
.brand { font-size: 1.6rem; font-weight: 700; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.where {
  display: flex; flex-direction: column; line-height: 1.1;
  background: rgba(255, 255, 255, 0.85); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 12px;
}
.slots { display: flex; gap: 5px; }
.slot {
  width: 36px; height: 36px; border-radius: 10px; border: 3px dashed rgba(18, 35, 63, 0.6);
  background: rgba(255, 255, 255, 0.55); display: grid; place-items: center; font-weight: 700; color: var(--ink-soft);
}
.slot.got { border-style: solid; border-color: var(--ink); background: #fff; animation: pop 0.4s; }

/* ---------- toolbar ---------- */
.toolbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: safe center; gap: 8px;
  padding: 14px 10px max(10px, env(safe-area-inset-bottom));
  overflow-x: auto;
}
.tool {
  position: relative;
  font: inherit; color: var(--ink);
  width: 78px; min-width: 70px; height: 84px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer; padding: 4px;
}
.tool canvas { width: 46px; height: 46px; pointer-events: none; }
.tool.active { background: linear-gradient(#fff6cf, #ffd760); transform: translateY(-4px); box-shadow: 0 8px 0 var(--ink); }
.tool:disabled { opacity: 0.5; }
.tool-name { font-size: 0.72rem; font-weight: 600; }
.tool .lvl { font-size: 0.6rem; color: var(--gold-dark); line-height: 1; }
.tool kbd { position: absolute; top: 3px; left: 6px; font: 600 0.65rem Fredoka, sans-serif; opacity: 0.55; }
.tool.more { border-style: dashed; background: rgba(255, 255, 255, 0.6); }
.tool .plus { font-size: 2rem; font-weight: 700; line-height: 1; }
.btn.swap { padding: 6px 12px; font-size: 0.9rem; }
.tool .badge {
  position: absolute; top: -10px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; cursor: pointer;
  background: linear-gradient(#ffe08a, var(--gold)); border: 3px solid var(--ink); animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* rock track */
.track { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.pips { display: inline-flex; gap: 3px; align-items: center; }
.pip { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink-soft); background: transparent; display: inline-block; }
.pip.boss { width: 13px; height: 13px; border-radius: 4px; transform: rotate(45deg); }
.pip.done { background: var(--ice-deep); border-color: var(--ink); }
.pip.now { border-color: var(--gold-dark); background: var(--gold); box-shadow: 0 0 0 2px rgba(255, 194, 61, 0.45); }
.mastered { font-weight: 700; color: var(--gold-dark); font-size: 0.85rem; }
.loc-track { display: flex; align-items: center; gap: 10px; margin: -4px 0 10px; }
.loc-track .meter { flex: 1; height: 9px; }

/* upgrade path in the shop */
.tiers { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 0 6px; }
.tier { font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 2px solid #c5d6e6; color: #8aa0b6; }
.tier.have { border-color: var(--ink); color: var(--ink); background: var(--tier); }
.tier.cur { box-shadow: 0 0 0 2px var(--gold); }
.meter { position: relative; }
.meter b { position: absolute; inset: 0 auto 0 0; background: #b9dcff; }
.meter i { position: relative; }
.gainline { margin: 6px 0 0; color: var(--primary-dark); font-weight: 600; }
.next-note { margin: 0; font-weight: 600; color: var(--primary-dark); }
.find-row.bonus { border-left-color: var(--gold); }
.find-row.clear.gold { border-left-color: #f5b301; background: #fff8e0; }
.find-row.clear.silver { border-left-color: #a9b6c4; background: #f3f7fb; }
.find-row.clear.bronze { border-left-color: #c98445; background: #fdf3ea; }
.find-row.clear.over { border-left-color: #c5d6e6; }
.medal-badge { font-size: 1.6rem; }

/* fossils */
.slot.fossil { border-color: #b4621f; background: #fff1e0; }
.celebrate.fossil h2 { font-size: 2rem; color: #b4621f; margin: 4px 0 0; }
.celebrate.fossil p { margin: 4px 0; }
.fossil-art { display: grid; place-items: center; margin: 0 auto; width: 104px; height: 104px; border-radius: 50%;
  background: radial-gradient(circle, #fff3d6 0 55%, #ffd99a 56% 100%); border: 4px solid #b4621f; animation: pop 0.5s; }
.big-name { font-size: 1.3rem; font-weight: 700; margin: 0; }
.set-where { margin: 0 8px 6px; color: #ffd9b0; }

/* hits against par */
.hits {
  display: flex; align-items: baseline; gap: 4px; padding: 4px 12px; border-radius: 14px;
  border: 3px solid var(--ink); background: rgba(255, 255, 255, 0.9); font-size: 0.85rem;
}
.hits b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hits .medal { margin-left: 6px; font-weight: 700; padding: 0 8px; border-radius: 999px; font-size: 0.75rem; }
.hits.gold .medal { background: #ffd34a; }
.hits.silver .medal { background: #d6dee8; }
.hits.bronze .medal { background: #e8b07a; }
.hits.over .medal { background: #f1d0d0; color: #8a3030; }

/* shop extras */
.buttons { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.strong { margin: 0 0 4px; font-weight: 600; color: #a0521c; }
.count-chip { font-size: 0.85rem; color: var(--ink-soft); }
.gear-glyph { font-size: 1.9rem; line-height: 46px; height: 46px; }
.gear-icon { width: 64px; height: 64px; flex: none; display: grid; place-items: center; font-size: 2.4rem; background: var(--ice); border-radius: 16px; border: 3px solid var(--line); }

/* ---------- Pip ---------- */
#pip-bubble {
  position: fixed; max-width: min(300px, 70vw);
  background: #fff; border: 3px solid var(--ink); border-radius: 18px 18px 18px 4px;
  padding: 10px 14px; font-weight: 500; box-shadow: var(--shadow); pointer-events: none; z-index: 5;
}
#pip-bubble.pop { animation: pop 0.3s; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 76px; right: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 6; pointer-events: none; align-items: flex-end; }
.toast {
  display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 3px solid var(--ink); border-left: 10px solid var(--rar, var(--primary));
  border-radius: 16px; padding: 8px 14px 8px 10px; box-shadow: var(--shadow);
  animation: slidein 0.35s cubic-bezier(.2, 1.4, .4, 1);
  max-width: min(360px, 92vw);
}
.toast.out { animation: slideout 0.5s forwards; }
.toast .rar { color: var(--rar); font-weight: 700; filter: brightness(0.75); }
.toast .new { background: var(--bad); color: #fff; font-weight: 700; font-size: 0.7rem; border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: 2px; }
.gain { font-weight: 700; color: var(--gold-dark); }
.gain.big { font-size: 1.5rem; margin: 10px 0; }

/* ---------- modal ---------- */
#modal {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(10, 25, 50, 0.45);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
}
.panel {
  position: relative;
  width: min(820px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--panel); border: 4px solid var(--ink); border-radius: 26px;
  padding: 20px 22px; box-shadow: var(--shadow);
  animation: pop 0.25s;
}
.panel h2 { margin: 0 0 8px; font-size: 1.7rem; }
.close { position: absolute; top: 10px; right: 12px; font: 700 1.2rem Fredoka, sans-serif; background: none; border: none; cursor: pointer; color: var(--ink); padding: 6px; }
.modal-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-right: 30px; }
.modal-head h2 { margin: 0; }

/* rock done */
.rock-done { display: flex; flex-direction: column; gap: 10px; }
.finds { display: flex; flex-direction: column; gap: 6px; }
.find-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-left: 8px solid var(--rar); border-radius: 12px; padding: 6px 12px; }
.total { font-size: 1.3rem; font-weight: 700; text-align: right; }
.celebrate { text-align: center; }
.celebrate canvas { background: linear-gradient(#24324f, #182238); border-radius: 18px; margin: 8px 0; }

/* shop */
.shop-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.shop-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px; }
.shop-card.owned { border-color: var(--ice-deep); }
.shop-card canvas { width: 64px; height: 64px; flex: none; }
.shop-card h3 { margin: 0; }
.shop-card .lvl { color: var(--gold-dark); font-size: 0.9rem; }
.shop-card p { margin: 2px 0 6px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(70px, 1fr)); gap: 4px 12px; }
.stat { font-size: 0.72rem; font-weight: 600; }
.meter { height: 7px; border-radius: 4px; background: #dfeaf5; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #5fb3ff, #2f8fe0); }

/* collection book */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tab { font: 600 0.9rem Fredoka, sans-serif; border: 3px solid var(--ink); background: #fff; border-radius: 12px; padding: 5px 10px; cursor: pointer; color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.entry {
  position: relative; font: inherit; color: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff; border: 3px solid var(--rar); border-radius: 16px; padding: 10px 6px 8px;
}
.entry.unknown { background: #e8f1fa; border-color: #b8cde0; }
.entry .name { font-weight: 600; font-size: 0.85rem; text-align: center; line-height: 1.1; }
.entry .rar { color: var(--rar); font-weight: 700; filter: brightness(0.75); }
.entry.unknown .rar { filter: none; color: #7d93ab; }
.entry .count { position: absolute; top: 4px; right: 8px; font-weight: 700; color: var(--ink-soft); }
.entry .perfect { position: absolute; top: 2px; left: 8px; color: var(--gold-dark); font-size: 1.1rem; }
.detail { margin-top: 12px; min-height: 2.5em; }
.museum { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.set-card { background: linear-gradient(#24324f, #182238); border-radius: 18px; padding: 8px; color: #fff; border: 3px solid #0d1526; }
.set-card.done { border-color: var(--gold); }
.set-foot { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 4px; gap: 8px; }

/* ---------- map ---------- */
#map::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(16, 40, 80, 0.15), rgba(16, 40, 80, 0.45)); pointer-events: none; }
.map-scroll { position: absolute; inset: 64px 0 0; overflow: auto; padding: 10px 16px 30px; }
.map-title { text-align: center; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; font-size: 2rem; margin: 6px 0 16px; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto; }
.loc-card { background: var(--panel); border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.thumb-wrap { position: relative; }
.thumb { display: block; width: 100%; aspect-ratio: 32 / 17; border-bottom: 4px solid var(--ink); }
.loc-card.locked .thumb { filter: grayscale(0.7) brightness(0.75); }
.lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; }
.loc-body { padding: 10px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.loc-body h3 { margin: 0; font-size: 1.25rem; }
.loc-body p { margin: 4px 0 10px; flex: 1; }
.loc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.locked-note { font-size: 0.8rem; opacity: 0.7; }

@keyframes pop { 0% { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
@keyframes slidein { from { transform: translateX(120%); } to { transform: translateX(0); } }
@keyframes slideout { to { transform: translateX(130%); opacity: 0; } }

@media (max-width: 640px) {
  .bar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .where { order: 3; flex-basis: auto; }
  .slots { order: 4; }
  .brand { font-size: 1.3rem; }
  .tool { width: 64px; min-width: 60px; height: 74px; }
  .tool canvas { width: 38px; height: 38px; }
  .tool-name { font-size: 0.62rem; }
  .map-scroll { inset: 60px 0 0; }
  .panel { padding: 16px 14px; border-radius: 20px; }
  .shop-card { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  #toasts { top: auto; bottom: 96px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; }
}

/* replay features */
.loc-grid.extras { margin-bottom: 16px; }
.loc-card.special { border-color: #2f5f8a; }
.loc-card.daily { background: linear-gradient(#fffbe8, var(--panel)); }
.badge-corner { position: absolute; top: 10px; left: 10px; background: var(--ink); color: #fff; font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; }
.trait { display: block; font-size: 0.75rem; font-weight: 600; color: #8a4b12; max-width: 340px; }
.quests { display: flex; flex-direction: column; gap: 10px; }
.quest { display: flex; gap: 12px; align-items: center; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.quest .meter { height: 9px; margin: 6px 0 2px; }
.toast-icon { font-size: 2rem; }
.toast .new.aurora, .shiny-badge { background: linear-gradient(90deg, #ff6fb1, #ffd34a, #5fffa8, #5fc8ff, #b07cff); color: #1d1a33; }
.shiny-badge { position: absolute; bottom: 4px; right: 6px; font-size: 0.7rem; font-weight: 700; border-radius: 6px; padding: 0 5px; }
.find-row.shiny { border-left-color: #b07cff; background: linear-gradient(90deg, #fff 60%, #f3eaff); }

.share-text { width: 100%; font: 600 1rem Fredoka, system-ui, sans-serif; border: 3px solid var(--line); border-radius: 12px; padding: 10px; resize: none; }
