/* Pokedexle styles. Fonts are served from this site (assets/fonts), nothing is loaded from other domains. */

html { -webkit-text-size-adjust: 100%;  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root {

  --accent: #e5382b;
  --accent-ink: #ffffff;
  --up: #0b6f61;
  --up-bg: #d3f1eb;
  --down: #9a5200;
  --down-bg: #ffe6c7;
  --same: #4a5578;
  --same-bg: #dde3f3;

}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
         
    --accent: #ff5a4d; --accent-ink: #1a0b09;
    --up: #5ee0ca; --up-bg: #103a34; --down: #ffb85c; --down-bg: #3d2a0d; --same: #aab6e6; --same-bg: #262d48;

  }
}
:root[data-theme="dark"] {
       
  --accent: #ff5a4d; --accent-ink: #1a0b09;
  --up: #5ee0ca; --up-bg: #103a34; --down: #ffb85c; --down-bg: #3d2a0d; --same: #aab6e6; --same-bg: #262d48;

}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.45;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--f-display); font-weight: 800; font-size: 2rem; letter-spacing: -0.03em; line-height: 1; margin: 0;  }
.brand b { color: var(--accent); font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 24, 36, .15); }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-weight: 600; font-size: .9rem; }
.icon-btn svg { width: 16px; height: 16px; }

/* mode bar + picker */
.modebar { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); }
.modebar:hover { border-color: var(--muted); }
.mb-tag { flex: none; background: var(--accent); color: var(--accent-ink); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.mb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.mb-scope { font-weight: 700; overflow-wrap: anywhere; }
.mb-sub { font-size: .8rem; color: var(--muted); }
.mb-spr { display: flex; flex: none; }
.mb-spr img { width: 32px; height: 32px; margin-left: -8px; }
.mb-spr img:first-child { margin-left: 0; }
.mb-act { flex: none; font-size: .85rem; font-weight: 600; color: var(--muted); }
.mb-chev { flex: none; width: 18px; height: 18px; color: var(--muted); transition: transform .2s ease; }
.modebar.open .mb-chev { transform: rotate(180deg); }

.picker { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 14px; animation: drop .22s ease-out; }
@keyframes drop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.pk-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pk-help { margin: 0; font-size: .88rem; color: var(--muted); flex: 1; min-width: 200px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.presets .lbl { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.presets button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .85rem; color: var(--ink); }
.presets button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.presets button.quiet { border-color: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.gcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gcard { position: relative; text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px 12px 10px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; min-width: 0; }
.gcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--gc, var(--accent)); }
.gcard:hover { border-color: var(--muted); }
.gcard[aria-pressed="true"] { border-color: var(--ink); }
.gcard .g-eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.gcard .g-name { font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1.1; }
.gcard .g-spr { display: flex; margin: 2px 0 0 -4px; }
.gcard .g-spr img { width: 44px; height: 44px; margin-left: -6px; }
.gcard .g-spr img:first-child { margin-left: 0; }
.gcard .g-meta { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }
.gcard .tick { position: absolute; top: 12px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); display: none; place-items: center; }
.gcard .tick svg { width: 14px; height: 14px; }
.gcard[aria-pressed="true"] .tick { display: grid; }
.gcard.all { grid-column: 1 / -1; padding-right: 44px; }
.gcard.all .g-spr img { width: 34px; height: 34px; margin-left: -8px; }
.gcard.all .g-spr img:first-child { margin-left: 0; }
.status { align-self: flex-start; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status.ok { background: var(--up-bg); color: var(--up); }
.status.no { background: var(--down-bg); color: var(--down); }
.pk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pk-count { font-family: var(--f-mono); font-size: .85rem; color: var(--muted); }
.pk-btns { display: flex; gap: 8px; }

/* mystery card */
.mystery { position: relative; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.mystery .band { height: 10px; display: flex; }
.mystery .band span { flex: 1; }
.mystery .body { padding: 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.tile { width: 88px; height: 88px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: 3rem; color: var(--muted); }
.tile img { width: 80px; height: 80px; }
.tile.won { background: var(--surface-2); animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.meta { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.mname { font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
.mname small { font-family: var(--f-mono); font-weight: 400; font-size: .85rem; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.types { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; line-height: 1.4; }
.badge.lg { font-size: .9rem; padding: 6px 16px; letter-spacing: .06em; }
.badge.none { background: transparent; color: var(--muted); border: 1.5px dashed var(--line); font-weight: 600; letter-spacing: .03em; text-transform: none; }
.badge.lg.none { font-size: .82rem; padding: 4.5px 14px; }
.typenote { margin: 0; font-size: .82rem; color: var(--muted); }
.count { text-align: right; }
.count .n { font-family: var(--f-display); font-weight: 800; font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; display: block; }
.count .l { font-size: .75rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* range strip */
.range { background: var(--surface); border-radius: 16px; padding: 12px 16px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.range .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .85rem; color: var(--muted); }
.range .row strong { font-family: var(--f-mono); font-weight: 500; color: var(--ink); font-size: .95rem; }
.track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.track .gap { position: absolute; top: 0; bottom: 0; z-index: 1; background: repeating-linear-gradient(135deg, var(--line) 0 3px, var(--surface) 3px 6px); }
.fill { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; min-width: 6px; transition: left .35s ease, width .35s ease; }
.ends { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }

/* guess input */
.guessbox { position: relative; display: flex; flex-direction: column; gap: 8px; }
.inputrow { display: flex; gap: 8px; }
.field { position: relative; flex: 1; min-width: 0; }
.field input { width: 100%; height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); padding: 0 16px; font-size: 1.05rem; }
.field input:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent); }
.field input:disabled { opacity: .55; }
.go { height: 52px; padding: 0 22px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1rem; }
.go:disabled { opacity: .45; cursor: not-allowed; }
.list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 316px; overflow-y: auto; }
.opt { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.opt img { width: 34px; height: 34px; flex: none; }
.opt .nm { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.opt .dx { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); }
.opt[aria-selected="true"], .opt:hover { background: var(--surface-2); }
.msg { min-height: 1.3em; font-size: .88rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.link { border: 0; background: none; padding: 2px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: .88rem; }

/* guesses */
.guesses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.guess { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "spr who hint" "spr types hint"; column-gap: 12px; row-gap: 2px; align-items: center; background: var(--surface); border-radius: 16px; padding: 8px 12px 8px 8px; box-shadow: var(--shadow); }
.guess.new { animation: slide .3s ease-out; }
@keyframes slide { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.guess .spr { grid-area: spr; width: 56px; height: 56px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.guess .who { grid-area: who; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.guess .nm { font-weight: 700; overflow-wrap: anywhere; }
.guess .dx { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); }
.guess .types { grid-area: types; }
.hint { grid-area: hint; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 9px; border-radius: 999px; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.hint svg { width: 18px; height: 18px; flex: none; }
.hint.up { background: var(--up-bg); color: var(--up); }
.hint.down { background: var(--down-bg); color: var(--down); }
.hint.same { background: var(--same-bg); color: var(--same); }
.hint.hit { background: var(--accent); color: var(--accent-ink); }
.hint.same { white-space: normal; max-width: 120px; line-height: 1.2; font-size: .78rem; }

.empty { background: var(--surface); border: 2px dashed var(--line); border-radius: 16px; padding: 18px; color: var(--muted); text-align: center; }

/* result */
.result { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 2px solid var(--accent); }
.result h2 { font-family: var(--f-display); font-size: 1.4rem; letter-spacing: -0.02em; margin: 0; }
.result p { margin: 0; color: var(--muted); }
.result .share { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 16px; font-weight: 700; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sharebox { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px 12px; font-family: var(--f-mono); font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.next { font-family: var(--f-mono); font-size: .9rem; color: var(--muted); }

/* how to play + footer */
details.how { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 16px; }
details.how summary { font-weight: 700; cursor: pointer; }
details.how ol { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
details.how li strong { color: var(--ink); }
.foot { font-size: .78rem; color: var(--muted); text-align: center; text-wrap: balance; }

/* stats dialog */
dialog { border: 0; border-radius: 20px; padding: 20px; background: var(--surface); color: var(--ink); width: min(92vw, 420px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(8, 10, 18, .55); }
dialog h2 { font-family: var(--f-display); font-size: 1.4rem; margin: 0 0 12px; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0; }
.stats div { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.stats dt { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--f-display); font-weight: 800; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
dialog .close { margin-top: 14px; width: 100%; }

@media (max-width: 520px) {
  .gcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mb-act { display: none; }
  .mb-spr img { width: 26px; height: 26px; margin-left: -6px; }
  .mb-spr img:nth-child(3) { display: none; }
  .modebar { gap: 10px; padding: 10px 12px; }
}
@media (max-width: 480px) {
  .brand { font-size: 1.7rem; }
  .mystery .body { grid-template-columns: auto 1fr; }
  .count { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; text-align: left; }
  .count .n { font-size: 2.2rem; order: 2; }
  .tile { width: 72px; height: 72px; font-size: 2.4rem; }
  .tile img { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .guess.new, .tile.won, .picker { animation: none; }
  .fill, .mb-chev { transition: none; }
}

.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--down-bg); color: var(--down); border-radius: 14px; padding: 10px 14px; font-weight: 600; font-size: .92rem; }
a.icon-btn { text-decoration: none; color: inherit; }
.notice .btn { color: var(--ink); padding: 7px 14px; }
