/* ===== ベース全体 ===== */

body {
  font-family: "Segoe UI", "Hiragino Sans", system-ui, sans-serif;
  margin: 0;
  background: #f4f6f8;
  color: #333;
  line-height: 1.5;
}

header {
  background: #0054a6;
  color: #fff;
  padding: 16px 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

header .sub {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-top: 4px;
}

footer {
  text-align: center;
  font-size: 0.7rem;
  color: #777;
  margin: 16px 0;
}

/* ===== レイアウト ===== */

.layout {
  display: flex;
  flex-wrap: wrap;
  padding: 16px;
  gap: 16px;
  box-sizing: border-box;
}

.panel {
  background: #fff;
  border-radius: 8px;
  flex: 1;
  min-width: 320px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.panel.left {
  flex-basis: 60%;
}

.panel.right {
  flex-basis: 40%;
}

.block {
  margin-bottom: 16px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  padding: 12px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.block.stretch {
  flex: 1;
  min-height: 0;
}

.block h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #0054a6;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.note {
  font-size: 0.75rem;
  color: #555;
  margin-top: 6px;
}
.note.small {
  font-size: 0.7rem;
  color: #777;
}

/* ===== フィルタ ===== */

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 0.8rem;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #333;
}

.filter-input {
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

/* ===== テーブル ===== */

.table-wrapper {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: auto;
  flex: 1;
  max-height: 60vh;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
  font-size: 0.8rem;
}

th {
  background: #eef2f7;
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  white-space: nowrap;
  color: #333;
  font-weight: 600;
  font-size: 0.75rem;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 8px;
}

td {
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
  padding: 6px 8px;
  line-height: 1.4;
  background: #fff;
  word-break: break-word;
}

tr.selected-row td {
  background: #dff0ff;
}

td.question-cell {
  background: #fafafa;
  font-size: 0.8rem;
  min-width: 240px;
  max-width: 360px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* チェックボックス */
input[type="checkbox"] {
  transform: scale(1.2);
  cursor: pointer;
}

/* ===== 選択済みリスト ===== */

#stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  margin-bottom: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
}

.selected-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  max-height: 40vh;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.selected-item {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 0;
}
.selected-item:last-child {
  border-bottom: none;
}

.selected-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.qhead {
  font-weight: 600;
  color: #111;
  font-size: 0.8rem;
}

.list-controls {
  display: flex;
  gap: 4px;
}
.reorder-btn {
  font-size: 0.7rem;
  line-height: 1rem;
  padding: 2px 6px;
  border: 1px solid #94a3b8;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.reorder-btn:hover {
  background: #e2e8f0;
}

.meta {
  font-size: 0.7rem;
  color: #555;
  margin: 4px 0 6px;
}

.title-block {
  font-size: 0.8rem;
  margin-bottom: 4px;
  line-height: 1.4;
  background: #eef2ff;
  border-radius: 4px;
  border-left: 3px solid #6366f1;
  padding: 4px 6px;
  word-wrap: break-word;
  font-weight: 600;
}

.case-block {
  font-size: 0.8rem;
  margin-bottom: 4px;
  padding: 4px 6px;
  line-height: 1.4;
  background: #fff8e1;
  border-radius: 4px;
  border-left: 3px solid #facc15;
  word-wrap: break-word;
}

.qtext-block {
  font-size: 0.8rem;
  margin-bottom: 4px;
  line-height: 1.4;
  background: #fafafa;
  border-radius: 4px;
  padding: 4px 6px;
  word-wrap: break-word;
}

.choices {
  font-size: 0.8rem;
  background: #fdfdfd;
  border-left: 3px solid #94a3b8;
  padding: 4px 6px;
  margin-bottom: 4px;
}
.choice-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}
.choice-label {
  font-weight: 600;
  min-width: 1.5em;
}
.choice-text {
  flex: 1;
  word-break: break-word;
}

.score-row {
  font-size: 0.8rem;
  color: #333;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.score-row select {
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  background: #fff;
  cursor: pointer;
}

/* ===== オプションセクション ===== */

.option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.opt-label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: #333;
  gap: 4px;
}

.opt-label-inline {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  color: #333;
  gap: 6px;
}

.opt-input {
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.opt-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
}

.opt-sub {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}

.opt-sub-inline {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  gap: 4px;
}

.opt-input.small {
  width: 120px;
}

/* ===== 出力ボタン ===== */

.export-zone {
  text-align: center;
}

.export-btn {
  width: 100%;
  background: #0054a6;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.export-btn:hover {
  background: #003f7a;
}

/* ===== スクロールバーの見た目 ===== */

.table-wrapper::-webkit-scrollbar,
.selected-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.table-wrapper::-webkit-scrollbar-thumb,
.selected-list::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-track,
.selected-list::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 4px;
}

/* ヘッダー全体を左右配置 */
.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* 左側ブロック（タイトル＋説明） */
.head-left {
  flex: 1;
  min-width: 250px;
}

/* 右端ボタン */
.head-right {
  text-align: right;
}

/* ボタンデザイン */
.guide-btn {
  display: inline-block;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.guide-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}
/* --- パイ型スクロール進捗インジケーター（シックver.） --- */
#scroll-progress-pie {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: conic-gradient(#6c757d 0%, #6c757d 0%, #2b2f33 0%);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #f1f1f1;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 999;
  transition: transform 0.25s ease, box-shadow 0.3s ease, background 0.3s ease;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 6px 16px rgba(0, 0, 0, 0.4);
  background-blend-mode: multiply;
  backdrop-filter: blur(4px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* --- ホバー時：上品な動きだけ（派手な光はナシ） --- */
#scroll-progress-pie:hover {
  transform: scale(1.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 8px 20px rgba(0, 0, 0, 0.45);
}

/* --- スクロール完了時（静かな達成感のグリーン） --- */
#scroll-progress-pie.fully-scrolled {
  background: conic-gradient(#198754 100%, #198754 100%, #2b2f33 0%);
  color: #e9ecef;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 8px 20px rgba(0, 0, 0, 0.45);
}

/* --- 出現時のフェードイン効果 --- */
#scroll-progress-pie.show {
  display: flex;
  animation: fadeInScale 0.4s ease forwards;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- 「TOP」文字を中央に完全固定する --- */
#scroll-progress-pie::before {
  content: "⇧";
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  color: inherit;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* --- 文字「TOP」を下部に控えめに配置 --- */
#scroll-progress-pie::after {
  content: "TOP";
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 1.5px;
  opacity: 0.8;
}

.tags-cell { white-space: normal; line-height: 1.6; }
.tag-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #eef2f7;
  border: 1px solid #d7dce3;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

.resizable-table {
  table-layout: fixed; /* なくても動くが固定にすると見栄えが安定 */
}
.resizable-table th {
  position: relative;
  overflow: visible;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;           /* ヘッダー右端に配置 */
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}
.col-resizer:hover {
  background: rgba(0,0,0,0.06);
}
.resizing .col-resizer {
  background: rgba(0,0,0,0.08);
}
.meta.tags { color: #3b4252; opacity: 0.9; }