/* Poke Life - khung giao dien. Pixel, toan man hinh, uu tien cam ung, ton trong vung an toan (tai tho, thanh home). */
/* Font pixel co dau tieng Viet (chu du an co san): chep vao fonts/ roi bo chu thich dong duoi.
@font-face { font-family: 'PLPixel'; src: url('../fonts/pixel.woff2') format('woff2'); font-display: swap; } */
:root {
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --bg: #14182b; --panel: #f8f4e8; --panel-2: #e8e0c8; --ink: #20202a; --ink-2: #5a5a6a;
  --line: #20202a; --accent: #e8483a; --accent-2: #3a78e8; --ok: #38b048; --warn: #f0b020; --bad: #e03030;
  --px: 2px;                        /* do day "diem anh" cua vien */
  --font: 'PLPixel', 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
  --tap: 48px;                      /* vung cham toi thieu */
  --vh: 1vh;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.3;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none; -webkit-text-size-adjust: 100%;
}
body { position: fixed; inset: 0; }
.hidden { display: none !important; }
#game, #controls, #ui, #overlay { position: absolute; inset: 0; }
#game canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#controls { z-index: 10; }
#ui { z-index: 20; pointer-events: none; padding: var(--sat) var(--sar) var(--sab) var(--sal); }
#ui > * { pointer-events: auto; }
#overlay { z-index: 40; pointer-events: none; }
#overlay > * { pointer-events: auto; }
#overlay > .fade-out { pointer-events: none; }
.scroll { overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Dieu khien ---------- */
#joy-zone { position: absolute; inset: 0; }
#joy { position: absolute; width: calc(var(--joy-r, 48px) * 2); height: calc(var(--joy-r, 48px) * 2); margin: calc(var(--joy-r, 48px) * -1) 0 0 calc(var(--joy-r, 48px) * -1);
  border-radius: 50%; background: rgba(255,255,255,.14); border: 3px solid rgba(255,255,255,.45); pointer-events: none; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  background: rgba(255,255,255,.75); border: 3px solid rgba(32,32,42,.6); }
#ab { position: absolute; right: calc(var(--sar) + 16px); bottom: calc(var(--sab) + 20px); display: flex; gap: 14px; align-items: flex-end; }
.ab { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--line); font: 700 24px var(--font); color: var(--ink);
  background: rgba(248,244,232,.85); box-shadow: 0 4px 0 rgba(0,0,0,.35); touch-action: none; }
#btn-a { margin-bottom: 26px; background: rgba(232,72,58,.9); color: #fff; }
.ab.down { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
body.no-touch #ab { display: none; }

/* ---------- Bo linh kien UI ---------- */
.pl-panel { background: var(--panel); border: var(--px) solid var(--line);
  box-shadow: 0 0 0 var(--px) #fff inset, 0 0 0 calc(var(--px) * 2) var(--line), 4px 4px 0 calc(var(--px) * 2) rgba(0,0,0,.35);
  border-radius: 6px; padding: 12px; color: var(--ink); }
.pl-panel > h2 { margin: 0 0 8px; font-size: 18px; }
.pl-btn { min-height: var(--tap); min-width: var(--tap); padding: 8px 14px; font: 600 16px var(--font); color: var(--ink);
  background: var(--panel); border: var(--px) solid var(--line); border-radius: 6px; box-shadow: 0 4px 0 var(--line);
  cursor: pointer; touch-action: manipulation; position: relative; outline: none; }
.pl-btn:focus-visible, .pl-btn.focus { box-shadow: 0 4px 0 var(--line), 0 0 0 3px var(--accent-2); }
.pl-btn.down { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.pl-btn[disabled] { opacity: .45; cursor: default; }
.pl-btn.primary { background: var(--accent); color: #fff; }
.pl-btn.blue { background: var(--accent-2); color: #fff; }
.pl-btn small { display: block; font-size: 12px; opacity: .85; font-weight: 400; }
.pl-row { display: flex; gap: 8px; align-items: center; }
.pl-grow { flex: 1; }
.pl-bar { position: relative; height: 10px; background: #404050; border: var(--px) solid var(--line); border-radius: 4px; overflow: hidden; }
.pl-bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--ok); transition: width .35s linear, background-color .2s; }
.pl-bar.exp > i { background: #48a8f0; }
.pl-bar.prog > i { background: var(--accent-2); }
.pl-bar.mid > i { background: var(--warn); } .pl-bar.low > i { background: var(--bad); }
.pl-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; }
.pl-list .pl-btn { text-align: left; }
.pl-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.pl-tabs .pl-btn { flex: 1; min-height: 40px; }
.pl-tabs .pl-btn.on { background: var(--accent-2); color: #fff; }

/* Hop thoai */
.pl-modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,12,24,.55);
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px); }
.pl-modal .pl-panel { width: min(420px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.pl-modal .body { white-space: pre-line; }
.pl-modal .btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pl-modal .btns .pl-btn { flex: 1 1 120px; }

/* Thong bao nho */
#toasts { position: absolute; left: 0; right: 0; top: calc(var(--sat) + 10px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 50; }
.pl-toast { background: rgba(20,24,43,.92); color: #fff; padding: 8px 14px; border-radius: 6px; border: 2px solid #fff; max-width: 90vw;
  animation: toast-in .18s ease-out; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

/* Hop chu (go tung chu) */
.pl-textbox { position: absolute; left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); bottom: calc(var(--sab) + 8px);
  min-height: 84px; font-size: 18px; }
.pl-textbox .more { position: absolute; right: 12px; bottom: 6px; animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Man phu ---------- */
.pl-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg); color: #fff; text-align: center; padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px); }
.pl-logo { font-size: clamp(40px, 11vmin, 88px); font-weight: 800; letter-spacing: 2px; color: #ffd84a; text-shadow: 4px 4px 0 #b03a2e, 8px 8px 0 #000; }
.pl-tap { font-size: 20px; animation: blink 1.2s steps(2) infinite; }
.pl-sub { font-size: 13px; opacity: .7; }
.pl-screen .pl-bar { width: min(360px, 80vw); height: 14px; }
.pl-screen .tip { max-width: 420px; font-size: 14px; opacity: .85; min-height: 2.6em; }
.pl-screen.fade-out { transition: opacity .25s; opacity: 0; pointer-events: none; }

/* ---------- Man tran ---------- */
#battle-ui { position: absolute; inset: 0; pointer-events: none; padding: var(--sat) var(--sar) var(--sab) var(--sal); }
#battle-ui > * { pointer-events: auto; }
.b-info { position: absolute; width: min(240px, 46vw); padding: 6px 10px; }
.b-info .nm { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; }
.b-info .hpnum { text-align: right; font-size: 13px; }
.b-info.foe { left: calc(var(--sal) + 8px); top: calc(var(--sat) + 8px); }
.b-info.me { right: calc(var(--sar) + 8px); bottom: calc(var(--sab) + var(--b-menu-h, 170px) + 8px); }
.b-menu { position: absolute; left: calc(var(--sal) + 6px); right: calc(var(--sar) + 6px); bottom: calc(var(--sab) + 6px); padding: 8px; }
.b-msg { min-height: 44px; font-size: 16px; margin-bottom: 8px; }
.b-grid { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); }
.b-grid.no-run { grid-template-columns: repeat(3, 1fr); }
.b-grid .pl-btn { min-height: 52px; padding: 8px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-grid .fight { grid-column: 1 / -1; background: var(--accent); color: #fff; font-size: 18px; }
.b-moves { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.b-moves .pl-btn { min-height: 58px; text-align: left; border-left-width: 8px; }
.b-back { margin-top: 8px; width: 100%; min-height: 44px; }
/* Ngang: menu tran thanh cot ben phai, de lo san dau */
@media (orientation: landscape) and (max-height: 560px) {
  .b-menu { left: auto; width: min(360px, 46vw); top: calc(var(--sat) + 6px); }
  .b-info.me { right: calc(var(--sar) + min(360px, 46vw) + 14px); bottom: calc(var(--sab) + 8px); }
  .b-grid .pl-btn { min-height: 46px; }
  .pl-textbox { right: calc(var(--sar) + 8px); }
}
/* Mau he (nut chieu) */
.t-NORMAL{border-left-color:#a8a878}.t-FIRE{border-left-color:#f08030}.t-WATER{border-left-color:#6890f0}.t-ELECTRIC{border-left-color:#f8d030}
.t-GRASS{border-left-color:#78c850}.t-ICE{border-left-color:#98d8d8}.t-FIGHTING{border-left-color:#c03028}.t-POISON{border-left-color:#a040a0}
.t-GROUND{border-left-color:#e0c068}.t-FLYING{border-left-color:#a890f0}.t-PSYCHIC{border-left-color:#f85888}.t-BUG{border-left-color:#a8b820}
.t-ROCK{border-left-color:#b8a038}.t-GHOST{border-left-color:#705898}.t-DRAGON{border-left-color:#7038f8}.t-DARK{border-left-color:#705848}
.t-STEEL{border-left-color:#b8b8d0}.t-FAIRY{border-left-color:#ee99ac}

/* HUD ban do */
.hud { position: absolute; left: calc(var(--sal) + 8px); top: calc(var(--sat) + 8px); display: flex; gap: 8px; }
.hud .pl-btn { min-height: 40px; padding: 6px 10px; font-size: 14px; }
.dbg { position: absolute; right: calc(var(--sar) + 8px); top: calc(var(--sat) + 8px); font: 12px monospace; color: #fff; background: rgba(0,0,0,.5);
  padding: 4px 6px; border-radius: 4px; pointer-events: none; white-space: pre; }

/* ---------- Trang toan man (chang 9) ---------- */
.pl-page { position: absolute; inset: 0; display: flex; flex-direction: column; background: #e9e2cc; color: var(--ink);
  padding: var(--sat) var(--sar) var(--sab) var(--sal); }
.pg-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg); color: #fff; }
.pg-head h1 { flex: 1; margin: 0; font-size: 20px; }
.pg-x { min-width: 44px; min-height: 40px; padding: 4px 10px; }
.pg-body { flex: 1; padding: 12px; min-height: 0; }
.pg-foot { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--panel-2); border-top: 2px solid var(--line); min-height: 64px; }
.pg-foot:empty { display: none; }
.pg-steps { flex: 1; display: flex; justify-content: center; gap: 6px; }
.pg-steps i { width: 10px; height: 10px; border-radius: 50%; background: #b8b09a; border: 2px solid var(--line); }
.pg-steps i.on { background: var(--accent); } .pg-steps i.done { background: var(--ok); }
.hint { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }
.empty { padding: 24px 8px; text-align: center; color: var(--ink-2); }
.px-frame { image-rendering: pixelated; image-rendering: crisp-edges; background-repeat: no-repeat; flex: none; }
.px-frame.ph { display: flex; align-items: center; justify-content: center; background: #ccc4ac; border-radius: 6px; color: #777; }
.pl-input { width: 100%; font: 18px var(--font); padding: 12px; border: var(--px) solid var(--line); border-radius: 6px; background: #fff;
  -webkit-user-select: text; user-select: text; touch-action: manipulation; }
.name-msg { min-height: 24px; margin-top: 8px; font-size: 15px; } .name-msg.ok { color: #1d7a2c; } .name-msg.bad { color: var(--bad); }
.look-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.look-card { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 160px; padding: 12px; }
.look-card.on, .unit.on, .st-card.on { background: #ffe9a8; box-shadow: 0 4px 0 var(--line), 0 0 0 3px var(--accent); }
.look-card .nm { font-weight: 700; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.unit { min-height: 48px; }
.st-count { position: sticky; top: -12px; z-index: 2; background: #e9e2cc; padding: 6px 0; font-weight: 700; }
.st-count.full { color: #1d7a2c; }
.gen-row { margin-bottom: 10px; }
.gen-lbl { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.gen-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.st-card { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; min-height: 120px; }
.st-img { height: 72px; display: flex; align-items: center; justify-content: center; }
.st-card .nm { font-size: 13px; font-weight: 700; } .st-card .tp { font-size: 11px; color: var(--ink-2); }
.confirm { margin-bottom: 12px; } .confirm .pl-row { align-items: center; gap: 14px; }
.cf-info .big { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.cf-mons { display: flex; gap: 8px; justify-content: space-around; margin-top: 10px; text-align: center; font-size: 13px; }
.cf-mon { display: flex; flex-direction: column; align-items: center; }
.cf-go { width: 100%; min-height: 56px; font-size: 18px; }

/* TUI */
.bag-list { display: flex; flex-direction: column; gap: 6px; }
.bag-item { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 52px; }
.bag-item .ic { width: 32px; height: 32px; } .bag-item .nm { flex: 1; } .bag-item .qty { font-weight: 700; }
.bag-item .trade { margin-left: 4px; color: var(--accent-2); }
.bag-detail { display: flex; gap: 12px; align-items: center; width: 100%; font-size: 14px; }
.bag-detail .sub { color: var(--ink-2); font-size: 13px; }

/* ID Card */
.card-wrap { perspective: 1200px; display: flex; justify-content: center; padding: 8px 0; }
.card3d { position: relative; width: min(560px, 100%); aspect-ratio: 1.586; transition: transform .5s; transform-style: preserve-3d; cursor: pointer; }
.card3d.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; padding: 12px 14px;
  border: 3px solid var(--line); box-shadow: 6px 6px 0 rgba(0,0,0,.3); display: flex; flex-direction: column; overflow: hidden; }
.face.front { background: linear-gradient(135deg, #fff6d8, #f2d98c); }
.face.back { background: linear-gradient(135deg, #20294a, #3a4a80); color: #fff; transform: rotateY(180deg); }
.c-brand { font-size: 12px; font-weight: 800; letter-spacing: 2px; opacity: .75; margin-bottom: 6px; }
.c-main { flex: 1; display: flex; gap: 12px; align-items: center; min-height: 0; }
.c-left { flex: none; background: rgba(255,255,255,.6); border: 2px solid var(--line); border-radius: 8px; padding: 4px; }
.c-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: clamp(11px, 2.6vw, 15px); }
.c-name { font-size: clamp(18px, 4.5vw, 26px); font-weight: 800; }
.kv { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .kv .k { color: var(--ink-2); min-width: 70px; }
.kv .v { font-weight: 600; } .kv .code { font: 700 1.1em monospace; letter-spacing: 1px; }
.kv .copy { min-height: 32px; min-width: 0; padding: 2px 8px; font-size: 12px; }
.badges { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 5px; }
.badge { border: 2px solid rgba(255,255,255,.35); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1px; min-height: 0; overflow: hidden; line-height: 1.15; }
.badge .medal { width: clamp(16px, 4.5vmin, 32px); height: clamp(16px, 4.5vmin, 32px); border-radius: 50%; background: #555c78; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: clamp(10px, 2.6vmin, 16px); flex: none; }
.badge.on { border-color: #ffd84a; } .badge.on .medal { background: radial-gradient(#ffe98a, #d9a020); color: #5a3a00; }
.badge .lbl { font-size: clamp(8px, 2.3vmin, 12px); white-space: nowrap; } .badge .cap { font-size: clamp(7px, 2vmin, 11px); opacity: .7; white-space: nowrap; }

/* Hop trang phuc */
.wd-preview { display: flex; justify-content: center; margin-bottom: 12px; }
.wd-stage { display: flex; align-items: flex-end; gap: 8px; position: relative; padding: 34px 20px 10px; background: #bfe0a0; border: 2px solid var(--line); border-radius: 10px; min-width: 260px; justify-content: center; }
.wd-title { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font-weight: 800; color: #fff; text-shadow: 2px 2px 0 #000; }
.wd-fig { position: relative; }
.wd-layer { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; text-align: center; background: rgba(255,255,255,.7); }
.wd-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wd-slot { text-align: left; min-height: 60px; } .wd-slot.on { background: #ffe9a8; }
@media (orientation: landscape) and (max-height: 560px) {
  .wardrobe .pg-body { display: flex; gap: 12px; align-items: flex-start; } .wd-preview { flex: none; } .wd-slots { flex: 1; }
  .card3d { width: min(520px, 100%, calc((100vh - 170px) * 1.586)); }
}

/* ---------- Thu vien (chang 10) ---------- */
.lib-pg { display: flex; flex-direction: column; gap: 8px; }
.lib-sum { font-size: 13px; color: var(--ink-2); }
.lib-tabs { flex: none; overflow-x: auto; touch-action: pan-x; }
.lib-tabs .pl-btn { flex: 1 0 auto; min-width: 74px; padding: 6px 8px; font-size: 14px; position: relative; }
.lib-tabs .pl-btn[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: -4px; right: -2px; background: var(--accent); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; line-height: 18px; }
.lib-body { flex: 1; min-height: 0; }
.t-chip { display: inline-block; padding: 1px 8px; margin-right: 4px; border-radius: 10px; font-size: 12px; color: #fff; background: #777; border: 1px solid rgba(0,0,0,.4); }
.tb-NORMAL{background:#a8a878}.tb-FIRE{background:#f08030}.tb-WATER{background:#6890f0}.tb-ELECTRIC{background:#d8b010;color:#222}.tb-GRASS{background:#58a838}.tb-ICE{background:#68b8b8}
.tb-FIGHTING{background:#c03028}.tb-POISON{background:#a040a0}.tb-GROUND{background:#c8a048}.tb-FLYING{background:#8870d8}.tb-PSYCHIC{background:#f85888}.tb-BUG{background:#88980c}
.tb-ROCK{background:#a08820}.tb-GHOST{background:#705898}.tb-DRAGON{background:#7038f8}.tb-DARK{background:#705848}.tb-STEEL{background:#8888a8}.tb-FAIRY{background:#d86a88}
.tag-warn { color: #a02020; font-size: 13px; margin-top: 4px; } .tag-busy { color: #7a5a00; font-size: 13px; margin-top: 4px; }
.sub { color: var(--ink-2); font-size: 13px; } .small { font-size: 13px; padding: 10px 4px; }

/* Hop */
.box-tab { display: flex; flex-direction: column; gap: 8px; }
.box-search { display: flex; gap: 6px; } .box-search .pl-input { padding: 8px; font-size: 16px; flex: 1; min-width: 0; }
.box-search .pl-btn { min-height: 44px; padding: 4px 10px; font-size: 14px; flex: none; }
.flt-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .flt-panel .pl-input { padding: 8px; font-size: 15px; }
.flt-fav.on { background: #ffe9a8; } .flt-info { font-size: 13px; color: var(--ink-2); }
.box-bar { display: flex; gap: 6px; } .bx-nav { flex: none; min-width: 48px; } .bx-title { flex: 1; min-width: 0; padding: 4px 8px; }
.box-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.bx-cell { aspect-ratio: 1; min-width: 0; min-height: 56px; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f2ecd8; position: relative; box-shadow: 0 2px 0 var(--line); }
.bx-cell.empty { background: #d9d1b8; opacity: .8; } .bx-cell.sel { background: #ffe9a8; box-shadow: 0 2px 0 var(--line), 0 0 0 3px var(--accent); }
.bx-cell.dim { opacity: .22; } .bx-cell .lv { font-size: 11px; line-height: 1; } .bx-cell .mk { position: absolute; top: 1px; right: 2px; font-size: 10px; line-height: 1; color: #b06a00; }
.bx-cell .plus { color: var(--accent-2); font-size: 20px; } .bx-cell .ic { display: flex; align-items: center; justify-content: center; height: 44px; }
.box-sel { padding: 8px; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.sel-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; } .sel-btns .pl-btn { padding: 6px 8px; font-size: 14px; }
.mv-hint { font-size: 14px; color: var(--accent-2); }

/* Chon Pokemon */
.pick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pick-row { display: flex; align-items: center; gap: 10px; text-align: left; } .pick-row.on { background: #ffe9a8; } .pick-row .tx { flex: 1; min-width: 0; } .pick-row small { display: block; font-weight: 400; color: var(--ink-2); } .pick-row .chk { width: 24px; font-weight: 800; color: #1d7a2c; }
.pick-count { flex: 1; text-align: center; font-weight: 700; }

/* Chi tiet Pokemon */
.pk-detail h3 { margin: 14px 0 6px; font-size: 16px; }
.pd-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; } .pd-img { flex: none; min-width: 120px; min-height: 120px; display: flex; align-items: center; justify-content: center; background: #bfe0a0; border: 2px solid var(--line); border-radius: 10px; }
.pd-meta { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; } .pd-name { font-size: 20px; font-weight: 800; }
.pd-exp { display: flex; align-items: center; gap: 8px; margin-top: 8px; } .pd-exp .pl-bar { flex: 1; }
.pd-iv { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; } .iv { display: flex; flex-direction: column; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 3px 0; font-size: 12px; }
.pd-moves { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; } .mv { background: var(--panel); border: 2px solid var(--line); border-left-width: 8px; border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; } .mv small { color: var(--ink-2); }
.pd-btn { width: 100%; margin-top: 8px; } .pd-item { display: flex; align-items: center; gap: 10px; }
.pd-note { font-size: 13px; color: var(--ink-2); } .mv-pick { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; touch-action: pan-y; }
.mvp { text-align: left; border-left-width: 8px; } .mvp.on { background: #ffe9a8; }
.pk-detail .pg-foot .pl-btn { flex: 1; }

/* Pokedex */
.dex-sum { font-weight: 700; margin-bottom: 6px; } .dex-ctl { display: flex; gap: 6px; flex-direction: column; margin-bottom: 8px; } .dex-ctl .pl-input { padding: 8px; font-size: 15px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 5px; }
.dx-cell { min-width: 0; min-height: 66px; padding: 2px; display: flex; flex-direction: column; align-items: center; background: #f2ecd8; position: relative; box-shadow: 0 2px 0 var(--line); }
.dx-cell .no { font-size: 10px; color: var(--ink-2); } .dx-cell .ic { height: 44px; display: flex; align-items: center; }
.dx-cell.s0 .ic .px-frame { filter: brightness(0) opacity(.45); } .dx-cell.s1 .ic .px-frame { filter: none; }
.dx-cell .ball { position: absolute; top: 2px; right: 4px; color: var(--accent); font-size: 10px; }
.dex-nav { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 10px 0; }
.dx-info { display: flex; flex-direction: column; gap: 4px; align-items: stretch; font-size: 14px; } .dx-img { align-self: center; }

/* Doi hinh */
.team-card { background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.team-head { display: flex; justify-content: space-between; } .team-mem { display: flex; gap: 6px; flex-wrap: wrap; min-height: 44px; align-items: center; }
.tm { display: flex; flex-direction: column; align-items: center; width: 46px; } .tm.warn small { color: var(--bad); } .tm small { font-size: 11px; }
.team-btns { display: flex; gap: 6px; } .team-btns .pl-btn { flex: 1; padding: 6px; font-size: 14px; }

/* Cua hang, ban be, hom thu */
.shop-head { font-weight: 800; font-size: 18px; margin-bottom: 6px; } .shop-list { display: flex; flex-direction: column; gap: 6px; }
.shop-item { display: flex; align-items: center; gap: 10px; text-align: left; } .shop-item .tx { flex: 1; min-width: 0; } .shop-item small { display: block; font-weight: 400; } .shop-item .price { font-weight: 800; color: var(--accent); }
.fr-me { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; } .fr-me .code { font: 700 18px monospace; letter-spacing: 1px; }
.fr-add { display: flex; gap: 6px; margin-bottom: 10px; } .fr-add .pl-input { flex: 1; min-width: 0; }
.fr-row, .offer { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.fr-row .tx, .offer .tx { flex: 1; min-width: 140px; display: flex; flex-direction: column; } .fr-row small, .offer small { color: var(--ink-2); }
.offer-btns { display: flex; gap: 6px; width: 100%; } .offer-btns .pl-btn { flex: 1; padding: 6px; font-size: 14px; }
.msg { font-size: 13px; padding: 6px 4px; border-bottom: 1px dashed #b8b09a; } .msg.new { font-weight: 700; }
.mail-tab h3 { margin: 12px 0 6px; font-size: 15px; }
@media (orientation: landscape) and (max-height: 560px) {
  .box-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); } .bx-cell { min-height: 48px; } .bx-cell .ic { height: 36px; }
  .pd-iv { grid-template-columns: repeat(6, 1fr); }
}

/* Thien nhien gia lap (chang 11) */
.hud { flex-wrap: wrap; max-width: calc(100vw - var(--sal) - var(--sar) - 16px); align-items: center; }
.tn-clock { background: rgba(20,24,43,.82); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; font-weight: 700; border: 2px solid var(--line); }
.tn-clock.warn { background: rgba(190,40,40,.9); animation: tnblink 1s steps(2) infinite; }
@keyframes tnblink { 50% { background: rgba(120,20,20,.9); } }
.nature-lobby .pg-body h3 { margin: 14px 0 6px; font-size: 15px; }
.nl-sum { background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.nl-teams, .nl-maps { display: grid; gap: 8px; margin-bottom: 8px; }
.nl-teams { grid-template-columns: 1fr; } .nl-maps { grid-template-columns: repeat(2, 1fr); }
.nl-team { text-align: left; } .nl-team.on { background: #ffe9a8; box-shadow: 0 2px 0 var(--line), 0 0 0 3px var(--accent); }
.nl-map { min-height: 64px; font-size: 18px; }
.nl-claim { display: flex; flex-direction: column; gap: 6px; background: #fff3c4; border: 2px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px 0; }
.nl-resume { width: 100%; margin-bottom: 8px; min-height: 56px; }
.nc-sum { background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.nc-list { display: flex; flex-direction: column; gap: 6px; }
.nc-row { display: flex; align-items: center; gap: 8px; text-align: left; } .nc-row .nm { flex: 1; font-weight: 700; } .nc-row .chk { visibility: hidden; color: var(--ok); font-size: 20px; }
.nc-row.on { background: #ffe9a8; } .nc-row.on .chk { visibility: visible; }
.nature-claim .pg-foot .pl-btn { flex: 1; }
.nc-shop { display: flex; flex-direction: column; gap: 6px; }
.nc-ball { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.nc-ball .info { flex: 1; min-width: 0; display: flex; flex-direction: column; } .nc-ball small { color: var(--ink-2); }
.nc-ball .btns { display: flex; gap: 6px; } .nc-ball .btns .pl-btn { min-height: 40px; padding: 4px 8px; font-size: 13px; }

/* ---- Nha thi dau (chang 12) ---- */
.gym-lobby .pg-body h3, .gym-lobby .pg-body h4 { margin: 14px 0 6px; font-size: 15px; } .gym-lobby h4 { font-size: 14px; }
.gym-tier { border-top: 2px dashed rgba(0,0,0,.18); padding-top: 4px; } .gym-tier.locked { opacity: .55; }
.gym-stages { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 640px) { .gym-stages { grid-template-columns: repeat(3, 1fr); } }
.gym-stage { text-align: left; font-size: 14px; } .gym-stage.won { background: #dff3d8; } .gym-stage.open { background: #ffe9a8; }
.gym-banner { background: #fff3c4; border: 2px solid var(--line); border-radius: 8px; padding: 8px; margin: 6px 0; font-weight: 700; }
.gym-badge-got { font-size: 18px; font-weight: 700; color: #8a5a00; margin: 6px 0; }
.gym-tablewrap { max-height: 280px; overflow: auto; border: 2px solid var(--line); border-radius: 8px; background: var(--panel); }
.gym-table { width: 100%; border-collapse: collapse; font-size: 13px; } .gym-table th, .gym-table td { padding: 4px 6px; border-bottom: 1px solid rgba(0,0,0,.12); text-align: left; white-space: nowrap; }
.gym-table th { position: sticky; top: 0; background: var(--panel-2); } .gym-table tr.me td { background: #ffe9a8; font-weight: 700; }
.gym-pairs { display: flex; flex-direction: column; gap: 4px; } .gym-pairs .pair, .gym-tourney > .pair { background: var(--panel); border: 2px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.gym-forfeit { margin-top: 18px; width: 100%; } .pl-btn.danger { background: #f6d2cc; }
.gym-arena { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) 12px calc(env(safe-area-inset-bottom) + 10px);
  overflow-y: auto; color: #fff; }
.gs-head { display: flex; flex-direction: column; background: rgba(20,24,43,.85); border: 2px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.gs-head b { font-size: 16px; } .gs-head span { font-size: 13px; opacity: .9; }
.gs-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gs-chips:has(.gs-chip:only-child) { grid-template-columns: 1fr; }
.gs-chip { white-space: pre-line; font-size: 11px; line-height: 1.25; text-align: center; padding: 4px; border-radius: 6px; border: 2px solid var(--line); background: rgba(255,255,255,.85); color: var(--ink); }
.gs-chip.won { background: #c8ecc0; } .gs-chip.now { background: #ffe9a8; box-shadow: 0 0 0 3px var(--accent); } .gs-chip.lost { background: #f6c0b8; }
.gs-vs { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gs-side { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; flex: 1; min-height: 124px; } .gs-side .nm { font-weight: 700; text-align: center; font-size: 13px; text-shadow: 0 1px 2px #000; }
.gs-side.enter { animation: gsin .6s ease-out both; } @keyframes gsin { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gs-side.enter { animation: none; } }
.gs-x { font: 700 28px var(--font); color: #ffd84a; text-shadow: 0 2px 0 #000; }
.gs-party { display: grid; grid-template-columns: 1fr; gap: 4px; background: rgba(248,244,232,.95); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 6px; }
@media (min-width: 640px) { .gs-party { grid-template-columns: 1fr 1fr; } }
.gs-mon { display: grid; grid-template-columns: 34px 1fr 70px 64px; align-items: center; gap: 6px; font-size: 13px; } .gs-mon.ko { opacity: .5; }
.gs-mon .hp { text-align: right; font-variant-numeric: tabular-nums; }
.gs-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; } .gs-btns .pl-btn { flex: 1 1 140px; min-height: 52px; }
/* ===== Doi song Poke (chang 13) ===== */
.life-coins { font: 700 18px var(--font); background: #ffe9a8; border: 2px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }
.life-main { display: flex; flex-direction: column; gap: 10px; }
.life-plots, .life-kitchens { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.life-plot, .life-kitchen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 84px; padding: 4px; font-size: 12px; background: #d9c59a; }
.life-plot.grow, .life-kitchen.grow { background: #bfe0a8; } .life-plot.ready, .life-kitchen.ready { background: #ffe27a; box-shadow: 0 0 0 3px var(--accent); }
.life-plot .plus, .life-kitchen .plus { font-size: 24px; opacity: .6; } .life-plot .tm, .life-kitchen .tm { font-size: 11px; font-variant-numeric: tabular-nums; }
.life-kitchens { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.life-workers { background: rgba(255,255,255,.7); border: 2px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.life-workers .wk { display: flex; gap: 6px; flex-wrap: wrap; } .wk-mon { display: flex; flex-direction: column; align-items: center; min-width: 52px; font-size: 10px; border: 2px dashed var(--line); border-radius: 6px; padding: 2px; } .wk-mon.empty { justify-content: center; min-height: 48px; font-size: 20px; opacity: .5; }
.life-store { background: rgba(255,255,255,.7); border: 2px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; } .life-store h3 { margin: 0; font-size: 14px; }
.life-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid rgba(0,0,0,.1); padding: 4px 0; } .life-row .nm { flex: 1; font-weight: 700; font-size: 13px; } .life-row .sub { font-size: 11px; opacity: .8; max-width: 38%; text-align: right; }
.life-row.locked { opacity: .5; } .life-up { width: 100%; }
/* ===== Bao loi (chang 14) ===== */
.report { display: flex; flex-direction: column; gap: 8px; } .report-text { width: 100%; resize: vertical; min-height: 96px; font: inherit; } .report-attach { width: 100%; }
