/* 李老師的普通話說話站 */
:root {
  --cream: #fff8ef;
  --orange: #e8802a;
  --orange-deep: #c75f14;
  --amber: #ffb84d;
  --brown: #4a3222;
  --brown-soft: #7a5c44;
  --line: #f0dcbf;
  --green: #3f8f5f;
  --shadow: 0 10px 30px rgba(122, 92, 68, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #fff8ef 0%, #fdf1e2 100%);
  color: var(--brown);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 22px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--amber), var(--orange));
  color: #fff; font-size: 22px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(232,128,42,.35);
}
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: .5px; }
.topbar p { margin: 2px 0 0; font-size: 12.5px; color: var(--brown-soft); }

.wrap { max-width: 900px; margin: 0 auto; padding: 26px 18px 70px; }
.hidden { display: none !important; }

/* 按鈕 */
.btn {
  border: none; cursor: pointer; font-family: inherit;
  border-radius: 12px; padding: 11px 18px; font-size: 15px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  color: #fff; box-shadow: 0 6px 16px rgba(232,128,42,.32);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(232,128,42,.42); }
.btn-primary:disabled { background: #e5cfb4; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--brown-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: #fffdf8; border-color: var(--amber); }
.btn-lg { padding: 14px 30px; font-size: 17px; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* 首頁 */
.hero {
  background: #fff; border-radius: 22px; padding: 32px 30px;
  box-shadow: var(--shadow); border: 1px solid var(--line); text-align: center;
}
.hero-badge {
  display: inline-block; background: #ffeed6; color: var(--orange-deep);
  font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px;
  letter-spacing: 1px;
}
.hero h2 { font-size: 34px; margin: 14px 0 6px; letter-spacing: 2px; }
.hero-desc { max-width: 620px; margin: 0 auto 18px; line-height: 1.9; color: var(--brown-soft); font-size: 15.5px; }
.hero-list {
  list-style: none; padding: 0; margin: 0 auto 22px; max-width: 460px;
  text-align: left; color: var(--brown-soft); font-size: 14.5px;
}
.hero-list li { padding: 6px 0 6px 26px; position: relative; }
.hero-list li::before {
  content: ""; position: absolute; left: 6px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
}
.field { max-width: 380px; margin: 0 auto 18px; text-align: left; }
.field label { display: block; font-size: 13px; color: var(--brown-soft); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 15px;
  border: 1.5px solid var(--line); background: #fffdf8; font-family: inherit; color: var(--brown);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--orange); }
.tiny-note { font-size: 12.5px; color: #a2876c; margin: 16px 0 0; line-height: 1.7; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-top: 20px;
}
.mini-card {
  background: #fffdf8; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
}
.mini-card h3 { margin: 0 0 6px; font-size: 15px; color: var(--orange-deep); }
.mini-card p { margin: 0; font-size: 13.5px; color: var(--brown-soft); line-height: 1.7; }

/* 問答 */
.progress-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress-bar { flex: 1; height: 10px; background: #ffeed6; border-radius: 999px; overflow: hidden; }
#progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  transition: width .3s ease;
}
.progress-text { font-size: 13px; color: var(--brown-soft); min-width: 48px; text-align: right; }

.quiz-card, .speech-paper, .result-head {
  background: #fff; border-radius: 22px; padding: 28px 30px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.section-tag {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--orange-deep); background: #ffeed6; padding: 5px 12px; border-radius: 999px;
}
.quiz-card h2 { font-size: 25px; margin: 14px 0 8px; line-height: 1.6; }
.hint { color: var(--brown-soft); font-size: 14px; line-height: 1.8; margin: 0 0 18px; }

.options { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fffdf8; border: 1.8px solid var(--line); border-radius: 16px;
  padding: 15px 18px; font-size: 16.5px; font-family: inherit; color: var(--brown);
  cursor: pointer; transition: all .15s ease;
}
.opt:hover { border-color: var(--amber); background: #fffaf1; }
.opt.selected { border-color: var(--orange); background: #fff2e2; box-shadow: 0 4px 12px rgba(232,128,42,.18); }
.opt .box {
  width: 22px; height: 22px; flex: none; border-radius: 7px;
  border: 2px solid #dcc3a3; display: grid; place-items: center;
  font-size: 13px; color: transparent; background: #fff;
}
.opt.selected .box { background: var(--orange); border-color: var(--orange); color: #fff; }
.opt .sub { display: block; font-size: 12.5px; color: #a2876c; margin-top: 3px; }

.custom-wrap { margin-top: 14px; }
.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; }

/* 檢查答案 */
.review-list { display: grid; gap: 10px; margin-bottom: 8px; }
.review-item {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  background: #fffdf8; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
}
.review-item .rq { font-size: 13px; color: var(--brown-soft); }
.review-item .ra { font-size: 15.5px; margin-top: 3px; line-height: 1.6; }
.review-item .none { color: #b79b7d; font-style: italic; }

/* 講稿結果 */
.voice-select {
  max-width: 220px; padding: 7px 10px; border-radius: 10px; font-size: 13px;
  border: 1.5px solid var(--line); background: #fffdf8; color: var(--brown); font-family: inherit;
}
.voice-warn {
  background: #fff4e2; border: 1px dashed var(--amber); color: var(--orange-deep);
  padding: 12px 16px; border-radius: 12px; font-size: 13.5px; line-height: 1.9; margin: 0 0 14px;
}
.result-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.result-head h2 { font-size: 26px; margin: 12px 0 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.speed-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 18px; margin-bottom: 14px; font-size: 14px; color: var(--brown-soft);
}
.speed-row input[type=range] { flex: 1; min-width: 120px; accent-color: var(--orange); }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.gen-note {
  background: #fff4e2; border: 1px dashed var(--amber); color: var(--orange-deep);
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; line-height: 1.7; margin: 0 0 14px;
}

.speech-paper { line-height: 2.2; margin-bottom: 16px; }
.para-title {
  font-size: 14px; font-weight: 700; color: var(--orange-deep); letter-spacing: 2px;
  margin: 18px 0 6px; padding-left: 10px; border-left: 4px solid var(--amber);
}
.para-title:first-child { margin-top: 0; }
.sentence {
  font-size: 20px; padding: 6px 8px 6px 10px; border-radius: 10px;
  border-left: 3px solid transparent; margin-bottom: 2px; transition: background .2s ease;
}
.sentence:hover { background: #fffdf6; }
.sentence.active { background: #fff0dc; border-left-color: var(--orange); }
.ruby-wrap { white-space: normal; }
ruby { ruby-align: center; margin-right: 2px; }
rt { font-size: 11px; color: var(--green); font-weight: 500; letter-spacing: 0; }
.no-pinyin rt { display: none; }
.say-btn {
  border: none; background: #ffeed6; color: var(--orange-deep); cursor: pointer;
  font-size: 12px; padding: 4px 10px; border-radius: 999px; margin-left: 6px;
  font-family: inherit; vertical-align: 2px;
}
.say-btn:hover { background: #ffe0bd; }

.word-count { font-size: 13px; color: #a2876c; margin-top: 14px; text-align: right; }

.topbar-btns { display: flex; gap: 8px; }

/* 學生資料 */
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 520px; margin: 0 auto 6px; }
.two-fields .field { max-width: none; }
.student-hello { min-height: 20px; font-size: 14px; color: var(--orange-deep); margin: 6px 0 0; }

/* 課程目錄 */
.catalog-head { text-align: center; margin-bottom: 22px; }
.catalog-head h2 { font-size: 32px; margin: 12px 0 4px; letter-spacing: 3px; }
.catalog-head .hero-desc { margin: 0 auto; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 22px; }
.course-card {
  text-align: left; font-family: inherit; cursor: pointer; color: var(--brown);
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.course-card:hover { transform: translateY(-3px); border-color: var(--orange); box-shadow: 0 14px 30px rgba(122,92,68,.18); }
.course-soon { background: #fdf6ec; color: var(--brown-soft); cursor: not-allowed; box-shadow: none; }
.course-soon:hover { transform: none; border-color: var(--line); box-shadow: none; }
.cc-order { font-size: 12.5px; font-weight: 700; letter-spacing: 1.5px; color: var(--orange-deep); }
.course-soon .cc-order { color: #b79b7d; }
.cc-title { font-size: 21px; font-weight: 600; margin: 6px 0 8px; letter-spacing: 1px; }
.cc-desc { font-size: 13.5px; line-height: 1.8; color: var(--brown-soft); min-height: 44px; }
.cc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.cc-tag { font-size: 13px; padding: 5px 12px; border-radius: 999px; }
.cc-go { background: linear-gradient(135deg, var(--orange), var(--orange-deep)); color: #fff; }
.cc-wait { background: #ece2d5; color: #8d7355; }
.cc-done { font-size: 12px; color: var(--green); }

.back-btn { align-self: flex-start; margin-bottom: 8px; }
.t-course {
  display: inline-block; font-size: 11.5px; font-weight: 500; margin-left: 8px;
  background: #ffeed6; color: var(--orange-deep); padding: 2px 9px; border-radius: 999px;
}

/* 老師端 */
.teacher-tools { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.teacher-count { font-size: 13px; color: var(--brown-soft); }
.teacher-list { display: grid; gap: 10px; }
.teacher-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fffdf8; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px;
}
.teacher-item .teacher-check { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--orange); }
.teacher-info { flex: 1; min-width: 0; }
.t-name { font-size: 15.5px; font-weight: 600; }
.t-meta { font-size: 12.5px; color: var(--brown-soft); margin-top: 3px; }
.t-preview { font-size: 13px; color: #a2876c; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teacher-acts { display: flex; flex-direction: column; gap: 6px; }

.tips-box {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px 24px;
  box-shadow: var(--shadow);
}
.tips-box h3 { margin: 0 0 10px; font-size: 16px; color: var(--orange-deep); }
.tips-box ul { margin: 0; padding-left: 22px; color: var(--brown-soft); font-size: 14px; line-height: 2; }

/* 彈窗 */
.modal {
  position: fixed; inset: 0; background: rgba(74,50,34,.45);
  display: grid; place-items: center; z-index: 50; padding: 18px;
}
.modal-box {
  background: #fff; border-radius: 20px; padding: 26px 28px; width: min(460px, 100%);
  box-shadow: 0 20px 50px rgba(74,50,34,.3);
}
.modal-box h2 { margin: 0 0 8px; font-size: 21px; }
.modal-box .hint { margin-bottom: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.api-msg { font-size: 13px; margin: 12px 0 0; min-height: 18px; color: var(--green); }
.api-msg.error { color: #c0392b; }

/* 載入 */
.loading { position: fixed; inset: 0; background: rgba(255,248,239,.85); display: grid; place-items: center; z-index: 60; }
.loading-box { text-align: center; color: var(--brown-soft); }
.spinner {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%;
  border: 4px solid #ffeed6; border-top-color: var(--orange); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--brown); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: 14px; z-index: 70; box-shadow: 0 8px 20px rgba(0,0,0,.2);
}

@media (max-width: 600px) {
  .topbar h1 { font-size: 16px; }
  .hero { padding: 24px 20px; }
  .hero h2 { font-size: 28px; }
  .quiz-card, .speech-paper, .result-head { padding: 22px 18px; }
  .quiz-card h2 { font-size: 21px; }
  .sentence { font-size: 18px; }
  .result-actions .btn { padding: 9px 13px; font-size: 13.5px; }
  .quiz-nav { flex-wrap: wrap; }
}
