/* Shared by both apps on paokemeng.com: the dex at / and the trade helper at /trade/.
   Palette, base elements, the Poké Ball mark, the top bar and the dex / trade switch. The edge serves this
   file at /shared/site.css (edge/build.sh copies shared/ into the site); each app's own styles.css loads
   after it and adds the rest. New oklch() colors need an sRGB value in the fallback block at the end. */
/* Warm, soft, toy-like palette: cream paper, softened Poké Ball red, Pikachu yellow, cocoa ink. */
:root {
  --paper: oklch(0.975 0.018 85);
  --paper-deep: oklch(0.945 0.03 82);
  --card: oklch(0.995 0.007 85);
  --ink: oklch(0.31 0.035 45);
  --ink-soft: oklch(0.52 0.03 50);
  --ink-faint: oklch(0.72 0.022 60);
  --line: oklch(0.31 0.035 45 / 0.12);
  --line-strong: oklch(0.31 0.035 45 / 0.22);
  --red: oklch(0.66 0.19 27);
  --red-soft: oklch(0.93 0.045 27);
  --red-ink: oklch(0.5 0.16 27);
  --yellow: oklch(0.88 0.15 92);
  --yellow-soft: oklch(0.96 0.06 95);
  --green: oklch(0.68 0.15 150);
  --green-soft: oklch(0.94 0.05 150);
  --green-ink: oklch(0.45 0.12 150);
  --shadow: 0 4px 0 oklch(0.31 0.035 45 / 0.10);
  --shadow-lift: 0 7px 0 oklch(0.31 0.035 45 / 0.10), 0 14px 28px oklch(0.31 0.035 45 / 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  /* Body text uses the system CJK font; only the display and number faces are web fonts. */
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-display: "ZCOOL KuaiLe", var(--font-system);
  --font-round: "Fredoka", var(--font-system);
  --font-body: var(--font-system);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Scarlet/Violet type colors. */
  --t-normal: #9fa19f; --t-fighting: #ff8000; --t-flying: #81b9ef; --t-poison: #9141cb;
  --t-ground: #915121; --t-rock: #afa981; --t-bug: #91a119; --t-ghost: #704170;
  --t-steel: #60a1b8; --t-fire: #e62829; --t-water: #2980ef; --t-grass: #3fa129;
  --t-electric: #fac000; --t-psychic: #ef4179; --t-ice: #3dcef3; --t-dragon: #5060e1;
  --t-dark: #624d4e; --t-fairy: #ef70ef; --t-stellar: #40b5a5;

  --s-hp: #ff7a7a; --s-atk: #f5ac78; --s-def: #f2cf55; --s-spa: #8fb0f2; --s-spd: #95d27c; --s-spe: #f792b3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: radial-gradient(oklch(0.31 0.035 45 / 0.07) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 10px; }

/* ---------- Poké Ball mark (pure CSS: circle, band, button) ---------- */
.ball {
  --size: 30px;
  width: var(--size); height: var(--size);
  flex: none;
  position: relative;
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--red) 0 46%, var(--ink) 46% 54%, #fff 54% 100%);
  box-shadow: inset 0 0 0 2.5px var(--ink);
}
.ball::after {
  content: "";
  position: absolute; inset: 50% auto auto 50%;
  width: 38%; height: 38%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2.5px var(--ink), inset 0 0 0 2px oklch(0.92 0.01 85);
}
.ball.spin { animation: wobble 1.1s ease-in-out infinite; }
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-16deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-6deg); }
}

/* ---------- Top bar and site switch ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  box-shadow: 0 3px 0 var(--red);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-name { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.02em; color: var(--ink); }

/* Switches between the dex at /, the trade helper at /trade/ and the damage calculator at /calc/. */
.site-switch {
  display: inline-flex; flex: none; padding: 3px; gap: 3px;
  background: var(--paper-deep);
  border: 2px solid var(--line); border-radius: 999px;
}
.site-switch a {
  display: inline-flex; align-items: center;
  min-height: 32px; padding: 0 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  color: var(--ink-soft); text-decoration: none;
}
.site-switch a:hover { color: var(--ink); }
.site-switch a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: 0 3px 0 var(--line-strong); }

/* Language switch (shared/lang.js fills it in); it names the other language. */
.lang-switch {
  flex: none; min-height: 42px; padding: 0 14px;
  background: var(--paper-deep); color: var(--ink-soft);
  border: 2px solid var(--line); border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.lang-switch:hover { color: var(--ink); }
.lang-switch:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* On phones it moves to the end of the search row; each app's search leaves it this much room:
   flex-basis: calc(100% - var(--lang-room)). None when lang.js did not load and the switch stays hidden. */
:root { --lang-room: 0px; }
.has-lang-switch { --lang-room: 66px; }

@media (max-width: 720px) {
  .brand-name { font-size: 21px; }
  .site-switch a { padding: 0 12px; }
  .site-switch .wide { display: none; }
  .lang-switch { order: 4; min-width: 56px; padding: 0 10px; }
}
/* The brand and the three tools on one row down to 360px-wide phones (the English brand is the wider one). */
@media (max-width: 420px) {
  .brand { gap: 6px; }
  .brand-name { font-size: 19px; }
  .site-switch a { padding: 0 8px; min-width: 44px; justify-content: center; }
}

/* ---------- Fallback for engines without color-mix() ----------
   Chrome < 111, Safari < 16.2 and older in-app webviews also lack (or half-support) oklch(),
   so they get the same palette in sRGB. App-specific fallbacks live at the end of each styles.css. */
@supports not (color: color-mix(in oklch, red, blue)) {
  :root {
    --paper: #fcf6e9;
    --paper-deep: #f7ebd7;
    --card: #fffdf8;
    --ink: #3f2b21;
    --ink-soft: #78645a;
    --ink-faint: #afa297;
    --line: rgba(63, 43, 33, 0.12);
    --line-strong: rgba(63, 43, 33, 0.22);
    --red: #f0574e;
    --red-soft: #ffddd8;
    --red-ink: #ac312c;
    --yellow: #fbd452;
    --yellow-soft: #fef2c5;
    --green: #45b164;
    --green-soft: #d5f5da;
    --green-ink: #09672e;
    --shadow: 0 4px 0 rgba(63, 43, 33, 0.1);
    --shadow-lift: 0 7px 0 rgba(63, 43, 33, 0.1), 0 14px 28px rgba(63, 43, 33, 0.08);
  }
  body { background-image: radial-gradient(rgba(63, 43, 33, 0.07) 1.2px, transparent 1.3px); }
  .ball::after { box-shadow: 0 0 0 2.5px var(--ink), inset 0 0 0 2px #e8e4dd; }
}
