body {
  background-color: #f4f6f5;
  font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
}

.w17-header {
  background: #2f6f4e;
  color: #fff;
  padding: 10px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.w17-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}

.w17-brand:hover {
  color: #fff;
}

.w17-brand img {
  height: 40px;
}

.w17-user {
  font-size: 0.95rem;
}

/* -------------------- 整體卡片 -------------------- */
.container-card {
  background-color: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
  overflow: visible;
}

.alert-info {
  border-left: 6px solid #0d6efd;
  font-size: 0.95rem;
}

.sticky-info-wrap {
  position: sticky;
  top: 12px;
  z-index: 20;
  background: #fff;
  padding-top: 4px;
  padding-bottom: 4px;
}

.w17-noclass-label {
  font-size: 1.15rem;
}

/* -------------------- 選項按鈕 -------------------- */
.option-btn {
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  max-width: 150px;
  flex: 1 1 auto;
  margin-bottom: 0.25rem;
  border-radius: 6px;
}

.option-btn input {
  display: none;
}

.option-btn.active,
.option-btn:has(input:checked) {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
  font-weight: 600;
}

/* -------------------- Accordion / 題目 -------------------- */
.accordion {
  overflow: visible;
}

.accordion-button {
  background-color: #f8f9fa;
  font-weight: 600;
}

.accordion-item {
  border: none;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.accordion-body {
  max-height: 50vh;
  overflow-y: auto;
  padding: 1rem;
}

.question-card {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.question-card .fw-bold {
  white-space: normal;
}

/* 手機預設收合；桌面只顯示完整說明 */
.fill-guide-compact {
  display: none;
}

.error-highlight {
  border: 2px solid red !important;
  background-color: #ffe6e6 !important;
}

.form-control-comment {
  border-radius: 10px;
  padding: 12px;
  background-color: #fdfdfd;
  min-height: 80px;
  resize: vertical;
}

/* -------------------- AI 回饋 -------------------- */
.swal2-popup.w17-eval-popup {
  max-width: 1100px;
  padding: clamp(1rem, 2.5vw, 2rem);
}

.w17-eval-popup .w17-eval-title {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
  padding-top: 0.25rem;
}

.w17-eval-popup .w17-eval-html {
  margin: 1rem 0 0;
  padding: 0;
}

.w17-eval-popup .w17-eval-confirm {
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.25rem);
  padding: 0.6em 2.2em;
}

.w17-eval-summary {
  text-align: left;
  font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.4rem);
  max-height: calc(100vh - 14rem);
  max-height: calc(100dvh - 14rem);
  overflow-y: auto;
  padding: 0 0.75rem 0 0.25rem;
}

.w17-eval-chart-head {
  text-align: center;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 3px solid #0d6efd;
}

.w17-eval-chart-teacher {
  color: #0d6efd;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  font-weight: 800;
  line-height: 1.4;
}

.w17-eval-chart-range {
  color: #64748b;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 2px;
}

.w17-eval-chart-box {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 380px;
  margin: 8px 0 4px;
  padding-left: 28px;
}

.w17-eval-chart-scroll {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.w17-eval-chart-canvas {
  height: 100%;
  min-width: 100%;
}

.w17-eval-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 0 0 16px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.w17-eval-chart-legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: -2px;
}

.w17-eval-chart-ylabel {
  position: absolute;
  left: 0;
  top: 42%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-weight: 700;
  color: #666;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 2px;
}

.w17-eval-summary p {
  margin-bottom: 0.9em;
  line-height: 1.85;
}

.w17-eval-summary .w17-eval-heading {
  font-weight: 700;
  color: #2f6f4e;
  margin-bottom: 0.25rem;
}

/* -------------------- AI 評鑑列表（weekly17-evaluations.html） -------------------- */

.w17e-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.w17e-toolbar h3 {
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.6rem);
  font-weight: 700;
}

.w17e-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.w17e-filters .form-select {
  width: auto;
  min-width: 9rem;
  border-radius: 999px;
}

.w17e-table {
  font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
}

.w17e-table thead th {
  background: #eef4fb;
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid #d8e3f0;
}

.w17e-table td {
  white-space: nowrap;
}

.w17e-pill {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: #eef4fb;
  border: 1px solid #d8e3f0;
  color: #1e3a5f;
  font-weight: 600;
}

.w17e-pill-muted {
  background: #f4f6f9;
  border-color: #e5e9ef;
  color: #334155;
  font-weight: 500;
}

.w17e-btn-eval {
  background: #1f5aa6;
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.3rem 0.9rem;
}

.w17e-btn-eval:hover,
.w17e-btn-eval:focus {
  background: #174a8b;
  color: #fff;
}

.w17e-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e9ef;
}

@media (max-width: 576px) {
  .container-card {
    padding: 0.75rem;
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
  }

  .container-card > h3,
  #w17FormSection > h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem !important;
  }

  .w17-header .container {
    gap: 8px;
  }

  .w17-brand {
    font-size: 1rem;
    min-width: 0;
  }

  .w17-brand span {
    white-space: nowrap;
  }

  .w17-header .btn {
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
  }

  .sticky-info-wrap {
    position: static;
    padding: 0;
    margin-bottom: 0.75rem;
  }

  .fill-guide-full {
    display: none !important;
  }

  .fill-guide-compact {
    display: block;
  }

  .fill-guide-compact summary {
    list-style: none;
    cursor: pointer;
    background-color: #cff4fc;
    border-left: 6px solid #0d6efd;
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    font-weight: 600;
    color: #055160;
  }

  .fill-guide-compact summary::-webkit-details-marker {
    display: none;
  }

  .fill-guide-compact[open] summary {
    margin-bottom: 0.35rem;
  }

  .fill-guide-compact .alert-info {
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0;
  }

  .accordion,
  .accordion-body {
    max-height: none;
    overflow: visible;
  }

  .accordion-body {
    padding: 0.5rem 0;
  }

  .question-card {
    padding: 0.75rem 0.35rem;
  }

  .w17-eval-chart-box {
    height: 300px;
  }

  .question-card .fw-bold {
    font-size: 1.05rem;
    line-height: 1.55;
    overflow: visible;
  }

  .option-btn {
    min-width: 0;
    max-width: calc(50% - 0.25rem);
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 52px;
    font-size: 1rem;
    white-space: nowrap;
    padding: 0.35rem 0.2rem;
  }

  .option-btn:has(input:checked) {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
    font-weight: 600;
  }

  .option-btn:has(input:checked) span {
    background: transparent !important;
    color: #fff !important;
    padding: 0 !important;
    font-weight: 600;
  }

  .w17e-filters,
  .w17e-filters .form-select {
    width: 100%;
  }

  .swal2-popup.w17-eval-popup {
    width: 100% !important;
  }

  .w17-eval-summary {
    line-height: 1.75;
    padding-right: 0.4rem;
  }
}
