/* ============================================
   game.css — 全新游戏化设计
   ============================================ */
:root {
  --bg:           #0a0a1a;
  --bg-panel:     #12122a;
  --border:       #2a2a5a;
  --border-hi:    #5a5aaa;
  --pink:         #ff6eb4;
  --cyan:         #7bf7ff;
  --yellow:       #ffe66d;
  --green:        #7bff9e;
  --text:         #e8e8ff;
  --text-dim:     #6868aa;
  --screen-bg:    #1e2a3a;
  --screen-dark:  #7bf7ff;
  --device-body:  #cfc0a8;
  --device-dark:  #9a8a72;
  --font-px:      'Press Start 2P', monospace;
  --font-body:    'Noto Sans SC', sans-serif;
}

*,*::before,*::after { box-sizing: border-box; margin:0; padding:0; }
html { font-size:16px; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 30%, #1a1050 0%, transparent 55%),
    radial-gradient(ellipse at 85% 70%, #0d1f40 0%, transparent 55%);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 扫描线 ── */
.scanlines {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 999;
  background: repeating-linear-gradient(
    to bottom, transparent 0, transparent 2px,
    rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
  );
}

/* ── 跑马灯 ── */
.marquee-bar {
  overflow: hidden;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--pink);
  padding: 6px 0;
  box-shadow: 0 0 16px rgba(255,110,180,0.25);
  flex-shrink: 0;
}
.marquee-track {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--font-px);
  font-size: 0.45rem;
  color: var(--pink);
  letter-spacing: 0.08em;
  animation: marquee 40s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── 主布局 ── */
.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ── 通用面板 ── */
.panel {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  box-shadow: 0 0 0 1px var(--border-hi), 4px 4px 0 rgba(0,0,0,0.4);
}
.card-title {
  font-family: var(--font-px);
  font-size: 0.5rem;
  color: var(--yellow);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.1em;
}

/* ══════════════════════════════
   设备
══════════════════════════════ */
.device {
  background: var(--device-body);
  border-radius: 24px 24px 48px 48px;
  border: 3px solid var(--device-dark);
  padding: 16px 20px 28px;
  box-shadow:
    inset 0 3px 6px rgba(255,255,255,0.45),
    0 12px 40px rgba(0,0,0,0.7),
    0 0 0 2px rgba(255,255,255,0.08);
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.device-brand {
  font-family: var(--font-px);
  font-size: 0.45rem;
  color: #5a4a3a;
  letter-spacing: 0.12em;
}
.device-model {
  font-family: var(--font-px);
  font-size: 0.3rem;
  color: #8a7a6a;
}

/* 屏幕边框 */
.screen-bezel {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 10px;
  border: 4px solid #111;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.9);
}

/* LCD 屏幕 */
.screen {
  background: var(--screen-bg);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  height: 400px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.15);
}

/* 场景层 */
.scene {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.scene-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #1e2a3a 0%, #0f1a2a 100%);
}
/* 地面线 */
.scene-bg::after {
  content: '';
  position: absolute;
  bottom: 20px; left: 0; right: 0;
  height: 3px;
  background: var(--screen-dark);
  opacity: 0.3;
}

/* 角色 */
.character-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.character-img {
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 4px rgba(15,56,15,0.4));
}

/* 动画状态 */
.character-img.idle     { animation: bounce 2s ease-in-out infinite; }
.character-img.happy    { animation: happy-jump 0.5s ease-in-out infinite alternate; }
.character-img.hungry   { animation: wobble 0.8s ease-in-out infinite; }
.character-img.sleeping { animation: breathe 3s ease-in-out infinite; }
.character-img.talking  { animation: talk-bob 0.3s ease-in-out infinite alternate; }

@keyframes bounce      { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes happy-jump  { from{transform:translateY(0) scale(1)} to{transform:translateY(-20px) scale(1.08)} }
@keyframes wobble      { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-4deg)} 75%{transform:rotate(4deg)} }
@keyframes breathe     { 0%,100%{transform:scaleY(1)} 50%{transform:scaleY(0.96)} }
@keyframes talk-bob    { from{transform:rotate(-3deg)} to{transform:rotate(3deg) translateY(-4px)} }

/* 气泡 */
.speech-bubble {
  position: absolute;
  top: -16px;
  right: -20px;
  background: #f0f0e0;
  border: 2px solid var(--screen-dark);
  border-radius: 10px 10px 10px 2px;
  padding: 5px 8px;
  font-family: var(--font-px);
  font-size: 0.32rem;
  color: var(--screen-dark);
  max-width: 130px;
  word-wrap: break-word;
  line-height: 1.5;
  z-index: 10;
  animation: bubble-pop 0.2s ease;
  white-space: pre-wrap;
}
@keyframes bubble-pop { from{transform:scale(0.6);opacity:0} to{transform:scale(1);opacity:1} }

/* 小游戏层 */
.minigame-layer {
  position: absolute; inset: 0; z-index: 5;
  background: var(--screen-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.minigame-content {
  font-family: var(--font-px);
  font-size: 0.5rem;
  color: var(--screen-dark);
  text-align: center;
  line-height: 2;
}

/* HUD 状态栏 */
.hud {
  background: rgba(0,0,20,0.6);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.hud-stat {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 5px;
}
.hud-icon { font-size: 0.7rem; line-height: 1; }
.hud-bar-track {
  height: 7px;
  background: rgba(0,0,20,0.5);
  border: 1px solid var(--screen-dark);
  border-radius: 3px;
  overflow: hidden;
}
.hud-bar {
  height: 100%;
  background: var(--screen-dark);
  border-radius: 3px;
  transition: width 0.6s ease;
  width: 80%;
}
.hud-bar.low  { background: #660000; }
.hud-bar.mid  { background: #444400; }
.hud-bar.high { background: var(--screen-dark); }

/* 设备状态文字 */
.device-status {
  font-family: var(--font-px);
  font-size: 0.42rem;
  color: var(--pink);
  text-align: center;
  min-height: 1.2rem;
  margin: 10px 0 4px;
  letter-spacing: 0.05em;
}

/* 主操作按钮组 */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 8px 0;
}
.action-btn {
  background: var(--device-dark);
  border: 3px solid #7a6a52;
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 4px 0 #5a4a32, inset 0 2px 3px rgba(255,255,255,0.25);
  transition: transform 0.08s, box-shadow 0.08s;
}
.action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5a4a32, inset 0 2px 3px rgba(255,255,255,0.25);
}
.action-btn:hover { background: #b0a090; }
.btn-icon  { font-size: 1.3rem; line-height: 1; }
.btn-label { font-family: var(--font-px); font-size: 0.28rem; color: #3a2a1a; }

/* 小游戏按钮行 */
.game-btn-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.game-btn {
  background: #2a2a4a;
  border: 2px solid var(--border-hi);
  border-radius: 6px;
  color: var(--cyan);
  font-family: var(--font-px);
  font-size: 0.32rem;
  padding: 7px 4px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s, box-shadow 0.15s;
}
.game-btn:hover {
  background: #3a3a6a;
  box-shadow: 0 0 10px rgba(123,247,255,0.3);
}
.game-btn:active { transform: scale(0.96); }

.device-footer {
  font-family: var(--font-px);
  font-size: 0.28rem;
  color: #8a7a6a;
  text-align: center;
}

/* ── 闪光按钮动画 ── */
@keyframes btn-flash {
  0%,100%{ box-shadow: 0 4px 0 #5a4a32; }
  50%    { box-shadow: 0 4px 0 #5a4a32, 0 0 18px var(--yellow); }
}
.action-btn.flash { animation: btn-flash 0.35s ease; }

/* ══════════════════════════════
   右栏
══════════════════════════════ */
.right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 个人卡片 */
.profile-card { }
.profile-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}
.profile-avatar {
  width: 72px; height: 72px;
  image-rendering: pixelated;
  border: 3px solid var(--cyan);
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(123,247,255,0.35);
  flex-shrink: 0;
}
.profile-name {
  font-family: var(--font-px);
  font-size: 0.6rem;
  color: var(--yellow);
  margin-bottom: 5px;
}
.profile-title { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 3px; }
.profile-location { font-size: 0.75rem; color: var(--text-dim); }
.profile-links { display: flex; gap: 8px; flex-wrap: wrap; }
.plink {
  font-family: var(--font-px);
  font-size: 0.42rem;
  color: var(--cyan);
  border: 1px solid var(--border-hi);
  padding: 3px 7px;
  border-radius: 3px;
  text-decoration: none;
  transition: background 0.15s;
}
.plink:hover { background: rgba(123,247,255,0.1); }

/* 聊天 */
.chat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: 4px;
  margin-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-msg {
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 6px;
  max-width: 88%;
  word-wrap: break-word;
  animation: msg-in 0.2s ease;
}
@keyframes msg-in { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }
.chat-msg.user {
  background: rgba(123,247,255,0.08);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  align-self: flex-end;
}
.chat-msg.assistant {
  background: rgba(255,110,180,0.08);
  border: 1px solid var(--pink);
  color: var(--text);
  align-self: flex-start;
}
.chat-msg.system {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-style: italic;
  align-self: center;
  text-align: center;
}
.chat-row { display: flex; gap: 6px; }
.chat-input {
  flex: 1;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--cyan); }
.chat-send {
  background: var(--pink);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-send:hover  { background: #ff3d9a; }
.chat-send:active { transform: scale(0.95); }
.chat-hint {
  font-family: var(--font-px);
  font-size: 0.35rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 5px;
}

/* 项目列表 */
.proj-list { display: flex; flex-direction: column; gap: 6px; }
.proj-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.proj-item:hover { border-color: var(--cyan); background: rgba(123,247,255,0.05); }
.proj-name { font-family: var(--font-px); font-size: 0.42rem; color: var(--yellow); }
.proj-tag  { font-size: 0.7rem; color: var(--text-dim); }

/* 页脚 */
.site-footer {
  text-align: center;
  font-family: var(--font-px);
  font-size: 0.38rem;
  color: var(--text-dim);
  padding: 12px;
  border-top: 1px dashed var(--border);
}
.blink { animation: blink 1s step-start infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* 打字点 */
.typing-dot { display:inline-block; animation: dot-pulse 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay:0.2s; }
.typing-dot:nth-child(3) { animation-delay:0.4s; }
@keyframes dot-pulse { 0%,80%,100%{opacity:0.3;transform:scale(0.8)} 40%{opacity:1;transform:scale(1.2)} }

/* 屏幕闪光 */
@keyframes screen-glow {
  0%,100%{ box-shadow: inset 0 0 20px rgba(0,0,0,0.15); }
  50%    { box-shadow: inset 0 0 20px rgba(0,0,0,0.15), 0 0 30px rgba(139,172,15,0.6); }
}
.screen.interacting { animation: screen-glow 0.5s ease; }

/* 响应式 */
@media (max-width: 850px) {
  .game-layout { grid-template-columns: 1fr; }
  .device { max-width: 400px; margin: 0 auto; }
}

/* 强制角色居中显示 */
.scene {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}
.character-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.character-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 300px;
  max-height: 300px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block !important;
}

/* 强制角色显示在屏幕中央 */
.scene {
  position: relative !important;
  flex: 1 !important;
  min-height: 200px !important;
  overflow: visible !important;
}
.character-wrap {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 10 !important;
}
.character-img {
  width: 250px !important;
  height: 250px !important;
  object-fit: contain !important;
  display: block !important;
  image-rendering: auto !important;
}

/* 字体放大修正 */
.card-title       { font-size: 0.65rem !important; }
.profile-name     { font-size: 0.75rem !important; }
.profile-title    { font-size: 0.95rem !important; }
.profile-location { font-size: 0.9rem  !important; }
.plink            { font-size: 0.55rem !important; padding: 5px 10px !important; }
.chat-msg         { font-size: 0.95rem !important; }
.chat-input       { font-size: 0.95rem !important; }
.chat-hint        { font-size: 0.45rem !important; }
.device-brand     { font-size: 0.55rem !important; }
.device-model     { font-size: 0.4rem  !important; }
.btn-label        { font-size: 0.38rem !important; }
.game-btn         { font-size: 0.42rem !important; padding: 9px 4px !important; }
.device-footer    { font-size: 0.35rem !important; }
.device-status    { font-size: 0.52rem !important; }
.marquee-track    { font-size: 0.55rem !important; }

/* ── 全局字号统一 ── */
:root { --font-size-base: 15px; }

.marquee-track    { font-size: 13px !important; }
.device-brand     { font-size: 13px !important; }
.device-model     { font-size: 13px !important; }
.device-status    { font-size: 13px !important; }
.device-footer    { font-size: 13px !important; }
.btn-label        { font-size: 13px !important; }
.game-btn         { font-size: 13px !important; padding: 10px 6px !important; }
.card-title       { font-size: 13px !important; }
.profile-name     { font-size: 15px !important; }
.profile-title    { font-size: 15px !important; }
.profile-location { font-size: 15px !important; }
.plink            { font-size: 13px !important; padding: 5px 12px !important; }
.chat-msg         { font-size: 15px !important; line-height: 1.6 !important; }
.chat-input       { font-size: 15px !important; }
.chat-hint        { font-size: 13px !important; }
.hud-icon         { font-size: 14px !important; }

/* ── 聊天框高度固定，不随内容撑高 ── */
.chat-card {
  flex: none !important;
  height: auto !important;
  min-height: unset !important;
}
.chat-log {
  height: 300px !important;
  min-height: unset !important;
  flex: none !important;
  overflow-y: auto !important;
}

/* ── 右栏不撑满整页 ── */
.right-col {
  align-self: start !important;
}
