/* 认字小能手 - 自适应 H5 + iPad */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #fdf6ec 0%, #fef9f0 100%);
  color: #4a3728;
  overflow: hidden;
}

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
}

/* ── 登录页 ── */
#login-screen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(160deg, #fdf6ec 0%, #fbeede 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 30px 24px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 30px rgba(180, 140, 90, 0.15);
}

.logo { font-size: 64px; margin-bottom: 12px; }

.login-card h1 {
  font-size: 32px;
  color: #e8843c;
  margin-bottom: 6px;
}

.subtitle { color: #a08a72; font-size: 15px; margin-bottom: 28px; }

#name-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid #f0e2d0;
  border-radius: 14px;
  outline: none;
  background: #fffdf9;
  margin-bottom: 14px;
  text-align: center;
}

#name-input:focus { border-color: #e8843c; }

.btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  background: #e8843c;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-primary:active { transform: scale(0.97); }

.user-list {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.user-chip {
  padding: 8px 18px;
  background: #fdf3e5;
  color: #c97a33;
  border: 1.5px solid #f0d9bc;
  border-radius: 20px;
  font-size: 15px;
  cursor: pointer;
}

/* ── 主菜单 ── */
#menu-screen { padding-top: 40px; }

.menu-header { margin-bottom: 30px; }

.welcome {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 56px;
  height: 56px;
  background: #ffe9d2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.hello { font-size: 22px; font-weight: 700; }

.progress-text { color: #b39474; font-size: 14px; margin-top: 2px; }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.menu-card {
  background: #fff;
  border-radius: 20px;
  padding: 26px 18px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(180, 140, 90, 0.1);
  cursor: pointer;
  transition: transform 0.1s;
}

.menu-card:active { transform: scale(0.96); }

.card-icon { font-size: 42px; margin-bottom: 10px; }
.card-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: #a08a72; }

/* ── 顶部栏 ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btn-back {
  background: none;
  border: none;
  font-size: 17px;
  color: #c97a33;
  padding: 8px 4px;
  cursor: pointer;
  min-width: 70px;
  text-align: left;
}

.top-title { font-size: 18px; font-weight: 700; }
.top-progress { font-size: 14px; color: #b39474; min-width: 70px; text-align: right; }

/* ── 卡片舞台 ── */
.card-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(180, 140, 90, 0.12);
  margin-bottom: 14px;
  min-height: 0;
  user-select: none;
}

.pinyin {
  font-size: clamp(22px, 5vw, 32px);
  color: #e8843c;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.big-char {
  font-size: clamp(120px, 30vw, 220px);
  line-height: 1.15;
  font-weight: 700;
  color: #3d2c1d;
}

.lesson-tag {
  margin-top: 16px;
  font-size: 13px;
  color: #c9b393;
  background: #fbf3e7;
  padding: 4px 14px;
  border-radius: 12px;
}

.review-tip {
  margin-top: 18px;
  font-size: 14px;
  color: #b39474;
  background: #fbf3e7;
  padding: 6px 16px;
  border-radius: 12px;
}

/* ── 翻页按钮 ── */
.nav-buttons {
  display: flex;
  gap: 12px;
  padding-bottom: 8px;
}

.btn-nav {
  flex: 1;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 16px;
  background: #fff;
  color: #c97a33;
  box-shadow: 0 4px 12px rgba(180, 140, 90, 0.12);
  cursor: pointer;
}

.btn-nav:active { transform: scale(0.97); }
.btn-next { background: #e8843c; color: #fff; }

/* ── 测字按钮 ── */
.test-stage { background: #fffdf9; }

.judge-buttons {
  display: flex;
  gap: 12px;
  padding-bottom: 8px;
}

.btn-judge {
  flex: 1;
  padding: 18px 0;
  font-size: 19px;
  font-weight: 600;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-judge:active { transform: scale(0.96); }
.btn-unknown { background: #f6e2e0; color: #c2564a; }
.btn-known { background: #dff0e3; color: #2f8f5b; }

/* ── 结果页 ── */
.test-result {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 30px;
  z-index: 10;
}

.result-title { font-size: 34px; font-weight: 800; color: #e8843c; }

.result-stats {
  font-size: 18px;
  color: #5a4633;
  text-align: center;
  line-height: 1.8;
}

.result-stats .big-num { font-size: 30px; font-weight: 800; color: #e8843c; }

#test-restart {
  max-width: 280px;
  margin-top: 8px;
}

.review-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

/* ── iPad 横屏适配 ── */
@media (min-width: 768px) {
  .card-stage { margin: 0 auto 16px; width: 100%; max-width: 640px; }
  .nav-buttons, .judge-buttons { max-width: 640px; margin: 0 auto; }
  .menu-grid { max-width: 640px; }
}
