/* 宝可梦放置冒险 —— 复古像素风，Win8/Chrome109 兼容 */
:root {
  --bg: #1a1c23;
  --panel: #262a34;
  --panel2: #313641;
  --border: #454b58;
  --text: #e8eaf0;
  --muted: #9aa0ad;
  --red: #e5484d;
  --yellow: #f5c518;
  --green: #46a758;
  --blue: #4a90d9;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif; font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
#app { max-width: 1080px; margin: 0 auto; padding: 0 12px 40px; }

/* 顶栏 */
#topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; border-bottom: 2px solid var(--border); }
.brand { font-size: 20px; font-weight: bold; color: var(--yellow); letter-spacing: 1px; }
.resources { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.res { color: var(--muted); }
.res b { color: var(--yellow); font-size: 15px; }
.btn-mini { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 5px 10px; }
.btn-mini:hover { background: var(--border); }
.btn-primary { background: var(--red); color: #fff; border: none; border-radius: 6px; padding: 12px 32px; font-size: 16px; font-weight: bold; }
.btn-primary:disabled { background: #5a4042; color: #999; cursor: not-allowed; }

/* 开始界面 */
.screen { margin-top: 20px; }
.intro-card { max-width: 680px; margin: 0 auto; background: var(--panel); border: 2px solid var(--border); border-radius: 12px; padding: 24px; }
.prof { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.prof-avatar { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; background: var(--red); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.dialogue { background: var(--panel2); border-radius: 8px; padding: 12px 16px; line-height: 1.7; }
.dialogue p { margin: 4px 0; }
.starter-select { display: flex; gap: 12px; justify-content: center; margin: 20px 0; }
.starter { flex: 1; max-width: 180px; background: var(--panel2); border: 2px solid var(--border); border-radius: 10px; padding: 12px; color: var(--text); transition: transform .1s; }
.starter:hover { transform: translateY(-3px); }
.starter.selected { border-color: var(--yellow); background: #3a3a2a; }
.starter img { width: 72px; height: 72px; image-rendering: pixelated; }
.starter-name { font-weight: bold; margin-top: 6px; }
.starter-type { color: var(--muted); font-size: 12px; }
.name-row { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.name-row input { background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 4px; padding: 8px 12px; font-size: 14px; }
#btnStart { display: block; margin: 0 auto; }

/* 主界面 */
.main-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .main-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 2px solid var(--border); border-radius: 12px; padding: 16px; min-height: 480px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 18px; color: var(--yellow); }
.panel-head select { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 6px; max-width: 160px; }

/* 战斗舞台 */
.battle-stage { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; min-height: 200px; background: linear-gradient(#2b3a2e, #232a26); border-radius: 10px; padding: 16px; }
.vs { color: var(--yellow); font-size: 20px; font-weight: bold; }
.enemy-slot, .party-slot { text-align: center; }
.enemy-slot img, .party-slot img { width: 96px; height: 96px; image-rendering: pixelated; }
.empty-hint { color: var(--muted); font-size: 13px; padding: 40px 0; }
.poke-name { font-weight: bold; margin-top: 6px; }
.poke-lv { color: var(--muted); font-size: 12px; }
.hpbar { height: 8px; background: #444; border-radius: 4px; margin: 6px auto 0; max-width: 120px; overflow: hidden; }
.hpbar > div { height: 100%; background: var(--green); }
.party-mini { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.party-mini img { width: 32px; height: 32px; }
.party-mini img.fainted { opacity: .3; }
.battle-status { margin-top: 14px; }
#battleMsg { color: var(--muted); min-height: 22px; line-height: 1.5; }
.progress-line { height: 6px; background: var(--panel2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
#battleProgress { height: 100%; width: 0; background: var(--blue); transition: width .1s linear; }
.legend-banner { margin-top: 10px; background: var(--yellow); color: #333; text-align: center; padding: 8px; border-radius: 6px; font-weight: bold; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.03); } }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 14px; }
.tab { background: none; border: none; color: var(--muted); padding: 8px 14px; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }
.tab-content { max-height: 560px; overflow-y: auto; }

/* 队伍卡片 */
.poke-card { display: flex; gap: 12px; align-items: center; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.poke-card img { width: 56px; height: 56px; image-rendering: pixelated; }
.poke-card .info { flex: 1; min-width: 0; }
.poke-card .title { font-weight: bold; }
.poke-card .meta { color: var(--muted); font-size: 12px; }
.poke-card .actions { display: flex; flex-direction: column; gap: 4px; }
.rarity-badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 8px; color: #111; font-weight: bold; }
.move-chip { display: inline-block; font-size: 11px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; margin: 2px 2px 0 0; }
.move-chip.locked { border-color: var(--yellow); color: var(--yellow); }
.btn-action { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 4px; padding: 4px 8px; font-size: 12px; }

/* 图鉴 */
.dex-group { margin-bottom: 16px; }
.dex-group h3 { font-size: 14px; margin: 0 0 8px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.dex-cell { background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; text-align: center; padding: 6px 2px; font-size: 11px; }
.dex-cell img { width: 40px; height: 40px; image-rendering: pixelated; }
.dex-cell.unseen { opacity: .35; }
.dex-cell.unseen img { filter: brightness(0); }
.dex-cell .num { color: var(--muted); }

/* 日志 */
.log-item { padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.4; }
.log-item.catch { color: var(--green); }
.log-item.evo, .log-item.legend { color: var(--yellow); }
.log-item.time { color: var(--muted); font-size: 11px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border: 2px solid var(--border); border-radius: 12px; padding: 20px; max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin-top: 0; color: var(--yellow); }
.modal-row { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px 16px; }
.btn:hover { background: var(--border); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 30px; background: var(--panel2); border: 2px solid var(--yellow); color: var(--text); padding: 12px 20px; border-radius: 8px; z-index: 200; box-shadow: 0 4px 20px rgba(0,0,0,.5); }

/* 调试面板 */
.debug-panel { position: fixed; right: 10px; bottom: 10px; width: 260px; background: #0d2818; border: 2px solid var(--green); border-radius: 8px; padding: 12px; z-index: 150; font-size: 12px; }
.debug-panel h4 { margin: 0 0 8px; color: var(--green); }
.debug-panel input, .debug-panel select { width: 100%; background: #111; color: #0f0; border: 1px solid var(--green); border-radius: 4px; padding: 4px; margin: 4px 0; }
.debug-panel button { background: #1a4d2e; color: #0f0; border: 1px solid var(--green); border-radius: 4px; padding: 4px 8px; margin: 2px; }
.debug-section { border-top: 1px solid var(--green); padding-top: 6px; margin-top: 6px; }
