/* style.css — 宝宝认物（核心样式，保证离线可用；Tailwind 仅作补充） */

:root {
  --pink: #ff7eb3;
  --pink-d: #ff5e9c;
  --blue: #5ec6ff;
  --yellow: #ffd54a;
  --green: #7ed957;
  --purple: #b388ff;
  --bg1: #fff0f6;
  --bg2: #e3f4ff;
  --ink: #2b2b3a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
}

#app { max-width: 720px; margin: 0 auto; min-height: 100%; position: relative; }

.hidden { display: none !important; }

/* ---- 顶部条 ---- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 4px solid var(--pink);
  box-shadow: 0 2px 10px rgba(255, 126, 179, .15);
}
.brand { font-size: 22px; font-weight: 800; color: var(--pink-d); }
.scores { display: flex; gap: 14px; }
.score { font-size: 20px; font-weight: 700; background: #fff7fb; padding: 4px 12px; border-radius: 999px; }
.score b { color: var(--pink-d); }

/* ---- 视图 ---- */
.view { padding: 18px 16px 120px; }
.home-title { text-align: center; font-size: 26px; font-weight: 800; margin: 10px 0 18px; color: var(--ink); }
.hint { text-align: center; color: #8a8aa0; margin-top: 16px; font-size: 16px; }

/* ---- 分类磁贴 ---- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 4px;
}
.tile {
  border: none;
  border-radius: 28px;
  padding: 22px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .08), 0 10px 22px rgba(0, 0, 0, .12);
  transition: transform .12s ease;
  min-height: 130px;
  justify-content: center;
}
.tile:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0, 0, 0, .08), 0 6px 12px rgba(0, 0, 0, .12); }
.tile:nth-child(8n+1) { background: linear-gradient(160deg, #ff9a9e, #ff5e9c); }
.tile:nth-child(8n+2) { background: linear-gradient(160deg, #74e0ff, #4aa8ff); }
.tile:nth-child(8n+3) { background: linear-gradient(160deg, #ffd86b, #ffb02e); }
.tile:nth-child(8n+4) { background: linear-gradient(160deg, #9be15d, #5fc23a); }
.tile:nth-child(8n+5) { background: linear-gradient(160deg, #c4a3ff, #8e5bff); }
.tile:nth-child(8n+6) { background: linear-gradient(160deg, #ffb3c7, #ff7eb3); }
.tile:nth-child(8n+7) { background: linear-gradient(160deg, #7ee8d3, #2bc0a6); }
.tile:nth-child(8n+8) { background: linear-gradient(160deg, #ffc371, #ff8a3d); }
.tile-icon { font-size: 56px; line-height: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,.2)); }
.tile-name { font-size: 22px; font-weight: 800; letter-spacing: 2px; }

/* ---- 学习页 ---- */
.learn-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.cat-label { font-size: 20px; font-weight: 800; color: var(--pink-d); flex: 1; text-align: center; }
.learn-progress { font-size: 18px; font-weight: 700; background: #fff; padding: 4px 12px; border-radius: 999px; }
.round-btn {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: #fff; font-size: 26px; font-weight: 800; color: var(--pink-d);
  box-shadow: 0 4px 12px rgba(0,0,0,.12); cursor: pointer;
}
.round-btn:active { transform: translateY(2px); }

.card-stage {
  min-height: 54vh;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}

.card {
  width: 100%;
  background: #fff;
  border-radius: 36px;
  padding: 28px 18px 32px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  animation: pop .35s ease;
}
@keyframes pop { from { transform: scale(.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.big-emoji {
  font-size: 150px;
  line-height: 1.1;
  margin: 6px 0 10px;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.12));
}
.title { font-size: 72px; font-weight: 900; color: var(--ink); letter-spacing: 4px; }
.pinyin { font-size: 32px; color: var(--pink-d); margin-top: 6px; font-weight: 700; }

/* 象形字卡片 */
.picto-card .picto { font-size: 150px; line-height: 1.1; transition: opacity .4s, transform .4s; }
.picto-card .picto.fade { opacity: 0; transform: scale(.6) rotate(20deg); }
.picto-card .char {
  font-size: 150px; line-height: 1.1; color: var(--purple); font-weight: 900;
  display: none;
}
.picto-card .char.shown { display: block; animation: charpop .5s ease; }
@keyframes charpop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.transform { margin-top: 16px; }

/* ---- 控制按钮 ---- */
.controls {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(255,255,255,.96), rgba(255,255,255,.78));
  max-width: 720px; margin: 0 auto;
}
.big-btn {
  flex: 1 1 30%;
  min-width: 120px;
  border: none; border-radius: 22px;
  padding: 18px 10px; font-size: 22px; font-weight: 800;
  color: #fff; cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,.1);
  transition: transform .1s ease;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.1); }
.big-btn.nav   { background: linear-gradient(160deg,#9be15d,#5fc23a); }
.big-btn.speak { background: linear-gradient(160deg,#74e0ff,#4aa8ff); }
.big-btn.read  { background: linear-gradient(160deg,#ffd86b,#ffb02e); }
.big-btn.done  { background: linear-gradient(160deg,#ff9a9e,#ff5e9c); }
.big-btn.transform { background: linear-gradient(160deg,#c4a3ff,#8e5bff); flex: 1 1 100%; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; top: 18%;
  transform: translateX(-50%);
  background: rgba(43,43,58,.92); color: #fff;
  padding: 14px 22px; border-radius: 18px;
  font-size: 22px; font-weight: 700; z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastin .25s ease;
}
@keyframes toastin { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%,0); opacity: 1; } }

/* ---- 庆祝 ---- */
.celebrate {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.82); backdrop-filter: blur(3px);
}
.celebrate-box {
  background: #fff; border-radius: 36px; padding: 36px 28px;
  text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.2);
  max-width: 90%; animation: pop .4s ease;
}
.celebrate-emoji { font-size: 64px; }
.celebrate-box h2 { font-size: 34px; color: var(--pink-d); margin: 10px 0; }
.celebrate-box p { font-size: 20px; color: #555; }
.celebrate-score { font-size: 28px; font-weight: 800; margin: 14px 0 22px; }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-piece {
  position: absolute; top: -40px;
  animation: fall 2.6s linear infinite;
}
@keyframes fall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: .7; }
}

/* ---- 后台通用（与 Tailwind 互补） ---- */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 18px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.admin-nav button {
  border: none; border-radius: 14px; padding: 12px 18px;
  font-size: 18px; font-weight: 700; background: #fff; color: var(--pink-d);
  box-shadow: 0 3px 10px rgba(0,0,0,.08); cursor: pointer;
}
.admin-nav button.active { background: var(--pink); color: #fff; }
.admin-card { background: #fff; border-radius: 22px; padding: 18px; margin-bottom: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.admin-card h2 { margin: 0 0 12px; font-size: 24px; color: var(--ink); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 10px; }
.form-row label { width: 110px; font-weight: 700; font-size: 16px; }
.form-row input, .form-row select {
  flex: 1; min-width: 160px; padding: 10px 12px; font-size: 16px;
  border: 2px solid #eee; border-radius: 12px; outline: none;
}
.form-row input:focus, .form-row select:focus { border-color: var(--pink); }
.btn {
  border: none; border-radius: 12px; padding: 12px 20px; font-size: 17px; font-weight: 700;
  color: #fff; cursor: pointer; background: var(--pink); box-shadow: 0 4px 0 rgba(0,0,0,.1);
}
.btn:active { transform: translateY(2px); }
.btn.gray { background: #9aa; }
.btn.red { background: #ff6b6b; }
.btn.green { background: var(--green); }
.btn.small { padding: 7px 12px; font-size: 14px; }
table.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 16px; overflow: hidden; }
table.admin-table th, table.admin-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 15px; }
table.admin-table th { background: #fff0f6; color: var(--pink-d); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.dash-item { background: #fff; border-radius: 18px; padding: 16px; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.dash-item .di-icon { font-size: 40px; }
.dash-item .di-name { font-weight: 800; margin-top: 6px; }
.dash-item .di-count { color: #888; font-size: 14px; }

/* 登录框 */
.login-box {
  max-width: 380px; margin: 12vh auto; background: #fff; border-radius: 28px;
  padding: 32px 26px; box-shadow: 0 16px 40px rgba(0,0,0,.15); text-align: center;
}
.login-box h1 { color: var(--pink-d); font-size: 28px; margin-bottom: 18px; }
.login-box input {
  width: 100%; padding: 14px; font-size: 18px; margin-bottom: 14px;
  border: 2px solid #eee; border-radius: 14px; outline: none;
}
.login-box input:focus { border-color: var(--pink); }
.login-msg { color: #e5484d; min-height: 22px; font-weight: 700; }
