/* ============================================================
   口袋幻兽 Pocket Phantoms  —  game.css
   只使用站点已有设计令牌（--surface / --border / --text / --accent …），
   因此自动跟随全站明暗主题；画布内部是独立像素调色板。
   ============================================================ */

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

/* ---------- 主机外壳 ---------- */
.game-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.game-hud b {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 700;
}
.game-hud .hud-sep {
  flex: 1;
}
.game-hud #pg-clock {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- 画布 ---------- */
.game-screen {
  position: relative;
  background: #0b1020;
  border-bottom: 1px solid var(--border);
}
#pg-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.game-banner {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  animation: pg-banner-in 0.28s ease;
  max-width: 90%;
  text-align: center;
}
@keyframes pg-banner-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 当前幻兽卡 ---------- */
.game-active {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.ga-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ga-name {
  font-size: 16px;
  font-weight: 800;
}
.ga-rar {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.ga-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  font-family: var(--mono);
}
.ga-type {
  color: #fff;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-family: var(--font);
  font-weight: 600;
}
.ga-bar {
  margin-top: 8px;
  height: 7px;
  border-radius: 99px;
  background: var(--bg-alt);
  overflow: hidden;
}
.ga-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent-gradient);
  transition: width 0.25s ease;
}
.ga-sub {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--mono);
}
.ga-flavor {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-3);
  font-style: italic;
}

/* ---------- 操作栏 ---------- */
.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}
.game-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.game-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.game-btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.3);
}
.game-btn.primary:hover {
  color: #fff;
  filter: brightness(1.06);
}
.game-btn.ghost {
  background: transparent;
}
.game-btn.danger {
  color: #e05260;
  border-color: rgba(224, 82, 96, 0.4);
}
.game-btn.danger:hover {
  background: rgba(224, 82, 96, 0.1);
  border-color: #e05260;
  color: #e05260;
}
.game-hint {
  align-self: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- 消息条 ---------- */
.game-msg {
  min-height: 34px;
  margin: 0 14px 12px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.game-msg:empty {
  display: none;
}
.game-msg.pop {
  animation: pg-pop 0.32s ease;
}
@keyframes pg-pop {
  0% { transform: scale(0.97); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- 标签页 ---------- */
.game-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px;
  border-top: 1px solid var(--border);
}
.game-tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}
.game-tab:hover {
  color: var(--text);
}
.game-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- 面板 ---------- */
.game-panel {
  padding: 14px;
  min-height: 150px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.gp-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.gp-line,
.gp-tip {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}
.gp-tip {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 12.5px;
}
.gp-flavor {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
  font-style: italic;
}
.game-empty {
  font-size: 13px;
  color: var(--text-3);
  padding: 12px 0;
}

/* 队伍列表 */
.gp-roster {
  list-style: none;
  display: grid;
  gap: 6px;
}
.gp-roster li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}
.gp-roster li.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.gp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.gp-name {
  font-weight: 600;
}
.gp-lv {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
}
.gp-rar {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.1em;
}

/* 图鉴 */
.gp-dex {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.dex-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all 0.15s ease;
}
.dex-cell:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.dex-cell canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}
.dex-cell.miss canvas {
  opacity: 0.55;
}
.dex-name {
  font-size: 11.5px;
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dex-rar {
  font-size: 9px;
  letter-spacing: 0.06em;
}

/* 日志 */
.gp-log {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
}
.gp-log li {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
}
.gp-log li time {
  flex: none;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11.5px;
}
.gp-log li.k-good {
  border-left: 3px solid #3f9e6a;
}
.gp-log li.k-warn {
  border-left: 3px solid #d99a2b;
}

/* 存档导入导出 */
.gp-textarea {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  resize: vertical;
  word-break: break-all;
}
.gp-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- 侧栏说明 ---------- */
.game-side {
  display: grid;
  gap: 16px;
}
.game-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.game-side-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 10px;
}
.game-side-card h3 .icon {
  color: var(--accent);
}
.game-side-card p,
.game-side-card li {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.75;
}
.game-side-card ul {
  list-style: none;
  display: grid;
  gap: 6px;
}
.game-side-card li::before {
  content: '·';
  color: var(--accent);
  font-weight: 800;
  margin-right: 8px;
}
.game-side-card code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-side {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .game-side {
    grid-template-columns: 1fr;
  }
  .game-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .game-tab {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
  }
}

/* 尊重系统的减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .game-banner,
  .game-msg.pop {
    animation: none;
  }
}
