.typing-hub {
  display: none;
  position: fixed;
  z-index: 40;
  top: 82px;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 0;
  padding: 22px;
  gap: 18px;
  overflow: hidden;
  background: var(--bg-primary);
}

.typing-hub.is-active { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.typing-panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 18px; box-shadow: 0 18px 48px rgba(0, 0, 0, .18); }
.typing-library-panel { padding: 18px; overflow-y: auto; }
.typing-hub-title { margin: 0 0 4px; font-size: 20px; color: var(--text-main); }
.typing-hub-subtitle { margin: 0 0 18px; color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.typing-field { margin-bottom: 14px; }
.typing-field label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.typing-field input, .typing-field select {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary); color: var(--text-main); outline: none;
}
.typing-field input::placeholder, .typing-input::placeholder { color: var(--text-muted); opacity: .82; }
.typing-category-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 12px 0 18px; }
.typing-category-btn { padding: 8px 6px; border: 1px solid var(--border-color); border-radius: 9px; background: rgba(255,255,255,.02); color: var(--text-muted); cursor: pointer; font-size: 12px; transition: var(--transition-smooth); }
.typing-category-btn:hover { color: var(--text-main); background: rgba(255,255,255,.055); }
.typing-category-btn.active { color: var(--text-main); background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.24); font-weight: 800; box-shadow: inset 3px 0 0 var(--neon-blue); }
.typing-article-list { display: flex; flex-direction: column; gap: 8px; }
.typing-article-item { text-align: left; padding: 11px; border: 1px solid var(--border-color); border-radius: 11px; background: rgba(255,255,255,.025); color: var(--text-main); cursor: pointer; }
.typing-article-item:hover { background: rgba(255,255,255,.05); }
.typing-article-item.active { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); box-shadow: inset 3px 0 0 var(--neon-blue); }
.typing-article-item strong { display: block; margin-bottom: 5px; font-size: 13px; }
.typing-article-meta { color: var(--text-muted); font-size: 10px; }
.typing-main-panel { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.typing-toolbar { padding: 14px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.typing-toolbar button, .typing-primary-btn, .typing-secondary-btn { border-radius: 10px; padding: 9px 13px; cursor: pointer; font-weight: 700; transition: var(--transition-smooth); }
.typing-primary-btn { background: var(--bg-secondary); color: var(--text-main); border: 1px solid rgba(255,255,255,.2); box-shadow: inset 3px 0 0 var(--neon-blue); }
.typing-primary-btn:hover { border-color: rgba(255,255,255,.32); background: rgba(255,255,255,.09); }
.typing-secondary-btn { background: rgba(148,163,184,.12); color: var(--text-main); border: 1px solid var(--border-color); }
.typing-secondary-btn:hover { background: rgba(148,163,184,.18); }
.typing-toolbar-spacer { flex: 1; }
.typing-favorite-btn.active { color: #fbbf24; }
.typing-workspace { padding: 24px clamp(20px, 4vw, 54px); overflow-y: auto; }
.typing-article-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 18px; }
.typing-article-heading h2 { margin: 0 0 7px; color: var(--text-main); }
.typing-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.typing-tag { padding: 3px 8px; border-radius: 999px; color: var(--text-muted); background: rgba(255,255,255,.06); border: 1px solid var(--border-color); font-size: 10px; }
.typing-progress { height: 6px; border-radius: 999px; background: rgba(148,163,184,.15); overflow: hidden; margin: 14px 0 22px; }
.typing-progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple)); transition: width .2s; }
.typing-source { font-size: clamp(18px, 2vw, 24px); line-height: 2; letter-spacing: .02em; color: var(--text-main); padding: 20px; border-radius: 14px; background: rgba(255,255,255,.025); border: 1px solid var(--border-color); white-space: pre-wrap; }
.typing-source .done { color: var(--success-color); }
.typing-source .current { color: var(--text-main); background: rgba(255,255,255,.1); border-bottom: 3px solid var(--neon-blue); border-radius: 2px; }
.typing-source .rest { color: var(--text-muted); }
.typing-input { width: 100%; box-sizing: border-box; min-height: 120px; margin-top: 16px; resize: vertical; padding: 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,.2); background: var(--bg-primary); color: var(--text-main); font: 18px/1.8 "Noto Sans JP", sans-serif; outline: none; }
.typing-input:focus { border-color: var(--neon-blue); box-shadow: 0 0 0 3px var(--neon-cyan-glow); }
.typing-input.has-error { border-color: var(--error-color); box-shadow: 0 0 0 3px var(--error-glow); }
.typing-help { margin: 9px 2px 0; color: var(--text-muted); font-size: 11px; }
.typing-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin: 20px 0; }
.typing-stat { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid var(--border-color); }
.typing-stat span { display: block; color: var(--text-muted); font-size: 10px; margin-bottom: 4px; }
.typing-stat strong { color: var(--text-main); font-size: 20px; }
.typing-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.typing-mini-card { padding: 15px; border-radius: 13px; border: 1px solid var(--border-color); background: rgba(255,255,255,.025); }
.typing-mini-card h3 { margin: 0 0 10px; font-size: 14px; color: var(--text-main); }
.typing-history-row { display: flex; justify-content: space-between; gap: 10px; color: var(--text-muted); font-size: 11px; padding: 6px 0; border-bottom: 1px solid rgba(148,163,184,.08); }
.typing-review-count { color: var(--text-main); }
.typing-empty { color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.typing-result { display: none; margin-top: 16px; padding: 20px; border: 1px solid rgba(52,211,153,.35); border-radius: 14px; background: rgba(16,185,129,.08); }
.typing-result.show { display: block; }
.typing-result h3 { margin: 0 0 8px; color: var(--success-color); }

body[data-theme="light"] .typing-hub {
  background: var(--bg-primary);
}

body[data-theme="light"] .typing-panel {
  background: rgba(255,255,255,.88);
  border-color: rgba(45,42,36,.14);
  box-shadow: 0 16px 40px rgba(70,60,50,.12);
}

body[data-theme="light"] .typing-hub-subtitle,
body[data-theme="light"] .typing-field label,
body[data-theme="light"] .typing-article-meta,
body[data-theme="light"] .typing-help,
body[data-theme="light"] .typing-empty,
body[data-theme="light"] .typing-stat span {
  color: #665f58;
}

body[data-theme="light"] .typing-field input,
body[data-theme="light"] .typing-field select,
body[data-theme="light"] .typing-input {
  background: #fff;
  color: #2d2a24;
  border-color: rgba(45,42,36,.18);
}

body[data-theme="light"] .typing-field input::placeholder,
body[data-theme="light"] .typing-input::placeholder {
  color: #746d66;
  opacity: 1;
}

body[data-theme="light"] .typing-category-btn {
  background: rgba(45,42,36,.015);
  color: #625c55;
  border-color: rgba(45,42,36,.14);
}

body[data-theme="light"] .typing-category-btn:hover {
  color: #2d2a24;
  background: rgba(45,42,36,.045);
}

body[data-theme="light"] .typing-category-btn.active {
  color: #1f2937;
  background: #eef2f7;
  border-color: #c8d0dc;
  box-shadow: inset 3px 0 0 #335c9b;
}

body[data-theme="light"] .typing-article-item {
  background: #fff;
  color: #2d2a24;
  border-color: rgba(45,42,36,.13);
}

body[data-theme="light"] .typing-article-item:hover {
  background: #f7f5f2;
}

body[data-theme="light"] .typing-article-item.active {
  background: #f0f3f7;
  border-color: #b8c2d0;
  box-shadow: inset 3px 0 0 #335c9b;
}

body[data-theme="light"] .typing-primary-btn {
  background: #f2f4f7;
  color: #253247;
  border-color: #c7cfda;
  box-shadow: inset 3px 0 0 #335c9b;
}

body[data-theme="light"] .typing-primary-btn:hover {
  background: #e9edf2;
  border-color: #aeb9c8;
}

body[data-theme="light"] .typing-secondary-btn {
  background: #f4f3f1;
  color: #39352f;
  border-color: rgba(45,42,36,.14);
}

body[data-theme="light"] .typing-tag {
  color: #3f4f66;
  background: #eef1f5;
  border-color: #d2d8e1;
}

body[data-theme="light"] .typing-progress {
  background: #e5e2de;
}

body[data-theme="light"] .typing-progress > div {
  background: linear-gradient(90deg, #335c9b, #6b5b95);
}

body[data-theme="light"] .typing-source {
  background: #fff;
  color: #332f2a;
  border-color: rgba(45,42,36,.14);
}

body[data-theme="light"] .typing-source .rest {
  color: #554f48;
}

body[data-theme="light"] .typing-source .current {
  color: #1f2937;
  background: #e8edf4;
  border-bottom-color: #335c9b;
}

body[data-theme="light"] .typing-input:focus {
  border-color: #335c9b;
  box-shadow: 0 0 0 3px rgba(51,92,155,.12);
}

body[data-theme="light"] .typing-stat,
body[data-theme="light"] .typing-mini-card {
  background: #faf9f7;
  border-color: rgba(45,42,36,.13);
}

body[data-theme="light"] .typing-history-row {
  color: #5e5851;
  border-bottom-color: rgba(45,42,36,.09);
}

@media (max-width: 1050px) {
  .typing-hub.is-active { grid-template-columns: 240px minmax(0,1fr); padding: 12px; }
  .typing-stats { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 760px) {
  .typing-hub { top: 132px; }
  .typing-hub.is-active { display: flex; flex-direction: column; overflow-y: auto; }
  .typing-library-panel { max-height: 330px; }
  .typing-main-panel { overflow: visible; }
  .typing-workspace { overflow: visible; padding: 18px; }
  .typing-bottom-grid { grid-template-columns: 1fr; }
}
