:root {
  --bg: #0f1410; --bg-2: #16201a; --surface: #1a241d; --surface-2: #223026; --border: #2c3a30;
  --text: #e8efe9; --text-muted: #93a598; --accent: #46c67c; --accent-2: #6fe0a0;
  --el-Fire:#ef6a3a; --el-Water:#4aa3e0; --el-Grass:#5cc46a; --el-Electric:#e6c93a; --el-Ice:#7fd6e0;
  --el-Ground:#c79a5a; --el-Dark:#9b6bd6; --el-Dragon:#7b6bef; --el-Neutral:#b6c0b8;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: radial-gradient(1000px 480px at 50% -80px, #1c2b21, var(--bg)) fixed;
  color: var(--text); min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.muted { color: var(--text-muted); }
.count { font-size: .82rem; margin-bottom: .6rem; }

header { border-bottom: 1px solid var(--border); background: rgba(15,20,16,.9); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; gap: 1rem; flex-wrap: wrap; }
h1 { font-size: 1.25rem; font-weight: 750; }
h1::before { content: "🐾 "; }
.tabs { display: flex; gap: .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: .2rem; }
.tab { font: inherit; cursor: pointer; background: transparent; border: none; color: var(--text-muted); padding: .4rem .9rem; border-radius: 7px; }
.tab.active { background: var(--surface-2); color: var(--text); font-weight: 700; }

main { padding: 1.25rem 0 3rem; }
.search { width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: .6rem .85rem; font: inherit; margin-bottom: .75rem; }
.search:focus { outline: none; border-color: var(--accent); }
.filter-group { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.fg-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; min-width: 68px; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { font: inherit; cursor: pointer; background: var(--bg-2); border: 1px solid var(--border); color: var(--text-muted); padding: .25rem .6rem; border-radius: 999px; font-size: .78rem; display: inline-flex; align-items: center; gap: .3rem; }
.chip img { width: 15px; height: 15px; }
.chip.active { background: var(--surface-2); color: var(--text); border-color: var(--accent); }

.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.pal { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .4rem; cursor: pointer; text-align: center; transition: all .12s; }
.pal:hover { border-color: var(--accent); transform: translateY(-2px); }
.pal img { width: 74px; height: 74px; object-fit: contain; }
.pal .pnum { font-size: .62rem; color: var(--text-muted); }
.pal .pname { font-size: .8rem; font-weight: 600; line-height: 1.2; }
.pal .pel { display: flex; gap: 2px; justify-content: center; margin-top: .2rem; }
.pal .pel img { width: 15px; height: 15px; }

.work-tabs { margin-top: .3rem; }
.work-tabs .chip.active { background: var(--accent); color: #0f1410; border-color: var(--accent); font-weight: 700; }
.work-list { display: flex; flex-direction: column; gap: .35rem; }
.wrow { display: grid; grid-template-columns: 34px 1.5rem 1fr auto; gap: .6rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .7rem; cursor: pointer; }
.wrow:hover { border-color: var(--accent); }
.wrow img.wimg { width: 34px; height: 34px; object-fit: contain; }
.wrow .wrank { color: var(--text-muted); font-size: .8rem; text-align: center; }
.wrow .wname { font-weight: 600; font-size: .9rem; }
.wrow .wels { display: flex; gap: 3px; margin-top: 2px; }
.wrow .wels img { width: 14px; height: 14px; }
.wrow .wlvl { display: flex; align-items: center; gap: .35rem; font-weight: 700; }
.wrow .wlvl img { width: 20px; height: 20px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-body { position: relative; max-width: 460px; width: 100%; max-height: 88vh; overflow-y: auto; margin: 0; }
.md-head { display: flex; gap: 1rem; align-items: center; }
.md-head img { width: 96px; height: 96px; object-fit: contain; }
.md-name { font-size: 1.3rem; font-weight: 750; }
.md-num { color: var(--text-muted); font-size: .85rem; }
.md-els { display: flex; gap: .35rem; margin-top: .35rem; }
.md-els .el-badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); }
.md-els img { width: 15px; height: 15px; }
.md-section { margin-top: 1rem; }
.md-section h3 { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .4rem; }
.stats { display: flex; gap: .5rem; }
.stat { flex: 1; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: .4rem; text-align: center; }
.stat b { display: block; font-size: 1.05rem; }
.stat span { font-size: .68rem; color: var(--text-muted); }
.md-works { display: flex; flex-wrap: wrap; gap: .4rem; }
.md-work { display: inline-flex; align-items: center; gap: .35rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px; padding: .3rem .55rem; font-size: .82rem; }
.md-work img { width: 20px; height: 20px; }
.md-work b { color: var(--accent-2); }
.md-skill { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .75rem; }
.md-skill .sk-name { font-weight: 700; margin-bottom: .2rem; }
.md-skill .sk-desc { font-size: .84rem; color: var(--text-muted); }
.md-close { position: absolute; top: .6rem; right: .8rem; background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; }
.md-breed { display: inline-block; margin-top: 1rem; color: var(--accent); text-decoration: none; font-size: .85rem; }
.md-breed:hover { text-decoration: underline; }

footer { color: var(--text-muted); font-size: .8rem; padding: 1.5rem 1rem 2.5rem; text-align: center; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
