/* ============================================================
 * 学生端样式
 * 定位：友好、简洁、不低幼，五年级学生易读
 * ============================================================ */

body {
  background: linear-gradient(180deg, #f7f5f0 0%, var(--bg) 100%);
  min-height: 100vh;
}

/* ============================================================
 * 通用容器
 * ============================================================ */

.stu-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.stu-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: var(--space-6);
}

/* ============================================================
 * 登录页
 * ============================================================ */

.stu-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.stu-login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: var(--space-6);
  max-width: 420px;
  width: 100%;
}

.stu-login-header {
  margin-bottom: var(--space-5);
  text-align: center;
}
.stu-login-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.stu-login-header p {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

/* ============================================================
 * 答题页
 * ============================================================ */

.answer-header {
  margin-bottom: var(--space-5);
}
.answer-header .eyebrow {
  display: inline-block;
  padding: 4px 10px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.answer-header h1 {
  font-size: var(--fs-page-title);
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.answer-header .meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.lesson-toggle {
  margin: var(--space-4) 0 var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.lesson-toggle summary {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  cursor: pointer;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.lesson-toggle summary::-webkit-details-marker { display: none; }
.lesson-toggle summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--t-fast) var(--easing);
}
.lesson-toggle[open] summary::before {
  transform: rotate(90deg);
}
.lesson-toggle .lesson-body {
  padding: var(--space-4);
  white-space: pre-wrap;
  font-size: var(--fs-meta);
  line-height: var(--lh-loose);
  color: var(--text);
  background: var(--surface);
  max-height: 240px;
  overflow-y: auto;
}

.questions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.q-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  background: var(--surface);
  transition: border-color var(--t-fast) var(--easing);
}
.q-block:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.q-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.q-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-body);
  font-weight: 700;
}
.q-text {
  font-size: var(--fs-body-l);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--text);
  padding-top: 4px;
}
.q-block textarea {
  min-height: 120px;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
}

/* 提交栏 */
.submit-bar {
  position: sticky;
  bottom: 0;
  margin: var(--space-5) calc(-1 * var(--space-6)) calc(-1 * var(--space-6));
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.submit-tip {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.submit-tip strong { color: var(--text); font-variant-numeric: tabular-nums; }
.submit-btn {
  height: 48px;
  padding: 0 var(--space-6);
  font-size: var(--fs-body-l);
  font-weight: 600;
}

/* ============================================================
 * 已提交页
 * ============================================================ */

.done-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.done-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-7) var(--space-6);
  text-align: center;
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--line);
}

.done-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  margin: 0 auto var(--space-5);
}
.done-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--text);
}
.done-card p {
  font-size: var(--fs-body);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}
.done-card .hint {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

/* ============================================================
 * 移动端适配（手机 ≤ 640px / 平板 ≤ 880px）
 * ============================================================ */

/* iPad / 小桌面 */
@media (max-width: 880px) {
  .stu-shell { padding: var(--space-5) var(--space-4); }
  .stu-card  { padding: var(--space-5); }
}

/* 手机 */
@media (max-width: 640px) {
  .stu-shell { padding: var(--space-4) var(--space-3); }
  .stu-card {
    padding: var(--space-4);
    border-radius: var(--radius);
  }

  .answer-header h1 { font-size: 22px; }
  .answer-header .meta { font-size: var(--fs-caption); }

  .lesson-toggle .lesson-body { max-height: 180px; }

  .questions-list { gap: var(--space-4); }
  .q-block { padding: var(--space-4); }
  .q-text { font-size: var(--fs-body); }
  .q-num { width: 28px; height: 28px; font-size: 14px; }
  .q-block textarea { min-height: 110px; }

  /* 提交栏：保留 sticky，紧凑 padding */
  .submit-bar {
    margin: var(--space-4) calc(-1 * var(--space-4)) calc(-1 * var(--space-4));
    padding: var(--space-3) var(--space-4);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    /* 加 safe-area 兼容 iPhone 底部 */
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0));
  }
  .submit-tip { font-size: var(--fs-caption); }
  .submit-btn {
    height: 44px;
    padding: 0 var(--space-5);
    font-size: var(--fs-body);
  }

  /* 登录 */
  .stu-login { padding: var(--space-3); }
  .stu-login-card { padding: var(--space-5); }
  .stu-login-header h1 { font-size: 22px; }

  /* 已提交页 */
  .done-card { padding: var(--space-6) var(--space-4); }
  .done-icon { width: 72px; height: 72px; font-size: 40px; }
  .done-card h1 { font-size: 24px; }
}
