/* ============================================================
   文字数帳 v3 — Styles
   ============================================================ */

/* ----------------------------------------
   CSS Variables
   ---------------------------------------- */
:root {
  --bg:            #f9f7f4;
  --bg-alt:        #f2ede6;
  --surface:       #ffffff;
  --surface-hover: #faf7f3;

  --border:        #ddd5c8;
  --border-subtle: #ede8e1;

  --text:          #1b1916;
  --text-secondary:#6a5f55;
  --text-muted:    #a0968c;

  --accent:        #b5783a;
  --accent-bg:     #f4e8d8;
  --accent-hover:  #9a6530;

  --danger:        #c0392b;
  --danger-bg:     #fde9e8;
  --success:       #3a8a60;
  --success-bg:    #e6f4ec;
  --warning:       #c07a2a;
  --warning-bg:    #fdf0e0;
  --info:          #3a6a8a;
  --info-bg:       #e6f0f6;

  --font-display:  'Cormorant Garamond', 'Noto Serif JP', Georgia, serif;
  --font-ui:       'Noto Sans JP', 'Hiragino Kaku Gothic ProN', system-ui, sans-serif;
  --font-editor:   'Noto Serif JP', 'Hiragino Mincho Pro', 'Yu Mincho', serif;

  --header-h:      56px;
  --left-sidebar-w:220px;
  --sidebar-w:     276px;
  --r:             5px;
  --r-sm:          3px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow:     0 2px 10px rgba(0,0,0,0.09);
  --shadow-lg:  0 4px 24px rgba(0,0,0,0.14);

  --t: 0.18s ease;
}

[data-theme="dark"] {
  --bg:            #131210;
  --bg-alt:        #1a1816;
  --surface:       #1e1c19;
  --surface-hover: #252320;

  --border:        #2e2b27;
  --border-subtle: #252320;

  --text:          #e6ddd3;
  --text-secondary:#9e948a;
  --text-muted:    #63594e;

  --accent:        #d4954c;
  --accent-bg:     #2a1e10;
  --accent-hover:  #e8a862;

  --danger:        #e05252;
  --danger-bg:     #2a1212;
  --success:       #4caf7a;
  --success-bg:    #0e2418;
  --warning:       #d4954c;
  --warning-bg:    #2a1a08;
  --info:          #5da0c0;
  --info-bg:       #0e1e2a;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.25);
  --shadow:     0 2px 10px rgba(0,0,0,0.35);
  --shadow-lg:  0 4px 24px rgba(0,0,0,0.5);
}


/* ----------------------------------------
   Reset & Base
   ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 14px; }
body {
  height: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: var(--font-ui); cursor: pointer; }
input, select, textarea { font-family: var(--font-ui); color: var(--text); }
option { background: var(--surface); color: var(--text); }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ----------------------------------------
   Header
   ---------------------------------------- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 200;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-work-name {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.save-status {
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 20px;
  transition: color var(--t), background var(--t);
  white-space: nowrap;
}
.save-status.is-saving { color: var(--accent); }
.save-status.is-saved  { color: var(--success); }
.save-status.is-error  { color: var(--danger); }

/* View Navigation (center) */
.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border-radius: 22px;
  padding: 3px;
  gap: 1px;
}

.view-btn {
  padding: 5px 13px;
  border-radius: 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 400;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}
.view-btn:hover { color: var(--text-secondary); background: var(--surface-hover); }
.view-btn.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}


/* ----------------------------------------
   Buttons
   ---------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 400;
  transition: background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-icon {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 6px 8px;
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1;
  transition: background var(--t);
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-menu { display: none; }


/* ----------------------------------------
   Sidebar Overlay (mobile)
   ---------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28);
  z-index: 148;
}
.sidebar-overlay.is-visible { display: block; }


/* ----------------------------------------
   Layout (3-column)
   ---------------------------------------- */
.layout {
  display: flex;
  position: fixed;
  top: var(--header-h);
  bottom: 0; left: 0; right: 0;
  overflow: hidden;
}


/* ----------------------------------------
   Left Sidebar
   ---------------------------------------- */
.left-sidebar {
  flex-shrink: 0;
  width: var(--left-sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  overflow: hidden;
  z-index: 10;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-section--chapters {
  flex: 1;
  min-height: 0;
  border-bottom: none;
  display: flex;
  flex-direction: column;
}
.sidebar-section--chapters.is-folded { flex: 0; }

.sidebar-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 7px;
  flex-shrink: 0;
}
.sidebar-section-ttl {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}
.sidebar-section-acts { display: flex; align-items: center; gap: 3px; }

.btn-sact {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 20px; height: 20px;
  border-radius: var(--r-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.btn-sact:hover { background: var(--surface); color: var(--accent); border-color: var(--accent); }

.btn-sfold {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 20px; height: 20px;
  border-radius: var(--r-sm);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t);
}
.btn-sfold:hover { color: var(--text); }
.fold-chevron { transition: transform var(--t); }
.sidebar-section.is-folded .fold-chevron { transform: rotate(-90deg); }

.sidebar-section-bd { overflow-y: auto; }
#worksSection .sidebar-section-bd { max-height: 200px; }
.sidebar-section--chapters .sidebar-section-bd { flex: 1; min-height: 0; }
.sidebar-section.is-folded .sidebar-section-bd { display: none; }

.chapters-footer {
  flex-shrink: 0;
  padding: 7px 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--border-subtle);
}


/* ----------------------------------------
   Work Items
   ---------------------------------------- */
.work-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 2px solid transparent;
  transition: background var(--t);
}
.work-item:hover { background: var(--surface-hover); }
.work-item.is-active { background: var(--accent-bg); border-left-color: var(--accent); }

.work-item-title {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  margin-bottom: 3px;
}
.work-item.is-active .work-item-title { color: var(--accent); font-weight: 500; }

.work-item-foot { display: flex; align-items: center; justify-content: space-between; }
.work-item-date { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.work-item-btns { display: none; gap: 2px; }
.work-item:hover .work-item-btns { display: flex; }

.work-item-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 2px;
  line-height: 1.4;
  transition: color var(--t), background var(--t);
}
.work-item-btn:hover { color: var(--text); background: var(--border); }
.work-item-btn.is-danger:hover { color: var(--danger); background: var(--danger-bg); }


/* ----------------------------------------
   Chapter Items
   ---------------------------------------- */
.chapter-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px 7px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  border-left: 2px solid transparent;
  transition: background var(--t);
  user-select: none;
}
.chapter-item:hover { background: var(--surface-hover); }
.chapter-item.is-active { background: var(--accent-bg); border-left-color: var(--accent); }
.chapter-item.drag-over { border-top: 2px solid var(--accent); }

.ch-drag { color: var(--text-muted); font-size: 10px; cursor: ns-resize; opacity: 0.4; flex-shrink: 0; line-height: 1; }
.chapter-item:hover .ch-drag { opacity: 0.8; }

.ch-body { flex: 1; min-width: 0; }
.ch-title {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  outline: none;
  border-bottom: 1px solid transparent;
}
.chapter-item.is-active .ch-title { color: var(--accent); font-weight: 500; }
.ch-title[contenteditable="true"] { white-space: normal; overflow: visible; border-bottom-color: var(--accent); }

.ch-bar { height: 2px; background: var(--border); border-radius: 1px; margin-top: 4px; overflow: hidden; }
.ch-bar-fill { height: 100%; background: var(--text-muted); border-radius: 1px; transition: width 0.3s ease; }
.chapter-item.is-active .ch-bar-fill { background: var(--accent); opacity: 0.8; }

.ch-chars { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.chapter-item.is-active .ch-chars { color: var(--accent); }

.ch-del {
  background: none; border: none; color: var(--text-muted);
  font-size: 12px; line-height: 1; padding: 2px 3px; border-radius: 2px;
  flex-shrink: 0; opacity: 0; transition: opacity var(--t), color var(--t), background var(--t);
}
.chapter-item:hover .ch-del { opacity: 1; }
.ch-del:hover { color: var(--danger); background: var(--danger-bg); }


/* ----------------------------------------
   Main Area
   ---------------------------------------- */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}


/* ----------------------------------------
   Work Info Panel
   ---------------------------------------- */
.work-info-panel {
  flex-shrink: 0;
  padding: 10px 20px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.work-info-row { display: flex; gap: 10px; }
.work-info-row--sub {
  padding-top: 5px;
  border-top: 1px solid var(--border-subtle);
  align-items: flex-end;
  gap: 10px;
}

.field-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field-group--title    { flex: 3; }
.field-group--genre    { flex: 2; min-width: 110px; }
.field-group--memo     { flex: 3; }
.field-group--template { flex: 2; min-width: 150px; }

.field-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
}
.field-input,
.field-select {
  width: 100%;
  padding: 6px 9px;
  background: var(--bg-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--t), background var(--t);
  -webkit-appearance: none;
}
.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a0968c'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 26px;
  cursor: pointer;
}
.field-input:focus, .field-select:focus { border-color: var(--accent); background: var(--surface); }
.field-input::placeholder { color: var(--text-muted); }

/* Submission set status badges */
.sub-status-area {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  flex-shrink: 0;
}
.sub-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--border);
  color: var(--text-muted);
}
.sub-status-badge.is-draft     { background: var(--bg-alt); color: var(--text-muted); }
.sub-status-badge.is-preparing { background: var(--warning-bg); color: var(--warning); }
.sub-status-badge.is-submitted { background: var(--success-bg); color: var(--success); }

.sub-deadline-text {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}


/* ----------------------------------------
   Tab Navigation
   ---------------------------------------- */
.tab-nav {
  flex-shrink: 0;
  display: flex;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  padding: 9px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: 13px;
  transition: color var(--t), border-color var(--t);
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }


/* ----------------------------------------
   Editor Container
   ---------------------------------------- */
.editor-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.tab-pane { display: none; width: 100%; height: 100%; }
.tab-pane.active { display: flex; }

.editor {
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 28px 34px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-editor);
  font-size: 16px;
  line-height: 2.1;
  letter-spacing: 0.03em;
  color: var(--text);
  overflow-y: auto;
}
.editor::placeholder { color: var(--text-muted); font-style: italic; }
.editor--notes { font-family: var(--font-ui); font-size: 14px; line-height: 1.85; letter-spacing: 0; }


/* ----------------------------------------
   Editor Footer
   ---------------------------------------- */
.editor-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
}
.editor-footer-left { display: flex; align-items: center; gap: 10px; }
.quick-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  transition: color var(--t);
}
.quick-count.is-over { color: var(--danger); }
.chapter-total-hint { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.editor-actions { display: flex; gap: 5px; }


/* ----------------------------------------
   View Content Panels
   ---------------------------------------- */
.view-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}


/* ----------------------------------------
   Dashboard View
   ---------------------------------------- */
.dash-active-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
}
.dash-active-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.dash-active-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.dash-active-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-display);
}
.dash-active-contest { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.dash-active-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.dash-progress-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-prog-item { display: flex; flex-direction: column; gap: 4px; }
.dash-prog-hd {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}
.dash-prog-rem { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dash-prog-rem.is-over { color: var(--danger); font-weight: 500; }

.dash-section { display: flex; flex-direction: column; gap: 10px; }
.dash-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dash-section-ttl {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Submission set list items */
.subm-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--r);
  padding: 11px 14px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  display: flex;
  align-items: center;
  gap: 10px;
}
.subm-item:hover { background: var(--surface-hover); }
.subm-item.is-active { border-left-color: var(--accent); background: var(--accent-bg); }

.subm-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.subm-dot.is-draft     { background: var(--text-muted); }
.subm-dot.is-preparing { background: var(--warning); }
.subm-dot.is-submitted { background: var(--success); }

.subm-body { flex: 1; min-width: 0; }
.subm-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subm-item.is-active .subm-name { color: var(--accent); font-weight: 500; }
.subm-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.subm-actions { display: flex; gap: 3px; flex-shrink: 0; }
.subm-action-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 11px; padding: 2px 5px; border-radius: 2px; line-height: 1;
  transition: color var(--t), background var(--t);
}
.subm-action-btn:hover { color: var(--text); background: var(--border); }
.subm-action-btn.is-danger:hover { color: var(--danger); background: var(--danger-bg); }

/* Dashboard stats grid */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.dash-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  text-align: center;
}
.dash-stat-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 4px;
}
.dash-stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.dash-stat-card--check.has-issues .dash-stat-num { color: var(--warning); }
.dash-stat-card--check.has-errors .dash-stat-num { color: var(--danger); }


/* ----------------------------------------
   Check View
   ---------------------------------------- */
.check-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}
.check-header-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-display);
}
.check-header-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.6;
}

.check-section { margin-bottom: 16px; }
.check-section-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}
.check-section-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.check-section-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.check-section-badge.is-ok { background: var(--success-bg); color: var(--success); }
.check-section-badge.is-warn { background: var(--warning-bg); color: var(--warning); }
.check-section-badge.is-err { background: var(--danger-bg); color: var(--danger); }

.check-item {
  display: flex;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 5px;
  background: var(--bg-alt);
}
.check-item.is-warn { background: var(--warning-bg); }
.check-item.is-err  { background: var(--danger-bg); }

.check-item-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background: var(--text-muted);
}
.check-item.is-warn .check-item-dot { background: var(--warning); }
.check-item.is-err  .check-item-dot { background: var(--danger); }

.check-item-body { flex: 1; min-width: 0; }
.check-item-msg { font-size: 12.5px; color: var(--text); line-height: 1.5; }
.check-item.is-warn .check-item-msg { color: var(--warning); }
.check-item.is-err  .check-item-msg { color: var(--danger); }
.check-item-excerpt {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-editor);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-ok {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: var(--success);
  font-size: 12.5px;
}
.check-footer-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-radius: var(--r);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
}


/* ----------------------------------------
   Export View
   ---------------------------------------- */
.export-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.export-section--bundle {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.export-section--snapshot {
  border-style: dashed;
}
.export-section-ttl {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}
.export-section--bundle .export-section-ttl { color: var(--accent); }
.export-section-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.export-section-acts { display: flex; gap: 6px; flex-shrink: 0; }


/* ----------------------------------------
   Stats Panel (right)
   ---------------------------------------- */
.stats-panel {
  flex-shrink: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
}
.stats-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.stats-heading {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text);
}
.stats-collapse-btn {
  background: none; border: none; color: var(--text-muted);
  padding: 4px; border-radius: 3px; line-height: 0;
  display: none; transition: transform var(--t), color var(--t);
}
.stats-collapse-btn:hover { color: var(--text-secondary); }
.stats-panel.is-collapsed .stats-collapse-btn { transform: rotate(-90deg); }
.stats-panel-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.stats-panel.is-collapsed .stats-panel-body { display: none; }

/* Progress Blocks */
.prog-block {
  padding: 11px 18px 9px;
  border-bottom: 1px solid var(--border-subtle);
}
.prog-block-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  gap: 6px;
}
.prog-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.prog-label-source {
  font-size: 9px;
  color: var(--accent);
  font-weight: 400;
  display: inline-block;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.limit-wrap { display: flex; align-items: center; gap: 3px; }
.limit-input {
  width: 70px;
  padding: 3px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text);
  outline: none;
  font-variant-numeric: tabular-nums;
  text-align: right;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  transition: border-color var(--t);
}
.limit-input:focus { border-color: var(--accent); }
.limit-input::-webkit-inner-spin-button,
.limit-input::-webkit-outer-spin-button { opacity: 0.4; }
.limit-unit { font-size: 10px; color: var(--text-muted); }

.prog-row { display: flex; align-items: center; gap: 7px; }
.progress-track {
  flex: 1; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}
.progress-fill.is-warning { background: var(--warning); }
.progress-fill.is-over    { background: var(--danger); }

.prog-pct {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; min-width: 30px; text-align: right;
}
.prog-pct.is-over { color: var(--danger); }

.prog-rem {
  margin-top: 4px; font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; min-height: 15px;
}
.prog-rem.is-over { color: var(--danger); font-weight: 500; }

/* Primary stats */
.stats-section { padding: 12px 18px; }
.stats-section--primary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats-section--secondary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding-top: 8px; }

.stat-card {
  background: var(--bg-alt); border-radius: var(--r);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 400; line-height: 1;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.stat-lbl {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-muted);
}
.stat-mini { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.stat-mini-num {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 400; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.stat-mini-unit { font-size: 11px; font-family: var(--font-ui); }
.stat-mini-lbl {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-muted);
}
.stats-divider { height: 1px; background: var(--border-subtle); margin: 0 18px; flex-shrink: 0; }

/* Analysis */
.analysis-block { padding: 12px 18px 14px; }
.analysis-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.analysis-lbl { font-size: 11px; color: var(--text-secondary); min-width: 34px; }
.analysis-bar-wrap { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.analysis-bar { display: block; height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.analysis-bar--narr { background: var(--text-muted); }
.analysis-val { font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.analysis-rate { margin-top: 4px; font-size: 11px; color: var(--text-muted); text-align: right; }

/* Section summary */
.section-summary { padding: 12px 18px 18px; }
.section-summary-title {
  font-size: 10px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-muted); margin-bottom: 8px;
}
.section-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: 12.5px;
}
.section-row:last-child { border-bottom: none; }
.section-row-label { color: var(--text-secondary); }
.section-row-val { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }


/* ----------------------------------------
   Mobile Bar
   ---------------------------------------- */
.mobile-bar { display: none; }


/* ----------------------------------------
   Modal Overlays
   ---------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.04em;
}
.modal-hd-acts { display: flex; align-items: center; gap: 8px; }
.modal-chapter-select { font-size: 12px; padding: 4px 22px 4px 8px; }


/* ----------------------------------------
   Vertical Preview Modal
   ---------------------------------------- */
.vpreview-modal {
  width: 95vw;
  height: 88vh;
  max-width: 1200px;
}
.vpreview-body {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg-alt);
  padding: 32px 40px;
}
.vpreview-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-editor);
  font-size: 17px;
  line-height: 2.1;
  letter-spacing: 0.08em;
  color: var(--text);
  height: 100%;
  white-space: pre-wrap;
  word-break: break-all;
  font-feature-settings: "vkna" 1;
}


/* ----------------------------------------
   Snapshot Modal
   ---------------------------------------- */
.snapshot-modal {
  width: min(520px, 95vw);
}
.snapshot-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}
.snapshot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.snapshot-item-body { flex: 1; min-width: 0; }
.snapshot-item-label { font-size: 13px; color: var(--text); }
.snapshot-item-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.snapshot-item-acts { display: flex; gap: 5px; flex-shrink: 0; }

.snapshot-empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}
.snapshot-empty-sub { font-size: 11.5px; margin-top: 6px; }


/* ----------------------------------------
   Submission Set Edit Modal
   ---------------------------------------- */
.subm-edit-modal {
  width: min(480px, 95vw);
}
.subm-edit-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.subm-edit-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.subm-edit-row--3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  flex-direction: unset;
}
.subm-edit-row--3col > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.subm-edit-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.subm-edit-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}


/* ----------------------------------------
   Print Area
   ---------------------------------------- */
.print-area { display: none; }

@media print {
  .header, .left-sidebar, .stats-panel,
  .work-info-panel, .editor-footer, .mobile-bar,
  .header-center, .view-btn, .modal-overlay { display: none !important; }

  body { overflow: auto; background: #fff; color: #000; }
  .layout { display: block; position: static; }
  .main-area { display: block; }

  .view-content { display: none !important; }
  .print-area {
    display: block !important;
    font-family: 'Noto Serif JP', serif;
    font-size: 14pt;
    line-height: 2;
    padding: 2cm;
    color: #000;
    white-space: pre-wrap;
  }
}


/* ----------------------------------------
   Toast
   ---------------------------------------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--text);
  color: var(--bg);
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ----------------------------------------
   Responsive — Tablet (≤1000px)
   ---------------------------------------- */
@media (max-width: 1000px) {
  :root { --left-sidebar-w: 190px; --sidebar-w: 250px; }
  .header-work-name { display: none; }
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .editor { padding: 22px 24px; font-size: 15px; }
}

@media (max-width: 800px) {
  :root { --sidebar-w: 220px; }
  .view-btn { padding: 5px 10px; font-size: 11.5px; }
}


/* ----------------------------------------
   Responsive — Mobile (≤700px)
   ---------------------------------------- */
@media (max-width: 700px) {
  :root { --header-h: 52px; }
  body { overflow: auto; }

  .layout {
    flex-direction: column;
    position: static;
    height: auto;
    /* bottom: mobile bar + footer */
    padding-bottom: calc(52px + 36px);
  }

  .header { padding: 0 10px; gap: 6px; }
  .btn-menu { display: flex; }

  /* アプリタイトル小さく */
  .app-title { font-size: 16px; }

  /* View nav on mobile: scrollable */
  .header-center {
    border-radius: 0;
    background: transparent;
    padding: 0;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .header-center::-webkit-scrollbar { display: none; }
  .view-btn { border-radius: 0; padding: 5px 11px; font-size: 12px; min-height: 40px; }
  .view-btn.active {
    box-shadow: none;
    border-bottom: 2px solid var(--accent);
    background: transparent;
  }

  /* Save status: shorter */
  .save-status { font-size: 10px; padding: 2px 7px; }

  /* Left sidebar slides in from left */
  .left-sidebar {
    position: fixed;
    top: var(--header-h);
    bottom: 0;
    left: calc(-1 * var(--left-sidebar-w) - 4px);
    z-index: 149;
    transition: left 0.25s ease, box-shadow 0.25s ease;
    box-shadow: none;
    width: min(var(--left-sidebar-w), 85vw);
  }
  .left-sidebar.is-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }

  /* サイドバー内タップ領域を広げる */
  .work-item { padding: 11px 12px; }
  .chapter-item { padding: 10px 10px 10px 12px; min-height: 44px; }
  .btn-sact { width: 28px; height: 28px; font-size: 15px; }

  .main-area { overflow: visible; }

  /* Work info panel: compact on mobile */
  .work-info-panel { padding: 8px 12px 6px; }
  .work-info-row { flex-wrap: wrap; gap: 7px; }
  .field-group--title    { flex: 1 1 100%; }
  .field-group--genre    { flex: 1 1 calc(50% - 4px); min-width: 100px; }
  .field-group--memo     { flex: 1 1 100%; }
  .field-group--template { flex: 1 1 calc(50% - 4px); min-width: 130px; }

  /* タップ領域確保 */
  .field-input, .field-select { padding: 9px 10px; font-size: 14px; min-height: 40px; }
  .field-select { padding-right: 28px; }

  .tab-nav {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 10px 14px; font-size: 13px; min-height: 42px; }

  .editor-container { overflow: visible; min-height: 300px; }
  .tab-pane.active { display: block; height: auto; }
  .editor { height: auto; min-height: 300px; padding: 16px 14px; font-size: 16px; line-height: 2; }
  .editor-footer { padding: 8px 12px; flex-wrap: wrap; gap: 6px; }
  .editor-footer-left { flex: 1; }
  .editor-actions { gap: 6px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; min-height: 38px; }

  .view-scroll-area { padding: 12px; gap: 12px; }
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .subm-edit-row--3col { grid-template-columns: 1fr; }

  /* 応募セット：タップしやすく */
  .subm-item { padding: 13px 12px; }
  .subm-action-btn { padding: 6px 8px; font-size: 14px; min-width: 30px; min-height: 32px; }

  /* Stats panel stacks below */
  .stats-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    overflow: visible;
  }
  .stats-collapse-btn { display: flex; }
  .stats-panel-header { padding: 10px 14px 8px; }
  .stats-section { padding: 10px 14px; }
  .section-summary { padding: 10px 14px 14px; }
  .stats-divider { margin: 0 14px; }
  .prog-block { padding: 9px 14px 7px; }
  .analysis-block { padding: 10px 14px 12px; }

  /* Modal adjustments */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--r) var(--r) 0 0; max-height: 92vh; width: 100%; }
  .vpreview-modal {
    width: 100%;
    height: 92vh;
    border-radius: var(--r) var(--r) 0 0;
  }
  .vpreview-body { padding: 16px; }
  .vpreview-text { font-size: 15px; }
  .snapshot-modal, .subm-edit-modal, .guide-modal { width: 100%; }
  .subm-edit-row--3col { grid-template-columns: 1fr 1fr; }

  /* Mobile quick bar */
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 36px; /* above footer */
    left: 0; right: 0;
    height: 50px;
    padding: 0 14px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.07);
    z-index: 300;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-bar-counts { display: flex; align-items: baseline; gap: 10px; }
  .mobile-bar-main { font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
  .mobile-bar-main strong { color: var(--text); font-weight: 600; }
  .mobile-bar-sub { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; }
  .mobile-bar-sub.is-over { color: var(--danger); }
  .mobile-bar-detail-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-ui);
    min-height: 36px;
    transition: background var(--t), color var(--t);
  }
  .mobile-bar-detail-btn:active { background: var(--surface-hover); }

  /* Footer on mobile */
  .app-footer { bottom: 0; }
}


/* ----------------------------------------
   App Footer
   ---------------------------------------- */
.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 36px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border-subtle);
  z-index: 199;
  display: none; /* desktop: hidden (layout uses fixed height) */
  align-items: center;
  justify-content: center;
}

/* Footer always visible on mobile (shown above mobile bar) and when needed */
@media (max-width: 700px) {
  .app-footer {
    display: flex;
    bottom: 0;
  }
}

/* Desktop: show footer below layout */
@media (min-width: 701px) {
  body { padding-bottom: 36px; }
  .layout { bottom: 36px; }
  .app-footer {
    display: flex;
  }
}

.app-footer-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.app-footer-name {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}
.app-footer-ver { font-variant-numeric: tabular-nums; }
.app-footer-sep { opacity: 0.4; }
.app-footer-btn {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 11px; font-family: var(--font-ui);
  cursor: pointer; padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t);
}
.app-footer-btn:hover { color: var(--accent); }
.app-footer-note { color: var(--text-muted); }


/* ----------------------------------------
   Help Button (header)
   ---------------------------------------- */
.btn-help-trigger {
  border-color: transparent;
  background: transparent;
}
.btn-help-trigger:hover { border-color: var(--border); background: var(--surface-hover); }


/* ----------------------------------------
   Copy Feedback Tooltip
   ---------------------------------------- */
.copy-feedback {
  position: fixed;
  z-index: 9998;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.copy-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}


/* ----------------------------------------
   Guide / Welcome Modal
   ---------------------------------------- */
.guide-modal {
  width: min(540px, 96vw);
  max-height: 90vh;
}
.guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.guide-logo {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  line-height: 1;
}
.guide-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-top: -6px;
}
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.guide-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.guide-step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.guide-step-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}
.guide-step-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.65;
}
.guide-notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--info-bg);
  color: var(--info);
  padding: 11px 13px;
  border-radius: var(--r);
  font-size: 12px;
  line-height: 1.6;
}
.guide-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}
.guide-no-show {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.guide-no-show input { cursor: pointer; accent-color: var(--accent); }


/* ----------------------------------------
   Export section layout fix (v4)
   ---------------------------------------- */
.export-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.export-section-main { flex: 1; min-width: 0; }
.export-section-acts { flex-shrink: 0; display: flex; gap: 6px; }

@media (max-width: 500px) {
  .export-section { flex-direction: column; align-items: flex-start; }
  .export-section-acts { width: 100%; }
  .export-section-acts .btn { flex: 1; justify-content: center; }
}


/* ----------------------------------------
   Tap target improvements (global)
   ---------------------------------------- */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 38px; }
  .btn-icon { min-height: 40px; min-width: 40px; }
  .work-item-btn { min-height: 32px; padding: 4px 8px; }
  .ch-del { min-height: 32px; min-width: 28px; opacity: 1; }
  .subm-action-btn { min-height: 36px; min-width: 36px; }
  .limit-input { min-height: 36px; }
}


/* ----------------------------------------
   Dark mode refinements (v4)
   ---------------------------------------- */
[data-theme="dark"] .guide-notice {
  background: var(--info-bg);
  color: var(--info);
}
[data-theme="dark"] .app-footer {
  background: var(--bg-alt);
}
[data-theme="dark"] .editor {
  /* ダーク時: エディタ背景をわずかに暖色に */
  background: var(--bg);
}
[data-theme="dark"] .copy-feedback {
  background: var(--success);
}

