/* 書扉 創作後台（writer.html）
   共用的色彩、字體、按鈕、封面來自 site.css，這裡只放後台專屬樣式 */

/* —— 按鈕補充 —— */
.btn-sm {
  height: 40px;
  padding: 0 16px;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.btn-accent:hover {
  background: #a93a22;
}

.btn-text,
.btn-text-danger {
  background: transparent;
  padding: 0 12px;
}

.btn-text {
  color: var(--muted);
}

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

.btn-text-danger {
  color: #a3301c;
}

.btn-text-danger:hover {
  background: #fbe9e4;
}

.btn[aria-disabled="true"] {
  background: var(--chip);
  color: #76746e;
  cursor: not-allowed;
}

.text-plain {
  padding: 10px 0;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.text-plain:hover {
  color: var(--accent);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.writer-header .header-inner {
  gap: 12px 24px;
}

.writer-header .header-actions {
  gap: 12px 20px;
}

.writer-auth {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.writer-auth-status {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-hint.is-error {
  color: #a3301c;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line, #d5d0c8);
  background: #fff;
  color: #3c4043;
  font-weight: 600;
}

.btn-google:hover {
  background: #f8f9fa;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line, #d5d0c8);
}

/* —— 狀態標籤 —— */
.pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-live {
  background: var(--ink);
  color: var(--bg);
}

.pill-ready {
  background: #fbe9e4;
  color: #a3301c;
}

.pill-draft {
  background: var(--chip);
  color: var(--muted);
}

/* —— 版面 —— */
.writer-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 40px 48px;
  padding-block: 40px 88px;
}

.writer-side {
  flex: 1 1 240px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.side-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
}

.side-count {
  font-size: 0.75rem;
  color: var(--muted);
}

.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.work-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.work-item:hover {
  background: var(--active);
}

.work-item.is-active {
  background: var(--surface);
  border-color: var(--line);
}

.work-thumb {
  flex: 0 0 40px;
}

.cover-xs {
  border-radius: 3px;
  box-shadow: none;
}

.cover-xs .cover-text {
  display: none;
}

.work-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.work-title {
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.6875rem;
  color: var(--muted);
}

.work-sub .pill {
  height: 22px;
  padding: 0 8px;
  font-size: 0.6875rem;
}

.writer-main {
  flex: 999 1 640px;
  min-width: 0;
}

/* —— 歡迎頁 —— */
.writer-welcome {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.writer-welcome h1 {
  margin: 0;
  font-size: clamp(1.875rem, 3.4vw, 2.5rem);
  font-weight: 900;
  line-height: 1.25;
}

.welcome-lead {
  margin: 0;
  max-width: 32em;
  color: var(--muted);
}

.progress-steps {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
  width: 100%;
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
}

.progress-step.is-done {
  background: var(--bg);
  box-shadow: none;
}

.progress-label {
  flex: 1 1 auto;
  font-weight: 700;
}

.progress-state {
  font-size: 0.75rem;
  color: var(--muted);
}

.step-mark {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.is-done > .step-mark,
.is-done .step-head .step-mark {
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
}

/* —— 作品編輯頁 —— */
.editor-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.editor-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.editor-kicker,
.editor-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.editor-kicker {
  letter-spacing: 0.08em;
}

.editor-head h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 900;
}

/* 發佈狀態 */
.publish-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 40px;
  padding: 24px;
  scroll-margin-top: 6rem;
  transition: border-color 0.2s ease;
}

.publish-panel.is-almost {
  border-color: var(--accent);
}

.publish-panel-copy {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.publish-panel-copy > p {
  margin: -12px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.publish-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.publish-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
}

.publish-step.is-done {
  background: var(--bg);
  box-shadow: none;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-label {
  font-size: 0.8125rem;
  font-weight: 700;
}

.step-note {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

.publish-panel-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* 章節＋作品資訊 */
.editor-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.chapter-panel {
  flex: 999 1 420px;
  min-width: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.chapter-edit-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
}

.chapter-row {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.chapter-row:hover {
  background: var(--active);
}

.chapter-row-num,
.chapter-row-words {
  font-size: 0.75rem;
  color: var(--muted);
}

.chapter-row-words {
  min-width: 56px;
  text-align: right;
}

.chapter-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-row-title {
  font-size: 1rem;
  font-weight: 700;
}

.chapter-row-preview {
  font-family: var(--font-serif);
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 12px;
  color: var(--muted);
}

.chapter-empty p {
  margin: 0;
}

.chapter-tip {
  margin: 0 24px 20px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

.meta-form {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 24px 24px;
}

.meta-form > .btn {
  align-self: flex-start;
}

.meta-cover {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.meta-cover-art {
  flex: 0 0 96px;
}

.meta-cover-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.meta-cover-controls > p,
.cover-matte-label {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted);
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.cover-upload-btn {
  cursor: pointer;
}

.cover-upload-btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.cover-file-meta {
  margin: 0;
  font-size: 0.6875rem;
  color: var(--muted);
}

.cover-matte {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cover-matte-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cover-matte-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.cover-matte-btn::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--matte);
  box-shadow: inset 0 0 0 1px rgba(40, 32, 24, 0.12);
}

.cover-matte-btn:hover::before {
  transform: scale(1.08);
}

.cover-matte-btn[aria-pressed="true"] {
  border-color: var(--ink);
}

.cover-matte-btn[aria-pressed="true"]::before {
  box-shadow: inset 0 0 0 1px rgba(40, 32, 24, 0.2);
}

.create-cover-field > span:first-child {
  font-size: 0.8125rem;
  font-weight: 700;
}

.create-cover-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.create-cover-preview {
  flex: 0 0 72px;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35), transparent 42%),
    repeating-linear-gradient(135deg, #e8dfd2 0 8px, #e2d7c8 8px 16px);
  box-shadow: inset 0 0 0 1px rgba(40, 32, 24, 0.08);
  overflow: hidden;
}

.create-cover-preview .cover {
  box-shadow: none;
}

.create-cover-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.create-cover-controls .field-hint,
.create-cover-controls .cover-file-meta,
.create-cover-controls .cover-matte {
  flex: 1 1 100%;
}

/* —— 表單欄位 —— */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span:first-child {
  font-size: 0.8125rem;
  font-weight: 700;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.field-label-row .mono {
  font-weight: 400;
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.field input,
.field select {
  height: 44px;
  padding: 0 14px;
}

.field textarea {
  padding: 12px 14px;
  font-family: var(--font-serif);
  line-height: 1.8;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}

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

/* —— 章節編輯（整頁） —— */
.is-writing .writer-header {
  display: none;
}

.chapter-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chapter-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.chapter-bar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-block: 12px;
}

.chapter-bar .back-link {
  border: 0;
  background: transparent;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.bar-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.chapter-bar-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chapter-body {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 32px 72px;
  padding-block: 40px 0;
}

.chapter-rail {
  flex: 1 1 200px;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-rail h2 {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.chapter-rail ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.rail-item .mono {
  font-size: 0.75rem;
  color: var(--muted);
}

.rail-item:hover {
  background: var(--active);
}

.rail-item.is-active {
  background: var(--active);
  font-weight: 700;
  cursor: default;
}

.rail-item.is-active .mono {
  color: var(--accent);
}

.rail-add {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
}

.rail-add:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.chapter-writing {
  flex: 999 1 560px;
  min-width: 0;
  max-width: 34em;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-size: 18px;
}

.chapter-hint {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--chip);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #3f3e3a;
}

.chapter-title-input,
.chapter-content-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.chapter-title-input {
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.25;
}

.chapter-content-input {
  min-height: 60vh;
  padding: 8px 0 48px;
  resize: vertical;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 2;
  letter-spacing: 0.02em;
}

.chapter-title-input:focus,
.chapter-content-input:focus {
  outline: none;
}

.chapter-title-input::placeholder,
.chapter-content-input::placeholder {
  color: #9a978f;
}

.chapter-foot {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.chapter-foot-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-block: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* —— 新增作品對話框 —— */
.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(20, 20, 20, 0.45);
}

.modal::backdrop {
  background: rgba(20, 20, 20, 0.45);
}

.modal-card {
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 8px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 900;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--chip);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 24px 8px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px 24px;
}

/* —— 批次公開 —— */
#btn-batch[aria-pressed="true"] {
  background: var(--chip);
  color: var(--ink);
}

.draft-banner,
.batch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 12px 0;
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius);
}

.draft-banner {
  background: #fbe9e4;
}

.draft-banner p {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.875rem;
  font-weight: 700;
  color: #a3301c;
}

.draft-banner-actions,
.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 暖沙色工具列：跟紙色頁面同一個色系，捲動時用細邊和淡陰影浮在章節上 */
.batch-bar {
  position: sticky;
  top: 72px;
  z-index: 2;
  background: #f4efe6;
  border: 1px solid #e6ddcd;
  box-shadow: 0 8px 18px -14px rgba(20, 20, 20, 0.35);
  color: var(--ink);
}

.batch-bar .btn-text:hover {
  background: rgba(20, 20, 20, 0.05);
}

.batch-bar .btn-soft {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px #e6ddcd;
}

.batch-bar .btn-soft:hover {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.batch-bar .btn:disabled {
  opacity: 0.45;
}

.batch-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.batch-all input,
.batch-check {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--ink);
}

.batch-actions {
  margin-left: auto;
}

.chapter-row.is-selectable {
  cursor: pointer;
}

.chapter-row.is-selected {
  background: var(--active);
}

/* —— 匯入章節 —— */
.card-head-actions,
.chapter-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chapter-panel {
  position: relative;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(247, 246, 242, 0.92);
  font-weight: 700;
  color: var(--accent);
  pointer-events: none;
}

.chapter-panel.is-dropping .drop-overlay {
  display: grid;
}

.modal-wide {
  width: min(880px, calc(100vw - 32px));
}

.modal-wide .modal-card {
  max-height: calc(100vh - 48px);
}

.modal-wide .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
}

.modal-sub {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.dropzone:hover,
.dropzone.is-dragging,
.dropzone:has(+ #import-input:focus-visible) {
  border-color: var(--ink);
  color: var(--ink);
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #fbe9e4;
}

.dropzone-title {
  font-size: 1rem;
  color: var(--ink);
}

.dropzone-sub {
  font-size: 0.8125rem;
}

.dropzone-link {
  margin-inline: 4px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dropzone.is-compact {
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
}

.dropzone.is-compact svg {
  width: 18px;
  height: 18px;
}

.dropzone.is-compact .dropzone-title {
  font-size: 0.875rem;
}

.dropzone.is-compact .dropzone-sub {
  display: none;
}

.import-tips {
  margin: 0;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--muted);
}

.import-review {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.import-summary {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
}

.import-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.import-mode select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  font: inherit;
  color: var(--ink);
}

.import-errors {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8125rem;
  color: #a3301c;
}

.import-errors:empty {
  display: none;
}

.import-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.import-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 8px 12px 14px;
}

.import-item + .import-item {
  border-top: 1px solid var(--line);
}

.import-item.is-excluded .import-main {
  opacity: 0.5;
}

.import-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 13px 0 0;
  accent-color: var(--ink);
}

.import-num {
  flex: 0 0 24px;
  padding-top: 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

.import-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.import-title {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  margin-left: -10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.import-title:hover {
  border-color: var(--line);
}

.import-title:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}

.import-meta,
.import-preview,
.import-warnings {
  margin: 0;
}

.import-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.import-preview {
  font-family: var(--font-serif);
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.import-warnings .pill {
  height: 22px;
  font-size: 0.6875rem;
}

.import-order {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.import-order .icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.import-foot {
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.import-as {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.875rem;
}

.import-as label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  cursor: pointer;
}

.import-as input {
  accent-color: var(--ink);
}

.import-foot-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

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

/* —— Toast —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* —— Responsive —— */
@media (max-width: 720px) {
  .writer-side,
  .chapter-rail {
    max-width: none;
  }

  /* 手機上先寫字，章節列表放到內文後面 */
  .chapter-rail {
    order: 2;
  }

  .writer-welcome {
    padding: 28px 20px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .chapter-bar-actions {
    margin-left: 0;
    width: 100%;
  }

  .chapter-title-input {
    font-size: 2rem;
  }
}
