/* site/assets/style.css — 素描本風格（Sketchbook）樣式表 */
/* 靈感來源：白紙、黑色墨線、亮黃色重點色、手寫感字體 */

:root {
  /* 1-1 顏色 token（淺色：白天的素描本） */
  --paper: #FBF8F1;
  --paper-2: #F3EEE2;
  --ink: #1F1F1F;
  --ink-2: #5E5A52;
  --rule: #D9D2C3;
  --highlight: #FFD43B;
  --on-highlight: #1F1F1F;
  --pencil-red: #C92A2A;
  --pencil-green: #2B8A3E;
  --tape: rgba(255, 212, 59, 0.55);

  /* 1-2 字體 token（字重一律 400） */
  --font-hand: "Iansui", "BiauKai", "DFKai-SB", "Kaiti TC", "PingFang TC", "Microsoft JhengHei", serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;

  /* 1-3 線條與形狀 token */
  --line: 1.5px solid var(--ink);
  --line-dashed: 1.5px dashed var(--ink);
  --wobble-1: 10px 14px 9px 12px;
  --wobble-2: 12px 9px 14px 10px;
  --wobble-3: 9px 12px 10px 14px;
  --pill: 999px;

  /* 別名相容 token（供特定邏輯與樣式使用） */
  --bg-color: var(--paper);
  --card-bg: var(--paper);
  --text-main: var(--ink);
  --text-muted: var(--ink-2);
  --border-color: var(--ink);
  --primary: var(--highlight);
  --danger: var(--pencil-red);
  --success: var(--pencil-green);
  --warning: var(--ink-2);
  color-scheme: light;
}

/* 全域重設與基礎排版 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background-color: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 標題與重點文字使用手寫字體，字重一律 400 */
h1, h2, h3, h4, h5, h6, button, .brand-title, .pill, .quota-indicator {
  font-family: var(--font-hand);
  font-weight: 400;
}

/* 測試模式黃色便利貼（3-1） */
.mock-banner {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
  font-family: var(--font-hand);
  font-size: 13px;
  padding: 4px 14px;
  transform: rotate(-1deg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 90%;
  margin: 10px 24px 8px auto;
  border-radius: 2px;
}

@media (max-width: 640px) {
  .mock-banner {
    margin: 8px auto;
    font-size: 12px;
  }
}

/* 頁面主要容器 */
.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

/* 頁首 Header（3-2） */
.header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 16px 20px;
  position: relative;
  z-index: 50;
}

.header-content {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.brand-icon {
  display: none;
}

.doodle-pencil {
  color: var(--ink);
  flex-shrink: 0;
}

.squiggle {
  display: block;
  margin-top: 3px;
  color: var(--ink);
}

.brand-school {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 2px;
}

.status-badge-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.status-indicator {
  font-family: var(--font-hand);
  font-size: 14px;
  border-radius: var(--pill);
  padding: 4px 14px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--line);
  white-space: nowrap;
}

.status-indicator.open {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
}

.status-indicator.closed {
  background: transparent;
  color: var(--pencil-red);
  border: 1.5px solid var(--pencil-red);
}

.quota-indicator {
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--ink-2);
  text-align: right;
  white-space: nowrap;
}

/* 提示訊息（3-8 老師的批註） */
.alert-box {
  border-left: 3px solid var(--pencil-red);
  padding: 4px 0 4px 12px;
  font-family: var(--font-hand);
  color: var(--pencil-red);
  margin: 16px 0;
  font-size: 16px;
  background: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  display: flex;
  align-items: center;
}

.alert-box.warning {
  border-left-color: var(--ink-2);
  color: var(--ink-2);
}

.alert-box.danger {
  border-left-color: var(--pencil-red);
  color: var(--pencil-red);
}

.alert-icon {
  display: none;
}

/* 班級通行碼輸入區塊（3-9） */
.class-code-overlay {
  text-align: center;
  padding: 36px 16px;
}

.class-code-box {
  max-width: 360px;
  margin: 0 auto;
}

.class-code-title {
  font-size: 24px;
  margin-bottom: 10px;
}

.class-code-notice {
  font-family: var(--font-hand);
  color: var(--ink-2);
  margin-bottom: 18px;
  font-size: 15px;
}

.class-code-input {
  width: 100%;
  font-family: var(--font-hand);
  font-size: 36px;
  letter-spacing: 12px;
  text-align: center;
  padding: 10px 16px;
  border: var(--line);
  border-radius: var(--wobble-1);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  margin-bottom: 20px;
  min-height: 56px;
}

.class-code-input:focus {
  border-color: var(--ink);
}

/* 卡片與區塊分隔（3-3 墨線橫格、不要陰影、不要卡片色塊） */
.card {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--rule);
  padding: 22px 0;
  margin-bottom: 4px;
}

.card-title {
  font-size: 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

/* 模式選擇 Tab（3-3） */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.mode-btn {
  font-family: var(--font-hand);
  font-size: 16px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--line-dashed);
  border-radius: var(--wobble-2);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 12px;
  transition: background 0.15s;
}

.mode-btn.active {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
  border-radius: var(--wobble-1);
}

/* 照片上傳區域 */
.photo-uploader {
  border: var(--line-dashed);
  border-radius: var(--wobble-2);
  padding: 20px;
  text-align: center;
  background: transparent;
  margin-bottom: 16px;
}

.upload-file-input {
  display: none;
}

.upload-trigger-btn {
  min-height: 48px;
  padding: 8px 22px;
  font-family: var(--font-hand);
  font-size: 16px;
  border-radius: var(--pill);
  background: transparent;
  border: var(--line-dashed);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.upload-trigger-btn:hover {
  background: var(--paper-2);
}

.photo-preview-box {
  margin-top: 14px;
  display: inline-block;
  position: relative;
  border: var(--line);
  padding: 6px;
  background: #FFFFFF;
  border-radius: 4px;
}


.photo-preview-img {
  max-width: 100%;
  max-height: 260px;
  display: block;
}

.remove-photo-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: var(--pill);
  background: var(--pencil-red);
  color: #FFFFFF;
  border: var(--line);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-note {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 10px;
}

/* 風格選擇卡片 Grid（3-3 手機 3 欄、桌機 4 欄） */
.styles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 640px) {
  .styles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.style-card {
  font-family: var(--font-hand);
  font-size: 15px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--line-dashed);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  text-align: center;
  user-select: none;
}

.style-card:nth-child(3n+1) { border-radius: var(--wobble-1); }
.style-card:nth-child(3n+2) { border-radius: var(--wobble-2); }
.style-card:nth-child(3n)   { border-radius: var(--wobble-3); }

.style-card:hover:not(.selected) {
  background: var(--paper-2);
}

.style-card.selected {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
}

.style-card .style-emoji {
  display: none;
}

.style-card .style-name {
  font-size: 15px;
  line-height: 1.2;
}

/* 描述小幫手（3-3 填空句設計） */
.helper-fill {
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 2.5;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  color: var(--ink);
}

.blank-input {
  display: inline-block;
  min-width: 80px;
  max-width: 170px;
  border: none;
  border-bottom: var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  text-align: center;
  padding: 0 4px;
  line-height: 1.6;
  outline: none;
}

.blank-input:focus {
  border-bottom: 2px solid var(--highlight);
}

/* 給我靈感快捷按鈕 */
.inspiration-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.inspiration-label {
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--ink-2);
}

.inspiration-btn {
  font-family: var(--font-hand);
  font-size: 14px;
  border: var(--line-dashed);
  border-radius: var(--pill);
  padding: 4px 12px;
  min-height: 36px;
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.inspiration-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
}

/* 描述文字框（3-3 橫格紙底色，唯一允許的 gradient） */
.prompt-area-wrapper {
  position: relative;
  margin-bottom: 18px;
}

.prompt-label {
  display: block;
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.prompt-textarea {
  width: 100%;
  min-height: 96px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 24px;
  padding: 0 8px;
  border: var(--line);
  border-radius: 4px;
  background: repeating-linear-gradient(transparent 0 23px, var(--rule) 23px 24px);
  color: var(--ink);
  resize: vertical;
  outline: none;
}

.prompt-textarea:focus {
  border-color: var(--ink);
}

.char-counter {
  text-align: right;
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 4px;
  font-family: var(--font-hand);
}

/* 開始按鈕（3-4） */
.action-btn {
  font-family: var(--font-hand);
  font-size: 21px;
  width: 100%;
  min-height: 54px;
  border: var(--line);
  border-radius: var(--pill);
  background: var(--highlight);
  color: var(--on-highlight);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  transition: opacity 0.15s;
}

.action-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 冷卻中：文字「休息一下，還有 N 秒」，底色透明、邊框虛線 */
.action-btn.wait,
.action-btn:disabled.wait {
  background: transparent;
  color: var(--ink);
  border: var(--line-dashed);
  opacity: 1;
}

/* 生成中的鉛筆塗鴉動畫（3-5） */
.loading-box {
  margin-top: 18px;
  text-align: center;
  padding: 16px;
  border: var(--line-dashed);
  border-radius: var(--wobble-1);
  background: transparent;
}

.sketch-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.pencil-icon {
  color: var(--ink);
  margin-bottom: 2px;
}

.doodle-wave {
  color: var(--ink);
}

@media (prefers-reduced-motion: no-preference) {
  .wave-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawWave 1.8s ease-in-out infinite alternate;
  }
  .pencil-icon {
    animation: pencilWobble 1.8s ease-in-out infinite alternate;
  }
}

@keyframes drawWave {
  0% { stroke-dashoffset: 200; }
  100% { stroke-dashoffset: 0; }
}

@keyframes pencilWobble {
  0% { transform: translate(-28px, 0) rotate(-10deg); }
  100% { transform: translate(28px, 0) rotate(12deg); }
}

.loading-tips {
  font-family: var(--font-hand);
  font-size: 15px;
  color: var(--ink-2);
  margin-top: 6px;
}

/* 生成結果展示區（3-6 紙膠帶貼在素描本上） */
.result-card {
  text-align: center;
  padding-top: 20px;
}

.artwork-display {
  position: relative;
  display: inline-block;
  margin: 28px 10px 10px;
  transform: rotate(0.8deg);
  border: var(--line);
  background: #FFFFFF;
  padding: 8px;
  max-width: 95%;
}



.artwork-display::before,
.artwork-display::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 70px;
  height: 22px;
  background: var(--tape);
  z-index: 2;
}

.artwork-display::before {
  left: -12px;
  transform: rotate(-12deg);
}

.artwork-display::after {
  right: -12px;
  transform: rotate(10deg);
}

.artwork-image {
  max-width: 100%;
  max-height: 480px;
  display: block;
}

.artwork-label {
  font-family: var(--font-hand);
  font-size: 15px;
  color: var(--ink-2);
  text-align: center;
  margin: 10px 0 16px;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-secondary {
  font-family: var(--font-hand);
  font-size: 16px;
  min-height: 48px;
  padding: 8px 24px;
  border: var(--line-dashed);
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--paper-2);
}

/* 這節課的作品歷史縮圖（3-7 小拍立得風格） */
.gallery-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 6px;
  align-items: flex-end;
}

.gallery-thumb {
  width: 68px;
  height: 80px;
  background: #FFFFFF;
  border: var(--line);
  padding: 4px 4px 14px;
  cursor: pointer;
  flex-shrink: 0;
  object-fit: cover;
  box-sizing: border-box;
}



.gallery-thumb:nth-child(3n+1) { transform: rotate(-2deg); }
.gallery-thumb:nth-child(3n+2) { transform: rotate(1deg); }
.gallery-thumb:nth-child(3n)   { transform: rotate(-1deg); }

.gallery-thumb.active {
  border-bottom: 4px solid var(--highlight);
}

/* 頁尾 Footer（3-10） */
.footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--ink-2);
  font-size: 13px;
  border-top: 1px solid var(--rule);
  margin-top: auto;
  line-height: 1.6;
}

/* -------------------------------------------------------------
 * 4. 老師頁 admin.html 特有樣式（老師的備課本）
 * ------------------------------------------------------------- */
/* 老師頁的紀錄表有 9 欄，760px 放不下，「封鎖此裝置」按鈕會被擠到看不見的地方 */
.container.admin-wide,
.header-content.admin-wide {
  max-width: 1120px;
}

.admin-badge {
  background: transparent;
  color: var(--ink);
  border: var(--line);
  padding: 2px 8px;
  border-radius: var(--pill);
  font-size: 12px;
  margin-left: 8px;
  font-family: var(--font-hand);
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .admin-grid-2 {
    grid-template-columns: 1fr;
  }
}

.quick-switch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.quick-btn {
  font-family: var(--font-hand);
  min-height: 48px;
  padding: 8px 16px;
  font-size: 15px;
  border: var(--line-dashed);
  border-radius: var(--wobble-1);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.quick-btn:hover {
  background: var(--paper-2);
}

.quick-btn.active {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
}

/* 班級通行碼投影大字（4-2） */
.class-code-display {
  font-family: var(--font-hand);
  font-size: 96px;
  line-height: 1;
  text-align: center;
  padding: 24px 12px;
  border: var(--line);
  border-radius: var(--wobble-2);
  background: repeating-linear-gradient(transparent 0 23px, var(--rule) 23px 24px);
  color: var(--ink);
  margin: 16px 0;
  letter-spacing: 8px;
}

@media (max-width: 640px) {
  .class-code-display {
    font-size: 64px;
    letter-spacing: 4px;
    padding: 16px 8px;
  }
}

/* 學生網址卡片樣式（6 節） */
.student-urls-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.student-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-2);
  padding: 8px 12px;
  border-radius: var(--wobble-1);
  border: var(--line-dashed);
}

.url-level-badge {
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: bold;
  min-width: 52px;
  color: var(--ink);
}

.url-display {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-url-btn {
  padding: 4px 14px;
  font-size: 13px;
  min-height: 36px;
  cursor: pointer;
  white-space: nowrap;
}

/* 今日額度與用量進度條（4-3） */
.stats-bar-box {
  margin: 12px 0;
}

.stats-bar-track {
  height: 16px;
  border: var(--line);
  border-radius: var(--pill);
  background: transparent;
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  background: var(--highlight);
  transition: width 0.3s;
}

.stats-data-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--ink);
}

/* 統計數字卡片 */
.stats-numbers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 640px) {
  .stats-numbers-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-item {
  border: var(--line-dashed);
  border-radius: var(--wobble-1);
  padding: 10px;
  text-align: center;
}

.stat-item .stat-label {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 2px;
}

.stat-item .stat-val {
  font-family: var(--font-hand);
  font-size: 22px;
}

.stat-val.success { color: var(--pencil-green); }
.stat-val.failure { color: var(--ink-2); }
.stat-val.blocked { color: var(--pencil-red); }

/* 限額設定表單（4-4 只有底線） */
.admin-field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .admin-field-grid {
    grid-template-columns: 1fr;
  }
}

.helper-field label {
  display: block;
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 4px;
}

.helper-field input[type="number"],
.helper-field input[type="password"],
.helper-field select {
  width: 100%;
  border: none;
  border-bottom: var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 8px 4px;
  min-height: 48px;
  outline: none;
  border-radius: 0;
}

.helper-field input:focus,
.helper-field select:focus {
  border-bottom: 2px solid var(--highlight);
}

/* 日誌表格（4-5） */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.admin-table th {
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 400;
  border-bottom: var(--line);
  padding: 10px 8px;
  color: var(--ink);
  white-space: nowrap;
}

.admin-table td {
  border-bottom: 1px solid var(--rule);
  padding: 10px 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}

.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-hand);
  border: 1px solid transparent;
}

.badge-tag.success {
  border-color: var(--pencil-green);
  color: var(--pencil-green);
}

.badge-tag.fail,
.badge-tag.block {
  border-color: var(--pencil-red);
  color: var(--pencil-red);
}

/* 裝置封鎖按鈕 */
.block-btn {
  color: var(--pencil-red) !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font-hand);
  font-size: 13px;
  padding: 4px 6px;
}

.unblock-btn {
  border: var(--line-dashed) !important;
  background: transparent !important;
  color: var(--ink) !important;
  border-radius: var(--pill) !important;
  padding: 4px 10px !important;
  cursor: pointer;
  font-family: var(--font-hand);
  font-size: 13px;
}

/* =========================================================
   年段分級樣式（規格：說明/改版規格_年段分級.md）
   ========================================================= */

/* 頁首年段標籤與切換按鈕 */
.level-nav-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
}

.level-badge-name {
  background: var(--highlight);
  color: var(--on-highlight);
  font-family: var(--font-hand);
  font-size: 14px;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: var(--pill);
  border: var(--line);
}

.change-level-btn {
  background: transparent;
  border: none;
  color: var(--ink-2);
  font-family: var(--font-hand);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
}

.change-level-btn:hover {
  color: var(--ink);
}

/* 年段選擇大卡片畫面 */
.level-picker-section {
  text-align: center;
  padding: 28px 20px;
}

.level-picker-title {
  font-size: 24px;
  margin-bottom: 6px;
  justify-content: center;
}

.level-picker-subtitle {
  color: var(--ink-2);
  font-size: 15px;
  margin-bottom: 24px;
}

.level-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 720px) {
  .level-cards-grid {
    grid-template-columns: 1fr;
  }
}

.level-card {
  background: var(--paper-2);
  border: var(--line);
  border-radius: var(--wobble-1);
  padding: 24px 18px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s, box-shadow 0.15s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.level-card:hover {
  transform: translateY(-2px);
  background: #FFFFFF;
  box-shadow: 2px 3px 0 var(--ink);
}

.level-card-tag {
  display: inline-block;
  font-size: 12px;
  font-family: var(--font-hand);
  background: var(--highlight);
  color: var(--on-highlight);
  padding: 2px 10px;
  border-radius: var(--pill);
  border: 1px solid var(--ink);
  margin-bottom: 10px;
}

.level-card-name {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--font-hand);
}

.level-card-desc {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 範本卡共通網格 */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.template-card {
  background: var(--paper-2);
  border: var(--line-dashed);
  border-radius: var(--wobble-2);
  padding: 12px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-card:hover {
  background: #FFFFFF;
  transform: translateY(-1px);
}

.template-card.selected {
  border: var(--line);
  background: #FFFFFF;
  outline: 2px solid var(--highlight);
}

.template-title {
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: bold;
  color: var(--ink);
}

.template-tip {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.4;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--rule);
}

.template-credit {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 4px;
}

/* 中年級詞卡 */
.middle-slots-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 14px 0;
}

.slot-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-row-label {
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: bold;
  color: var(--ink);
}

.slot-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-chip {
  background: var(--paper-2);
  border: var(--line-dashed);
  border-radius: var(--pill);
  padding: 6px 14px;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s;
  user-select: none;
}

.word-chip:hover {
  background: #FFFFFF;
}

.word-chip.selected {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
  font-weight: bold;
}

.word-custom-input {
  max-width: 130px;
  border: var(--line);
  background: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--pill);
  font-size: 14px;
  font-family: var(--font-body);
}

.middle-sentence-box {
  margin-top: 18px;
  padding: 16px;
  border: var(--line);
  border-radius: var(--wobble-1);
  background: #FFFFFF;
}

.middle-sentence-label {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-family: var(--font-hand);
}

.middle-assembled-sentence {
  font-size: 22px;
  font-family: var(--font-hand);
  line-height: 1.5;
  color: var(--ink);
}

/* 高年級填空與細節 */
.upper-blanks-box, .upper-extras-box {
  margin: 12px 0;
}

.upper-box-label {
  font-size: 14px;
  font-family: var(--font-hand);
  font-weight: bold;
  color: var(--ink);
  margin-bottom: 8px;
}

.upper-blanks-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.upper-blank-item {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.upper-blank-label {
  font-size: 12px;
  color: var(--ink-2);
  font-family: var(--font-hand);
}

.upper-extras-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.extra-chip {
  background: var(--paper-2);
  border: var(--line-dashed);
  border-radius: var(--pill);
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s;
}

.extra-chip:hover {
  background: #FFFFFF;
}

.extra-chip.selected {
  background: var(--highlight);
  color: var(--on-highlight);
  border: var(--line);
  font-weight: bold;
}

/* 國中提示詞架構說明 */
.junior-structure-card {
  margin-bottom: 16px;
}

.junior-structure-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.junior-blocks-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}

.junior-block-item {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--ink);
  font-family: var(--font-hand);
  font-size: 14px;
  font-weight: bold;
  color: #1F1F1F;
}

.junior-quote-box {
  background: var(--paper-2);
  border-left: 4px solid var(--highlight);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--ink);
  margin-top: 10px;
  line-height: 1.6;
}

/* 國中八段卡片 */
.junior-segments-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.segment-card {
  background: var(--paper);
  border: var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  transition: outline 0.15s, opacity 0.2s, background-color 0.2s;
}

.segment-card.highlighted {
  outline: 3px solid var(--highlight);
}

.segment-card.segment-disabled {
  opacity: 0.55;
  background: var(--paper-2);
}

.segment-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.segment-title {
  font-family: var(--font-hand);
  font-size: 17px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.segment-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.segment-skip-label {
  font-size: 13px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.segment-question {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.segment-textarea {
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  border: var(--line);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 14px;
  background: #FFFFFF;
  color: var(--ink);
  resize: vertical;
  line-height: 1.5;
}

.segment-note {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 6px;
  background: var(--paper-2);
  padding: 6px 10px;
  border-radius: 4px;
  line-height: 1.4;
}

.segment-effect-toggle {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 6px;
  cursor: pointer;
  text-decoration: underline;
  display: inline-block;
}

.segment-effect-text {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--rule);
  line-height: 1.4;
}

.segment-missing-text {
  font-size: 13px;
  color: var(--pencil-red);
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(201, 42, 42, 0.08);
  border-radius: 4px;
  line-height: 1.4;
}

.segment-conflict-note {
  font-size: 13px;
  color: var(--pencil-red);
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(255, 169, 77, 0.2);
  border-radius: 4px;
  line-height: 1.4;
}

/* 完整提示詞預覽（彩色底線） */
.junior-preview-card {
  margin-top: 14px;
}

.junior-preview-box {
  background: #FFFFFF;
  border: var(--line);
  border-radius: 4px;
  padding: 16px;
  font-size: 15px;
  line-height: 2.2;
  min-height: 80px;
  color: var(--ink);
}

.preview-segment-span {
  display: inline;
  margin-right: 4px;
  padding-bottom: 2px;
  cursor: pointer;
  transition: background-color 0.15s, outline 0.15s;
}

.preview-segment-span:hover,
.preview-segment-span.highlighted {
  background-color: rgba(255, 212, 59, 0.35);
  border-radius: 2px;
}

/* 八段顏色 class 定義（規格 5-3） */
.seg-subject { border-left: 6px solid #FFD43B; }
.seg-action { border-left: 6px solid #8CE99A; }
.seg-setting { border-left: 6px solid #74C0FC; }
.seg-composition { border-left: 6px solid #FFA8A8; }
.seg-lighting { border-left: 6px solid #FFA94D; }
.seg-material { border-left: 6px solid #E599F7; }
.seg-style { border-left: 6px solid #B197FC; }
.seg-constraints { border-left: 6px solid #ADB5BD; }

.hl-subject { border-bottom: 3px solid #FFD43B; }
.hl-action { border-bottom: 3px solid #8CE99A; }
.hl-setting { border-bottom: 3px solid #74C0FC; }
.hl-composition { border-bottom: 3px solid #FFA8A8; }
.hl-lighting { border-bottom: 3px solid #FFA94D; }
.hl-material { border-bottom: 3px solid #E599F7; }
.hl-style { border-bottom: 3px solid #B197FC; }
.hl-constraints { border-bottom: 3px solid #ADB5BD; }

.bg-subject { background-color: #FFD43B; }
.bg-action { background-color: #8CE99A; }
.bg-setting { background-color: #74C0FC; }
.bg-composition { background-color: #FFA8A8; }
.bg-lighting { background-color: #FFA94D; }
.bg-material { background-color: #E599F7; }
.bg-style { background-color: #B197FC; }
.bg-constraints { background-color: #ADB5BD; }

/* 提示詞小實驗便條 */
.junior-experiment-card {
  background: #FFF9DB;
  border: var(--line-dashed);
  border-radius: var(--wobble-3);
  padding: 14px 16px;
  margin-top: 14px;
}

.junior-experiment-title {
  font-family: var(--font-hand);
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--ink);
}

.junior-experiment-body {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

/* 照片提示與風格說明文字 */
.photo-input-hint {
  background: var(--paper-2);
  border: var(--line-dashed);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  border-radius: 4px;
  margin-bottom: 12px;
  text-align: center;
}

.style-note-text {
  font-size: 13px;
  color: var(--ink-2);
}

