/* 花果山阅读打卡 - 公共样式（移动优先，温暖清新） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #3d3429;
  --sub: #8a7d6d;
  --orange: #f5a623;
  --green: #4caf7d;
  --blue: #4a90d9;
  --red: #e05d5d;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(61,52,41,.08);
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}
.container { max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.topbar h1 { font-size: 20px; }
.topbar .right { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--sub); }
.btn-link { background: none; border: none; color: var(--blue); font-size: 14px; cursor: pointer; padding: 4px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 { font-size: 17px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

/* 按钮 */
button { font-family: inherit; cursor: pointer; border: none; border-radius: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; font-size: 16px; font-weight: 600;
  color: #fff; background: var(--blue); border-radius: 12px;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-orange { background: var(--orange); }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-ghost { background: #f0ece3; color: var(--ink); font-weight: 500; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }

/* 输入框 */
.input {
  width: 100%; padding: 13px 14px; font-size: 16px; border: 1.5px solid #ddd6c8;
  border-radius: 12px; outline: none; background: #fff; color: var(--ink);
}
.input:focus { border-color: var(--orange); }

/* 学生大按钮 */
.student-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.student-btn {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700; color: var(--ink);
}
.student-btn .avatar { font-size: 40px; }
.student-btn small { font-size: 12px; color: var(--sub); font-weight: 400; }

/* 打卡卡片 */
.rec-card { position: relative; }
.rec-card h2 { gap: 6px; flex-wrap: wrap; white-space: nowrap; }
.rec-card .status-tag {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 6px; border-radius: 20px;
  flex-shrink: 0; white-space: nowrap;
}
.tag-none { background: #f0ece3; color: var(--sub); }
.tag-done { background: #e3f5ea; color: var(--green); }
.tag-part { background: #fff3d9; color: #c98a12; }
.tag-rec { background: #fde8e8; color: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.rec-timer { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; padding: 10px 0 4px; }
.rec-hint { text-align: center; color: var(--sub); font-size: 13px; margin-bottom: 12px; }
.rec-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rec-actions .btn { flex: 1; min-width: 120px; }
.rec-audio { width: 100%; margin-top: 12px; }
.rec-saved-info { text-align: center; font-size: 13px; color: var(--sub); margin-top: 8px; }
.score-info { display:flex; align-items:center; justify-content:center; gap:6px; text-align:center; margin-top:10px; color:#b36b00; font-size:14px; font-weight:600; }
.score-cell { white-space:nowrap; line-height:1.7; }
.date-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 38px; margin-bottom: 14px; padding: 8px 12px; border-radius: 11px;
  background: #edf5fc; color: var(--blue); font-size: 13px; font-weight: 700;
}
.date-bar.makeup { background: #fff0d7; color: #a86b00; }
.date-bar.view-only { background: #e9eff5; color: #536b82; }
.date-bar button { padding: 6px 10px; background: #fff; color: inherit; font-size: 12px; font-weight: 700; }

/* 登录 */
.login-logo { text-align: center; padding: 16px 0 8px; }
.login-logo h1 { font-size: 24px; margin-top: 8px; }
.login-logo p { color: var(--sub); font-size: 14px; margin-top: 4px; }
.login-form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.owner-link { text-align: center; margin-top: 16px; }
.owner-link button { background: none; border: none; color: var(--sub); font-size: 13px; text-decoration: underline; cursor: pointer; }
.hidden { display: none !important; }

/* 日历 */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.calendar .dow { text-align: center; font-size: 11px; color: var(--sub); padding: 4px 0; }
.calendar .day {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
  background: #f3efe6; color: var(--sub);
}
.calendar .day.full { background: var(--green); color: #fff; }
.calendar .day.half { background: #ffe9c4; color: #b97d13; }
.calendar .day.today { outline: 2.5px solid var(--orange); }
.calendar .day.selectable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.calendar .day.selectable:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(61,52,41,.16); }
.calendar .day.selectable:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; }
.calendar .day.selected {
  position: relative; z-index: 2;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4.5px var(--blue);
}
.calendar .day.selected.today { outline: none; }
.calendar .day.selected:hover,
.calendar .day.selected:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4.5px var(--blue);
}
.calendar .day.selected:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 6px;
}
.calendar .day .mini {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 2px; margin-top: 2px; line-height: 1;
}
.coin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%;
  box-sizing: border-box; border: 1px solid rgba(91, 61, 13, .22);
  color: #fff; font-size: 9px; line-height: 1; font-weight: 700;
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, .55),
              inset -1px -1px 2px rgba(60, 35, 0, .22),
              0 1px 1px rgba(0, 0, 0, .14);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.coin.gold { background: radial-gradient(circle at 35% 30%, #ffe89a, #f0b400 55%, #a67c00); }
.coin.silver { background: radial-gradient(circle at 35% 30%, #f2f5f8, #b9c2cc 55%, #7c8794); }
.coin.bronze { background: radial-gradient(circle at 35% 30%, #e8b48a, #c07c3a 55%, #8a5220); }
.calendar-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.calendar-heading h2 { margin-bottom: 0; }
.coin-stats {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
  color: var(--sub); font-size: 12px; white-space: nowrap;
}
.coin-stats .coin { width: 14px; height: 14px; flex-basis: 14px; font-size: 8px; }
.calendar-nav { display: flex; align-items: center; gap: 7px; color: var(--sub); font-size: 13px; white-space: nowrap; }
.calendar-nav button {
  width: 28px; height: 28px; border-radius: 8px; background: #f0ece3; color: var(--ink);
  font-size: 20px; line-height: 1;
}
.home-calendar { margin-top: 12px; }
.home-calendar .day { justify-content: flex-start; padding: 4px 2px 3px; gap: 1px; }
.home-calendar .day-number { font-size: 11px; line-height: 1.2; }
.day-icons { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: auto; }
.day-icons i { font-style: normal; font-size: 11px; line-height: 1.25; text-align: center; }
.day-icons i.unchecked { filter: grayscale(1); opacity: .16; }
.calendar-message { padding: 24px 0 12px; text-align: center; color: var(--sub); font-size: 13px; }

/* 首页最近动态 */
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recent-heading h2 { margin-bottom: 0; }
.recent-reset {
  padding: 0; border: none; background: none; color: var(--sub); font-size: 12px;
  text-decoration: underline; cursor: pointer;
}
.recent-list { display: flex; flex-direction: column; }
.recent-row {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; padding: 3px 0;
  font-size: 13px;
}
.recent-row span:first-child { color: var(--sub); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent-row span { white-space: nowrap; }
.recent-message { padding: 6px 0 2px; color: var(--sub); font-size: 13px; text-align: center; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #efe9dd; }
th { font-size: 12px; color: var(--sub); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #e3f5ea; color: var(--green); }
.badge.no { background: #f0ece3; color: var(--sub); }

/* 筛选条 */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-bar select, .filter-bar input { padding: 9px 10px; border: 1.5px solid #ddd6c8; border-radius: 10px; font-size: 14px; background: #fff; color: var(--ink); }
.filter-bar .grow { flex: 1; min-width: 130px; }

/* 统计条 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; text-align: center; }
.stat .num { font-size: 22px; font-weight: 800; }
.stat .lbl { font-size: 12px; color: var(--sub); }

/* 底部播放器 */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
  box-shadow: 0 -2px 14px rgba(0,0,0,.1); padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  display: none; z-index: 50;
}
.player audio { width: 100%; }
.player .player-title { font-size: 12px; color: var(--sub); margin-bottom: 4px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: rgba(40,34,26,.92); color: #fff; padding: 10px 20px; border-radius: 30px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 本地录音箱 */
.audio-box summary { font-size: 17px; font-weight: 700; cursor: pointer; }
.audio-box-note { color: var(--sub); font-size: 12px; margin: 8px 0; }
.audio-box-hint { color: #a34824; font-size: 13px; overflow-wrap: anywhere; }
.audio-box-hint:empty { display: none; }
#audioBoxList { color: var(--sub); font-size: 13px; }
.audio-box-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 0; border-bottom: 1px solid #efe9dd; }
.audio-box-row:last-child { border-bottom: 0; padding-bottom: 0; }
.audio-box-label { flex: 1 1 220px; overflow-wrap: anywhere; }
.audio-box-row .btn { min-height: 44px; }

/* 录音上传进度 */
.upload-progress { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0; }
.upload-progress .track { flex: 1; min-width: 0; height: 8px; overflow: hidden; border-radius: 999px; background: #f7e8d5; }
.upload-progress .bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffc56e, var(--orange)); transition: width .15s ease; }
.upload-progress .pct { flex: 0 0 3.5em; color: #a34824; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
