/* ===== CSS Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #080a0e;
  --bg2:       rgba(255,255,255,0.025);
  --bg3:       rgba(255,255,255,0.05);
  --bg4:       rgba(255,255,255,0.07);
  --border:    rgba(255,255,255,0.08);
  --border-md: rgba(255,255,255,0.12);
  --accent:    #e8a838;
  --accent2:   #f0c060;
  --accent-dim:rgba(232,168,56,0.12);
  --accent-glow:rgba(232,168,56,0.2);
  --text:      #eaecf4;
  --text-muted:#8b95b5;
  --text-dim:  #5a6080;
  --text2:     #8b95b5;
  --text3:     #5a6080;
  --green:     #3fb950;
  --red:       #f85149;
  --yellow:    #d29922;
  --blue:      #58a6ff;
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --font:      'Noto Sans JP', sans-serif;
  --font-display: 'Playfair Display', serif;
  --trans:     0.2s ease;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== Base ===== */
body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 55% at 50% -5%, rgba(232,168,56,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 85% 95%,  rgba(88,166,255,0.03)  0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
header {
  background: rgba(8,10,14,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  transition: opacity var(--trans);
}
.logo:hover { opacity: 0.85; }
.logo-img   { display: block; flex-shrink: 0; }
.logo-text  { color: var(--accent); }
.logo-sub   { color: var(--text-dim); font-size: 0.82rem; margin-left: auto; }

/* ===== Header Nav ===== */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}
.nav-link:hover  { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-link.active { background: rgba(232,168,56,0.12); color: var(--accent); }
@media (max-width: 600px) {
  .nav-link { padding: 5px 9px; font-size: 0.78rem; }
}

/* ===== Main ===== */
main { max-width: 860px; margin: 0 auto; padding: 48px 20px 100px; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 44px;
  animation: fadeInUp 0.5s ease both;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3rem);
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}
.accent { color: var(--accent); }
.hero-sub {
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 20px;
  font-size: 1.02rem;
}
.hero-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== Form Card ===== */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: fadeInUp 0.5s 0.05s ease both;
}
.form-group { margin-bottom: 22px; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.required { color: var(--accent); }

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  -webkit-appearance: none;
}
input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(232,168,56,0.5);
  background: var(--bg4);
  box-shadow: 0 0 0 3px rgba(232,168,56,0.08);
}
textarea { resize: vertical; min-height: 80px; }
select   { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
}
@media (max-width: 580px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .form-row .form-group:first-child { grid-column: 1 / -1; }
}

/* Field hint */
.field-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 5px;
}

/* ===== Example Prompts ===== */
.example-prompts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}
.example-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.example-chip {
  padding: 3px 10px;
  border-radius: 99px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
}
.example-chip:hover {
  border-color: rgba(232,168,56,0.4);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== Style Chips ===== */
.style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.style-chip {
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
  user-select: none;
}
.style-chip:hover {
  border-color: rgba(232,168,56,0.4);
  color: var(--text);
  background: var(--bg4);
}
.style-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

/* ===== Email notify group ===== */
.notify-group {
  padding: 16px;
  background: rgba(88,166,255,0.03);
  border: 1px solid rgba(88,166,255,0.1);
  border-radius: var(--radius-sm);
}
.notify-group label { color: var(--text-muted); }

/* ===== Generate Button ===== */
.btn-generate {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #e8a838 0%, #c88820 100%);
  color: #080a0e;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--trans);
  margin-top: 8px;
  box-shadow: 0 4px 16px var(--accent-glow);
  letter-spacing: 0.01em;
}
.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,168,56,0.35);
  background: linear-gradient(135deg, #f0b840 0%, #d49830 100%);
}
.btn-generate:active:not(:disabled) { transform: translateY(0); }
.btn-generate:disabled {
  background: var(--bg3);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-icon { font-size: 1.1em; }

/* ===== Progress ===== */
.progress-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.3s ease both;
}
.progress-card h2 {
  font-family: var(--font-display);
  color: var(--accent);
  margin-bottom: 20px;
  font-size: 1.2rem;
}
.progress-bar-wrap {
  background: var(--bg4);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #e8a838, #f0c060, #e8a838);
  background-size: 200% 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 0.6s ease;
  animation: progress-flow 2s linear infinite;
}
@keyframes progress-flow {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.progress-pct {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 14px;
  text-align: right;
}
.progress-log {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.log-entry {
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg3);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-left: 2px solid transparent;
  animation: fadeInLeft 0.2s ease both;
}
.log-entry.error           { border-left-color: var(--red); }
.log-entry.done            { border-left-color: var(--green); }
.log-entry.chapter_done    { border-left-color: var(--green); }
.log-entry.warning         { border-left-color: var(--yellow); }
.log-entry.planning,
.log-entry.writing,
.log-entry.consistency_check { border-left-color: var(--accent); }
.log-time {
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
  margin-top: 2px;
  flex-shrink: 0;
}

/* ===== Chapter Preview ===== */
.chapter-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  animation: fadeInUp 0.3s ease both;
  transition: border-color var(--trans);
}
.chapter-card:hover { border-color: var(--border-md); }
.chapter-card-header {
  padding: 12px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-badge {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(232,168,56,0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.chapter-card-title  { font-weight: 500; font-size: 0.9rem; }
.chapter-card-body {
  padding: 16px 18px;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-muted);
  max-height: 180px;
  overflow: hidden;
  position: relative;
}
.chapter-card-body::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(transparent, rgba(8,10,14,0.9));
}

/* ===== Done Section ===== */
.done-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  animation: fadeInUp 0.3s ease both;
}
.done-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent);
}

/* ===== Book Cover ===== */
#book-cover {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
  animation: fadeInUp 0.5s ease both;
}
.book-cover-img {
  max-height: 380px;
  max-width: 260px;
  width: auto;
  border-radius: 8px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.08),
    4px 4px 0 rgba(0,0,0,0.4);
  display: block;
}
.cover-placeholder {
  width: 220px; height: 320px;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--text2); font-size: 0.85rem;
}
.cover-placeholder .cover-icon { font-size: 2.5rem; }
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-action {
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
}
.btn-action:hover      { border-color: var(--border-md); color: var(--text); background: var(--bg3); }
.btn-new               { border-color: rgba(232,168,56,0.4); color: var(--accent); }
.btn-new:hover         { background: var(--accent-dim); border-color: var(--accent); }

/* ===== Book Content ===== */
.book-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  font-size: 1rem;
  line-height: 2;
  animation: fadeInUp 0.3s 0.1s ease both;
}
.book-content h1, .book-content h2, .book-content h3 {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 2em 0 0.7em;
}
.book-content h1 { font-size: 1.6rem; }
.book-content h2 { font-size: 1.3rem; }
.book-content h3 { font-size: 1.1rem; }
.book-content p  { margin-bottom: 1em; color: var(--text-muted); }
.book-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5em 0; }

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
footer a { color: var(--text-muted); text-decoration: none; transition: color var(--trans); }
footer a:hover { color: var(--accent); }

/* ===== KDP Validation ===== */
#validation-report {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
  animation: fadeInUp 0.3s ease both;
}
.btn-validate        { border-color: rgba(88,166,255,0.4); color: var(--blue); }
.btn-validate:hover  { background: rgba(88,166,255,0.08); border-color: var(--blue); }
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 24px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.report-header h3   { font-size: 0.95rem; font-weight: 600; }
.report-badges      { display: flex; gap: 8px; flex-wrap: wrap; }
.badge              { padding: 3px 10px; border-radius: 99px; font-size: 0.76rem; font-weight: 700; }
.badge-pass         { background: rgba(63,185,80,0.12); color: var(--green); border: 1px solid rgba(63,185,80,0.3); }
.badge-fail         { background: rgba(248,81,73,0.12); color: var(--red);   border: 1px solid rgba(248,81,73,0.3); }
.badge-warn         { background: rgba(210,153,34,0.12); color: var(--yellow); border: 1px solid rgba(210,153,34,0.3); }
.report-grid        { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .report-grid { grid-template-columns: 1fr; } }
.report-section     { padding: 18px 24px; border-right: 1px solid var(--border); }
.report-section:last-child { border-right: none; }
.report-section h4  { font-size: 0.88rem; margin-bottom: 12px; color: var(--text-muted); }
.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.83rem;
}
.check-item:last-child { border-bottom: none; }
.check-icon         { flex-shrink: 0; width: 18px; text-align: center; margin-top: 1px; }
.check-body         { flex: 1; }
.check-name         { font-weight: 500; color: var(--text); }
.check-msg          { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }
.check-detail       { color: var(--text-dim); font-size: 0.73rem; margin-top: 2px; }
.severity-OK      .check-icon { color: var(--green); }
.severity-WARNING .check-icon { color: var(--yellow); }
.severity-ERROR   .check-icon,
.severity-FATAL   .check-icon { color: var(--red); }
.severity-INFO    .check-icon { color: var(--blue); }
.report-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.report-footer a { color: var(--blue); text-decoration: none; }
.report-footer a:hover { text-decoration: underline; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,34,42,0.95);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
  backdrop-filter: blur(12px);
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Static pages (privacy, terms) ===== */
.static-page              { max-width: 720px; margin: 0 auto; }
.static-page h1           { font-family: var(--font-display); font-size: 2rem; color: var(--accent); margin-bottom: 6px; }
.static-page .last-updated{ color: var(--text-dim); font-size: 0.82rem; margin-bottom: 40px; }
.static-page section      { margin-bottom: 30px; }
.static-page h2           { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.static-page p            { color: var(--text-muted); margin-bottom: 10px; line-height: 1.8; }
.static-page ul           { color: var(--text-muted); padding-left: 1.4em; line-height: 1.8; }
.static-page ul li        { margin-bottom: 4px; }

/* ===== 404 page ===== */
.error-page           { text-align: center; padding: 80px 24px; animation: fadeInUp 0.4s ease both; }
.error-code           { font-family: var(--font-display); font-size: 9rem; font-weight: 700; color: var(--accent); opacity: 0.2; line-height: 1; margin-bottom: 16px; }
.error-page h1        { font-size: 1.5rem; margin-bottom: 12px; }
.error-page p         { color: var(--text-muted); margin-bottom: 32px; }
.btn-home             { display: inline-block; padding: 12px 28px; background: linear-gradient(135deg, #e8a838, #c88820); color: #080a0e; border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; transition: all var(--trans); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-home:hover       { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,168,56,0.35); }

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar        { width: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== Email Registration Gate ===== */
.reg-card {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 44px 40px;
}
.reg-icon-wrap {
  font-size: 2.8rem;
  margin-bottom: 16px;
  display: block;
}
.reg-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.reg-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 28px;
  line-height: 1.7;
}
.reg-error {
  display: block;
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 6px;
}

/* ===== Email Badge Bar ===== */
.email-badge-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.email-badge-icon { font-size: 1rem; }
.email-badge-addr {
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-change-btn {
  background: none;
  border: 1px solid var(--border-md);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 3px 10px;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
}
.email-change-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* ===== Generation Estimate Box ===== */
.gen-estimate-box {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px 0;
}
.est-item {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 160px;
}
.est-icon { font-size: 1rem; flex-shrink: 0; }
.est-label { font-size: 0.78rem; color: var(--text2); white-space: nowrap; }
.est-val   { font-size: 0.88rem; font-weight: 600; color: var(--accent); margin-left: 2px; }
.est-note  { font-size: 0.7rem; color: var(--text-dim); margin-left: 4px; }
.est-divider {
  width: 1px; height: 32px;
  background: var(--border);
  margin: 0 16px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .est-divider { display: none; }
  .est-item    { min-width: 100%; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
  .est-item:last-child { border-bottom: none; padding-bottom: 0; }
}

/* ===== Generation Hero (progress screen) ===== */
.gen-hero-area {
  text-align: center;
  padding: 40px 16px 20px;
  animation: fadeInUp 0.4s ease both;
}
.gen-title {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  margin: 20px 0 10px;
}

/* 現在の作業（大きく目立つカード） */
.gen-current-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(232,168,56,0.07);
  border: 1px solid rgba(232,168,56,0.22);
  border-radius: 14px;
  padding: 12px 22px;
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  max-width: 560px;
  word-break: break-all;
  transition: all 0.4s ease;
}
.gen-action-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  display: inline-block;
  animation: iconFloat 2.4s ease-in-out infinite;
}
@keyframes iconFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
#gen-phase-label {
  font-size: 0.95rem;
  color: var(--text);
  min-height: 1.4em;
  transition: opacity 0.3s ease;
}
.gen-timer {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ===== Chapter Progress Grid ===== */
.ch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 4px 16px 24px;
  max-width: 680px;
  margin: 0 auto;
}
.ch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  padding: 9px 6px 7px;
  border-radius: 11px;
  background: var(--bg2);
  border: 1px solid var(--border);
  transition: all 0.35s ease;
  cursor: default;
}
.ch-item-icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.3s ease;
}
.ch-item-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}
/* 執筆中 */
.ch-item.active {
  background: rgba(232,168,56,0.1);
  border-color: rgba(232,168,56,0.55);
  animation: chItemPulse 1.6s ease infinite;
}
.ch-item.active .ch-item-label { color: var(--accent); font-weight: 600; }
@keyframes chItemPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(232,168,56,0); }
  50%      { box-shadow: 0 0 0 5px rgba(232,168,56,0.18); }
}
/* 完了 */
.ch-item.done {
  background: rgba(63,185,80,0.08);
  border-color: rgba(63,185,80,0.4);
}
.ch-item.done .ch-item-label { color: var(--green); }

/* ===== Progress log details ===== */
.progress-log-details {
  margin: 0 0 16px;
  text-align: center;
}
.progress-log-details > summary {
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 8px;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg2);
  transition: all var(--trans);
  user-select: none;
}
.progress-log-details > summary:hover { color: var(--text2); border-color: var(--border-md); }
.progress-log-details > summary::-webkit-details-marker { display: none; }
.progress-log-details[open] > summary { color: var(--text2); margin-bottom: 10px; }

/* Book animation */
.book-anim {
  display: inline-flex;
  align-items: stretch;
  height: 90px;
  position: relative;
  filter: drop-shadow(0 8px 20px rgba(232,168,56,0.2));
}
.book-spine {
  width: 12px;
  background: linear-gradient(180deg, #c88820, #a06010);
  border-radius: 3px 0 0 3px;
  flex-shrink: 0;
}
.book-page-left, .book-page-right {
  width: 68px;
  background: #1e2230;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  position: relative;
}
.book-page-left  { border-radius: 0; border-right: 1px solid rgba(255,255,255,0.06); }
.book-page-right { border-radius: 0 3px 3px 0; }
.book-lines { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.book-lines div {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
}
.book-lines.writing div {
  background: rgba(255,255,255,0.06);
  animation: lineAppear 2.4s ease infinite;
}
.book-lines.writing div:nth-child(1) { animation-delay: 0s; }
.book-lines.writing div:nth-child(2) { animation-delay: 0.4s; }
.book-lines.writing div:nth-child(3) { animation-delay: 0.8s; }
.book-lines.writing div:nth-child(4) { animation-delay: 1.2s; }
.book-lines.writing div:nth-child(5) { animation-delay: 1.6s; }
.book-lines.writing div:nth-child(6) { animation-delay: 2.0s; }
@keyframes lineAppear {
  0%,10% { background: rgba(255,255,255,0.06); width: 0%; }
  30%,80% { background: rgba(232,168,56,0.5); width: 100%; }
  95%,100% { background: rgba(255,255,255,0.15); width: 100%; }
}
.writing-cursor {
  position: absolute;
  bottom: 10px;
  left: 6px;
  width: 2px;
  height: 10px;
  background: var(--accent);
  border-radius: 1px;
  animation: cursorBlink 0.8s ease infinite;
}
@keyframes cursorBlink {
  0%,49% { opacity: 1; }
  50%,100% { opacity: 0; }
}

/* ===== Phase Steps ===== */
.phase-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 16px 24px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.phase-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.phase-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg4);
  border: 2px solid var(--border-md);
  transition: all 0.4s ease;
}
.phase-step.active .phase-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(232,168,56,0.5);
  animation: pulseDot 1.2s ease infinite;
}
.phase-step.done .phase-dot {
  background: var(--green);
  border-color: var(--green);
}
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 8px rgba(232,168,56,0.4); }
  50%      { box-shadow: 0 0 18px rgba(232,168,56,0.8); }
}
.phase-name {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.4s ease;
}
.phase-step.active .phase-name { color: var(--accent); font-weight: 600; }
.phase-step.done   .phase-name { color: var(--green); }
.phase-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin-bottom: 18px;
  flex-shrink: 0;
  transition: background 0.4s ease;
}
.phase-line.done { background: var(--green); }
@media (max-width: 480px) {
  .phase-line { width: 20px; }
  .phase-name { font-size: 0.65rem; }
}

/* ===== Progress stats ===== */
.progress-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.progress-chapters-stat {
  font-size: 0.78rem;
  color: var(--text-dim);
}
