/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 22px;
  border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 700; font-size: 17px; cursor: pointer;
  text-decoration: none; transition: transform .12s var(--ease), box-shadow .12s, background-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-deep); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hi); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); box-shadow: 0 2px 0 var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--dot); }
.btn-quiet { background: none; color: var(--ink-soft); padding-inline: 12px; }
.btn-quiet:hover:not(:disabled) { background: var(--paper-deep); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 3px 0 #2c6744; }
.btn-lg { min-height: 58px; font-size: 19px; padding-inline: 30px; }

/* 卡片 */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }

/* 首頁工坊卡 */
.ws-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); position: relative; min-height: 190px; transition: transform .18s var(--ease), box-shadow .18s; }
a.ws-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.ws-card .ws-art { height: 84px; border-radius: 14px; background: var(--paper-deep); display: grid; place-items: center; overflow: hidden; }
.ws-card .ws-art svg { height: 70px; width: auto; }
.ws-card .tag { position: absolute; top: 14px; right: 14px; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--ok-soft); color: var(--ok); }
.ws-card.soon { opacity: .78; box-shadow: none; background: transparent; border-style: dashed; }
.ws-card.soon .tag { background: var(--paper-deep); color: var(--muted); }
.ws-card .domain { font-size: 13px; color: var(--muted); }

/* 工坊首頁的三個主要動作 */
.actions { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.action { display: flex; flex-direction: column; gap: 8px; padding: 24px; text-decoration: none; color: var(--ink); transition: transform .18s var(--ease), box-shadow .18s; }
.action:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.action .who { font-size: 13px; font-weight: 700; color: var(--accent-deep); }
.action .go { margin-top: auto; color: var(--accent-deep); font-weight: 700; }
.action svg.icon { width: 46px; height: 46px; }

/* 題型卡 */
.types { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.type-card { display: grid; grid-template-columns: 1fr; gap: 8px; text-align: left; padding: 16px; font: inherit; color: var(--ink); cursor: pointer; border: 2px solid var(--line); }
.type-card .ill { background: var(--paper); border-radius: 12px; padding: 8px; }
.type-card .ill svg { display: block; width: 100%; height: auto; }
.type-card .skill { font-size: 14px; color: var(--muted); }
.type-card[aria-pressed="true"], .type-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.type-card .check { justify-self: start; font-size: 13px; font-weight: 700; color: var(--accent-deep); visibility: hidden; }
.type-card[aria-checked="true"] .check { visibility: visible; }

/* 晶片（篩選、單選） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 16px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--card);
  color: var(--ink); font: inherit; font-size: 16px; cursor: pointer;
}
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > .label { font-weight: 700; font-size: 15px; color: var(--ink-soft); }
.field > .hint { font-size: 14px; color: var(--muted); }
.input { min-height: var(--tap); border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 8px 14px; font: inherit; background: var(--card); color: var(--ink); width: 100%; max-width: 420px; }

/* 步驟條 */
.stepper { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; counter-reset: s; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; }
.stepper li + li::before { content: ""; width: 22px; height: 2px; background: var(--line-strong); }
.stepper .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--paper-deep); color: var(--muted); font-size: 15px; }
.stepper li[aria-current="step"] { color: var(--ink); font-weight: 700; }
.stepper li[aria-current="step"] .n { background: var(--accent); color: #fff; }
.stepper li.done .n { background: var(--ok); color: #fff; }
.stepper a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }

/* 精靈版面：主內容＋摘要 */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.wizard .summary { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; }
.summary dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; }
.wizard-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .wizard .summary { position: static; order: -1; }
  .summary dl { grid-template-columns: repeat(2, auto 1fr); }
}
@media (max-width: 520px) { .summary dl { grid-template-columns: auto 1fr; } }

/* 題目卡（選題） */
.picks { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.pick { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.pick svg { width: 100%; height: auto; display: block; }
.pick b { font-family: var(--font-title); font-size: 18px; line-height: 1.2; }
.pick .meta { font-size: 13px; color: var(--muted); }
.pick .no { position: absolute; top: 4px; right: 4px; min-width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; padding: 0 8px; font-weight: 700; font-size: 15px; background: var(--card); border: 2px solid var(--line-strong); color: transparent; }
.pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick[aria-pressed="true"] .no { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; }
.pager span { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.tabs { display: inline-flex; background: var(--paper-deep); border-radius: 999px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.tabs button { min-height: 44px; border: 0; background: none; border-radius: 999px; padding: 6px 18px; font: inherit; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.empty { padding: 20px; border-radius: 16px; background: var(--paper-deep); color: var(--ink-soft); }

/* 學習單預覽 */
.sheets { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.sheets svg.sheet { width: 100%; max-width: 640px; height: auto; background: #fff; box-shadow: var(--shadow-up); border-radius: 4px; }
.sheet-label { font-size: 14px; color: var(--muted); }
.note-box { background: var(--gold-soft); border-radius: 14px; padding: 12px 16px; font-size: 15px; color: var(--ink-soft); }

/* 線上練習 */
.play { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.play.solo { grid-template-columns: minmax(0, 1fr); max-width: 720px; margin: 0 auto; width: 100%; }
@media (max-width: 820px) { .play { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel .panel-title { font-weight: 700; color: var(--ink-soft); font-size: 15px; }
.example svg, .board svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.board-wrap { display: flex; flex-direction: column; gap: 12px; }
.board { background: var(--card); border-radius: var(--r); border: 1.5px solid var(--line); padding: 8px; max-width: min(100%, calc(100vh - 230px)); width: 100%; margin: 0 auto; }
.board svg { cursor: crosshair; }
.board.erase svg { cursor: pointer; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.progress { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.progress i { width: 14px; height: 14px; border-radius: 50%; background: var(--line-strong); }
.progress i.cur { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.progress i.ok { background: var(--ok); }
.progress i.retry { background: var(--gold); }
.feedback { border-radius: 16px; padding: 14px 18px; font-size: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.feedback.ok { background: var(--ok-soft); color: #2c6744; }
.feedback.try { background: var(--gold-soft); color: var(--ink); }
.arrow-steps { display: flex; flex-direction: column; gap: 10px; }
.arrow-steps .stroke { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.arrow-steps .start { width: 30px; height: 30px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 700; margin-right: 6px; flex: none; }
.arrow-steps .arr { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; }
.arrow-steps .arr svg { width: 22px; height: 22px; }
.arrow-steps .gap { width: 10px; }
.memory-cover { display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px; background: repeating-linear-gradient(45deg, var(--paper-deep) 0 12px, var(--paper) 12px 24px); color: var(--ink-soft); font-weight: 700; text-align: center; padding: 16px; }
.done-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.done-item { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: 14px; padding: 10px; border: 1.5px solid var(--line); }
.done-item svg { width: 56px; height: 56px; flex: none; }

/* 自己出題 */
.mine-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mine-item { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.mine-item svg { width: 100%; height: auto; }
.mine-item .row { gap: 6px; }
.mine-item .btn { min-height: 40px; padding: 6px 12px; font-size: 15px; flex: 1; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 12px 22px; border-radius: 999px; font-size: 16px; z-index: 60; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow-up); }
table.records { width: 100%; border-collapse: collapse; font-size: 15px; }
table.records th, table.records td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
@media (max-width: 820px) {
  .play .example { max-width: 240px; margin: 0 auto; width: 100%; }
}
