/* SpaceCatz: Orbit Hop — game page */
:root {
  --ink: #F6F3FF;
  --muted: #B9B3E0;
  --panel: rgba(18, 16, 50, .82);
  --line: rgba(255, 255, 255, .12);
  --orange: #FF9F43;
  --orange-d: #C9620F;
  --violet: #6E5BFF;
  --violet-d: #3B2DA8;
  --gold: #FFD166;
  --pink: #FF5FA2;
  --fish: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 24'%3E%3Cpath d='M30 12L39 4v16z' fill='%23F2A93B'/%3E%3Cellipse cx='17' cy='12' rx='15' ry='9.5' fill='%23FFD166'/%3E%3Cpath d='M12 4.5q4 7.5 0 15' fill='none' stroke='%23F2A93B' stroke-width='2'/%3E%3Ccircle cx='7.5' cy='10' r='2' fill='%232A1E3B'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  font-family: 'Fredoka', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
body {
  display: flex;
  justify-content: center;
  background: #05051A radial-gradient(ellipse at 50% 0%, #1D1656 0%, #05051A 70%);
}

#stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  box-shadow: 0 0 90px rgba(120, 90, 255, .2);
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; inset: 0 0 auto 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}
#hud > :first-child { justify-self: start; }
#hud > :last-child { justify-self: end; }
.hud-score {
  display: flex; flex-direction: column; align-items: center;
  font-size: 54px; font-weight: 700; line-height: 1;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 24px rgba(160, 140, 255, .45);
}
.hud-score small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; text-shadow: none; }
.icon-btn {
  pointer-events: auto;
  width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line);
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); color: var(--ink); cursor: pointer;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .32); border: 1px solid var(--line);
  font-weight: 600; font-size: 17px;
}
.fish-ico { display: inline-block; width: 22px; height: 14px; background: var(--fish) center / contain no-repeat; vertical-align: -1px; }

#hint {
  position: absolute; left: 50%; bottom: calc(13% + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 20px; border-radius: 999px;
  background: rgba(0, 0, 0, .4); border: 1px solid var(--line);
  font-weight: 600; font-size: 18px; white-space: nowrap;
  pointer-events: none;
  animation: hint 1.3s ease-in-out infinite;
}
@keyframes hint { 50% { transform: translateX(-50%) scale(1.07); } }

#toast {
  position: absolute; left: 50%; top: calc(96px + env(safe-area-inset-top));
  transform: translate(-50%, -8px); opacity: 0;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(20, 16, 60, .9); border: 1px solid rgba(255, 209, 102, .5);
  color: var(--gold); font-weight: 600; white-space: nowrap;
  transition: opacity .25s, transform .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(5, 5, 26, .2), rgba(5, 5, 26, .72));
  animation: fade .25s ease-out;
}
#screen-menu { justify-content: space-between; }
@keyframes fade { from { opacity: 0; } }

.panel {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px; border-radius: 24px;
  background: var(--panel); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  text-align: center;
  animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.panel.scroll { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.panel h2 { margin: 0; font-size: 30px; }
.panel h3 { margin: 0; font-size: 20px; }
.panel p { margin: 0; color: var(--muted); line-height: 1.4; }

.corner-link {
  align-self: flex-start; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .25);
}
.menu-top { text-align: center; margin-top: 2vh; }
.logo {
  margin: 0;
  font-size: clamp(56px, 17vw, 84px); font-weight: 700; line-height: .86; letter-spacing: .01em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #FFE7A3 10%, #FF9F43 55%, #FF6A3D 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 #3A1F75) drop-shadow(0 14px 28px rgba(255, 140, 60, .35));
}
.tagline { margin: 12px auto 0; max-width: 300px; color: var(--muted); font-size: 16px; line-height: 1.35; }
.fine { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.fine a { color: inherit; text-underline-offset: 3px; }
kbd { font: inherit; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); border: 1px solid var(--line); }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 6px; }
.stats-row > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.stats-row b { font-size: 22px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.stats-row span:not(.fish-ico) { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stats-row b span { font-size: 22px !important; color: var(--ink) !important; letter-spacing: 0 !important; text-transform: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 12px 18px;
  border: 0; border-radius: 16px; cursor: pointer;
  font: 600 18px/1.1 'Fredoka', ui-rounded, system-ui, sans-serif; text-decoration: none; text-align: center;
  color: #2A1240; background: linear-gradient(#FFC36E, #FF9F43);
  box-shadow: 0 5px 0 var(--orange-d), 0 10px 24px rgba(255, 159, 67, .28);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--orange-d); }
.btn:disabled, .btn.is-soon { filter: grayscale(.7) brightness(.8); cursor: not-allowed; }
.btn-big { min-height: 60px; font-size: 22px; }
.btn.alt { color: #fff; background: linear-gradient(#8A7BFF, #5B4BE0); box-shadow: 0 5px 0 var(--violet-d), 0 10px 24px rgba(110, 91, 255, .3); }
.btn.alt:active { box-shadow: 0 2px 0 var(--violet-d); }
.btn.ghost { color: var(--ink); background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px var(--line); min-height: 46px; font-size: 16px; }
.btn.ghost:active { box-shadow: inset 0 0 0 1px var(--line); }
.btn small { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 500; opacity: .85; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn:focus-visible, .icon-btn:focus-visible, .cat-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pulse { animation: btnpulse 1.4s ease-in-out infinite; }
@keyframes btnpulse { 50% { transform: scale(1.03); } }

/* ---------- studio credit + Ko-fi ---------- */
.menu-foot { display: flex; flex-direction: column; gap: 4px; }
.studio b { color: var(--ink); font-weight: 600; }
.kofi-row { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 4px; }
.kofi-slot { display: inline-flex; justify-content: center; min-height: 40px; }
.kofi-fallback { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 7px; color: #fff; font: 700 14px 'Fredoka', ui-rounded, system-ui, sans-serif; text-decoration: none; }

/* ---------- purrks ---------- */
.purrk-line {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 12px 8px 8px; border-radius: 16px; cursor: pointer;
  background: rgba(46, 196, 182, .1); border: 1px solid rgba(154, 245, 234, .25); color: var(--muted);
  font: 400 13px/1.3 'Fredoka', ui-rounded, system-ui, sans-serif;
}
.purrk-line img { width: 38px; height: 48px; flex: none; }
.purrk-line b { display: block; color: #9AF5EA; font-weight: 600; font-size: 14.5px; margin-bottom: 1px; }
.cat-detail {
  display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; text-align: left;
  padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
}
.cat-detail img { width: 96px; aspect-ratio: 120 / 150; }
.cd-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cd-body h3 { font-size: 22px; }
.cd-blurb { font-size: 13.5px; }
.cd-purrk { padding: 8px 10px; border-radius: 12px; background: rgba(46, 196, 182, .12); }
.cd-purrk b { color: #9AF5EA; font-size: 16px; }
.cd-purrk p { font-size: 13.5px; margin-top: 2px !important; color: var(--ink) !important; }
.purrk-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #2A1240; background: #9AF5EA; padding: 2px 6px; border-radius: 6px; vertical-align: 2px; }
.cd-body .btn { min-height: 44px; font-size: 16px; margin-top: 2px; }
.cat-card.selected { box-shadow: 0 0 0 2px #9AF5EA; }

/* ---------- game over ---------- */
.over-panel h2 { font-size: 28px; }
.badge {
  align-self: center; padding: 4px 12px; border-radius: 999px;
  background: var(--gold); color: #3A2400; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .06em;
  animation: pop .4s cubic-bezier(.2, 1.6, .4, 1);
}
.score-big { font-size: 88px; font-weight: 700; line-height: .9; text-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 34px rgba(255, 159, 67, .4); }
.score-label { color: var(--muted); font-size: 15px; text-transform: uppercase; letter-spacing: .1em; margin-top: -4px; }
.nudge {
  border: 1px dashed rgba(255, 209, 102, .45); background: rgba(255, 209, 102, .08); color: var(--gold);
  border-radius: 14px; padding: 10px; font: 500 14px/1.3 'Fredoka', ui-rounded, system-ui, sans-serif; cursor: pointer;
}

/* ---------- trophies ---------- */
.trophies-panel { max-width: 440px; }
.trophy-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; text-align: left; }
.trophy { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); opacity: .72; }
.trophy.done { opacity: 1; background: rgba(255, 209, 102, .1); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, .35); }
.trophy-icon { font-size: 26px; text-align: center; }
.trophy-body { min-width: 0; }
.trophy-body b { display: block; font-size: 16px; }
.trophy-body p { font-size: 13px; line-height: 1.3; }
.trophy-bar { height: 4px; margin-top: 6px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.trophy-bar i { display: block; height: 100%; background: var(--gold); }
.trophy.done .trophy-bar { display: none; }
.trophy-prog { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.trophy.done .trophy-prog { color: var(--gold); }
.ach-line { margin: -2px 0 2px; font-size: 14px; color: var(--gold); font-weight: 600; line-height: 1.4; }

/* ---------- cats ---------- */
.cats-panel { max-width: 440px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.cats-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 4px 0; }
.cats-grid > * { flex: 0 0 calc((100% - 20px) / 3); }
.cat-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px; border-radius: 16px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 2px solid transparent; color: var(--ink);
  font: inherit;
}
.cat-card img { width: 78%; aspect-ratio: 120 / 150; transition: transform .15s; }
.cat-card:hover img { transform: translateY(-3px) rotate(-3deg); }
.cat-card b { font-size: 15px; }
.cat-card .tag { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.cat-card.equipped { border-color: var(--gold); background: rgba(255, 209, 102, .1); }
.cat-card.equipped .tag { color: var(--gold); }
.cat-card.locked img { filter: brightness(.45) saturate(.5); }
.cat-card.affordable .tag { color: #9CF29C; }
.cat-card.supporter .tag { color: #FF9AD5; }
.cat-card.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.supporter-box {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border-radius: 18px; margin-top: 6px;
  background: linear-gradient(135deg, rgba(110, 91, 255, .25), rgba(255, 95, 162, .18));
  border: 1px solid rgba(255, 154, 213, .35);
}
.supporter-box.is-supporter .btn, .supporter-box.is-supporter .code-form { display: none; }
.code-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-form input {
  min-width: 0; padding: 0 12px; height: 46px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: var(--ink);
  font: 500 15px 'Fredoka', ui-rounded, system-ui, sans-serif; text-transform: uppercase; -webkit-user-select: text; user-select: text;
}
.code-form .btn { width: auto; }

@media (max-height: 640px) {
  .logo { font-size: 52px; }
  .tagline { display: none; }
  .btn-big { min-height: 52px; font-size: 20px; }
  .score-big { font-size: 64px; }
  .panel { padding: 16px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
