:root {
  --c-bg: #f7f7f5;
  --c-text: #222;
  --c-muted: #666;
  --c-border: #ddd;
  --c-accent: #0a6cb5;
  --c-new: #2a8a4a;
  --c-urgent: #c0392b;
  --c-card: #fff;
  --radius: 8px;
  --space: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space);
  padding: var(--space) calc(var(--space) * 1.5);
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}

.site-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--c-text);
}

.site-main {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space);
}

.site-footer {
  max-width: 980px;
  margin: calc(var(--space) * 2) auto var(--space);
  padding: var(--space);
  border-top: 1px solid var(--c-border);
  font-size: 0.875rem;
  color: var(--c-muted);
}

.site-footer .disclaimer { font-size: 0.8rem; }

.intro h1 { margin-bottom: 0.25em; }
.intro p { color: var(--c-muted); }
.intro .tagline {
  font-size: 1.15rem;
  color: var(--c-accent);
  margin: 4px 0 12px 0;
  letter-spacing: 0.02em;
}
.intro .tagline strong { color: var(--c-accent); }

.filters {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space);
  margin-bottom: var(--space);
}
.filters summary { cursor: pointer; font-weight: 600; }
.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}
.filter-label {
  font-weight: 600;
  min-width: 4em;
  color: var(--c-muted);
}
.filter-group label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: 0.875rem;
}
.filter-group select,
#reset-filters,
#copy-link {
  font-size: 0.9rem;
  padding: 4px 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}
#copy-link.copied {
  background: var(--c-new);
  color: #fff;
  border-color: var(--c-new);
}
.filter-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--c-border);
}
.persist-note {
  font-size: 0.75rem;
  color: var(--c-muted);
}

.card-list {
  display: grid;
  gap: var(--space);
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 0.75rem;
  border-radius: 999px;
  margin-right: 4px;
  color: #fff;
  vertical-align: middle;
}
.badge-new { background: var(--c-new); }
.badge-urgent { background: var(--c-urgent); }

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag {
  background: #eef3f8;
  color: #2a4a6a;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}
.tag-size {
  background: #f0eef8;
  color: #4a3a6a;
}
/* Phase 1 (TECH_DEF §1.1): 全業種対象 (universal=true) を示すバッジ */
.tag-universal {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 600;
}
/* Phase 1 (TECH_DEF §4.4): inferred=true (AI 推測) を示すバッジ */
.inferred-badge {
  display: inline-block;
  font-size: 0.65rem;
  color: #888;
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
  font-style: italic;
}

.card-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  margin: 0;
  font-size: 0.9rem;
}
.card-meta dt { color: var(--c-muted); }
.card-meta dd { margin: 0; }

.card-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--c-text);
}

.card-actions { margin: 0; }
.btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--c-accent);
  color: #fff;
  font-size: 0.875rem;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn-primary { font-weight: 600; }

.empty {
  color: var(--c-muted);
  text-align: center;
  padding: calc(var(--space) * 2);
}
.hidden { display: none; }

.detail h1 { margin-top: 0; }
.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space) 0;
}
.detail-table th,
.detail-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.detail-table th {
  width: 8em;
  color: var(--c-muted);
  font-weight: 600;
}
.detail-summary, .detail-body { margin-top: var(--space); }
.detail-cta { margin: calc(var(--space) * 1.5) 0; }
.back-link { font-size: 0.9rem; }
.disclaimer { font-size: 0.85rem; color: var(--c-muted); }
.badges { margin-bottom: 8px; }

.ai-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #4a3a6a;
  background: #f0eef8;
  padding: 1px 6px;
  border-radius: 999px;
  margin: 0 4px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.ai-notice {
  font-size: 0.85rem;
  color: #7a5a1a;
  background: #fdf6e3;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin: 8px 0;
  border-left: 3px solid #d4a017;
}
.diff-points {
  font-size: 0.85rem;
  color: var(--c-muted);
  margin-top: 4px;
}
.diff-points a { color: var(--c-accent); }

/* === Phase 1.6: 3秒判定 / 警告 === */
.card-warning {
  margin: 4px 0;
  padding: 6px 10px;
  background: #fdf6e3;
  border-left: 3px solid #d4a017;
  font-size: 0.85rem;
  color: #7a5a1a;
  border-radius: 4px;
}
.warning-icon {
  font-weight: bold;
  margin-right: 4px;
}
.badge-difficulty {
  background: #6a7a8a;
  color: #fff;
}
.catch-phrase {
  font-size: 1.05rem;
  color: var(--c-muted);
  font-style: italic;
  margin: 8px 0 16px;
  padding-left: 12px;
  border-left: 3px solid var(--c-border);
}
.quick-decision {
  background: #f9fafb;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space);
  margin: var(--space) 0;
}
.quick-decision h2 {
  margin-top: 0;
  font-size: 1.1rem;
}
.plain-summary {
  font-size: 1rem;
  margin: 4px 0 16px;
  padding: 8px 12px;
  background: #fff;
  border-radius: var(--radius);
  border-left: 3px solid var(--c-accent);
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.quick-block {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.quick-block h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--c-muted);
  font-weight: 600;
}
.quick-block ul {
  margin: 0;
  padding-left: 1.2em;
  font-size: 0.9rem;
}
.quick-block li { margin: 2px 0; }
.quick-warning {
  background: #fdf6e3;
  border-color: #d4a017;
}
.quick-warning h3 { color: #7a5a1a; }

/* === Phase 1.7: Wizard / Visited tracking === */

/* 既読カードのグレーアウト */
.card.visited {
  opacity: 0.55;
  position: relative;
}
.card.visited::after {
  content: "既読";
  position: absolute;
  top: 8px; right: 8px;
  font-size: 0.7rem;
  background: #999;
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
}
body.hide-visited .card.visited { display: none; }

/* 未読トグル & 既読リセット */
.filter-actions-secondary {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--c-border);
}
.unread-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.text-button {
  background: none;
  border: none;
  color: var(--c-accent);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 4px;
}
.text-button:hover { text-decoration: underline; }
.text-link {
  font-size: 0.85rem;
  color: var(--c-accent);
}

/* ウィザード モーダル */
.wizard-modal { position: fixed; inset: 0; z-index: 100; }
.wizard-modal.hidden { display: none; }
.wizard-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.wizard-dialog {
  position: relative;
  max-width: 640px;
  margin: 5vh auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  padding: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
}
.wizard-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.wizard-skip {
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--c-muted);
  cursor: pointer;
}
.wizard-skip:hover { color: var(--c-text); }
.wizard-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.wizard-progress {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--c-muted);
}
.wizard-step h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}
.wizard-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.wizard-option {
  padding: 10px 12px;
  font-size: 0.95rem;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, border-color 0.1s;
}
.wizard-option:hover { background: #f6f7f9; }
.wizard-option.selected {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.wizard-free {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--c-border);
}
.wizard-free-label {
  display: block;
  font-size: 0.85rem;
  color: var(--c-muted);
  margin-bottom: 4px;
}
.wizard-free-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.95rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-sizing: border-box;
}
.wizard-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  background: #fafafa;
  border-radius: 0 0 12px 12px;
}
.wizard-back,
.wizard-next {
  padding: 8px 16px;
  font-size: 0.95rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}
.wizard-next {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
  font-weight: 600;
}
.wizard-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body.wizard-open { overflow: hidden; }

.footer-links {
  font-size: 0.85rem;
  margin-top: 8px;
}
.about .lead {
  font-size: 1rem;
  color: var(--c-text);
  padding: 12px 16px;
  background: #f0f6fb;
  border-left: 3px solid var(--c-accent);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.about h3 { margin-top: 1em; font-size: 1rem; }

/* === アクセシビリティ === */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: 0 0 var(--radius) 0;
  z-index: 200;
  font-size: 0.9rem;
}
.skip-link:focus {
  left: 0;
  outline: 3px solid #ffb800;
  text-decoration: none;
}

/* 共通フォーカススタイル — マウス時は地味、キーボード時に強調 */
*:focus-visible {
  outline: 3px solid #ffb800;
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #ffb800;
  outline-offset: 2px;
}

/* main 自体には outline は出さない（tabindex="-1" の不可視フォーカス用） */
.site-main:focus { outline: none; }
.site-main:focus-visible { outline: none; }

/* === 共有ボタン === */
.share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: var(--space) 0;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.share-label {
  font-size: 0.85rem;
  color: var(--c-muted);
  font-weight: 600;
}
.share-button {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.85rem;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  cursor: pointer;
  font-family: inherit;
}
.share-button:hover { background: #eef3f8; text-decoration: none; }
.share-twitter { color: var(--c-text); }
.share-copy { font-family: inherit; }
.share-copy.copied {
  background: var(--c-new);
  color: #fff;
  border-color: var(--c-new);
}

/* === 404ページ === */
.not-found {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--space) * 2) var(--space);
}
.not-found h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.not-found .lead {
  font-size: 1rem;
  color: var(--c-muted);
  padding: 12px 16px;
  background: #f0f6fb;
  border-left: 3px solid var(--c-accent);
  border-radius: var(--radius);
  margin: 16px 0;
}
.not-found .hint {
  font-size: 0.85rem;
  color: var(--c-muted);
  margin-top: 12px;
}

/* === レスポンシブ強化 === */
@media (max-width: 640px) {
  .site-header {
    padding: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .site-main {
    padding: 12px;
  }
  .card-list {
    grid-template-columns: 1fr;
  }
  .filter-group {
    gap: 4px 8px;
  }
  .filter-group label {
    font-size: 0.8rem;
    padding: 2px 6px;
  }
  .detail-table th {
    width: 6em;
    font-size: 0.85rem;
  }
  .detail-table td {
    font-size: 0.9rem;
  }
  .quick-grid {
    grid-template-columns: 1fr;
  }
  .wizard-dialog {
    margin: 2vh 8px;
    max-height: 96vh;
  }
}
