/* Quiz component motion and interaction tokens. */
/* Quiz shell, cards, options, answer states, and results. */
        #app-container {
            position: absolute;
            top: calc(var(--header-height) + var(--safe-top));
            bottom: calc(var(--footer-height) + var(--safe-bottom));
            left: 0;
            right: 0;

            display: flex;
            justify-content: center;
            align-items: center;
            perspective: 1000px;
            width: 100%;
            overflow: hidden;
            padding: 10px 0;
        }
        .card {
            width: 92%; max-width: 500px; height: 95%; max-height: 95%;
            background: var(--card-bg); border-radius: 16px; box-shadow: 0 10px 25px var(--shadow-color);
            position: absolute; display: flex; flex-direction: column; 
            user-select: none; transform: translateX(0) rotate(0); opacity: 1;
            transition: transform var(--duration-normal) ease-out, opacity var(--duration-normal) ease-out, background-color var(--duration-normal), width var(--duration-normal) ease-out, max-width var(--duration-normal) ease-out, height var(--duration-normal) ease-out, max-height var(--duration-normal) ease-out;
            overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform-style: preserve-3d;
        }
        .anim-leave-left { transform: translateX(-120%) rotate(-10deg) !important; opacity: 0; }
        .anim-prepare-right { transition: none !important; transform: translateX(120%) rotate(10deg) !important; opacity: 0; }
        .anim-leave-right { transform: translateX(120%) rotate(10deg) !important; opacity: 0; }
        .anim-prepare-left { transition: none !important; transform: translateX(-120%) rotate(-10deg) !important; opacity: 0; }
        @media (max-width: 600px) {
            .anim-leave-left { transform: translateX(-120%) rotate(0deg) !important; opacity: 0; }
            .anim-prepare-right { transition: none !important; transform: translateX(120%) rotate(10deg) !important; opacity: 0; }
            .anim-leave-right { transform: translateX(120%) rotate(0deg) !important; opacity: 0; }
            .anim-prepare-left { transition: none !important; transform: translateX(-120%) rotate(-10deg) !important; opacity: 0; }
            .card { width: 94%; }
        }
        .scroll-hidden { overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
        .scroll-hidden.is-overflowing { mask-image: linear-gradient(to bottom, black calc(100% - 30px), transparent 100%); -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 30px), transparent 100%); }
        .tag-type { display: inline-block; font-size: 0.8em; padding: 3px 10px; background: var(--highlight-bg); color: var(--highlight-text); border-radius: 12px; margin-right: 0; vertical-align: middle; font-weight: 600; }
        
        .card-header-scroll { max-height: 40%; padding: 20px 25px; padding-bottom: 10px; padding-top: 13px; margin-top: 3px; flex-shrink: 0; width: 100%; box-sizing: border-box; }
        .card-header-text { font-size: 1.1em; font-weight: bold; line-height: 1.6; color: var(--text-color); text-align: left; word-wrap: break-word; overflow-wrap: anywhere; }
        .question-meta-row { text-align: center; margin-bottom: 13px; }

        .card-body-scroll { flex: 1; padding: 10px 20px 0 20px; padding-top: 5px; display: flex; flex-direction: column; width: 100%; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; position: relative;}
        .card-body-content { padding-bottom: 20px; }
        
        .options-list { list-style: none; padding: 0; margin: 0; width: 100%; }
        .option-item { padding: 12px 15px; border: 1px solid var(--border-color); margin-bottom: 10px; border-radius: 8px; cursor: pointer; transition: all 0.2s; display: flex; align-items: flex-start; color: var(--text-color); background: var(--card-bg); line-height: 1.4; }
        .option-key { margin-right: 10px; font-weight: bold; flex-shrink: 0; margin-top: 0; }
        .option-content-scroll { flex: 1; word-wrap: break-word; overflow-wrap: anywhere; padding-bottom: 0; }
        .option-item:active { transform: scale(0.99); }
        .option-item.selected { border-color: var(--primary-color); background-color: var(--highlight-bg); color: var(--highlight-text); }
        .option-item.correct { background-color: var(--success-color); color: var(--success-text); border-color: var(--success-color); font-weight: bold; }
        .option-item.wrong { background-color: var(--error-color); color: var(--error-text); border-color: var(--error-color); }
        .option-item.partial { background-color: var(--partial-bg); color: var(--partial-text); border-color: var(--partial-bg); font-weight: bold; }

        .fill-input-container { width: 100%; margin-top: 10px; }
        .fill-input { 
            width: 100%; padding: 12px; font-size: 16px; 
            border: 2px solid var(--border-color); border-radius: 8px; 
            margin-bottom: 15px; box-sizing: border-box; outline: none; 
            background: var(--card-bg); color: var(--text-color); 
            transition: border-color 0.2s; 
            appearance: none; -webkit-appearance: none; opacity: 1; 
        }
        .fill-input:disabled { opacity: 1 !important; -webkit-text-fill-color: var(--text-color); background-color: var(--card-bg); color: var(--text-color); }
        .fill-input:focus { border-color: var(--primary-color); }
        .fill-input.correct { border-color: var(--success-color); background: var(--success-color); color: var(--success-text); }
        .fill-input.correct:disabled { background-color: var(--success-color) !important; color: var(--success-text) !important; -webkit-text-fill-color: var(--success-text) !important; border-color: var(--success-color) !important; opacity: 1 !important; }
        .fill-input.wrong { border-color: var(--error-color); background: var(--error-color); }
        .fill-input.wrong:disabled { background-color: var(--error-color) !important; border-color: var(--error-color) !important; opacity: 1 !important; color: var(--text-color) !important; -webkit-text-fill-color: var(--text-color) !important; }
        
        .btn-submit { background-color: var(--primary-color); color: white; border: none; padding: 12px 20px; border-radius: 8px; font-size: 16px; width: 100%; cursor: pointer; margin-top: 10px; margin-bottom: 10px; transition: opacity 0.2s; flex-shrink: 0; }
        .btn-submit:hover { opacity: 0.9; }
        .btn-submit:disabled { background-color: var(--border-color); cursor: not-allowed; }

        .explanation-container {
            margin-top: 20px; padding: 15px; background-color: var(--exp-bg); border: 1px solid var(--exp-border);
            border-radius: 12px; font-size: 14px; line-height: 1.6; color: var(--sub-text-color); animation: fadeIn 0.4s ease-out;
        }
        body.no-anim .explanation-container { animation: none; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        
        .explanation-header { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--exp-title); margin-bottom: 8px; font-size: 14px; }
        .explanation-text { word-wrap: break-word; overflow-wrap: anywhere; }

        .result-container { text-align: center; display: flex; flex-direction: column; justify-content: center; height: 100%; align-items: center; padding: 20px; }
        .score-circle { width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--primary-color) 0%, var(--border-color) 0%); display: flex; justify-content: center; align-items: center; margin-bottom: 20px; position: relative; flex-shrink: 0; }
        .score-inner { width: 100px; height: 100px; background: var(--card-bg); border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; }
        .score-num { font-size: 24px; font-weight: bold; color: var(--primary-color); }
        .score-label { font-size: 12px; color: var(--text-color); opacity: 0.7; }
        .result-stats { margin-bottom: 30px; color: var(--text-color); font-size: 16px; }
        .btn-restart { background: var(--primary-color); color: white; padding: 12px 30px; border-radius: 25px; border: none; font-size: 16px; cursor: pointer; box-shadow: 0 4px 10px var(--shadow-color); transition: transform 0.2s, opacity 0.2s; }
        .btn-restart:active { transform: scale(0.95); }

        .readme-hint {
            margin-top: 18px;
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
        }
        .readme-button {
            display: inline-flex; align-items: center; justify-content: center; gap: 8px;
            min-width: 44px; min-height: 44px; max-width: 100%; padding: 10px 18px;
            border: 1px solid var(--border-color); border-radius: 12px;
            background: var(--card-bg); color: var(--icon-accent-color); font: inherit; font-size: 14px;
            cursor: pointer; transition: background-color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
        }
        .readme-button:hover:not(:disabled) { background: var(--highlight-bg); border-color: var(--icon-accent-color); }
        .readme-button:active:not(:disabled) { transform: scale(0.98); }
        .readme-button:focus-visible { outline: 2px solid var(--icon-accent-color); outline-offset: 3px; }
        .readme-button:disabled { color: var(--sub-text-color); opacity: 0.65; cursor: default; }
        .readme-status { font-size: 12px; line-height: 1.5; color: var(--sub-text-color); }
.option-item,
.btn-submit,
.btn-restart,
.nav-btn {
  transition-duration: var(--duration-fast);
}

.option-item:focus-visible,
.btn-submit:focus-visible,
.btn-restart:focus-visible,
.nav-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ============================================================================
 * 欢迎页「最近使用」（2026-10-08，需求 §3 / §7.1）
 * ---------------------------------------------------------------------------
 * 结构与 `buildWelcomeCardMarkup()`（src/ui/quiz-card-template.js）及 index.html 的
 * 静态骨架一一对应：`.welcome-container > .welcome-top + .recent-section > #recent-list`。
 *
 * 布局要点：
 *   · `.welcome-container` 覆盖 `.result-container` 的 `justify-content:center` + `height:100%`
 *     —— 那是「单块指引居中」的形态；多出下半区列表后必须改成「顶部指引固定、列表占据余量」，
 *     否则短屏上列表会把指引顶出可视区（需求 §7.1「不挤压固定顶部／底部控件」）。
 *   · 列表保留最小可用空间；文字放大时外层可以滚动，避免列表被压缩到零高度。
 *     列表在需要时自己纵向滚动（`overscroll-behavior: contain` 顺带切断滚动链），
 *     避免手指在列表上滑动时误触发卡片的翻页手势（需求 §7.1 最后一条）。
 *   · 颜色全部走既有语义变量 ⇒ 浅色 / 深色 / 自动主题自动一致（需求 §3）。
 * ========================================================================== */
.welcome-container {
  justify-content: flex-start;
  gap: 0;
  padding: 20px 20px max(20px, var(--safe-bottom));
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.welcome-container::-webkit-scrollbar { display: none; }
.welcome-top { flex-shrink: 0; width: 100%; }
.welcome-title { margin: 0 0 14px; font-size: 24px; line-height: 1.35; }
.welcome-text { margin: 0; font-size: 15px; line-height: 1.7; }
.welcome-top .welcome-hint { margin-top: 10px; line-height: 1.6; }

.recent-section {
  width: 100%;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex: 1 0 160px;
  min-height: 0;
  text-align: left;
}
.recent-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sub-text-color);
  letter-spacing: 0.02em;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-color);
  color: var(--text-color);
  text-align: left;
  cursor: pointer;
  font: inherit;
  flex-shrink: 0;
  transition: background-color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}
.recent-item:hover { border-color: var(--highlight-text); }
.recent-item:active { background: var(--highlight-bg); }
.recent-item:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.recent-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--highlight-text);
}
.recent-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
/* 名称是主要文字、时间是次要文字（需求 §3）——超长一律省略，完整值在 title / aria-label 里。 */
.recent-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item-time {
  font-size: 12px;
  color: var(--sub-text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item-source {
  font-size: 12px;
  color: var(--sub-text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-placeholder,
.recent-empty {
  padding: 12px 4px;
  font-size: 13px;
  color: var(--sub-text-color);
  text-align: center;
}
.recent-empty--error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
/* 重试是**独立于空状态**的可恢复反馈（需求 §7.2），因此不复用空状态的灰色文案样式。 */
.recent-retry {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--highlight-text);
  border-radius: 12px;
  background: var(--highlight-bg);
  color: var(--highlight-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.recent-retry:active { transform: scale(0.98); }
.recent-retry:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

@media (max-height: 560px) {
  .welcome-container { padding-top: 12px; overflow-y: auto; overscroll-behavior: contain; }
  .welcome-hint { margin-top: 10px; }
  .recent-section { margin-top: 12px; padding-top: 10px; flex: 0 0 auto; }
  .recent-list { overflow: visible; flex: 0 0 auto; }
}
