:root {
  --brand: #e3350d; --bg: #fdf6ee; --card: #ffffff; --ink: #333;
  --radius: 28px; --shadow: 0 6px 0 rgba(0,0,0,.12);
}
@font-face {
  font-family: "Baloo 2";
  src: url("assets/fonts/baloo2.woff2") format("woff2");
  font-weight: 400 800; font-display: swap;
}
@font-face {
  font-family: "Quicksand";
  src: url("assets/fonts/quicksand.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "Material Symbols Rounded";
  src: url("assets/fonts/materialsymbolsrounded.woff2") format("woff2");
  font-weight: 400; font-display: block;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Baloo 2", system-ui, sans-serif; overscroll-behavior: none; }
body { min-height: 100dvh; }
#app { max-width: 520px; margin: 0 auto;
  padding: calc(60px + env(safe-area-inset-top)) 12px calc(46px + env(safe-area-inset-bottom)); }

button { font: inherit; border: none; cursor: pointer; }
.bounce { transition: transform .15s cubic-bezier(.34,1.56,.64,1); }
.bounce:active { transform: scale(.9); }
@media (prefers-reduced-motion: reduce) {
  .bounce, .bounce:active { transition: none; transform: none; }
}

/* App chrome (persistent header/footer) */
.app-header { position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(48px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px; padding: env(safe-area-inset-top) 16px 0;
  background: var(--bg); border-bottom: 1px solid rgba(0,0,0,.06);
  transition: transform .25s ease; }
.app-header.hidden { transform: translateY(-100%); }
.app-header.split { justify-content: space-between; }
@media (prefers-reduced-motion: reduce) { .app-header { transition: none; } }
.app-header .ball { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #222;
  background: linear-gradient(180deg, var(--brand) 46%, #222 46% 54%, #fff 54%); flex-shrink: 0; }
.app-header .name { font-size: 18px; font-weight: 800; color: var(--brand); }
.app-header .title { font-size: 18px; font-weight: 800; }
.app-header .back-btn { font-family: "Material Symbols Rounded", sans-serif;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 40;
  font-size: 20px; padding: 6px 14px; border-radius: 18px;
  background: var(--card); box-shadow: var(--shadow); }
.app-footer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid rgba(0,0,0,.06);
  text-align: center; font-size: 11px; color: var(--brand); }

/* Home */
.game-btn { width: 100%; padding: 18px; margin-bottom: 14px; border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow); font-size: 24px; font-weight: 800; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.type-btn { position: relative; overflow: hidden; aspect-ratio: 1; border-radius: var(--radius);
  box-shadow: var(--shadow); background: #fff; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; color: var(--ink); }
.type-btn .label { font-size: 15px; font-weight: 700; font-family: "Quicksand", sans-serif; }
.shine::before { content: ""; position: absolute; top: -20%; left: -10%; right: -10%; height: 55%;
  background: radial-gradient(closest-side, rgba(255,255,255,.5), transparent 70%); pointer-events: none; }
.shelf { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 14px; }
.shelf img { width: 72px; height: 72px; background: var(--card);
  border-radius: 20px; box-shadow: var(--shadow); }

/* Type world + detail */
.type-icon { vertical-align: -3px; }
.mon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mon-card { position: relative; overflow: hidden; border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 10px; display: flex; flex-direction: column;
  align-items: center; background: rgba(255,255,255,.55); backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%); border: 2px solid rgba(255,255,255,.7); }
.mon-meta { position: absolute; top: 8px; left: 8px; right: 8px; display: flex;
  justify-content: space-between; align-items: center; pointer-events: none; }
.mon-typepower { display: flex; align-items: center; gap: 3px; }
.mon-card img { width: 100%; aspect-ratio: 1; filter: drop-shadow(0 6px 5px rgba(0,0,0,.25)); }
.mon-card .name { font-weight: 700; font-size: 15px; color: var(--ink);
  font-family: "Quicksand", sans-serif; }
.detail { display: flex; flex-direction: column; align-items: center; }
.detail .hero { width: min(78vw, 340px); aspect-ratio: 1; filter: drop-shadow(0 10px 8px rgba(0,0,0,.28)); }
.detail .hero.hero-missing { background: #ddd; border-radius: var(--radius); }
.type-power-row { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin: -6px 0 10px; }
.detail .mon-name { font-size: 32px; font-weight: 800; margin: 4px 0 0; color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.35); font-family: "Quicksand", sans-serif; }
.nav-arrows { position: fixed; top: 42%; left: 0; right: 0; display: flex;
  justify-content: space-between; padding: 0 6px; pointer-events: none; }
.nav-arrows button { pointer-events: auto; font-size: 30px; padding: 12px 16px;
  border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: var(--shadow); }
.sound-row { display: flex; gap: 16px; margin: 14px 0; }
.sound-row button { width: 74px; height: 74px; border-radius: 50%; font-size: 32px;
  background: var(--card); box-shadow: var(--shadow); }
.sound-row button.speaking { background: var(--brand); color: #fff; }
.pill { background: rgba(255,255,255,.92); border-radius: 12px; padding: 3px 9px;
  font-weight: 800; font-size: 12px; color: var(--brand); box-shadow: 0 2px 0 rgba(0,0,0,.1);
  white-space: nowrap; }
.type-badge { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.15); flex-shrink: 0; }
.pokeball { width: 34px; height: 34px; border-radius: 50%; background: none; margin-top: 4px;
  border: 3px solid #bbb; position: relative; flex: none;
  background: linear-gradient(#eee 0 calc(50% - 2.5px), #bbb calc(50% - 2.5px) calc(50% + 2.5px),
    #fff calc(50% + 2.5px) 100%); }
.pokeball::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 10px; height: 10px; background: #fff; border: 3px solid #bbb; border-radius: 50%; }
.pokeball.caught { border-color: #1a1a1a;
  background: linear-gradient(var(--brand) 0 calc(50% - 2.5px), #1a1a1a calc(50% - 2.5px) calc(50% + 2.5px),
    #fff calc(50% + 2.5px) 100%); }
.pokeball.caught::after { border-color: #1a1a1a; }
.evo-strip { display: flex; align-items: center; gap: 6px; margin: 10px 0;
  overflow-x: auto; max-width: 100%; min-width: 0; }
.evo-strip img { width: 84px; height: 84px; background: var(--card);
  border-radius: 20px; box-shadow: var(--shadow); flex-shrink: 0; }
.evo-strip img.current { outline: 4px solid var(--brand); }
.evo-arrow { font-size: 20px; }

.tool-row { display: flex; justify-content: center; gap: 18px; margin-top: 22px; }
.gear { display: block; background: none; font-size: 20px; opacity: .45; }
.search-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-top: 10px; }
.search-input { width: 100%; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--bg);
  font: inherit; font-size: 16px; background: var(--bg); }
.search-results { margin-top: 8px; max-height: 260px; overflow-y: auto; }
.search-result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px;
  border-radius: 12px; text-align: left; background: none; }
.search-result img { width: 40px; height: 40px; background: var(--card); border-radius: 10px; }
.search-result span { font-size: 15px; }
.parent-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-top: 10px; }
.parent-panel .title { font-weight: 700; margin-bottom: 8px; }
.info-page { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-top: 10px; }
.info-page h2 { font-size: 20px; margin: 0 0 12px; }
.info-page p { margin: 0 0 14px; line-height: 1.5; }
.info-page .github-link { display: inline-block; background: var(--brand); color: #fff;
  font-weight: 800; padding: 10px 18px; border-radius: 14px; text-decoration: none; }
.share-block { text-align: center; }
.share-block h2, .share-block p { text-align: left; }
.share-qr { display: block; margin: 2px auto 8px; width: min(58vw, 220px); height: auto;
  background: #fff; padding: 8px; border-radius: 14px; box-shadow: var(--shadow); }
.share-block .share-url { text-align: center; font-weight: 800; margin-bottom: 14px;
  color: var(--brand); }
.share-btn { background: var(--brand); color: #fff; font-weight: 800; padding: 10px 18px;
  border-radius: 14px; }
.gen-row { display: block; width: 100%; text-align: left; padding: 10px 12px; margin: 6px 0;
  border-radius: 14px; background: var(--bg); font-size: 15px; }

/* Game */
.game-stage { position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 14px; padding-top: 10px; }
.game-stage img { width: min(78vw, 340px); aspect-ratio: 1; transition: filter .3s; }
.game-stage img.silhouette { filter: brightness(0); }
.game-hint { font-size: 26px; font-weight: 800; }
.confetti { position: absolute; top: 20%; width: 12px; height: 12px; border-radius: 3px;
  animation: fall 1.5s ease-in forwards; }
@keyframes fall { to { transform: translateY(70vh) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
