/*
  全站样式表。

  第一部分（到 “通用页面” 之前）是从早期原型 app/styles.css 原样搬来的水彩外观：
  整屏水彩背景、首页布局、可翻面的词卡。项目所有者已确认沿用这套外观。
  只做了三处必要改动：背景图路径；词卡背面的 .definition / .example 加上
  .card-back 前缀（避免和通用页面里同名的类互相影响）；Start Learning 与返回首页
  由按钮改为链接后补的两条规则。

  已确认的视觉规则：水彩可以整屏铺满，但正文、题目和按钮必须放在足够不透明的
  白色承载面上，不直接压在水彩上；目前只做浅色。
*/

:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  /* 标题字体：英文 Georgia，中文用系统自带的宋体类字体，不用下载 */
  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
  --paper: #f8fcf7;
  --aqua-pale: #e4f8f1;
  --aqua-soft: #bcebdc;
  --aqua: #65ceb9;
  --teal: #239f90;
  --forest: #174f43;
  --lemon: #f3df83;
  --mastery-not-studied: #d4ddd9;
  --mastery-learning: #82cfbd;
  --mastery-initial: #2fa08f;
  --mastery-consolidating: #efc35a;
  --mastery-mastered: #245f52;
  background: var(--paper);
  color: var(--forest);
}

* {
  box-sizing: border-box;
}

/*
  大屏幕上整页按比例放大（所有者 2026-11-29 定：电脑大屏上两边和下面留白太多）。
  就像浏览器的“放大”，只在宽屏上自动生效；1440 像素以下（手机、平板、笔记本）不变。
  倍数只在这里；脚本要用鼠标位置去摆东西时，用 js/page_zoom.js 量出现在的倍数再换算。
*/
:root {
  --page-zoom: 1;
}

@media (min-width: 1440px) {
  :root { --page-zoom: 1.12; }
}

@media (min-width: 1680px) {
  :root { --page-zoom: 1.25; }
}

@media (min-width: 1920px) {
  :root { --page-zoom: 1.4; }
}

@media (min-width: 2400px) {
  :root { --page-zoom: 1.6; }
}

html {
  zoom: var(--page-zoom);
}

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  min-width: 320px;
  min-height: calc(100vh / var(--page-zoom));
  min-height: calc(100dvh / var(--page-zoom));
  margin: 0;
  background: var(--paper);
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  content: "";
}

/*
  水彩背景固定为整个窗口的宽度（100vw，把滚动条那一条也算进去；除以 --page-zoom 是因为大屏放大时“一个窗口宽”也会跟着被放大）。
  否则页面一长出滚动条，背景会跟着变窄、平移一下，看起来像整个页面闪了一下。
*/
body::before {
  inset: 0 auto 0 0;
  width: calc(100vw / var(--page-zoom));
  background-image: url("../img/watercolor-wash-v5.jpg");
  background-position: center;
  background-size: cover;
  opacity: 0.56;
}

body::after {
  inset: 0;
  background: rgb(250 253 248 / 10%);
}

[hidden] {
  display: none !important;
}

.home-stage {
  position: relative;
  z-index: 1;
  min-height: calc(100vh / var(--page-zoom));
  min-height: calc(100dvh / var(--page-zoom));
  padding: clamp(16px, 2.5vw, 26px) clamp(16px, 4vw, 44px);
}

.home-shell {
  display: grid;
  width: min(100%, 1060px);
  margin: 0 auto;
  gap: clamp(10px, 1.25vw, 14px);
}

.site-header {
  display: flex;
  min-height: 40px;
  align-items: center;
  /* 可以比里面的东西窄：手机上让邮箱缩成省略号，而不是把整页撑宽 */
  min-width: 0;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgb(35 159 144 / 17%);
  padding-bottom: 8px;
}

.brand,
.utility-placeholders,
.user-control {
  display: flex;
  align-items: center;
}

/*
  首页左上角的标志：白色词卡 + 底部水彩（所有者 2026-11-21 定稿，无阴影）。
  图片由 brand/wordtide-mark.html 生成（运行 brand/render.sh），不要手改图片。
  直接放在水彩背景上，不垫底板：靠白卡本身和背景隔开。
*/
.brand-logo {
  display: block;
  width: 44px;
  height: 44px;
}

/*
  名字字标 VocaTide：所有者生成的浪 + 毛笔字（所有者 2026-11-28 定）。
  图片由 brand/wordmark/wordmark.html 生成（运行 sh brand/wordmark/render.sh），不要手改图片。
  放在 logo 右边，和 logo 卡片一样高（所有者 2026-11-28 定）；手机上两个一起缩小一点。
*/
/* 标志和名字不缩，窄了让右边的邮箱缩成省略号 */
.brand {
  flex-shrink: 0;
  gap: 10px;
}

.brand-wordmark {
  display: block;
  width: auto;
  height: 44px;
}

.bar-wordmark {
  display: block;
  width: auto;
  height: 40px;
}

@media (max-width: 600px) {
  .brand-logo,
  .brand-wordmark {
    height: 38px;
  }

  .brand-logo {
    width: 38px;
  }

  .brand {
    gap: 6px;
  }

  /* 手机上 “Sign out” 分成上下两行、居中，按钮窄一点，右边的按钮才能留在同一行（所有者 2026-11-28 定）。
     中文 “退出” 本来就短，keep-all 让它不被拆成两行。 */
  .sign-out-button {
    max-width: 4.6em;
    word-break: keep-all;
    padding: 4px 8px;
    border-radius: 14px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }
}

.utility-placeholders {
  min-width: 0;
  gap: 8px;
}

.utility-control {
  min-height: 32px;
  border: 1px solid rgb(35 159 144 / 18%);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgb(249 253 250 / 58%);
  color: #73958e;
  cursor: not-allowed;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  opacity: 0.68;
}

.user-control {
  gap: 7px;
  padding-left: 7px;
}

.user-avatar {
  width: 20px;
  height: 20px;
  border: 2px solid currentcolor;
  border-radius: 50%;
  background: rgb(228 248 241 / 68%);
}

.home-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow,
.section-label,
.preview-label,
.static-value {
  margin: 0;
}

.eyebrow {
  color: #4c7f76;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.home-header h1 {
  margin: 5px 0 0;
  color: var(--forest);
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.start-panel,
.placeholder-panel,
.placeholder-control {
  border: 1px solid rgb(35 159 144 / 22%);
  border-radius: 22px;
  background: rgb(252 255 253 / 80%);
  box-shadow:
    0 16px 36px rgb(23 93 79 / 9%),
    0 2px 8px rgb(23 93 79 / 6%);
}

.start-panel {
  display: grid;
  min-height: clamp(104px, 12vw, 120px);
  padding: clamp(16px, 2.5vw, 24px);
  place-items: center;
  row-gap: 14px; /* 按钮和 Today's Study 这行字之间留出空隙（所有者 2026-11-27 定） */
}

.start-panel .section-label {
  align-self: start;
  justify-self: start;
}

.section-label {
  color: #416f67;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-label {
  color: #83a39c;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start-button {
  min-width: min(100%, 260px);
  padding: 15px 30px;
  border: 1px solid rgb(20 122 108 / 20%);
  border-radius: 999px;
  background: var(--teal);
  box-shadow:
    0 14px 28px rgb(26 126 112 / 24%),
    0 3px 8px rgb(26 126 112 / 12%);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.start-button:focus-visible {
  outline: 3px solid var(--lemon);
  outline-offset: 4px;
}

.placeholder-panel {
  padding: 14px 16px;
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(10px, 1.5vw, 16px);
}

.progress-placeholder {
  min-height: 156px;
}

.progress-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: clamp(12px, 2vw, 24px);
  height: calc(100% - 18px);
  align-items: center;
}

.progress-summary {
  display: grid;
  gap: 18px;
}

.status-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 9px 14px;
  color: #678b83;
  font-size: 0.68rem;
  font-weight: 700;
}

.status-key span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.status-not-studied {
  background: var(--mastery-not-studied);
}

.status-learning {
  background: var(--mastery-learning);
}

.status-initial {
  background: var(--mastery-initial);
}

.status-consolidating {
  background: var(--mastery-consolidating);
}

.status-mastered {
  background: var(--mastery-mastered);
}

.progress-track {
  display: flex;
  overflow: hidden;
  height: 12px;
  border: 1px solid rgb(35 159 144 / 17%);
  border-radius: 999px;
  background: #f5f8f6;
}

.progress-segment {
  display: block;
  width: var(--segment-share);
  height: 100%;
}

.progress-pie {
  width: 104px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--mastery-not-studied) 0 36%,
    var(--mastery-learning) 36% 60%,
    var(--mastery-initial) 60% 78%,
    var(--mastery-consolidating) 78% 90%,
    var(--mastery-mastered) 90% 100%
  );
  box-shadow: none;
}

.overview-side {
  display: grid;
  grid-template-rows: auto minmax(70px, 1fr);
  gap: clamp(10px, 1.5vw, 14px);
}

.streak-panel,
.badges-placeholder {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.streak-copy {
  display: grid;
  gap: 5px;
  flex: 0 0 auto;
}

.static-value {
  color: #789a93;
  font-size: 0.72rem;
  font-weight: 750;
}

/* Current 和 Total：小字下面一个小圆，里面是天数；两个并排，和那 5 天的格子分开放。 */
.streak-counts {
  display: flex;
  gap: 14px;
  margin: 0;
}

.streak-counts div {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.streak-counts dt {
  color: #6f938b;
  font-size: 0.6rem;
  font-weight: 700;
}

.streak-counts dd {
  display: grid;
  min-width: 26px;
  height: 26px;
  box-sizing: border-box;
  place-items: center;
  margin: 0;
  border-radius: 999px;
  padding: 0 7px;
  background: radial-gradient(circle at 35% 28%, #f6fffb, #d3f1e7 78%);
  box-shadow: 0 2px 6px rgb(23 93 79 / 10%);
  color: #2b6b5f;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

/* 打卡按钮（所有者 2026-11-30 定）：天数下面一个绿色小圆角按钮，打过了变灰、不能点。 */
.checkin-button {
  justify-self: start;
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  padding: 4px 12px;
  background: var(--teal);
  box-shadow: 0 3px 8px rgb(23 93 79 / 18%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.checkin-button:hover {
  background: #1b8578;
}

.checkin-button.is-done {
  background: #e3efea;
  box-shadow: none;
  color: #5f857c;
  cursor: default;
}

/* 打卡那一行：左箭头、5 个日期格子（今天居中）、右箭头。 */
.checkin-row {
  display: flex;
  min-width: 0;
  flex: 0 1 300px;
  align-items: center;
  gap: 8px;
}

.checkin-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgb(228 248 241 / 85%);
  color: #58ab9d;
  cursor: pointer;
  touch-action: manipulation; /* 连着快点不会变成放大页面 */
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease;
}

/* 三角形的三个角都是圆的：用同色的粗圆边把尖角包住。 */
.checkin-arrow svg {
  width: 15px;
  fill: currentcolor;
  stroke: currentcolor;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.checkin-days {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

/* 只有今天是绿色，其他日子都是浅黄色（所有者 2026-11-24 定）。 */
.checkin-day {
  position: relative;
  display: grid;
  height: 46px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  box-sizing: border-box;
  border: 0;
  border-radius: 15px;
  padding: 0;
  background: #fdf6da;
  color: #746b3a;
  font: inherit;
  line-height: 1;
}

.checkin-month {
  font-size: 0.56rem;
  font-weight: 700;
}

.checkin-date {
  font-size: 0.92rem;
  font-weight: 800;
}

.checkin-day.is-checked {
  background: #f9ebb0;
}

.checkin-day.is-future {
  background: #fdf8e2;
  color: #948a56;
}

/* 今天：还没打卡是浅绿，可以点；打过卡变成网站按钮那种绿。 */
.checkin-day.is-today {
  background: linear-gradient(160deg, #d6f4ea, #a9e2d2);
  box-shadow: 0 4px 12px rgb(35 159 144 / 20%);
  color: var(--forest);
}

.checkin-day.is-today.is-checked {
  background: linear-gradient(160deg, #5fb3a5, #459a8c);
  color: white;
}

button.checkin-day {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: filter 150ms ease;
}

/* 打过卡的格子右上角有一个圆圆的勾（不只靠颜色），样子在下面和动效里的小勾写在一起。 */
.checkin-day.is-checked::after {
  content: "";
}

/* 打卡的动效（js/checkin_effect.js） */
.streak-panel {
  position: relative;
}

.checkin-fx {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.checkin-fx > span {
  position: absolute;
}

.checkin-drop {
  width: 15px;
  height: 15px;
  border-radius: 50% 50% 50% 50% / 62% 62% 42% 42%;
  background: radial-gradient(circle at 36% 34%, #f2fffb 0 12%, #8fded0 34%, #2f9f90 100%);
  opacity: 0;
}

.checkin-bead,
.checkin-flyer {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #f2fffb 0 14%, #7fd6c6 45%, #2f9f90 100%);
  opacity: 0;
}

.checkin-bead {
  width: 6px;
  height: 6px;
}

.checkin-flyer {
  width: 10px;
  height: 10px;
}

.checkin-ring {
  width: 104px;
  height: 104px;
  border: 2.5px solid #4fb9a8;
  border-radius: 50%;
  box-sizing: border-box;
  opacity: 0;
}

.checkin-cover,
.checkin-wave {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  border-radius: inherit;
}

.checkin-cover {
  background: linear-gradient(160deg, #d6f4ea, #a9e2d2);
  color: var(--forest);
}

.checkin-wave {
  background: linear-gradient(160deg, #5fb3a5, #459a8c);
  color: white;
  clip-path: circle(0);
}

/* 动效里的小勾和平时的一样，只是换成会动的一个 */
.checkin-day.is-filling::after {
  visibility: hidden;
}

.checkin-tick,
.checkin-day.is-checked::after {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fffefa
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.8 8.4l2.2 2.1 4.2-4.6' fill='none' stroke='%233d9486' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 100% no-repeat;
  box-shadow: 0 1px 4px rgb(23 93 79 / 18%);
}

.count-roll {
  display: grid;
  overflow: hidden;
  height: 1.5em;
  align-items: center;
}

.count-roll > span {
  grid-area: 1 / 1;
  text-align: center;
}

.checkin-arrow:focus-visible,
button.checkin-day:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

@media (hover: hover) {
  .checkin-arrow:hover {
    background: #cdeee3;
  }

  button.checkin-day:hover {
    filter: brightness(0.97);
  }
}

/* 这一块窄的时候（手机，或两栏并排的平板）：标题和天数一行，日期格子单独一行。 */
.overview-side {
  container-type: inline-size;
}

@container (max-width: 410px) {
  .streak-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .streak-copy {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .streak-copy .section-label {
    margin-right: auto;
  }

  .checkin-row {
    flex: 0 0 auto;
  }
}

/* 首页 Badges：五个圈圈。前四个摆用户选的徽章，没摆的是一个浅浅的凹圈；最右边的 … 进展示柜。 */
.badge-row {
  display: grid;
  grid-template-columns: repeat(5, clamp(38px, 4.2vw, 48px));
  gap: clamp(8px, 1.1vw, 14px);
}

.badge-row img {
  display: block;
  width: 100%;
  height: auto;
}

.badge-hole,
.badge-more {
  display: block;
  aspect-ratio: 1;
  border-radius: 50%;
}

.badge-hole,
.slot-hole {
  background: radial-gradient(circle at 50% 38%, #e9f5ef, #f6fbf7 72%);
  box-shadow:
    inset 0 2px 6px rgb(23 79 67 / 17%),
    inset 0 -2px 4px rgb(255 255 255 / 90%);
}

.badge-more {
  display: grid;
  place-items: center;
  background: #e2f5ee;
  box-shadow: 0 2px 8px rgb(23 93 79 / 13%);
  transition: background-color 150ms ease;
}

.badge-more:hover {
  background: #cfeee2;
}

.badge-more:focus-visible {
  outline: 3px solid rgb(35 159 144 / 55%);
  outline-offset: 2px;
}

/* 三个小圆点，画出来的，不用文字的省略号（字体不同会偏上偏下）。 */
.badge-more span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: -9px 0 var(--teal), 9px 0 var(--teal);
}

@container (max-width: 360px) {
  .badge-row {
    grid-template-columns: repeat(5, minmax(0, 38px));
    flex: 0 1 222px;
    gap: 7px;
    min-width: 0;
  }
}

/* 展示柜 */
.showcase-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.showcase-count {
  margin: 0;
  color: rgb(23 79 67 / 66%);
  font-size: 0.95rem;
  font-weight: 750;
}

.showcase {
  display: grid;
  width: min(100%, 760px);
  gap: 16px;
}

/* 上方四个圈圈：往下翻柜子时一直停在顶上，随时能往里摆。 */
.showcase-slots {
  position: sticky;
  z-index: 5;
  top: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  border: 1px solid rgb(35 159 144 / 22%);
  border-radius: 26px;
  padding: 16px 14px 12px;
  background: rgb(252 255 253 / 95%);
  box-shadow:
    0 14px 30px rgb(23 93 79 / 13%),
    0 2px 8px rgb(23 93 79 / 7%);
  list-style: none;
}

.showcase-slots li {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.slot-place {
  position: relative;
  display: block;
  width: clamp(58px, 15vw, 92px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.slot-hole {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.slot-name {
  overflow: hidden;
  width: 100%;
  min-height: 1.25em;
  font-family: var(--serif);
  font-size: clamp(0.7rem, 2.4vw, 0.9rem);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

/* 拿下来：右上角一个小圆叉，点它放回柜子 */
.slot-remove {
  position: absolute;
  z-index: 2;
  top: -5px;
  left: calc(50% + clamp(29px, 7.5vw, 46px) - 17px);
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 2px 6px rgb(23 79 67 / 24%);
  color: #1f7d70;
  cursor: pointer;
}

/* 手指点得到：看着是小圆，能点的地方大一圈 */
.slot-remove::after {
  position: absolute;
  inset: -8px;
  content: "";
}

.slot-remove svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2.4;
}

.badge-grab img,
.slot-place img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.is-picked img {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 0 0 4px rgb(255 217 90 / 85%),
    0 8px 18px rgb(160 110 10 / 34%);
}

/* 手里拿着一枚时，四个圈圈亮起来，表示可以放 */
.showcase.is-placing .slot-place::before {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgb(101 206 185 / 75%);
  content: "";
  animation: slot-ready 1.3s ease-in-out infinite;
}

.showcase .slot-place.is-over::before {
  box-shadow: 0 0 0 5px var(--teal);
  animation: none;
}

@keyframes slot-ready {
  50% { opacity: 0.35; }
}

.slot-place:focus-visible,
.badge-grab:focus-visible,
.slot-remove:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

/* 柜子：白色柜框、细金边、玻璃后背，一层层的隔板 */
.cabinet {
  --columns: 4;
  border: 2px solid #e6b93f;
  border-radius: 30px;
  padding: 13px;
  background: linear-gradient(160deg, #ffffff, #eef7f2);
  box-shadow:
    0 18px 40px rgb(23 93 79 / 15%),
    inset 0 0 0 1px rgb(255 255 255 / 80%);
}

.cabinet-glass {
  overflow: hidden;
  border-radius: 19px;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 42%) 0 16%, rgb(255 255 255 / 0%) 16.2% 22%, rgb(255 255 255 / 26%) 22.2% 25%, rgb(255 255 255 / 0%) 25.2%),
    linear-gradient(#dff1ea, #eef8f2);
  box-shadow: inset 0 3px 12px rgb(23 79 67 / 15%);
}

.cabinet.is-over .cabinet-glass {
  box-shadow: inset 0 0 0 4px rgb(101 206 185 / 85%);
}

.shelf-name {
  margin: 0;
  padding: 18px 20px 0;
  color: #2c6a5c;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.shelf > li {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  text-align: center;
}

.badge-stand {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 16px 8px 13px;
}

/* 隔板：每行第一枚画一整条，行里不满也是通长的 */
.shelf > li:nth-child(4n + 1) .badge-stand::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 400%;
  height: 16px;
  border-top: 2px solid #edc95c;
  background: linear-gradient(#ffffff, #f2faf6 45%, #bfe0d2);
  box-shadow: 0 8px 13px rgb(23 79 67 / 20%);
  content: "";
}

.badge-grab,
.badge-still {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 122px);
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: none;
  filter: drop-shadow(0 5px 5px rgb(23 79 67 / 22%));
}

.badge-grab {
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

.badge-still img {
  display: block;
  width: 100%;
  height: auto;
}

.badge-label {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 4px;
  padding: 16px 8px 18px;
}

.badge-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.04rem;
  font-weight: 600;
}

.is-locked .badge-name {
  color: rgb(23 79 67 / 74%);
}

.badge-condition {
  margin: 0;
  color: rgb(23 79 67 / 84%);
  font-size: 0.79rem;
  line-height: 1.4;
}

.badge-earned,
.badge-progress-text {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.badge-earned {
  color: #1f7d70;
}

.badge-progress {
  display: grid;
  width: min(100%, 116px);
  gap: 3px;
}

.badge-track {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: rgb(35 159 144 / 18%);
}

.badge-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #3db39f;
}

.showcase-error {
  margin: -6px 0 0;
  border-radius: 14px;
  padding: 10px 16px;
  background: #fff3d6;
  color: #6b4a06;
  font-size: 0.9rem;
  font-weight: 700;
}

.is-dragging img {
  opacity: 0.35;
}

.badge-ghost {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  width: 96px;
  border-radius: 50%;
  filter: drop-shadow(0 12px 14px rgb(23 79 67 / 34%));
  pointer-events: none;
}

@media (max-width: 560px) {
  .cabinet {
    --columns: 2;
    padding: 9px;
  }

  .slot-name {
    min-height: 2.5em; /* 名字一行两行都一样高，摆上去时下面不跳 */
  }

  .slot-remove {
    width: 21px;
    height: 21px;
  }

  .shelf > li:nth-child(4n + 1) .badge-stand::after {
    content: none;
  }

  .shelf > li:nth-child(2n + 1) .badge-stand::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 16px;
    border-top: 2px solid #edc95c;
    background: linear-gradient(#ffffff, #f2faf6 45%, #bfe0d2);
    box-shadow: 0 8px 13px rgb(23 79 67 / 20%);
    content: "";
  }
}

@media (prefers-reduced-motion: reduce) {
  .showcase.is-placing .slot-place::before {
    animation: none;
  }
}

.home-grid {
  display: grid;
  gap: clamp(12px, 2vw, 20px);
}

.home-grid-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-column {
  display: grid;
  grid-template-rows: minmax(0, auto) minmax(58px, auto);
  gap: clamp(10px, 1.5vw, 14px);
}

.placeholder-control {
  color: #668a83;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.placeholder-control:disabled {
  cursor: not-allowed;
  filter: saturate(0.72);
  opacity: 0.64;
}

.deck-placeholder {
  min-width: 126px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgb(23 93 79 / 7%);
}

.placeholder-tile {
  min-height: 58px;
  padding: 18px 20px;
  text-align: center;
}

.task-placeholder,
.quiz-placeholder {
  min-height: 126px;
}

.plan-preview {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  color: #668a83;
  font-size: 0.76rem;
  font-weight: 700;
}

.plan-preview div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.plan-preview dt,
.plan-preview dd {
  margin: 0;
}

.plan-preview dd {
  color: #789a93;
  font-variant-numeric: tabular-nums;
}

.quiz-placeholder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 9px;
}

.quiz-option {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 12px;
  box-shadow: none;
  text-align: center;
}

.quiz-heading {
  grid-column: 1 / -1;
  align-self: center;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (hover: hover) {
  .start-button:hover {
    background: #1b8e80;
    box-shadow:
      0 16px 30px rgb(26 126 112 / 27%),
      0 4px 10px rgb(26 126 112 / 13%);
    transform: translateY(-2px);
  }
}

.card-stage {
  position: relative;
  z-index: 1;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  min-height: calc(100vh / var(--page-zoom));
  min-height: calc(100dvh / var(--page-zoom));
  align-items: center;
  gap: clamp(10px, 2vw, 18px);
  padding: clamp(16px, 3vw, 28px) 20px clamp(20px, 4vw, 36px);
}

.back-home-button {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  min-height: 42px;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  border: 1px solid rgb(35 159 144 / 24%);
  border-radius: 999px;
  padding: 9px 15px 9px 11px;
  background: rgb(251 255 252 / 86%);
  box-shadow:
    0 8px 20px rgb(23 93 79 / 10%),
    0 2px 6px rgb(23 93 79 / 6%);
  color: var(--teal);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.back-home-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.back-home-button:focus-visible {
  outline: 3px solid var(--lemon);
  outline-offset: 4px;
}

@media (hover: hover) {
  .back-home-button:hover {
    background: #fffdf4;
    box-shadow:
      0 10px 24px rgb(23 93 79 / 14%),
      0 2px 6px rgb(23 93 79 / 7%);
    color: var(--forest);
    transform: translateY(-2px);
  }
}

.study-shell {
  display: grid;
  flex: 1 1 auto;
  justify-items: center;
  align-content: center;
  gap: clamp(18px, 3.2vw, 26px);
}

.vocab-card {
  width: min(76vw, 404px);
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  border-radius: clamp(20px, 4vw, 26px);
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  perspective: 1200px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.vocab-card:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 6px;
}

.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  box-shadow:
    0 30px 64px rgb(14 72 60 / 22%),
    0 8px 22px rgb(14 72 60 / 14%),
    0 0 0 1px rgb(255 255 255 / 76%);
  transform-origin: center;
  transform-style: preserve-3d;
  transition: box-shadow 210ms ease;
  will-change: transform;
}

.vocab-card.is-turning .card-inner {
  box-shadow: 0 10px 22px rgb(14 72 60 / 16%);
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border: 2px solid rgb(31 143 128 / 30%);
  border-radius: inherit;
}

.card-face[aria-hidden="true"] {
  display: none;
}

.card-front {
  position: absolute;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 7vw, 56px);
  background: #fafffc;
  color: var(--forest);
}

.mastery-corner-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(42px, 7vw, 50px);
  aspect-ratio: 1;
  background: var(--mastery-not-studied);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* 小角的颜色跟着这个词的掌握级别走，与首页进度图用同一套颜色。 */
.mastery-corner-preview[data-level="learning"] {
  background: var(--mastery-learning);
}

.mastery-corner-preview[data-level="initial"] {
  background: var(--mastery-initial);
}

.mastery-corner-preview[data-level="consolidating"] {
  background: var(--mastery-consolidating);
}

.mastery-corner-preview[data-level="mastered"] {
  background: var(--mastery-mastered);
}

.front-word {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.card-back {
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 4vw, 32px);
  background: #fcfffd;
}

.back-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.back-word {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.part-of-speech {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--aqua-pale);
  color: #247b70;
  font-size: clamp(0.72rem, 2.2vw, 0.84rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-back .definition {
  margin-top: clamp(14px, 2.5vw, 20px);
  color: var(--forest);
  font-size: clamp(1.02rem, 2.2vw, 1.18rem);
  font-weight: 600;
  line-height: 1.38;
}

/* 中文界面：释义和例句下面的中文，比英文小、比英文淡。 */
.in-chinese {
  display: block;
  margin-top: 3px;
  color: #6b8f86;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  font-size: 0.82em;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.divider {
  flex: 0 0 3px;
  width: 56px;
  height: 3px;
  min-height: 3px;
  margin: clamp(10px, 1.8vw, 14px) 0 0;
  border-radius: 999px;
  background: var(--lemon);
}

.card-back .example {
  display: grid;
  gap: clamp(8px, 1.6vw, 11px);
  max-width: 36ch;
  margin-top: clamp(15px, 2.4vw, 20px);
  color: #527970;
  font-family: var(--serif);
  font-size: clamp(0.92rem, 2vw, 1rem);
  font-style: italic;
  line-height: 1.45;
}

.example-line {
  display: block;
}

.example-target {
  color: var(--forest);
  font-weight: 700;
  text-decoration-line: underline;
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.16em;
}

.card-navigation {
  display: flex;
  gap: 18px;
}

.nav-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 1px solid rgb(35 159 144 / 24%);
  border-radius: 50%;
  background: rgb(251 255 252 / 90%);
  box-shadow:
    0 8px 20px rgb(23 93 79 / 12%),
    0 2px 6px rgb(23 93 79 / 7%);
  color: var(--teal);
  cursor: pointer;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    opacity 150ms ease,
    transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
}

.nav-button:disabled {
  border-color: rgb(46 139 126 / 32%);
  background: rgb(238 248 244 / 88%);
  box-shadow: 0 3px 10px rgb(23 93 79 / 7%);
  color: #5f9f94;
  cursor: default;
  opacity: 0.64;
}

@media (hover: hover) {
  .nav-button:not(:disabled):hover {
    border-color: rgb(224 194 73 / 54%);
    background: #fffdf4;
    box-shadow:
      0 10px 24px rgb(23 93 79 / 15%),
      0 2px 6px rgb(23 93 79 / 8%);
    color: var(--forest);
    transform: translateY(-2px);
  }
}

@media (max-width: 700px) {
  .overview-band,
  .home-grid-actions {
    grid-template-columns: 1fr;
  }

  .progress-placeholder {
    min-height: 166px;
  }

  .overview-side {
    grid-template-rows: minmax(72px, auto) 72px;
  }

  .action-column {
    grid-template-rows: auto;
  }
}

@media (max-width: 480px) {
  .home-stage {
    padding: 14px 14px 22px;
  }

  .site-header {
    gap: 10px;
  }

  .utility-placeholders {
    gap: 5px;
  }

  .utility-control {
    padding: 5px 9px;
    font-size: 0.62rem;
  }

  .home-header {
    align-items: center;
    gap: 12px;
  }

  .home-header h1 {
    font-size: 2.05rem;
  }

  .deck-placeholder {
    min-width: 92px;
    min-height: 40px;
    padding: 8px 12px;
  }

  .start-panel {
    min-height: 112px;
    padding: 16px;
  }

  .progress-content {
    grid-template-columns: minmax(0, 1fr) 90px;
    gap: 12px;
  }

  .progress-pie {
    width: 88px;
  }

  .status-key {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    font-size: 0.62rem;
  }

  .status-key span {
    gap: 5px;
  }

  .status-dot {
    width: 8px;
    height: 8px;
  }

  .streak-panel,
  .badges-placeholder {
    padding: 12px 14px;
  }

  .badges-placeholder {
    padding-block: 10px;
  }

  .task-placeholder,
  .quiz-placeholder {
    min-height: 122px;
  }

  .placeholder-tile {
    min-height: 58px;
    padding: 15px 16px;
  }

  .vocab-card {
    width: min(78vw, 306px);
    aspect-ratio: 4 / 5;
  }

  .back-home-button {
    min-height: 40px;
    padding: 8px 13px 8px 9px;
    font-size: 0.7rem;
  }

  .nav-button {
    width: 46px;
    height: 46px;
  }
}

@media (orientation: landscape) and (min-width: 700px) {
  .study-shell {
    grid-template-columns: 48px auto 48px;
    grid-template-rows: auto;
    column-gap: clamp(18px, 3vw, 30px);
    row-gap: 0;
    align-items: center;
  }

  .vocab-card {
    grid-column: 2;
    grid-row: 1;
  }

  .card-navigation {
    z-index: 2;
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    justify-content: space-between;
    pointer-events: none;
  }

  .card-navigation .nav-button {
    pointer-events: auto;
  }
}

@media (orientation: landscape) {
  .card-back {
    padding: clamp(26px, 4vh, 34px) clamp(24px, 3vw, 28px);
  }

  .back-word {
    font-size: clamp(1.9rem, 4vw, 2.4rem);
  }

  .card-back .definition {
    margin-top: clamp(12px, 1.8vw, 16px);
    font-size: clamp(0.98rem, 1.8vw, 1.08rem);
  }

  .card-back .example {
    width: 100%;
    max-width: none;
    gap: clamp(7px, 1.2vw, 9px);
    font-size: clamp(0.88rem, 1.6vw, 0.94rem);
    line-height: 1.42;
  }
}

@media (orientation: landscape) and (min-width: 700px) and (max-height: 500px) {
  .card-stage {
    gap: 8px;
    padding: 8px 20px 12px;
  }
}

/* 原型里这两个是 <button>；网站里它们是跳转链接，补上链接需要的样式。 */
a.start-button,
a.back-home-button,
a.utility-control {
  text-decoration: none;
}

a.start-button {
  display: inline-block;
  text-align: center;
}

/* 顶栏右侧的账号区：原型里是不可点的占位，这里登录/退出真的可用。 */
.utility-control.is-live {
  color: #3f7d73;
  cursor: pointer;
  opacity: 1;
}

.utility-form {
  display: inline;
  margin: 0;
}

.account-email {
  overflow: hidden;
  min-width: 0;
  max-width: 22ch;
  color: #4c7f76;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 首页与词卡页里的一次性提示、空词库提示：同样坐在白色承载面上。 */
.stage-notice {
  position: relative;
  z-index: 1;
  width: min(100%, 1060px);
  margin: 0 auto;
  border: 1px solid rgb(35 159 144 / 22%);
  border-radius: 16px;
  padding: 12px 16px;
  background: rgb(252 255 253 / 94%);
  color: var(--forest);
  font-size: 0.9rem;
}

.stage-notice p {
  margin: 0;
}

.stage-notice ul {
  margin: 6px 0 0;
  padding-left: 1.1rem;
}

.card-counter {
  margin: 0;
  color: #4c7f76;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

/* 没登录时词卡页上的提示：只能看前 25 个词，登录看全部（所有者 2026-11-29 定）。放在白色半透明底上，不直接压在水彩上。 */
.deck-limit {
  max-width: 34rem;
  margin: 14px auto 0;
  border-radius: 14px;
  padding: 10px 16px;
  background: rgb(255 255 255 / 80%);
  color: var(--forest);
  font-size: 0.86rem;
  line-height: 1.5;
  text-align: center;
}

.deck-limit a {
  color: #0f6f63;
  font-weight: 700;
}

/* ==========================================================================
   通用页面（登录、注册、测验作答与结果、学习记录、旧的逐张词卡页）
   原型没有设计过这些页面。这里只做一件事：让它们坐在一块白色承载面上，
   用同一套颜色，结构和文字与原来完全一样。规则全部限定在 .page 之内，
   不会影响上面的首页和词卡。
   ========================================================================== */

.page {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 46rem);
  margin: clamp(16px, 4vw, 40px) auto;
  border: 1px solid rgb(35 159 144 / 22%);
  border-radius: 22px;
  padding: 1.5rem clamp(1.1rem, 4vw, 2rem) 2rem;
  /* 和首页面板同一个雾面底（半透明，不是纯白），同一套阴影。 */
  background: rgb(252 255 253 / 80%);
  box-shadow:
    0 16px 36px rgb(23 93 79 / 9%),
    0 2px 8px rgb(23 93 79 / 6%);
  color: var(--forest);
  font-size: 16px;
  line-height: 1.6;
}

.page header.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid rgb(35 159 144 / 17%);
  padding-bottom: 0.75rem;
}

.page header.bar > a {
  color: var(--forest);
  font-family: var(--serif);
  font-weight: 700;
  text-decoration: none;
}

/* 白色面板顶栏里的标志用带淡阴影的版本：白卡放在白底上，靠阴影分开（所有者 2026-11-21 定）。 */
.page header.bar > a.bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bar-logo {
  display: block;
  width: 40px;
  height: 40px;
}

.page header.bar .who { color: #4c6f68; font-size: 0.875rem; }
.page h1 {
  margin: 0 0 1rem;
  color: var(--forest);
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.page h2 { margin: 2rem 0 0.5rem; font-size: 1.125rem; font-weight: 700; }
.page h3 { margin: 1.25rem 0 0.375rem; font-size: 1rem; font-weight: 700; }
.page p { margin: 0 0 0.875rem; }
.page a { color: #0f6f63; }
.page .quiet { color: #4c6f68; font-size: 0.875rem; }
.page .quieter { color: #5d7f78; font-size: 0.8125rem; }
.page ul.plain { margin: 0; padding: 0; list-style: none; }
.page ul.plain > li { margin: 0 0 0.5rem; }

.page form.inline { display: inline; }
/* 表单标签用首页小标题（Progress、Streak 那一类）同样的字。 */
.page label {
  display: block;
  margin: 0 0 0.35rem;
  color: #416f67;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}
.page input[type="email"],
.page input[type="password"] {
  width: 100%;
  max-width: 22rem;
  border: 1px solid #7fa59d;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: #fff;
  color: inherit;
  font: inherit;
}
.page select {
  border: 1px solid #7fa59d;
  border-radius: 10px;
  padding: 0.3rem 0.4rem;
  background: #fff;
  font: inherit;
}
.page button {
  border: 1px solid rgb(20 122 108 / 30%);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.page button.secondary { background: #fff; color: #17604f; }
.page button:focus-visible,
.page select:focus-visible,
.page input:focus-visible,
.page a:focus-visible,
.page [tabindex]:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.page .field { margin: 0 0 1rem; }
.page .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1.75rem 0 0;
}

.page .notice {
  margin: 0 0 1.5rem;
  border-left: 3px solid #7fa59d;
  border-radius: 0 10px 10px 0;
  padding: 0.75rem 0.9rem;
  background: #f1f8f5;
}
.page .notice.warning { border-left-color: #b98a1c; }
.page .notice.confirm { border-left-color: var(--teal); }
.page .notice p:last-child { margin-bottom: 0; }

.page .card { padding: 1.25rem 0 0; }
.page .card .headword {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.page .card .pos { margin: 0.125rem 0 1rem; color: #4c6f68; font-style: italic; }
.page .card .definition { margin: 0 0 1rem; font-size: 1.0625rem; }
.page .card .example {
  margin: 0 0 1rem;
  border-left: 3px solid var(--lemon);
  padding-left: 0.9rem;
  color: #35584f;
}

.page .question { border-top: 1px solid rgb(35 159 144 / 17%); padding: 1.5rem 0; }
.page .question .meta { margin: 0 0 0.5rem; color: #4c6f68; font-size: 0.8125rem; }
.page .question .prompt { margin: 0 0 0.875rem; font-size: 1.0625rem; }
.page .choice { margin: 0 0 0.375rem; }
.page .choice label {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: normal;
}
.page .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 0.5rem; }
.page .row .row-label { min-width: 12rem; }
.page .chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
.page .chip { border: 1px solid #7fa59d; border-radius: 999px; padding: 0.25rem 0.7rem; background: #f1f8f5; }
.page .state { color: #4c6f68; font-size: 0.8125rem; }

.page table.record { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.page table.record th,
.page table.record td {
  border-bottom: 1px solid rgb(35 159 144 / 17%);
  padding: 0.5rem 0.75rem 0.5rem 0;
  text-align: left;
  vertical-align: top;
}
.page table.record th { font-weight: 700; }


/* 首页进度：图例里每个级别后面的真实词数。 */
.status-count {
  color: var(--forest);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   词卡页新增的部分（原型没有）：顶栏、顺序切换、概览、首字母分组、一词多义。
   全部沿用原型已有的颜色、圆角、阴影和字体，不引入新的视觉元素。
   ========================================================================== */

/* 首页的 Deck 现在是可点的链接（进入全部词卡的概览）。 */
a.deck-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #3f7d73;
  text-decoration: none;
}

.stage-bar {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-bar .back-home-button {
  align-self: auto;
}

.order-toggle {
  padding: 9px 15px 9px 12px;
}

.order-control {
  position: relative;
}

.order-caret {
  width: 15px;
  height: 15px;
}

/* 点 Order 按钮后在它下面展开的小列表；当前选中的那项有底色和实心圆点。 */
.order-menu {
  position: absolute;
  z-index: 4;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 172px;
  gap: 4px;
  border: 1px solid rgb(35 159 144 / 24%);
  border-radius: 18px;
  padding: 8px;
  background: #fcfffd;
  box-shadow:
    0 16px 36px rgb(23 93 79 / 14%),
    0 2px 8px rgb(23 93 79 / 8%);
}

.order-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
}

.order-option::before {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgb(35 159 144 / 45%);
  border-radius: 50%;
  content: "";
}

.order-option[aria-checked="true"] {
  background: var(--aqua-pale);
}

.order-option[aria-checked="true"]::before {
  border-color: var(--teal);
  background: radial-gradient(circle, var(--teal) 0 42%, transparent 48%);
}

.order-option:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

@media (hover: hover) {
  .order-option[aria-checked="false"]:hover {
    background: #fffdf4;
  }
}

.card-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  align-items: center;
  gap: clamp(10px, 2vw, 18px);
}

/* 右下角的圆形按钮：在单张词卡和概览之间切换。 */
.overview-toggle {
  position: fixed;
  z-index: 3;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  width: 52px;
  height: 52px;
}

.overview-toggle[aria-pressed="true"] {
  border-color: rgb(20 122 108 / 30%);
  background: var(--teal);
  color: white;
}

/* ---- 概览 ---- */

/*
  概览在自己的区域里上下滚动，整个页面本身不滚动。
  这样从单张词卡切到概览时，页面不会长出滚动条：背景、顶上的两个按钮都纹丝不动，
  不会有“整页跳一下”的感觉。
*/
.card-stage[data-view="grid"] {
  height: calc(100vh / var(--page-zoom));
  height: calc(100dvh / var(--page-zoom));
}

.grid-view {
  display: grid;
  flex: 1 1 auto;
  width: calc(100% + 40px);
  min-height: 0;
  align-content: start;
  gap: clamp(12px, 2vw, 18px);
  margin-inline: -20px;
  padding: 16px max(20px, calc((100% - 1060px) / 2)) 96px;
  overflow-y: auto;
  /* 滚动时，词卡在顶部按钮下方柔和地淡出，而不是被一刀切断。 */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
}

.letter-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border: 1px solid rgb(35 159 144 / 22%);
  border-radius: 22px;
  padding: 12px 14px;
  background: rgb(252 255 253 / 80%);
  box-shadow:
    0 16px 36px rgb(23 93 79 / 9%),
    0 2px 8px rgb(23 93 79 / 6%);
}

.letter-chip {
  min-width: 38px;
  min-height: 34px;
  border: 1px solid rgb(35 159 144 / 24%);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgb(251 255 252 / 90%);
  color: var(--teal);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.letter-chip.is-active {
  border-color: rgb(20 122 108 / 30%);
  background: var(--teal);
  color: white;
}

.letter-chip:focus-visible,
.deck-tile:focus-visible,
.order-toggle:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 12px;
}

.deck-group-heading {
  display: flex;
  grid-column: 1 / -1;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin: 8px 0 0;
  border: 1px solid rgb(35 159 144 / 30%);
  border-radius: 11px 14px 10px 15px;
  background: rgb(228 248 241 / 92%);
  color: var(--teal);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
}

/* 概览里的每一张小卡：和大词卡正面同一种白底、描边、衬线字。 */
.deck-tile {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgb(31 143 128 / 30%);
  border-radius: 18px;
  padding: 12px 10px;
  background: #fafffc;
  box-shadow:
    0 8px 20px rgb(14 72 60 / 10%),
    0 2px 6px rgb(14 72 60 / 6%);
  color: var(--forest);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-align: center;
  transition:
    box-shadow 150ms ease,
    transform 150ms ease;
}

@media (hover: hover) {
  .deck-tile:hover,
  .letter-chip:not(.is-active):hover {
    background: #fffdf4;
    transform: translateY(-2px);
  }
}

/* ---- 词卡背面的释义区 ---- */

.sense-area {
  display: flex;
  flex-direction: column;
}

/* 一词多义：每个意思前面一个圆点，意思下面跟着它自己的例句。 */
.card-back.has-senses .sense-area {
  gap: clamp(9px, 1.6vw, 13px);
  margin-top: clamp(12px, 2vw, 16px);
}

.card-back.has-senses .sense {
  position: relative;
  display: block;
  padding-left: 1.05em;
}

.card-back.has-senses .sense::before {
  position: absolute;
  top: 0.48em;
  left: 0;
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: var(--teal);
  content: "";
}

.card-back.has-senses .definition {
  display: block;
  margin-top: 0;
  font-size: clamp(0.92rem, 1.8vw, 1rem);
  line-height: 1.32;
}

.card-back.has-senses .example {
  margin-top: 4px;
  font-size: clamp(0.84rem, 1.6vw, 0.9rem);
  line-height: 1.36;
}

.card-back.has-senses .back-word {
  font-size: clamp(1.7rem, 4vw, 2.1rem);
}

@media (orientation: landscape) {
  .card-back.has-senses {
    padding-block: clamp(16px, 2.6vh, 22px);
  }
}

/* ==========================================================================
   选择题练习页（原型没有）。一块和首页面板同样雾面的大卡片，
   沿用原型已有的颜色、圆角、阴影和字体：题干用衬线字，其余用统一的无衬线字。
   ========================================================================== */

/* 首页 Quiz 里已经能点的题型。 */
a.quiz-option-live {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3f7d73;
  text-decoration: none;
}

.quiz-stage {
  overflow: visible;
}

.quiz-card {
  width: min(100%, 680px);
  margin: auto 0;
  border: 1px solid rgb(35 159 144 / 22%);
  border-radius: 26px;
  padding: clamp(18px, 3.5vw, 30px);
  background: rgb(252 255 253 / 88%);
  box-shadow:
    0 16px 36px rgb(23 93 79 / 9%),
    0 2px 8px rgb(23 93 79 / 6%);
  color: var(--forest);
}

.quiz-instruction {
  margin: 14px 0 0;
  color: #527970;
  font-size: 0.86rem;
  line-height: 1.45;
}

.quiz-prompt {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.12rem, 2.6vw, 1.32rem);
  line-height: 1.5;
}

.quiz-choices {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.quiz-choice {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 12px;
  border: 2px solid rgb(31 143 128 / 26%);
  border-radius: 16px;
  padding: 10px 14px;
  background: #fafffc;
  color: var(--forest);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.quiz-choice-letter {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--aqua-pale);
  color: #247b70;
  font-size: 0.8rem;
  font-weight: 800;
}

.quiz-choice-text {
  flex: 1 1 auto;
}

.quiz-choice-mark {
  flex: 0 0 auto;
  color: #416f67;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quiz-choice:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.quiz-choice:disabled {
  cursor: default;
}

.quiz-choice:disabled:not(.is-answer):not(.is-wrong) {
  opacity: 0.6;
}

/* 选中但还没提交 */
.quiz-choice.is-selected {
  border-color: var(--teal);
  background: var(--aqua-pale);
  box-shadow: 0 0 0 2px rgb(35 159 144 / 25%);
}

.quiz-choice.is-answer {
  border-color: var(--teal);
  background: var(--aqua-pale);
}

.quiz-choice.is-answer .quiz-choice-letter {
  background: var(--teal);
  color: white;
}

.quiz-choice.is-wrong {
  border-color: #c9952a;
  background: #fff8e1;
}

.quiz-choice.is-wrong .quiz-choice-letter {
  background: var(--lemon);
  color: #6b4e08;
}

@media (hover: hover) {
  .quiz-choice:not(:disabled, .is-selected):hover {
    border-color: rgb(224 194 73 / 70%);
    background: #fffdf4;
    transform: translateY(-1px);
  }
}

.quiz-feedback {
  margin-top: 20px;
  border-top: 1px solid rgb(35 159 144 / 17%);
  padding-top: 16px;
}

.quiz-verdict {
  margin: 0;
  color: #8a6510;
  font-family: var(--serif);
  font-size: 1.3rem;
}

.quiz-verdict.is-correct {
  color: #167a6c;
}

.quiz-rationale {
  margin: 6px 0 0;
  line-height: 1.5;
}

.quiz-word {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
}

.quiz-word-head {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.quiz-definitions {
  margin: 6px 0 0;
  padding-left: 1.1rem;
  color: #35584f;
  line-height: 1.45;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.quiz-next {
  min-width: 180px;
}

.quiz-summary {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.quiz-score {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 9vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.quiz-summary .back-home-button {
  align-self: auto;
  text-decoration: none;
}

/* ==========================================================================
   学习模式（/ui/learn）
   词卡本身沿用上面的样式；这里只有卡片下方的提示和两个按钮，以及一轮结束后的小结。
   提示和按钮都放在自己的雾面底上，不直接压在水彩上。
   ========================================================================== */

.learn-stage[data-view="summary"] {
  overflow: visible;
}

/* 卡片、下面的提示或按钮、进度三样挨在一起，作为一组上下居中。 */
.learn-stage .card-view {
  justify-content: center;
}

.learn-stage .study-shell {
  flex: 0 0 auto;
}

.learn-actions {
  display: grid;
  width: min(100%, 440px);
  min-height: 56px;
  flex: 0 0 auto;
  place-items: center;
}

.learn-hint {
  margin: 0;
  border: 1px solid rgb(35 159 144 / 20%);
  border-radius: 999px;
  padding: 9px 18px;
  background: rgb(252 255 253 / 80%);
  color: #416f67;
  font-size: 0.86rem;
  font-weight: 700;
}

.learn-buttons {
  display: flex;
  width: 100%;
  gap: 12px;
}

.learn-choice {
  min-height: 52px;
  flex: 1 1 0;
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.learn-know {
  border: 1px solid rgb(20 122 108 / 20%);
  background: var(--teal);
  box-shadow:
    0 10px 22px rgb(26 126 112 / 22%),
    0 3px 8px rgb(26 126 112 / 12%);
  color: white;
}

.learn-again {
  border: 2px solid rgb(31 143 128 / 34%);
  background: rgb(251 255 252 / 94%);
  box-shadow: 0 6px 16px rgb(23 93 79 / 10%);
  color: var(--forest);
}

.learn-choice:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

@media (hover: hover) {
  .learn-choice:hover {
    transform: translateY(-1px);
  }
}

.learn-subheading {
  margin: 20px 0 0;
  color: #527970;
  font-size: 0.86rem;
  font-weight: 800;
}

.learn-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.learn-words li {
  border: 1px solid rgb(31 143 128 / 30%);
  border-radius: 999px;
  padding: 6px 14px;
  background: #fafffc;
  font-family: var(--serif);
  font-size: 1rem;
}

.learn-summary .back-home-button {
  align-self: auto;
  text-decoration: none;
}

/* ==========================================================================
   首页：额外复习（Review）和考前冲刺（Cram Session）入口、每日计划的进度，以及好几天没学习时的提醒。
   ========================================================================== */

a.review-tile,
a.cram-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #3f7d73;
  text-decoration: none;
}

/* 提醒要显眼：整条放在页面最上方，黄色底、深色字，右边一个直接去复习的按钮。 */
.review-reminder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  border: 2px solid #d9b83a;
  border-radius: 20px;
  padding: 16px 20px;
  background: #fff6cf;
  box-shadow:
    0 12px 28px rgb(140 108 12 / 16%),
    0 2px 8px rgb(140 108 12 / 10%);
  color: #4a3a08;
}

.review-reminder-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.review-reminder-text {
  margin: 4px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.review-reminder-button {
  min-width: 0;
  flex: 0 0 auto;
  padding: 12px 24px;
  font-size: 1rem;
  text-decoration: none;
}

.plan-preview.is-live dd {
  color: var(--forest);
}

.today-results {
  margin: 18px 0 6px;
  font-size: 0.9rem;
}

/* 词卡轮右上角：这是每日计划的第几步，或“额外复习”。 */
.learn-step {
  margin: 0;
  border: 1px solid rgb(35 159 144 / 20%);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgb(252 255 253 / 86%);
  color: #416f67;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* 下一步的按钮在“过关”记录还没存好时先不让点。 */
#learn-next.is-waiting {
  opacity: 0.55;
  pointer-events: none;
}

/* 只有一句话的小结（每日计划的复习做完时）。 */
.learn-done-message {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.25;
}

/* ==========================================================================
   报告：一次测验的报告（quiz_report.html）和总报告 My Report（report.html）。
   沿用测验卡片的雾面底和颜色；对错除了颜色还有文字。
   ========================================================================== */

.report-stage {
  overflow: visible;
}

.report-stage .stage-bar {
  width: min(100%, 760px);
}

.report-card,
.report-section,
.report-title-card {
  width: min(100%, 760px);
  margin: 0;
}

.report-title-card {
  border-radius: 22px;
  padding: 14px 22px;
  background: rgb(252 255 253 / 80%);
}

.report-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 500;
}

.report-done {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 1.3rem;
}

.report-list {
  display: grid;
  width: min(100%, 760px);
  gap: 12px;
}

.report-section {
  display: grid;
  gap: 10px;
}

.report-section-head {
  border-radius: 999px;
  padding: 8px 18px;
  background: rgb(252 255 253 / 80%);
  justify-self: start;
}

.report-question {
  border: 1px solid rgb(35 159 144 / 22%);
  border-left: 6px solid var(--teal);
  border-radius: 20px;
  padding: 16px 20px;
  background: rgb(252 255 253 / 92%);
  color: var(--forest);
}

.report-question.is-wrong {
  border-left-color: #d9b83a;
}

.report-question.is-skipped {
  border-left-color: #b9c9c4;
}

.report-question-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-question-number {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--aqua-pale);
  font-size: 0.8rem;
  font-weight: 800;
}

.report-verdict {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #167a6c;
}

.report-question.is-wrong .report-verdict {
  color: #7a5a06;
}

.report-question.is-skipped .report-verdict {
  color: #6c8a84;
}

.report-when {
  margin-left: auto;
  color: #6c8a84;
  font-size: 0.8rem;
}

.report-question .quiz-prompt {
  margin-top: 10px;
  font-size: 1.08rem;
}

.report-choices {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.report-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgb(31 143 128 / 20%);
  border-radius: 12px;
  padding: 6px 10px;
  background: #fafffc;
  font-size: 0.95rem;
  font-weight: 600;
}

.report-choice.is-answer {
  border-color: var(--teal);
  background: var(--aqua-pale);
}

.report-choice.is-answer .quiz-choice-letter {
  background: var(--teal);
  color: white;
}

.report-choice.is-wrong {
  border-color: #c9952a;
  background: #fff8e1;
}

.report-choice.is-wrong .quiz-choice-letter {
  background: var(--lemon);
  color: #6b4e08;
}

.report-question .quiz-rationale {
  margin-top: 12px;
}

.report-question a.quiz-word-head {
  color: var(--forest);
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.report-stats > div {
  display: grid;
  gap: 2px;
}

.report-stat {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  line-height: 1.1;
}

.report-stat-label {
  color: #527970;
  font-size: 0.82rem;
}

.report-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.86rem;
}

.report-levels li,
.report-table td {
  align-items: center;
}

.report-levels .status-dot,
.report-table .status-dot {
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.report-days {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.report-day {
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 0.72rem;
  text-align: center;
}

.report-day-value {
  min-height: 1.2em;
  color: #416f67;
  font-weight: 800;
}

.report-bar-track {
  position: relative;
  display: block;
  width: 100%;
  max-width: 28px;
  height: 110px;
  border-radius: 8px;
  background: rgb(35 159 144 / 8%);
  overflow: hidden;
}

.report-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 8px;
  background: var(--teal);
}

.report-day-count {
  color: #527970;
  font-weight: 700;
}

.report-day-label {
  color: #6c8a84;
  line-height: 1.2;
}

.report-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.report-table th {
  border-bottom: 1px solid rgb(35 159 144 / 25%);
  padding: 6px 8px;
  color: #527970;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.report-table td {
  border-bottom: 1px solid rgb(35 159 144 / 10%);
  padding: 8px;
}

.report-table a,
.report-sort a {
  color: #1f7d70;
  font-weight: 700;
}

.report-sort {
  color: #527970;
  font-size: 0.82rem;
}

.report-sort a,
.report-sort strong {
  margin-left: 8px;
}

a.panel-link {
  color: #1f7d70;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 560px) {
  .report-stats {
    grid-template-columns: 1fr;
  }

  .report-days {
    gap: 2px;
  }

  .report-day-label,
  .report-day-value {
    font-size: 0.6rem;
  }

  .report-table {
    font-size: 0.82rem;
  }
}

/* 总报告里“最近做错的题”：每道题先收起来，只显示词、你选的和正确答案，点开看整题。 */
.report-mistakes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.report-mistake > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  border: 1px solid rgb(201 149 42 / 45%);
  border-radius: 14px;
  padding: 10px 14px;
  background: #fffaf0;
  cursor: pointer;
  list-style: none;
}

.report-mistake > summary::-webkit-details-marker {
  display: none;
}

.report-mistake > summary::before {
  content: "+";
  color: #8a6510;
  font-weight: 800;
}

.report-mistake[open] > summary::before {
  content: "\2212";
}

.report-mistake[open] > summary {
  margin-bottom: 8px;
}

.report-mistake-word {
  font-family: var(--serif);
  font-size: 1.1rem;
}

.report-mistake-answers {
  color: #527970;
  font-size: 0.88rem;
}


/* My Report 入口做成小按钮的样子，一眼能看出可以点。 */
a.panel-link {
  border: 1px solid rgb(35 159 144 / 35%);
  border-radius: 999px;
  padding: 5px 12px;
  background: #fafffc;
  white-space: nowrap;
}

/* ---- 窄屏与宽屏的排版修正（2026-11-21 在 360 / 390 / 768 / 1024 / 1280 / 1920 宽度下逐页检查后补的） ---- */

/* 选项右边的 “Your answer · Correct” 太长时换到下一行，不把选项撑出卡片。 */
.report-choice,
.quiz-choice {
  flex-wrap: wrap;
}

.report-choice .quiz-choice-text,
.quiz-choice .quiz-choice-text {
  min-width: 0;
  flex: 1 1 8em;
}

.quiz-choice-mark {
  margin-left: auto;
  text-align: right;
}

/* 14 天的柱子：屏幕太窄放不下时，在自己的框里左右滑，不撑宽整页。 */
.report-days-scroll {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}


.report-day {
  min-width: 0;
}

@media (max-width: 420px) {
  .account-email {
    max-width: 12ch;
  }
}

/* 手机上表格改成一行一张小卡片：第一格（词或日期）单独一行，其余几格带小标题排在下面。 */
@media (max-width: 600px) {
  .report-table thead {
    display: none;
  }

  .report-table,
  .report-table tbody {
    display: block;
  }

  .report-table tr {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    border-bottom: 1px solid rgb(35 159 144 / 12%);
    padding: 8px 2px;
  }

  .report-table td {
    border: 0;
    padding: 0;
  }

  .report-table td:first-child {
    flex: 1 0 100%;
    font-weight: 700;
  }

  .report-table td[data-label]:not(:first-child):not([data-label=""])::before {
    content: attr(data-label) ": ";
    color: #6c8a84;
    font-size: 0.75rem;
  }

  .report-sort {
    width: 100%;
  }

  .report-card .panel-heading {
    flex-wrap: wrap;
  }
}

/* 首页图例：“Not started 331”这类在格子里放不下时允许换行，不挤出格子。 */
.status-key span {
  flex-wrap: wrap;
  white-space: normal;
}

.status-key .status-count {
  white-space: nowrap;
}

/* 手机上 14 天的柱子太挤：只显示最近 7 天。 */
@media (max-width: 420px) {
  .report-day:nth-child(-n + 7) {
    display: none;
  }

  .report-days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .report-days-note-wide {
    display: none;
  }
}

@media (min-width: 421px) {
  .report-days-note-narrow {
    display: none;
  }
}

/* 首页 Progress：进度条右端上方的总词数，小字、淡色。 */
.progress-bar-block {
  display: grid;
  gap: 4px;
}

.progress-total {
  margin: 0;
  justify-self: end;
  color: rgb(65 111 103 / 62%);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* 总报告“正确率走势”折线图（js/report_trend.js 画）：点按或悬停时上方弹出小气泡。 */
.trend-chart {
  position: relative;
  margin-top: 12px;
}

.trend-svg {
  display: block;
  max-width: 100%;
  overflow: visible;
  touch-action: pan-y;
  cursor: crosshair;
}

.trend-svg:focus {
  outline: none;
}

.trend-svg:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
  border-radius: 6px;
}

.trend-grid {
  stroke: rgb(35 159 144 / 22%);
  stroke-width: 1;
}

.trend-grid.is-faint {
  stroke: rgb(35 159 144 / 10%);
}

.trend-axis {
  fill: #6c8a84;
  font-size: 11px;
}

.trend-area {
  fill: rgb(35 159 144 / 10%);
}

.trend-line {
  fill: none;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-dot {
  fill: var(--teal);
}

.trend-guide {
  stroke: rgb(23 79 67 / 30%);
  stroke-dasharray: 3 3;
}

.trend-marker {
  fill: var(--teal);
  stroke: #fff;
  stroke-width: 2.5;
}

.trend-tip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 1px;
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--forest);
  box-shadow: 0 6px 16px rgb(23 79 67 / 22%);
  color: #fff;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.trend-tip[hidden] {
  display: none;
}

.trend-tip::after {
  position: absolute;
  top: 100%;
  left: var(--arrow-x, 50%);
  border: 6px solid transparent;
  border-top-color: var(--forest);
  content: "";
  transform: translateX(-50%);
}

.trend-tip.is-below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--forest);
}

.trend-tip-value {
  font-size: 1.05rem;
}

.trend-tip-detail {
  color: rgb(255 255 255 / 80%);
  font-size: 0.72rem;
}

/* 单次测验报告最底下的回首页按钮，和上面的题目隔开一点。 */
.report-bottom-bar {
  margin: 8px 0 4px;
}

/* 折线图的放大缩小按钮（− / + / All），放在说明文字右边；窄屏时换到说明下面。 */
.trend-heading-row {
  align-items: flex-start;
  margin-top: 8px;
}

.trend-tools[hidden] {
  display: none;
}

.trend-heading-row .quiz-instruction {
  margin: 0;
}

.trend-tools {
  display: flex;
  flex: none;
  gap: 6px;
}

.trend-tool {
  min-width: 36px;
  height: 32px;
  border: 1px solid rgb(35 159 144 / 35%);
  border-radius: 999px;
  padding: 0 10px;
  background: #fafffc;
  color: #1f7d70;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.trend-tool-all {
  font-size: 0.8rem;
}

.trend-tool:hover:not(:disabled) {
  background: var(--aqua-pale);
}

.trend-tool:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.trend-tool:disabled {
  opacity: 0.4;
  cursor: default;
}

.trend-chart.is-dragging .trend-svg {
  cursor: grabbing;
}

@media (max-width: 600px) {
  .trend-heading-row {
    flex-wrap: wrap;
  }

  .trend-tools {
    margin-left: auto;
  }
}

/* ---- 配对题（Matching，js/matching.js）----
   每张卡在固定的格子里（第 1 列词、第 2 列释义，每行一样高，高度由脚本按最长那条释义定好）。
   选中变绿；配对了泛起淡绿柔光再慢慢淡出；配错闪黄、轻轻震一下回原位；新卡在空格里浮现。 */
.match-board {
  --slot-h: 64px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  grid-auto-rows: var(--slot-h);
  gap: 10px 14px;
  margin-top: 16px;
}

.match-board[hidden] {
  display: none;
}

.match-slot {
  position: relative;
  min-width: 0;
}

.match-slot-word {
  grid-column: 1;
}

.match-slot-def {
  grid-column: 2;
}

.match-tile {
  width: 100%;
  height: 100%;
  border: 2px solid rgb(31 143 128 / 26%);
  border-radius: 14px;
  padding: 10px 14px;
  background: #fafffc;
  color: var(--forest);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: left;
  touch-action: manipulation; /* 连着快点两下不会变成放大页面 */
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

/* 量格子高度时用的临时卡：按内容自己的高度。 */
.match-tile.is-probe {
  position: absolute;
  height: auto;
  visibility: hidden;
}

.match-word {
  display: grid;
  gap: 2px;
  align-content: center;
}

.match-word-text {
  font-family: var(--serif);
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.match-pos {
  color: #6c8a84;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 手机上点过的卡会一直停在“悬停”的样子，看着像还选中，所以只给真有鼠标的设备。 */
@media (hover: hover) {
  .match-tile:hover {
    border-color: rgb(31 143 128 / 55%);
  }
}

.match-tile:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.match-tile.is-checking,
.match-tile.is-selected {
  border-color: var(--teal);
  background: var(--aqua-pale);
  box-shadow: 0 0 0 2px rgb(35 159 144 / 25%);
}

.match-tile.is-arriving {
  animation: match-arrive 450ms ease both;
}

.match-tile.is-wrong {
  animation:
    match-flash-yellow 480ms ease,
    match-shake 420ms ease;
}

.match-tile.is-matched {
  pointer-events: none;
  animation: match-glow-out 750ms ease forwards;
}

@keyframes match-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes match-flash-yellow {
  0%, 60% { border-color: #d9ab45; background: #fff3d1; }
  100% { border-color: rgb(31 143 128 / 26%); background: #fafffc; }
}

/* 淡绿柔光：边框和底色变成很浅的绿，外面一圈柔和的光晕，然后整张慢慢淡出。 */
@keyframes match-glow-out {
  0% { border-color: var(--teal); background: var(--aqua-pale); box-shadow: 0 0 0 0 rgb(101 206 185 / 0%); opacity: 1; }
  35% { border-color: rgb(101 206 185 / 70%); background: #e9faf3; box-shadow: 0 0 18px 4px rgb(101 206 185 / 45%); opacity: 1; }
  100% { border-color: rgb(101 206 185 / 30%); background: #f3fcf8; box-shadow: 0 0 24px 8px rgb(101 206 185 / 0%); opacity: 0; }
}

@keyframes match-arrive {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .match-tile.is-wrong {
    animation: match-flash-yellow 480ms ease;
  }

  .match-tile.is-matched {
    animation: match-glow-out 150ms ease forwards;
  }

  .match-tile.is-arriving {
    animation: none;
  }
}

.match-done {
  margin-top: 10px;
  text-align: center;
}

.match-done .quiz-actions {
  justify-content: center;
}

@media (max-width: 480px) {
  .match-board {
    gap: 8px;
  }

  .match-tile {
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .match-word-text {
    font-size: 1rem;
  }
}

/* 配对测验报告里那条释义 */
.report-matching-definition {
  margin: 4px 0 0;
  font-size: 1rem;
  line-height: 1.5;
}

/* 配对题的卡片固定在上方、不上下居中：配对一对消失时卡片变矮，居中的话剩下的词会整体挪位置，手指容易点错。 */
.quiz-card.match-card {
  margin: clamp(8px, 4vh, 40px) 0 auto;
}

.match-error {
  margin: 10px 0 0;
  color: #8a6510;
  font-weight: 700;
}

/* ---- 拖词填空（Drag & Drop，js/dragdrop.js）----
   上面一排词块，每块有自己固定的小格子（拿走后留虚线框，别的词不挪）；下面每句话里一个空。
   词块和配对题的卡片同一种样子；选中变绿；拖动时原处变淡，一张同样的卡跟着手指走。
   判完：空的边框变绿 / 变黄，并且每句下面有文字结论（对错不只靠颜色）。 */
.dd-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  border-radius: 18px;
  padding: 12px;
  background: rgb(233 248 243 / 70%);
}

.dd-bank.is-drop-target {
  box-shadow: inset 0 0 0 2px rgb(35 159 144 / 35%);
}

.dd-bank-slot {
  display: inline-flex;
  min-width: 0;
  border-radius: 14px;
}

.dd-bank-slot.is-vacant {
  outline: 2px dashed rgb(31 143 128 / 25%);
  outline-offset: -2px;
}

.dd-tile {
  border: 2px solid rgb(31 143 128 / 26%);
  border-radius: 14px;
  padding: 8px 14px;
  background: #fafffc;
  color: var(--forest);
  cursor: grab;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.25;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.dd-tile:hover {
  border-color: rgb(31 143 128 / 55%);
}

.dd-tile:focus-visible,
.dd-empty:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.dd-tile.is-selected {
  border-color: var(--teal);
  background: var(--aqua-pale);
  box-shadow: 0 0 0 2px rgb(35 159 144 / 25%);
}

.dd-tile.is-dragging {
  opacity: 0.35;
}

.dd-tile:disabled {
  cursor: default;
}

.dd-ghost {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  border-color: var(--teal);
  background: var(--aqua-pale);
  box-shadow: 0 10px 24px rgb(23 93 79 / 22%);
  cursor: grabbing;
}

.dd-sentences {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.dd-sentence {
  border-top: 1px solid rgb(35 159 144 / 14%);
  padding-top: 12px;
}

.dd-sentence:first-child {
  border-top: 0;
  padding-top: 0;
}

.dd-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  line-height: 1.9;
}

.dd-blank {
  display: inline-flex;
  min-width: 7.5em;
  min-height: 2.1em;
  align-items: center;
  justify-content: center;
  margin: 0 4px;
  border-radius: 12px;
  vertical-align: middle;
}

.dd-blank.is-drop-target {
  background: var(--aqua-pale);
  box-shadow: 0 0 0 2px var(--teal);
}

.dd-empty {
  width: 100%;
  min-height: 2.1em;
  border: 2px dashed rgb(31 143 128 / 40%);
  border-radius: 12px;
  background: rgb(250 255 252 / 70%);
  cursor: pointer;
}

.dd-empty[hidden] {
  display: none;
}

.dd-empty:disabled {
  cursor: default;
}

.dd-blank .dd-tile {
  padding: 4px 12px;
}

.dd-blank.is-correct .dd-tile {
  border-color: var(--teal);
  background: var(--aqua-pale);
}

.dd-blank.is-wrong .dd-tile {
  border-color: #c9952a;
  background: #fff8e1;
}

.dd-result {
  margin-top: 6px;
}

.dd-verdict {
  margin: 0;
  color: #8a6510;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dd-verdict.is-correct {
  color: #167a6c;
}

.dd-why {
  margin: 2px 0 0;
  color: #35584f;
  font-size: 0.92rem;
  line-height: 1.45;
}

.quiz-card.dd-card {
  margin: clamp(8px, 4vh, 40px) 0 auto;
}

a.quiz-next[hidden],
button.quiz-next[hidden] {
  display: none;
}

@media (max-width: 480px) {
  .dd-bank {
    gap: 8px;
    padding: 10px;
  }

  .dd-tile {
    padding: 7px 11px;
    font-size: 0.98rem;
  }

  .dd-blank {
    min-width: 6.5em;
  }
}

/* 拖词填空报告里那句话：空里放的是你的词 */
.report-dd-placed {
  border-bottom: 2px solid currentcolor;
  padding: 0 2px;
  font-weight: 700;
}

/* ---- 玩法说明弹窗（partials/quiz_rules.html，js/quiz_rules.js）----
   题目卡片右上角一个只有问号的小圆钮（所有者 2026-11-24 定，不和旁边的进度文字抢地方）；弹窗居中，白色卡片，背后整页变暗。
   四种题型的弹窗一样大（所有者 2026-11-24 定）：内容放不下时整个在弹窗里滑动，Got it 在说明的最底下；
   还有没看到的内容时，上边或下边有一道淡影提示。 */
.panel-heading-side {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.rules-button {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(35 159 144 / 30%);
  border-radius: 50%;
  padding: 0;
  background: var(--aqua-pale);
  color: #2d7f73;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
}

.panel-heading-side .preview-label {
  white-space: nowrap;
}

.rules-button:hover {
  border-color: var(--teal);
}

.rules-button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.rules-dialog {
  width: min(calc(100vw / var(--page-zoom) - 48px), 400px);
  max-width: none;
  height: min(calc(100dvh / var(--page-zoom) - 48px), 360px);
  max-height: none;
  border: 0;
  border-radius: 26px;
  padding: 0;
  overflow: hidden;
  background: #fcfffd;
  box-shadow: 0 24px 60px rgb(12 50 43 / 30%);
  color: var(--forest);
}

.rules-dialog::backdrop {
  background: rgb(14 44 38 / 55%);
}

.rules-dialog[open] {
  animation: rules-in 200ms ease;
}

/* 只做位移，不做淡入：半透明的那一瞬间弹窗文字和底下的题目会叠在一起。 */
@keyframes rules-in {
  from { transform: translateY(10px); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rules-dialog[open] {
    animation: none;
  }
}

.rules-panel {
  height: 100%;
  box-sizing: border-box;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
  /* 淡影：白色的盖片跟着内容走，滑到头时正好盖住那一边的影子。 */
  background:
    linear-gradient(#fcfffd 40%, rgb(252 255 253 / 0%)) top / 100% 36px no-repeat local,
    linear-gradient(rgb(252 255 253 / 0%), #fcfffd 60%) bottom / 100% 36px no-repeat local,
    linear-gradient(rgb(23 93 79 / 16%), rgb(23 93 79 / 0%)) 0 1px / 100% 12px no-repeat scroll,
    linear-gradient(rgb(23 93 79 / 0%), rgb(23 93 79 / 16%)) 0 calc(100% - 1px) / 100% 12px no-repeat scroll,
    #fcfffd;
}

.rules-title {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.rules-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0 0 0 1.15rem;
  color: #35584f;
  line-height: 1.5;
}

.rules-points li::marker {
  color: var(--teal);
}

.rules-panel .quiz-actions {
  margin-top: 20px;
}

/* 没登录时点测验前的提示（partials/guest_quiz.html）：沿用玩法说明的弹窗，高度跟着内容走。 */
.guest-quiz-dialog {
  height: fit-content; /* 不能写 auto：弹窗是上下贴边定位的，auto 会被撑满整个窗口 */
  max-height: calc(100dvh / var(--page-zoom) - 48px);
}

.guest-quiz-text {
  margin: 12px 0 0;
  color: #35584f;
  line-height: 1.55;
}

.guest-quiz-text a {
  color: #0f6f63;
  font-weight: 700;
}

.guest-quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 22px;
}

.guest-quiz-actions form {
  margin: 0;
}

.guest-quiz-close {
  border: 0;
  padding: 8px 4px;
  background: none;
  color: #4c7f76;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* ---- 拼词题（Word Assembly，js/word_assembly.js）----
   词片和固定位置的小格子沿用拖词填空（dd-tile、dd-bank）；这里只加放拼好的词的那条线
   （所有者 2026-11-24 定）：像一个词的下划线，固定差不多一个词那么长，词片居中放在线上；
   拼出来的比线长时，线才跟着变长。不画格子，看不出这个词有几片。
   下面那一排词片一样大，大小由脚本按最宽的那片定（--wa-w / --wa-h）。 */
.wa-pos {
  margin: 10px 0 0;
}

.wa-word {
  display: flex;
  width: fit-content;
  min-width: min(220px, 100%);
  max-width: 100%;
  min-height: calc(var(--wa-h) + 8px);
  box-sizing: border-box;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 6px 4px;
  margin: 22px auto 24px;
  border-bottom: 2px solid #2d7f73;
  padding-bottom: 6px;
}

.wa-word .wa-tile {
  height: var(--wa-h);
}

#wa-bank .dd-bank-slot {
  width: var(--wa-w);
  height: var(--wa-h);
}

#wa-bank .wa-tile {
  min-width: max(100%, 52px);
}

.wa-tile {
  padding-inline: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.wa-word.is-correct .dd-tile {
  border-color: var(--teal);
  background: var(--aqua-pale);
}

.wa-word.is-wrong .dd-tile {
  border-color: #c9952a;
  background: #fff8e1;
}

/* 还不能点的 Check（空没填满）要看得出来；拖词填空和拼词题共用。 */
.start-button.quiz-next:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
}

/* 获得徽章的弹窗（js/badge_award.js）：页面变暗，中间一张白卡，徽章在上面。 */
.award-dialog {
  width: min(400px, calc(100vw / var(--page-zoom) - 32px));
  max-height: calc(100dvh / var(--page-zoom) - 32px);
  overflow: auto;
  border: 0;
  border-radius: 30px;
  padding: 24px 22px 22px;
  background:
    radial-gradient(circle at 50% 34%, rgb(255 243 190 / 60%), rgb(255 255 255 / 0) 62%),
    linear-gradient(#ffffff, #f3fbf6);
  box-shadow: 0 24px 70px rgb(8 50 44 / 32%);
  color: var(--forest);
  text-align: center;
}

.award-dialog[open] {
  display: grid;
  justify-items: center;
  animation: award-in 260ms ease-out;
}

.award-dialog::backdrop {
  background: rgb(8 45 41 / 52%);
  animation: award-dim 260ms ease-out;
}

.award-dialog.award-count-2 {
  background: linear-gradient(#fffdf4, #f3fbf6);
}

.award-dialog.award-count-3 {
  background: linear-gradient(#fffdf4, #f3fbf6);
  width: min(520px, calc(100vw / var(--page-zoom) - 32px));
}

.award-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.award-list li {
  display: grid;
  justify-items: center;
  align-content: start;
  width: 100%;
}

.award-count-2 .award-list li {
  width: 50%;
}

.award-count-3 .award-list li {
  width: 33.33%;
}

.award-stage {
  display: block;
  width: min(100%, 310px);
  height: auto;
  overflow: visible;
}

.award-copy {
  margin-top: -14px;
  padding: 0 4px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms ease-out, transform 420ms ease-out;
}

.award-count-2 .award-copy,
.award-count-3 .award-copy {
  margin-top: -6px;
}

.award-count-3 .award-list {
  row-gap: 14px;
  margin-top: 10px;
}

.award-copy.is-shown {
  opacity: 1;
  transform: none;
}

.award-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
}

.award-count-2 .award-copy h2 {
  font-size: 1.25rem;
}

.award-count-3 .award-copy h2 {
  font-size: 1.02rem;
}

.award-copy p {
  margin: 6px 0 0;
  color: rgb(23 79 67 / 82%);
  font-size: 0.95rem;
  line-height: 1.45;
}

.award-count-2 .award-copy p {
  font-size: 0.82rem;
}

.award-button {
  min-width: 180px;
  min-height: 48px;
  margin-top: 20px;
  opacity: 0;
  transition: opacity 360ms ease-out 260ms;
}

.award-dialog.is-ready .award-button {
  opacity: 1;
}

.award-dialog.is-still .award-copy,
.award-dialog.is-still .award-button {
  transition: none;
}

/* 只做位移，不做淡入：半透明的那一瞬间弹窗和底下的页面会叠在一起。 */
@keyframes award-in {
  from {
    transform: translateY(14px) scale(0.97);
  }
}

@keyframes award-dim {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .award-dialog[open],
  .award-dialog::backdrop {
    animation: none;
  }
}

/* 界面语言：首页右上角的小列表 */
.language-control summary {
  display: flex;
  align-items: center;
  list-style: none;
}

.language-control summary::-webkit-details-marker {
  display: none;
}

.language-control summary:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.site-header {
  position: relative;
  z-index: 6; /* 展开的列表盖在下面的面板上 */
}

/* 中文不需要英文标题那种收紧或拉开的字距 */
:lang(zh-Hans) :is(h1, h2, h3, .section-label, .eyebrow, .start-button, .placeholder-control, .preview-label, .utility-control, .report-title, .rules-title) {
  letter-spacing: 0.02em;
}

/* 英文里很小的小字，换成中文笔画多，要大一点才看得清 */
:lang(zh-Hans) :is(.streak-counts dt, .checkin-month) {
  font-size: 0.68rem;
}

:lang(zh-Hans) :is(.preview-label, .utility-control, .progress-total, .learn-step, .report-day-label, .report-day-count) {
  font-size: 0.74rem;
}

@media (max-width: 480px) {
  .language-control .order-menu {
    right: auto;
    left: 0;
    min-width: 150px;
  }
}

/* 中文界面的词卡：背面多了中文，卡片稍大一点、行距紧一点，一张卡里放得下。 */
html[lang="zh-Hans"] .vocab-card {
  width: min(76vw, 430px);
  aspect-ratio: 6 / 5;
}

html[lang="zh-Hans"] .card-back {
  padding: 18px clamp(20px, 3vw, 28px);
}

html[lang="zh-Hans"] .back-heading {
  flex: 0 0 auto;
  flex-flow: row wrap;
  align-items: center;
  gap: 5px 12px;
}

html[lang="zh-Hans"] .back-word {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
}

html[lang="zh-Hans"] .card-back .definition {
  margin-top: 11px;
  font-size: clamp(0.94rem, 1.8vw, 1.04rem);
  line-height: 1.32;
}

html[lang="zh-Hans"] .divider {
  margin-top: 9px;
}

html[lang="zh-Hans"] .card-back .example {
  max-width: none;
  margin-top: 10px;
  font-size: clamp(0.86rem, 1.6vw, 0.94rem);
  line-height: 1.36;
}

html[lang="zh-Hans"] .in-chinese {
  margin-top: 2px;
  font-size: max(0.82em, 12px);
  line-height: 1.42;
}

html[lang="zh-Hans"] .card-back.has-senses .sense-area {
  gap: 8px;
  margin-top: 9px;
}

html[lang="zh-Hans"] .card-back.has-senses .definition {
  margin-top: 0;
  font-size: clamp(0.88rem, 1.7vw, 0.96rem);
}

html[lang="zh-Hans"] .card-back.has-senses .example {
  margin-top: 3px;
  font-size: clamp(0.82rem, 1.5vw, 0.88rem);
}

@media (max-width: 480px) {
  html[lang="zh-Hans"] .vocab-card {
    width: min(84vw, 330px);
    aspect-ratio: 3 / 4;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  html[lang="zh-Hans"] .vocab-card {
    width: min(76vw, 404px);
    aspect-ratio: 4 / 3;
  }
}

/* 实在放不下的（中文界面里意思多的词、很窄的手机），在释义区里上下滑 */
html[lang="zh-Hans"] .sense-area {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

html[lang="zh-Hans"] .sense-area > * {
  flex: 0 0 auto;
}

@media (max-width: 350px) {
  .card-back {
    padding-block: 14px;
  }

  .back-heading {
    flex: 0 0 auto;
  }

  .sense-area {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sense-area > * {
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   设置（首页右上角的齿轮进来，所有者 2026-11-27 定）。页面骨架和总报告一样，
   这里只有设置自己的部分：入口列表、表单、词量的固定档、常见问题。
   ========================================================================== */

.settings-gear {
  display: inline-flex;
  width: 32px;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.settings-gear svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-list {
  display: grid;
  gap: 0;
  padding-block: 6px;
}

.settings-who {
  margin: 6px 0 10px;
  color: #4c7f76;
  font-size: 0.84rem;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  border-top: 1px solid rgb(35 159 144 / 14%);
  padding: 15px 22px 15px 2px;
  color: var(--forest);
  font-weight: 800;
  text-decoration: none;
  position: relative;
}

.settings-who + .settings-row,
.settings-list > .settings-row:first-child {
  border-top: 0;
}

/* 右边一个小箭头，表示点进去 */
.settings-row::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 4px;
  width: 7px;
  height: 7px;
  border-top: 2px solid #8fb5ad;
  border-right: 2px solid #8fb5ad;
  transform: translateY(-50%) rotate(45deg);
}

.settings-row:hover,
.settings-row:focus-visible {
  color: var(--teal);
}

.settings-card {
  display: grid;
  gap: 12px;
}

.settings-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.settings-facts > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.settings-facts dt {
  color: #668a83;
  font-size: 0.84rem;
  font-weight: 700;
}

.settings-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.settings-facts code,
.feedback-meta code {
  font-size: 0.9em;
  letter-spacing: 0.04em;
}

.settings-help,
.settings-points,
.faq-item p {
  margin: 0;
  color: #4c7f76;
  font-size: 0.9rem;
  line-height: 1.55;
}

.settings-points {
  display: grid;
  gap: 8px;
  padding-left: 1.2em;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-label {
  color: #416f67;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.settings-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgb(35 159 144 / 30%);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fff;
  color: var(--forest);
  font: inherit;
  font-size: 1rem;
}

.settings-textarea {
  resize: vertical;
  line-height: 1.5;
}

.settings-input:focus-visible,
.amount-number:focus-visible {
  outline: 3px solid var(--lemon);
  outline-offset: 1px;
}

.settings-problem {
  margin: 0;
  border-radius: 12px;
  padding: 10px 12px 10px 14px;
  background: #fff6cf;
  color: #4a3a08;
  font-size: 0.88rem;
  font-weight: 700;
  list-style: none;
}

.settings-warning {
  margin: 0;
  border-left: 4px solid #c9623f;
  padding: 4px 0 4px 12px;
  color: #6b2f1c;
  font-weight: 700;
  line-height: 1.5;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.settings-save,
.settings-button {
  justify-self: start;
  min-height: 42px;
  border: 1px solid rgb(35 159 144 / 26%);
  border-radius: 999px;
  padding: 9px 20px;
  background: rgb(251 255 252 / 90%);
  color: var(--teal);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.settings-save {
  border-color: rgb(20 122 108 / 20%);
  background: var(--teal);
  color: #fff;
}

.settings-button.is-danger {
  border-color: rgb(176 74 40 / 35%);
  color: #a3442a;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-actions form {
  margin: 0;
}

.amount-field {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
  min-width: 0;
}

.amount-options,
.feedback-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 固定档：一个个小圆角块，选中的变青绿 */
.amount-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.amount-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.amount-chip > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 46px;
  justify-content: center;
  border: 1px solid rgb(35 159 144 / 26%);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  color: var(--forest);
  cursor: pointer;
  font-weight: 800;
}

.amount-chip small {
  color: #7c9d96;
  font-size: 0.7rem;
  font-weight: 700;
}

.amount-chip input[type="radio"]:checked + span {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.amount-chip input[type="radio"]:checked + span small {
  color: rgb(255 255 255 / 85%);
}

.amount-chip input[type="radio"]:focus-visible + span {
  outline: 3px solid var(--lemon);
  outline-offset: 2px;
}

.amount-number {
  width: 112px;
  box-sizing: border-box;
  border: 1px solid rgb(35 159 144 / 30%);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--forest);
  font: inherit;
  font-weight: 800;
}

.faq-list {
  gap: 0;
}

.faq-item {
  border-top: 1px solid rgb(35 159 144 / 14%);
  padding: 4px 0;
}

.faq-item:first-child {
  border-top: 0;
}

.faq-item summary {
  cursor: pointer;
  display: flex;
  gap: 10px;
  padding: 10px 0;
  color: var(--forest);
  font-weight: 800;
  line-height: 1.45;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

/* 问题前的小三角：展开时顺滑地转向下（动画在 js/faq.js） */
.faq-item summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  margin-top: 0.42em;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transition: transform 0.28s cubic-bezier(0.2, 0, 0.2, 1);
}

.faq-item[open] summary::before {
  transform: rotate(90deg);
}

.faq-item.is-closing summary::before {
  transform: rotate(0deg);
}

@media (prefers-reduced-motion: reduce) {
  .faq-item summary::before {
    transition: none;
  }
}

.faq-item p {
  margin: 0 0 10px;
}

/* 回答里的一排要点：前面的词加粗，方便一眼找到（五个级别、两个按钮等） */
.faq-terms {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding-left: 1.2em;
  color: #4c7f76;
  font-size: 0.9rem;
  line-height: 1.55;
}

.faq-terms strong {
  color: var(--forest);
}

.feedback-meta {
  margin: 0;
  color: #7c9d96;
  font-size: 0.8rem;
}

.feedback-message {
  margin: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.settings-updated {
  margin: 0;
  color: #4c7f76;
  font-size: 0.8rem;
}

/* 设置页卡片里的文字链接（如出处说明）：用网站的青绿色，不用浏览器默认的蓝色 */
.settings-card .settings-help a {
  color: var(--teal);
  font-weight: 700;
}

/*
  设新密码时的要求清单（partials/password_checklist.html，注册、改密码、重设密码共用）：
  没满足是一个空心小圆圈，满足了变成实心绿圆里一个白色小勾。
*/
.password-checklist {
  display: grid;
  gap: 6px;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  color: #6b8f88;
  font-size: 0.88rem;
}

.password-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.password-check-icon {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #a9c4be;
  border-radius: 50%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.password-check-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 4.5px;
  width: 4px;
  height: 7px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  opacity: 0;
  transform: rotate(45deg) scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.password-checklist li.is-met {
  color: var(--forest);
}

.password-checklist li.is-met .password-check-icon {
  border-color: #3a9f6e;
  background: #3a9f6e;
}

.password-checklist li.is-met .password-check-icon::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

form button[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
  .password-checklist li,
  .password-check-icon,
  .password-check-icon::after {
    transition: none;
  }
}

/*
  出现时的小动效（所有者 2026-11-27：点了以后东西不要“刷”地一下闪出来）。
  这些东西原本是藏着的（hidden），一露出来就从稍下方、半透明，很快地滑进来、变清楚：
  - 词卡页 Order、首页 Language 的小列表（收起时也淡出）；
  - 词卡浏览在单张卡和概览之间切换；
  - 翻面后出现的“确定知道 / 还不确定”，一轮做完的小结；
  - 选择题、拼词交卷后的对错和解释，拖词填空每句的对错，配对题做完的结果。
  用的是浏览器的 @starting-style：不支持的浏览器就照旧直接出现，不会出错。
  系统设了“减少动态效果”就都不播。
*/
.order-menu,
.card-view,
.grid-view,
.learn-buttons,
.learn-summary,
.quiz-feedback,
.dd-result,
.match-done {
  transition:
    opacity 0.2s ease,
    transform 0.22s cubic-bezier(0.2, 0, 0.2, 1);
}

@starting-style {
  .order-menu,
  .learn-buttons,
  .quiz-feedback,
  .dd-result {
    opacity: 0;
    transform: translateY(-4px);
  }

  .card-view,
  .grid-view,
  .learn-summary,
  .match-done {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* 小列表收起时也淡出，不是一下子消失 */
.order-menu {
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    display 0.16s allow-discrete;
}

.order-menu[hidden] {
  opacity: 0;
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
  .order-menu,
  .card-view,
  .grid-view,
  .learn-buttons,
  .learn-summary,
  .quiz-feedback,
  .dd-result,
  .match-done {
    transition: none;
  }
}
