/*
 * This is a manifest file that'll be compiled into application.css.


 */

/* ── Cinnamoroll palette ─────────────────────────────────────────── */
:root {
  --sky:       #A8D8EA;
  --sky-light: #EBF7FC;
  --sky-dark:  #6DB8D8;
  --pink:      #FFB7C5;
  --pink-dark: #F9899F;
  --white:     #FFFFFF;
  --text:      #3D4852;
  --text-muted:#7A8A96;
  --border:    #C9E8F5;
  --error-bg:  #FFF0F3;
  --error:     #D64F6E;
}

/* ── Reset / base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--sky-light);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Auth layout ─────────────────────────────────────────────────── */
.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(168, 216, 234, 0.35);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--sky-dark);
  letter-spacing: -0.5px;
}

.auth-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.auth-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ── Form elements ───────────────────────────────────────────────── */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.field input[type="email"],
.field input[type="text"],
.field input[type="password"] {
  display: block;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--sky-light);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.field input:focus {
  border-color: var(--sky-dark);
  box-shadow: 0 0 0 3px rgba(109, 184, 216, 0.2);
  background: var(--white);
}

.field .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.actions { margin-top: 1.5rem; }

.btn-primary,
.actions input[type="submit"] {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: var(--sky-dark);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover,
.actions input[type="submit"]:hover {
  background: #5AAACF;
}

.btn-primary:active,
.actions input[type="submit"]:active {
  transform: scale(0.98);
}

/* ── Flash messages ──────────────────────────────────────────────── */
.flash { padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash.notice { background: #E0F4FF; color: #2272A8; border: 1px solid var(--sky); }
.flash.alert  { background: var(--error-bg); color: var(--error); border: 1px solid #F5C6CF; }

/* ── Error messages ──────────────────────────────────────────────── */
#error_explanation {
  background: var(--error-bg);
  border: 1px solid #F5C6CF;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

#error_explanation h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--error);
  margin-bottom: 0.5rem;
  text-align: left;
}

#error_explanation ul { padding-left: 1.2rem; }
#error_explanation li { font-size: 0.85rem; color: var(--error); }

/* ── Auth links ──────────────────────────────────────────────────── */
.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--sky-dark);
  text-decoration: none;
  font-weight: 500;
}

.auth-links a:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.25rem;
    border-radius: 16px;
  }
}

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sky-dark);
  text-decoration: none;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.navbar-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.navbar-links a:hover, .navbar-links a.active { color: var(--sky-dark); }

.navbar-admin {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white !important;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.navbar-admin:hover {
  opacity: 0.9;
  color: white !important;
}

.navbar-user {
  color: var(--text);
  font-weight: 600;
  padding: 0 0.25rem;
}

.btn-logout {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-logout:hover { border-color: var(--sky-dark); color: var(--sky-dark); }

/* ── Layout ──────────────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - 57px); }

.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.flash {
  max-width: 800px;
  margin: 0.75rem auto 0;
  padding: 0.75rem 1.5rem;
}

.page-header { margin-bottom: 1.5rem; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-header a { font-size: 0.9rem; font-weight: 600; color: var(--sky-dark); text-decoration: none; }
.page-header a:hover { text-decoration: underline; }

.text-muted { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.25rem; }

/* ── Dashboard ───────────────────────────────────────────────────── */
.dashboard-header { margin-bottom: 1.5rem; }
.dashboard-header h1 { font-size: 1.75rem; font-weight: 700; }

.dashboard-cta { margin-bottom: 2rem; }

.btn-primary-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--sky-dark);
  color: var(--white);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-primary-link:hover { background: #5AAACF; }

.dashboard-section { margin-top: 1rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 { font-size: 1.1rem; font-weight: 600; }

.section-link { font-size: 0.85rem; color: var(--sky-dark); text-decoration: none; }
.section-link:hover { text-decoration: underline; }

/* ── Cards ───────────────────────────────────────────────────────── */
.question-list, .answer-list { display: flex; flex-direction: column; gap: 1rem; }

.question-card, .answer-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.question-card:hover, .answer-card:hover {
  border-color: var(--sky);
  box-shadow: 0 2px 12px rgba(168, 216, 234, 0.25);
}

.question-card-meta, .answer-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.question-card-title, .answer-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.question-card-title a, .answer-card-title a {
  color: var(--text);
  text-decoration: none;
}

.question-card-title a:hover, .answer-card-title a:hover { color: var(--sky-dark); }

.answer-card-link, .question-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.answer-card-link .answer-card-content {
  text-decoration: none;
}

.answer-card-link:hover .answer-card,
.question-card-link:hover .question-card {
  border-color: var(--sky);
  box-shadow: 0 2px 12px rgba(168, 216, 234, 0.25);
}

.question-card-body, .answer-card-content {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.answer-time { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-easy    { background: #D1FAE5; color: #065F46; }
.badge-medium  { background: #FEF3C7; color: #92400E; }
.badge-hard    { background: #FEE2E2; color: #991B1B; }
.badge-category { background: var(--sky-light); color: var(--sky-dark); }
.badge-function { background: #EDE9FE; color: #5B21B6; }
.badge-principle { background: #E0E7FF; color: #3730A3; }
.badge-evaluated { background: #DBEAFE; color: #0C4A6E; }

/* ── Filters ─────────────────────────────────────────────────────── */
.filter-bar { margin-bottom: 1.5rem; }

.filter-form {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }

.filter-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.filter-select {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  outline: none;
}

.filter-select:focus { border-color: var(--sky-dark); }

.btn-filter {
  padding: 0.5rem 1rem;
  background: var(--sky-dark);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-clear {
  padding: 0.5rem 1rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

/* ── Question Detail ─────────────────────────────────────────────── */
.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--sky-dark);
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.question-detail { margin-bottom: 2rem; }
.question-meta { margin-bottom: 0.75rem; display: flex; gap: 0.5rem; }
.question-detail h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 1rem; }
.question-body { font-size: 0.95rem; line-height: 1.7; color: var(--text); }

.answer-form-section h2 { font-size: 1.1rem; font-weight: 600; }

.answer-textarea {
  display: block;
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  background: var(--sky-light);
}

.answer-textarea:focus {
  border-color: var(--sky-dark);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(109, 184, 216, 0.2);
}

.form-actions { margin-top: 1rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.btn-voice {
  padding: 0.75rem 1.25rem;
  background: var(--white);
  color: var(--sky-dark);
  border: 1.5px solid var(--sky);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-voice:hover { border-color: var(--sky-dark); }
.btn-voice:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-voice--recording {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

@keyframes voice-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* 等麥克風授權中:全螢幕淺灰罩,擋互動 + 告訴使用者「還不要開始錄音」 */
.voice-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(120, 138, 150, 0.28);
  display: flex; align-items: center; justify-content: center;
  cursor: progress;
}
.voice-overlay-card {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--white); color: var(--text);
  padding: 0.9rem 1.4rem; border-radius: 999px;
  font-weight: 600; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.voice-overlay-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--sky-dark);
  animation: voice-spin 0.8s linear infinite;
}
@keyframes voice-spin { to { transform: rotate(360deg); } }

/* 等麥克風授權中(尚未開始錄音):跳動提示 + progress 游標,有別於錄音中的紅色脈動 */
.btn-voice--preparing {
  background: var(--sky-light, #eaf6fc);
  border-color: var(--sky-dark);
  color: var(--sky-dark);
  cursor: progress;
  animation: voice-pulse 0.9s ease-in-out infinite;
}

.voice-error { color: var(--error); font-size: 0.85rem; }
.voice-unsupported { color: var(--text-muted); font-size: 0.82rem; line-height: 1.4; }

/* 錄音即時波形（跳動長條） */
.voice-viz {
  width: 120px;
  height: 40px;
  flex: 0 0 auto;
  background: var(--sky-light, #eaf6fc);
  border: 1.5px solid var(--sky);
  border-radius: 12px;
}
@media (max-width: 480px) {
  .voice-viz { width: 88px; height: 36px; }
}

.btn-submit {
  padding: 0.75rem 1.5rem;
  background: var(--sky-dark);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-submit:hover { background: #5AAACF; }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-submit:disabled:hover { background: var(--sky-dark); }
/* BQ 對話送出鈕靠右(與 case 一致) */
.form-actions .btn-submit { margin-left: auto; }

/* ── AI Evaluation: conversation ─────────────────────────────────── */
.convo { display: flex; flex-direction: column; gap: 0.875rem; margin-bottom: 2rem; }

.convo-bubble {
  border-radius: 14px;
  padding: 1rem 1.25rem;
  max-width: 90%;
  font-size: 0.95rem;
  line-height: 1.6;
}

.convo-user {
  align-self: flex-end;
  background: var(--sky-light);
  border: 1.5px solid var(--border);
}

.convo-ai {
  align-self: flex-start;
  background: var(--white);
  border: 1.5px solid var(--pink);
}

.convo-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.convo-ai .convo-label { color: var(--pink-dark); }

.convo-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.convo-text p { margin: 0; }
.convo-text p + p { margin-top: 0.5rem; }

/* 教練回覆的 markdown 渲染 */
.convo-md > :first-child { margin-top: 0; }
.convo-md > :last-child { margin-bottom: 0; }
.convo-md h4, .convo-md h5, .convo-md h6 { font-weight: 700; margin: 0.6rem 0 0.3rem; }
.convo-md h4 { font-size: 1.05rem; }
.convo-md h5, .convo-md h6 { font-size: 1rem; }
.convo-md ul, .convo-md ol { margin: 0.4rem 0; padding-left: 1.4rem; }
.convo-md li { margin: 0.2rem 0; }
.convo-md li + li { margin-top: 0.15rem; }
.convo-md code {
  background: var(--sky-light);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.convo-md a { color: var(--sky-dark); text-decoration: underline; }

/* ── AI Evaluation: scores ───────────────────────────────────────── */
.eval-result h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.score-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
}

.score-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--sky-dark);
}

.score-max { font-size: 1rem; color: var(--text-muted); font-weight: 500; }

.score-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.eval-feedback {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  line-height: 1.8;
}

.eval-feedback h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sky-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--sky-light);
}

.eval-feedback h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sky-dark);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  padding-left: 0.75rem;
  border-left: 4px solid var(--sky-dark);
}

.eval-feedback h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.eval-feedback p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.8;
  color: var(--text);
}

.eval-feedback p + p { margin-top: 0.75rem; }

.eval-feedback li {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.eval-feedback ul, .eval-feedback ol {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 600px) {
  .score-grid { grid-template-columns: 1fr; }
  .convo-bubble { max-width: 100%; }
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state a { color: var(--sky-dark); }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar { padding: 0.75rem 1rem; }
  .navbar-links { gap: 0.75rem; }
  .page-container { padding: 1.25rem 1rem; }
  .filter-form { flex-direction: column; align-items: stretch; }
  .answer-time { margin-left: 0; }
}

/* ── Thinking dots animation (Vue 對話思考中) ──────────────────── */
.thinking-dots span {
  animation: thinking-blink 1.4s infinite both;
  font-weight: 700;
  font-size: 1.2em;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40%           { opacity: 1; }
}

/* ── Character counter ─────────────────────────────────────── */
.char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.char-counter--warn { color: var(--error); font-weight: 600; }

/* ── Hint button + modal ─────────────────────────────────── */
.answer-form-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }

.convo-label { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }

.hint-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: var(--sky-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.hint-btn:hover { border-color: var(--sky-dark); background: var(--sky-light); }

.hint-btn--inline { flex: 0 0 auto; }

/* Modal */
.hint-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(61, 72, 82, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.hint-modal {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(61, 72, 82, 0.3);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.hint-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--sky-dark);
}

.hint-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.hint-modal-close:hover { color: var(--text); }

.hint-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  line-height: 1.8;
  color: var(--text);
}
.hint-modal-body p { margin: 0; }
.hint-modal-body p + p { margin-top: 0.6rem; }
.hint-modal-body ul, .hint-modal-body ol { margin: 0.25rem 0; padding-left: 1.4rem; }
.hint-modal-body li { margin-bottom: 0.4rem; }
.hint-modal-body strong { color: var(--sky-dark); }

.hint-modal-loading { color: var(--text-muted); }

/* 密碼欄位「眼睛」顯示切換(password_toggle.js)*/
.password-field {
  position: relative;
  display: block;
}
.password-field input {
  width: 100%;
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0.7;
}
.password-toggle:hover {
  opacity: 1;
}

/* Case interview 對話 UI(case_conversation.js)*/
.case-conv { max-width: 720px; margin: 0 auto; }
.case-phases { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.case-phase {
  font-size: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 999px;
  background: var(--sky-light); color: var(--text-muted); border: 1px solid var(--border);
}
.case-phase.active { background: var(--sky-dark); color: var(--white); border-color: var(--sky-dark); }

.case-transcript {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.5rem; margin-bottom: 1rem;
}
.case-bubble {
  max-width: 85%; padding: 0.6rem 0.85rem; border-radius: 14px;
  font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap;
}
.case-bubble-interviewer { align-self: flex-start; background: var(--sky-light); color: var(--text); }
.case-bubble-candidate { align-self: flex-end; background: var(--sky-dark); color: var(--white); }
.case-bubble-system { align-self: center; background: transparent; color: var(--text-muted); font-size: 0.85rem; }
.case-thinking { font-style: italic; color: var(--text-muted); }

.case-exhibit { width: 100%; }
.case-exhibit-title { font-weight: 600; margin-bottom: 0.4rem; }
.case-exhibit table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.case-exhibit th, .case-exhibit td { border: 1px solid var(--border); padding: 0.3rem 0.5rem; text-align: left; }

.case-quant.ok { color: #2e7d32; font-weight: 700; }
.case-quant.bad { color: #c62828; font-weight: 700; }

.case-input { display: flex; flex-direction: column; gap: 0.5rem; }
.case-input textarea {
  width: 100%; padding: 0.6rem 0.85rem; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 0.95rem; resize: vertical; background: var(--sky-light);
}
.case-input-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.case-input-actions .voice-input { display: inline-flex; align-items: center; gap: 0.5rem; }
.case-input-actions .btn-submit { margin-left: auto; }

/* 作答計時器(正計碼錶,可點一下暫停/繼續) */
.answer-timer {
  display: inline-flex; align-items: center; gap: 0.35rem; font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--text-muted); font-size: 0.9rem;
  padding: 0.35rem 0.6rem; background: var(--sky-light); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.answer-timer:hover:not(:disabled) { background: var(--sky); color: var(--text); }
.answer-timer:disabled { cursor: default; opacity: 0.85; }
.answer-timer--paused { color: var(--pink-dark); border-color: var(--pink); background: var(--error-bg); }
.answer-timer-icon { font-size: 0.8rem; line-height: 1; }
/* 自寫的即時 tooltip(取代 native title,無延遲) */
.answer-timer-wrap { position: relative; display: inline-flex; }
.timer-tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 1100;
  white-space: nowrap; pointer-events: none;
  background: var(--text); color: var(--white);
  font-size: 0.78rem; font-weight: 500; padding: 0.35rem 0.6rem; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.timer-tooltip::after {
  content: ""; position: absolute; top: 100%; left: 14px;
  border: 5px solid transparent; border-top-color: var(--text);
}
/* 結構化整體評估(DB-8) */
.eval-summary { line-height: 1.7; margin: 0 0 1rem; }
.eval-feedback-h { font-size: 1rem; font-weight: 700; color: var(--text); margin: 1.25rem 0 0.5rem; }
.feedback-item {
  border: 1px solid var(--border); border-left: 4px solid var(--sky); border-radius: 10px;
  padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; background: var(--white);
}
.feedback-item-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.feedback-item-body { line-height: 1.65; font-size: 0.92rem; color: var(--text); }

/* Feature flags:升級提示頁與區塊 */
.upgrade-page {
  max-width: 520px; margin: 2rem auto; text-align: center;
  border: 1px solid var(--border); border-radius: 14px; padding: 2rem 1.5rem; background: var(--white);
}
.upgrade-badge {
  display: inline-block; background: #fdebd0; color: #b9770e; font-weight: 800; letter-spacing: 1px;
  padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; margin-bottom: 0.75rem;
}
.upgrade-page h1 { margin: 0.25rem 0; }
.upgrade-feature { font-weight: 600; color: var(--text); }
.upgrade-lede { color: var(--text-muted); }
.upgrade-perks { list-style: none; padding: 0; margin: 1rem auto; max-width: 400px; text-align: left; }
.upgrade-perks li { padding: 0.5rem 0 0.5rem 1.6rem; position: relative; }
.upgrade-perks li::before { content: "✓"; position: absolute; left: 0; color: var(--sky-dark); font-weight: 700; }
.upgrade-contact { color: var(--text-muted); font-size: 0.9rem; margin-top: 1rem; }
.upgrade-hint {
  border: 1px dashed var(--border); border-radius: 12px; padding: 1.25rem; text-align: center;
  background: var(--sky-light); margin-top: 1rem;
}
.upgrade-hint h2 { margin-top: 0; }

/* Stage C:候選人面的逐項考核 */
.assessment-points { margin-top: 1.75rem; }
.assessment-points h2 { margin-bottom: 0.75rem; }
.assessment-point-link { display: inline-block; margin: 0.25rem 0; font-size: 0.85rem; color: var(--sky-dark); text-decoration: none; font-weight: 600; }
.assessment-point-link:hover { text-decoration: underline; }
.convo-bubble[id^="fu-"] { scroll-margin-top: 70px; }
.assessment-point {
  border: 1px solid var(--border); border-left: 4px solid var(--sky); border-radius: 10px;
  padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; background: var(--white);
}
.assessment-point-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.assessment-point-title { font-weight: 700; color: var(--text); }
.assessment-point-fb { margin: 0.2rem 0; line-height: 1.6; }
.assessment-point-meta { margin: 0.2rem 0; line-height: 1.6; font-size: 0.9rem; }
.assessment-point-meta strong { color: var(--text); }
.assessment-point-evidence { color: var(--text-muted); border-left: 3px solid var(--border); padding-left: 0.6rem; }
.assessment-point-sug { margin: 0.2rem 0; line-height: 1.6; color: var(--text-muted); font-size: 0.92rem; }
.assess-status { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.assess-satisfied, .assess-resolved { background: #e0ffe0; color: #1e8449; }
.assess-unresolved { background: #fff3e0; color: #b9770e; }
.assess-unanswered { background: var(--error-bg); color: var(--error); }
.grade-chip { font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.grade-strong { background: #e0ffe0; color: #1e8449; }
.grade-good { background: #e0f7ff; color: #2471a3; }
.grade-needs_work { background: #fff3e0; color: #b9770e; }
.grade-missing { background: var(--error-bg); color: var(--error); }

/* DB-8:結構化版就緒提示按鈕(由使用者自己決定要不要 refresh) */
.feedback-refresh { margin: 0.75rem 0; }
.feedback-refresh-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.1rem; border: 1.5px solid var(--sky-dark); border-radius: 999px;
  background: var(--sky-light); color: var(--sky-dark); font-weight: 600; font-size: 0.92rem;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.feedback-refresh-btn:hover { background: var(--sky); color: var(--text); }

/* 賽後檢討對話 */
.debrief { margin-top: 2rem; padding-top: 1.5rem; border-top: 2px solid var(--border); }
.debrief-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin: 0 0 0.25rem; }
.debrief-intro { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1rem; }
.debrief-thread { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.debrief-ask-this {
  margin-left: 0.5rem; padding: 1px 8px; font-size: 0.72rem; font-weight: 600;
  color: var(--sky-dark); background: var(--sky-light); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer;
}
.debrief-ask-this:hover { background: var(--sky); color: var(--text); }
.debrief-anchor {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--text); background: var(--sky-light);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.7rem; margin-bottom: 0.5rem;
}
.debrief-anchor-x {
  margin-left: auto; border: none; background: none; color: var(--text-muted);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.debrief-anchor-tag { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); margin-left: 0.4rem; }

/* 每則回答旁顯示該題用時 */
.bubble-time {
  font-size: 0.72rem; font-weight: 600; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.case-bubble-candidate .bubble-time { display: block; margin-top: 0.35rem; opacity: 0.85; }
.convo-label .bubble-time { margin-left: 0.5rem; }
.btn-hint {
  padding: 0.75rem 1.1rem; background: var(--white); color: var(--pink-dark);
  border: 1.5px solid var(--pink); border-radius: 12px; font-size: 0.9rem;
  font-weight: 600; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.btn-hint:hover { background: var(--error-bg); }
.btn-hint:disabled { opacity: 0.6; cursor: not-allowed; }

/* 提示泡泡:有別於一般面試官對話 */
.case-bubble-hint {
  align-self: flex-start; background: #FFF7E6; border: 1px solid #F6D98A; color: #5d4e0a;
}
.case-hint-label { font-weight: 700; margin-right: 0.4rem; }

.case-eval {
  border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem 1.5rem;
  background: var(--white); margin-bottom: 1rem; box-shadow: 0 2px 12px rgba(109, 184, 216, 0.14);
}
.case-eval-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.case-eval-head h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.case-eval-total {
  display: inline-flex; align-items: baseline; gap: 1px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--sky), var(--sky-dark)); color: var(--white);
  padding: 0.35rem 0.95rem; border-radius: 999px; box-shadow: 0 2px 6px rgba(109, 184, 216, 0.35);
}
.case-eval-total-num { font-size: 1.35rem; font-weight: 800; line-height: 1; }
.case-eval-total-max { font-size: 0.8rem; font-weight: 600; opacity: 0.9; }

.case-eval-scores {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem; margin-bottom: 1.25rem;
}
.case-score { background: var(--sky-light); border-radius: 12px; padding: 0.55rem 0.7rem; }
.case-score-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.4rem; }
.case-score-name { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.case-score-val { font-size: 1.05rem; font-weight: 800; color: var(--sky-dark); }
.case-score-max { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.case-score-bar { height: 6px; background: var(--white); border-radius: 999px; overflow: hidden; }
.case-score-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sky), var(--sky-dark)); }

.case-eval-dim { margin-bottom: 0.85rem; }
.case-eval-dim-name { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.case-eval-dim p { margin: 0; font-size: 0.9rem; line-height: 1.6; color: var(--text); }
.case-eval-evidence { margin: 0.35rem 0 0; padding: 0.4rem 0.7rem; border-left: 3px solid var(--sky); background: var(--sky-light); border-radius: 0 6px 6px 0; font-size: 0.86rem; line-height: 1.55; color: var(--text-muted); }
.case-eval-evidence-label { font-weight: 700; color: var(--sky-dark); margin-right: 0.3rem; }
.case-eval-target { margin: 0.35rem 0 0; font-size: 0.88rem; line-height: 1.55; color: var(--text); }
.case-eval-target-label { font-weight: 700; color: var(--pink-dark); margin-right: 0.3rem; }

/* admin case session：證據引用(候選人原話) */
.cs-evidence { margin: 0.25rem 0 0; padding: 0.4rem 0.75rem; border-left: 3px solid var(--sky); background: var(--sky-light); border-radius: 0 6px 6px 0; font-size: 0.9rem; line-height: 1.55; color: var(--text); }
.case-eval-overall { background: var(--sky-light); border-radius: 12px; padding: 0.8rem 1rem; margin: 1rem 0; }
.case-eval-overall p { margin: 0; line-height: 1.65; color: var(--text); }
.case-eval-goals h4 { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.case-eval-goals ol { margin: 0; padding-left: 1.2rem; }
.case-eval-goals li { margin: 0.3rem 0; line-height: 1.55; color: var(--text); }

/* Case 題庫(/cases)與詳情(/cases/:id)*/
.case-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.case-card {
  display: block;
  padding: 1.1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(109, 184, 216, 0.18);
  border-color: var(--sky-dark);
}
.case-card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.6rem; color: var(--text); }
.case-card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.case-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--sky-light);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.case-pill--easy { background: #E8F6EC; color: #2E7D32; border-color: #BFE3C8; }
.case-pill--medium { background: var(--sky-light); color: var(--sky-dark); border-color: var(--border); }
.case-pill--hard { background: var(--error-bg); color: var(--error); border-color: #F6C9D4; }

.case-brief {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.case-brief-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.7rem; color: var(--text); }
.case-brief-prompt {
  margin: 1.1rem 0 1.4rem;
  padding: 1rem 1.1rem;
  background: var(--sky-light);
  border-left: 4px solid var(--sky-dark);
  border-radius: 12px;
  line-height: 1.65;
  color: var(--text);
}
.case-start {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 10px;
  background: var(--sky-dark);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.case-start:hover { background: #5AAACF; }
.case-back { display: inline-block; margin-top: 1.2rem; color: var(--sky-dark); text-decoration: none; font-size: 0.9rem; }
.case-back:hover { text-decoration: underline; }
