/* 薯片接龙 - 墨水屏专用样式
 * 原则：纯黑白高对比 / 无动画无渐变无阴影 / 大字号大按钮 / 兼容老内核(不用grid、CSS变量)
 * 布局：上半历史记录(可滚动) + 输入显示，底部固定 QWERTY 大按钮键盘
 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0,0,0,0); }
html, body { background: #fff; color: #000; }
body {
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 22px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 1000px; margin: 0 auto; padding: 12px 16px 0; }
.hidden { display: none !important; }
button {
  font-family: inherit; color: #000; background: #fff;
  border: 3px solid #000; border-radius: 10px;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
button:active { background: #000; color: #fff; }

/* ---------- 顶栏 ---------- */
#topbar { position: relative; }
#brand { font-size: 42px; font-weight: bold; padding: 4px 140px 10px 0; letter-spacing: 2px; }
#net-status { font-size: 16px; font-weight: normal; margin-left: 12px; letter-spacing: 0; }
#btn-menu {
  position: absolute; right: 0; top: 0;
  font-size: 26px; font-weight: bold; min-height: 64px; padding: 8px 26px;
}
#scorebar { display: flex; border: 3px solid #000; border-radius: 10px; overflow: hidden; }
.score-cell { flex: 1; text-align: center; padding: 6px 2px; border-left: 2px solid #000; }
.score-cell:first-child { border-left: none; }
.score-name { font-size: 22px; font-weight: bold; }
.score-num { font-size: 40px; font-weight: bold; line-height: 1.1; }
.score-cur { background: #000; color: #fff; } /* 当前玩家反色高亮 */

/* ---------- 回合条 ---------- */
#turnbar { display: flex; align-items: center; padding: 12px 2px 8px; }
#turn-text { flex: 1; font-size: 28px; font-weight: bold; }
#btn-hint { font-size: 24px; font-weight: bold; min-height: 64px; padding: 6px 30px; }

/* ---------- 历史记录（上半部分，一词一行） ---------- */
#history {
  border: 3px solid #000; border-radius: 12px;
  height: 36vh; min-height: 180px; overflow-y: auto;
  padding: 6px 12px;
}
.h-empty { text-align: center; font-size: 24px; padding: 30px 0; }
.h-row { display: flex; align-items: baseline; border-bottom: 2px solid #000; padding: 8px 2px; font-size: 22px; }
.h-row:last-child { border-bottom: none; }
.h-idx { flex: 0 0 44px; font-size: 18px; }
.h-word { flex: 0 0 220px; font-weight: bold; font-size: 26px; letter-spacing: 1px; }
.h-def { flex: 1; padding: 0 8px; }
.h-meta { flex: 0 0 auto; white-space: nowrap; font-weight: bold; }

/* ---------- 输入显示 ---------- */
#inputbar { padding: 8px 2px 0; }
#typed {
  text-align: center; font-size: 48px; font-weight: bold; letter-spacing: 4px;
  min-height: 72px; line-height: 1.3;
  border-bottom: 3px dashed #000; margin: 0 20px;
}
.typed-empty { font-size: 26px; font-weight: normal; letter-spacing: 0; }
#judge-tip { text-align: center; font-size: 26px; font-weight: bold; min-height: 44px; padding-top: 6px; }

/* ---------- 键盘（固定底部，标准 QWERTY，仅字母+退格+确认） ---------- */
#keyboard {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: #fff; border-top: 3px solid #000;
  padding: 8px 10px 12px;
}
.kb-row { display: flex; max-width: 1000px; margin: 0 auto; }
.kb-row2 { padding: 0 4%; } /* 第二行居中缩进，仿标准键盘 */
.key {
  flex: 1 1 0; margin: 4px; min-height: 84px;
  font-size: 36px; font-weight: bold; text-transform: uppercase;
}
.key-wide { flex: 1.7 1 0; font-size: 26px; }
.key-clear { font-size: 26px; } /* 第四行整行：重新输入（清空） */
#view-game { padding-bottom: 412px; } /* 底部留白给固定键盘（4 行） */

/* ---------- 菜单弹出层 ---------- */
#menu-overlay {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(0,0,0,0.5);
}
#menu-panel {
  max-width: 560px; margin: 90px auto 0; background: #fff;
  border: 4px solid #000; border-radius: 12px; padding: 20px 22px 24px;
}
#menu-title { font-size: 32px; font-weight: bold; text-align: center; padding-bottom: 14px; }
.big-btn { display: block; width: 100%; font-size: 32px; font-weight: bold; min-height: 96px; padding: 14px 8px; }
.menu-item { margin: 8px 0; }

/* ---------- 结算 / 历史 ---------- */
#view-summary { padding-bottom: 140px; }
#summary-box, #history-box { border: 3px solid #000; border-radius: 12px; padding: 16px 18px; margin-top: 14px; }
.sum-title { font-size: 28px; font-weight: bold; text-align: center; padding-bottom: 10px; }
.sum-table { width: 100%; border-collapse: collapse; }
.sum-table th, .sum-table td { border: 2px solid #000; padding: 8px 6px; text-align: center; font-size: 24px; }
.sum-table th { font-size: 20px; }
.sum-win { background: #000; color: #fff; font-weight: bold; }
.sum-note { font-size: 18px; padding-top: 10px; text-align: center; }
.hist-item { border-bottom: 2px solid #000; padding: 10px 2px; font-size: 20px; }
.hist-item:last-child { border-bottom: none; }
.hist-date { font-weight: bold; font-size: 22px; }
#summary-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: #fff; border-top: 3px solid #000; padding: 10px 16px 14px;
}
#summary-actions .big-btn { flex: 0 1 480px; font-size: 30px; min-height: 90px; margin: 0 6px; }

/* ---------- 加载 ---------- */
#view-loading { padding: 60px 0; text-align: center; }
#loading-text { font-size: 26px; padding-bottom: 24px; }
#btn-retry { max-width: 400px; margin: 0 auto; }

/* ---------- 小屏(手机调试)适配 ---------- */
@media (max-width: 480px) {
  body { font-size: 18px; }
  #brand { font-size: 32px; padding-right: 110px; }
  #btn-menu { font-size: 20px; min-height: 52px; padding: 6px 18px; }
  .score-num { font-size: 30px; }
  #turn-text { font-size: 22px; }
  #btn-hint { font-size: 20px; min-height: 52px; padding: 4px 20px; }
  #history { height: 30vh; min-height: 140px; }
  .h-row { font-size: 18px; }
  .h-word { flex-basis: 140px; font-size: 20px; }
  #typed { font-size: 34px; min-height: 54px; }
  #judge-tip { font-size: 20px; min-height: 36px; }
  .key { min-height: 62px; font-size: 26px; margin: 3px; }
  .key-wide { font-size: 20px; }
  .key-clear { font-size: 20px; }
  #view-game { padding-bottom: 310px; }
  #menu-panel { margin: 50px 16px 0; }
}