/* ============ 小朋友工作台 · 全局样式（卡通、平板优先） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --orange: #ff8c42;
  --orange-dark: #f0732a;
  --yellow: #ffd166;
  --blue: #4aa8ff;
  --blue-dark: #2f88e0;
  --green: #6bc46b;
  --red: #ff6b6b;
  --purple: #9b6bff;
  --ink: #4a3b2a;
  --card: #ffffff;
  --bg: #fff7ec;
  --radius: 20px;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: linear-gradient(180deg, #ffe9d2 0%, #fff7ec 30%, #eaf6ff 100%);
  min-height: 100vh;
  color: var(--ink);
  font-size: 17px;
}

.container { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }

/* 顶部 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.topbar h1 { font-size: 24px; color: var(--orange-dark); }
.topbar .kid { background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.06); }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(255, 140, 66, .12);
  border: 2px solid #fff3e6;
}

.card h2 { font-size: 17px; margin-bottom: 10px; color: var(--orange-dark); }

/* 赛车卡片 */
.race-card { background: linear-gradient(135deg, #ffd9b3, #fff3e0); }
.race-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.race-info .km-big { font-size: 30px; font-weight: 800; color: var(--orange-dark); }
.race-info .km-big small { font-size: 14px; font-weight: 400; }
.race-meta { font-size: 14px; color: #a08a6e; }

/* 赛道 */
.track-wrap { position: relative; height: 78px; margin: 14px 0 6px; }
.track-line {
  position: absolute; left: 0; right: 0; top: 36px; height: 14px;
  background: #e8d5bd; border-radius: 999px;
}
.track-progress {
  position: absolute; left: 0; top: 36px; height: 14px;
  background: linear-gradient(90deg, var(--yellow), var(--orange));
  border-radius: 999px; width: 0%;
  transition: width 1s ease;
}
/* 赛道节点标记 */
.track-node { position: absolute; top: 6px; transform: translateX(-50%); text-align: center; font-size: 13px; }
.track-node .node-flag { font-size: 22px; display: block; }
.track-node .node-km { color: #a08a6e; font-size: 11px; }
/* 赛车 */
.car {
  position: absolute; top: 8px; transform: translateX(-50%);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.25));
  z-index: 2;
  text-align: center;
  transition: left 1s ease;
}
.car .car-icon { font-size: 40px; display: block; line-height: 1; }
.car .car-dot { display: block; width: 14px; height: 14px; border-radius: 50%; margin: 3px auto 0; border: 1px solid rgba(0,0,0,.2); }
.car .car-dot.rainbow { background: conic-gradient(red, orange, yellow, green, blue, purple, red); }
.car.boost { animation: wobble .4s ease 2; }
@keyframes wobble { 0%,100%{transform:translateX(-50%) rotate(0)} 50%{transform:translateX(-50%) rotate(-6deg)} }

/* 任务列表 */
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 16px;
  background: #fff; border: 2px solid #f2e4d4;
  margin-bottom: 10px;
  transition: transform .1s;
}
.task-item:active { transform: scale(.98); }
.task-icon {
  width: 52px; height: 52px; flex: 0 0 52px;
  background: #fff3e6; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.task-body { flex: 1; }
.task-name { font-size: 16px; font-weight: 700; }
.task-km { font-size: 13px; color: #a08a6e; margin-top: 2px; }
.task-status { flex: 0 0 auto; }
.badge {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.badge.todo { background: var(--yellow); color: #7a5b1f; }
.badge.pending { background: #fff0d0; color: #9a6a00; }
.badge.approved { background: #d9f2d9; color: #2f7a2f; }
.badge.rejected { background: #ffd9d9; color: #b03a3a; }
.btn-checkin {
  background: var(--orange); color: #fff; border: none;
  padding: 8px 18px; border-radius: 999px; font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.btn-checkin:disabled { background: #e8d5bd; color: #b7a48a; }

/* 通用按钮 */
.btn {
  border: none; border-radius: 999px; cursor: pointer; font-weight: 700;
  padding: 10px 22px; font-size: 16px; color: #fff;
  background: var(--blue);
}
.btn.primary { background: var(--orange); }
.btn.green { background: var(--green); }
.btn.gray { background: #cbbda9; }
.btn:disabled { background: #e0d6c6; color: #b9ac97; }
.btn-lg { padding: 14px 28px; font-size: 18px; width: 100%; }
.btn-sm { padding: 7px 16px; font-size: 14px; }

/* 表单 */
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  border: 2px solid #eeddca; font-size: 16px; background: #fffdf8;
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--orange); }
label { display: block; font-size: 14px; color: #a08a6e; margin: 10px 0 6px; }

/* 弹窗 */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.overlay.show { display: flex; }
.dialog {
  background: #fff; border-radius: 24px; padding: 22px;
  width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto;
  text-align: center;
}
.dialog h3 { font-size: 20px; margin-bottom: 10px; color: var(--orange-dark); }

/* 加油卡抽卡 */
.gas-cards { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.gas-card {
  width: 92px; height: 130px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; cursor: pointer; color: #fff; font-weight: 800;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
  transition: transform .15s;
}
.gas-card:active { transform: scale(.94); }
.gas-card.flipped { background: #fff; border: 3px solid var(--yellow); font-size: 22px; }

/* 底部导航（孩子端） */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; background: #fff; border-top: 2px solid #f2e4d4;
  z-index: 20;
}
.tabs button {
  flex: 1; border: none; background: none; padding: 10px 0 12px;
  font-size: 13px; color: #a08a6e; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs button .ti { font-size: 22px; }
.tabs button.active { color: var(--orange-dark); font-weight: 700; }
.pad-bottom { padding-bottom: 90px; }

/* 徽章 / 车库 / 奖励券网格 */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.g-item {
  background: #fff; border: 2px solid #f2e4d4; border-radius: 16px;
  padding: 14px 8px; text-align: center;
}
.g-item .g-icon { font-size: 34px; display: block; margin-bottom: 6px; }
.g-item .g-name { font-size: 13px; font-weight: 700; }
.g-item .g-sub { font-size: 11px; color: #a08a6e; margin-top: 3px; }
.g-item.locked { opacity: .45; filter: grayscale(.8); }

/* 家长端 */
.parent-body { background: #f4f7fb; }
.panel h2 { font-size: 18px; color: var(--blue-dark); margin-bottom: 12px; }
.review-item {
  background: #fff; border-radius: 16px; padding: 14px;
  margin-bottom: 12px; border: 2px solid #e8eef6;
}
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-head .task { font-weight: 700; font-size: 16px; }
.review-head .km { background: #fff3e6; color: var(--orange-dark); padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.review-meta { font-size: 13px; color: #8a95a5; margin-bottom: 6px; }
.review-photo { max-width: 100%; border-radius: 12px; margin: 6px 0; max-height: 220px; }
.review-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.review-actions input { flex: 1; min-width: 140px; }
.chip { padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.chip.pending { background: #fff0d0; color: #9a6a00; }
.chip.approved { background: #d9f2d9; color: #2f7a2f; }
.chip.rejected { background: #ffd9d9; color: #b03a3a; }
.chip.rest { background: #e6e9ff; color: #5560b0; }

.stat-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat-box { flex: 1; background: #fff; border-radius: 16px; padding: 12px; text-align: center; border: 2px solid #e8eef6; }
.stat-box .v { font-size: 26px; font-weight: 800; color: var(--blue-dark); }
.stat-box .l { font-size: 12px; color: #8a95a5; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { padding: 8px 6px; border-bottom: 1px solid #edf1f6; text-align: center; }

.login-box { max-width: 360px; margin: 12vh auto 0; background: #fff; border-radius: 24px; padding: 30px 24px; box-shadow: 0 6px 20px rgba(0,0,0,.08); text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(60,50,35,.92); color: #fff; padding: 10px 22px;
  border-radius: 999px; font-size: 15px; z-index: 99; display: none;
  max-width: 86vw; text-align: center;
}
.toast.show { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 10px);} to { opacity: 1; transform: translate(-50%, 0);} }

.muted { color: #a08a6e; font-size: 13px; }
.section-title { font-size: 16px; font-weight: 800; margin: 18px 0 10px; color: var(--ink); }

/* 驾照状态条 */
.license-bar {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 700; margin-top: 4px;
  background: #d9f2d9; color: #2f7a2f;
}
.license-bar.warn { background: #fff0d0; color: #9a6a00; }
.license-bar.revoked { background: #ffd9d9; color: #b03a3a; }
.license-warn { color: #b03a3a !important; font-weight: 700; }

/* 家长端驾照 */
.lic-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.lic-log { font-size: 13px; color: #8a95a5; margin-top: 8px; max-height: 120px; overflow-y: auto; }

/* 时间→里程对照表（作业/阅读卡片） */
.task-kmtable {
  margin-top: 8px; background: #fff8ec; border: 1.5px dashed #f0c98a;
  border-radius: 12px; padding: 8px 10px;
}
.kt-title { font-size: 12px; font-weight: 700; color: #c08a2d; margin-bottom: 5px; }
.kt-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; line-height: 1.7; color: #6b5a3a; }
.kt-row b { color: #e07a1f; }
.kt-sub { border-top: 1px dashed #eeddbd; margin-top: 4px; padding-top: 4px; font-size: 12px; }
.kt-sub b { font-size: 12px; }

/* 计时方式选择（作业/阅读） */
.way-btn {
  padding: 16px; border-radius: 16px; border: 2px solid #f2e4d4;
  background: #fff; font-size: 17px; font-weight: 700; cursor: pointer;
  color: var(--ink);
}
.way-btn:active { transform: scale(.97); }
.way-btn .wb-icon { font-size: 26px; display: block; margin-bottom: 4px; }
.way-timer-note { background: #fff3e6; border-radius: 12px; padding: 10px; font-size: 15px; font-weight: 700; color: var(--orange-dark); }

/* 选赛车 */
.car-pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.car-pick-item { border: 2px solid #f2e4d4; border-radius: 16px; padding: 10px 6px; background: #fff; cursor: pointer; text-align: center; }
.car-pick-item.selected { border-color: var(--orange); background: #fff3e6; }
.car-pick-item .cp-icon { font-size: 32px; display: block; }
.car-pick-item .cp-name { font-size: 13px; font-weight: 700; margin-top: 4px; }
.color-row { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot.selected { border-color: #333; box-shadow: 0 0 0 2px #fff inset; }
.color-dot.locked { opacity: .3; cursor: not-allowed; }
.color-dot.rainbow-dot { background: conic-gradient(red, orange, yellow, green, blue, purple, red); }

/* 车库里的车 */
.car-show-item { display: flex; align-items: center; gap: 12px; padding: 10px; border: 2px solid #f2e4d4; border-radius: 14px; margin-bottom: 8px; background: #fff; }
.car-show-item .cs-icon { font-size: 34px; }
.car-show-item .cs-dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; margin-left: 4px; vertical-align: middle; }
.car-show-item .cs-dot.rainbow { background: conic-gradient(red, orange, yellow, green, blue, purple, red); }
.car-show-item .cs-name { font-weight: 700; font-size: 15px; }
