/* 法令サーチ — スタイルシート（独立プロダクトデザイン） */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #14181f;
  --ink-soft: #4a5160;
  --muted: #8a92a3;
  --line: #e7e9ee;
  --line-soft: #f0f1f5;
  --accent: #1d4ed8;
  --accent-dark: #1740a8;
  --accent-soft: #eef3ff;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --ng: #c2410c;
  --ng-soft: #fff7ed;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20,24,31,.06), 0 1px 3px rgba(20,24,31,.04);
  --shadow-md: 0 4px 16px rgba(20,24,31,.08), 0 2px 6px rgba(20,24,31,.04);
  --shadow-lg: 0 18px 50px rgba(20,24,31,.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Inter", "Noto Sans JP", "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ===== ヘッダー ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247,248,250,.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 920px;
  margin: 0 auto;
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
/* ナビ群：セグメントピル（薄グレーの土台＋ホバーで白く浮く） */
.header-nav {
  display: flex; align-items: center; gap: 2px;
  background: var(--line-soft); border-radius: 10px; padding: 3px;
}
.nav-link {
  padding: 8px 15px; border-radius: 8px;
  color: var(--ink-soft); font-size: 14.5px; font-weight: 600; letter-spacing: .01em;
  text-decoration: none; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s;
}
.nav-link:hover { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
/* ヘッダー内のアクションボタン（みんなの検索履歴）も少し大きく */
.header-actions .ghost-btn { font-size: 14.5px; }

/* 検索ボックス下の注意（みんなの検索履歴＝共有のため個人情報禁止） */
.search-warning {
  max-width: 680px; margin: 12px auto 0; padding: 10px 14px;
  background: var(--ng-soft); border: 1px solid #fed7aa; border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.65; color: var(--ng); text-align: left;
  display: flex; gap: 8px; align-items: flex-start;
}
.search-warning svg { flex-shrink: 0; margin-top: 2px; }
.search-warning strong { font-weight: 700; }
/* ドロワー内の注意 */
.drawer-note {
  margin: 0 12px 8px; padding: 10px 12px; font-size: 12px; line-height: 1.6;
  color: var(--ng); background: var(--ng-soft); border: 1px solid #fed7aa; border-radius: 8px;
}

/* ===== ボタン ===== */
.primary-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { background: #b6c2e0; cursor: not-allowed; }
.primary-btn.small { padding: 8px 16px; font-size: 13px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.ghost-btn:hover { border-color: #cfd4de; color: var(--ink); }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 6px; border-radius: 8px;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

.text-btn {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 13px; font-weight: 600;
  padding: 4px 6px; border-radius: 6px;
  transition: background .15s;
}
.text-btn:hover { background: var(--accent-soft); }

/* ===== メイン ===== */
.main { max-width: 920px; margin: 0 auto; padding: 0 24px 80px; }

/* ===== ヒーロー ===== */
.hero { padding: 72px 0 24px; text-align: center; }
.hero-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.3;
  margin-bottom: 14px;
}
.hero-subtitle {
  color: var(--ink-soft);
  font-size: 16px;
  max-width: 560px;
  margin: 0 auto 32px;
}

.search-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 16px 16px 12px;
  max-width: 680px;
  margin: 0 auto;
  text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}
.search-box textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  max-height: 200px;
}
.search-box textarea::placeholder { color: var(--muted); }
.search-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.search-hint { color: var(--muted); font-size: 12px; }

.examples {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  max-width: 680px;
  margin: 20px auto 0;
}
.example-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ===== ローディング ===== */
.loading {
  display: flex; align-items: center; gap: 16px;
  justify-content: center;
  padding: 64px 24px;
}
.loading-text { display: flex; flex-direction: column; gap: 4px; }
.loading-text span:first-child { font-weight: 600; }
.loading-hint { color: var(--muted); font-size: 13px; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 結果 ===== */
.result { padding-top: 40px; max-width: 760px; margin: 0 auto; }
.result-query {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 20px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.report-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: #fcfcfd;
}
.report-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.report-body {
  padding: 28px 32px 34px;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
}

/* レポート内タイポグラフィ */
.report-body h1, .report-body h2, .report-body h3 { line-height: 1.4; }
.report-body h1 { font-size: 21px; font-weight: 700; margin: 24px 0 12px; }
.report-body h2 {
  font-size: 18px; font-weight: 700; margin: 26px 0 12px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.report-body h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.report-body p { margin: 12px 0; }
.report-body ul, .report-body ol { margin: 12px 0; padding-left: 24px; }
.report-body li { margin: 5px 0; }
.report-body strong { font-weight: 700; }
.report-body a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(29,78,216,.3);
  word-break: break-all;
}
.report-body a:hover { border-bottom-color: var(--accent); background: var(--accent-soft); }
.report-body blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 16px;
  margin: 14px 0;
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft);
}
.report-body table {
  width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px;
}
.report-body th, .report-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.report-body th { background: var(--line-soft); font-weight: 600; }
.report-body pre {
  background: #1118271a; padding: 14px; border-radius: 8px; overflow-x: auto; margin: 14px 0;
  font-size: 13px;
}
.report-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.report-error {
  background: var(--ng-soft);
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 18px 22px;
  color: var(--ng);
}
.report-error strong { display: block; margin-bottom: 6px; }
.report-error p { font-size: 14px; margin: 4px 0; }

/* ===== 無料お試しの残回数表示 ===== */
.trial-status {
  margin: 14px auto 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.trial-status:empty { display: none; }
.trial-status-zero { color: var(--ng); font-weight: 600; }
.trial-status-zero a { color: var(--accent); font-weight: 700; margin-left: 6px; }

/* ===== お試し上限到達カード（コンバージョン導線） ===== */
.limit-card {
  text-align: center;
  padding: 16px 8px;
}
.limit-card h2 {
  font-size: 19px;
  margin-bottom: 12px;
  color: var(--ink);
}
.limit-card p {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 540px;
  margin: 0 auto 20px;
}
.limit-card .primary-btn.large { text-decoration: none; }
.primary-btn.large { padding: 14px 28px; font-size: 15px; }

/* ===== フィードバック ===== */
.feedback {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.feedback-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
}
.fb-btn {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 7px 16px;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.fb-btn.fb-ok { color: var(--ok); }
.fb-btn.fb-ok:hover, .fb-btn.fb-ok.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.fb-btn.fb-ng { color: var(--ng); }
.fb-btn.fb-ng:hover, .fb-btn.fb-ng.on { background: var(--ng); color: #fff; border-color: var(--ng); }
.feedback-detail { margin-top: 14px; }
.feedback-detail textarea {
  width: 100%; min-height: 70px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14px; resize: vertical;
}
.feedback-detail textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.feedback-detail .primary-btn { margin-top: 10px; }
.feedback-sent { margin-top: 8px; font-size: 13px; color: var(--muted); }

.result-foot { text-align: center; margin-top: 28px; }

/* ===== 履歴ドロワー ===== */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(20,24,31,.4);
  z-index: 50;
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 88vw;
  background: var(--surface);
  z-index: 60;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slide-in .22s cubic-bezier(.32,.72,0,1);
}
@keyframes slide-in { from { transform: translateX(100%); } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 16px; font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }

.history-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s;
}
.history-item:hover { background: var(--line-soft); }
.history-item-main { flex: 1; min-width: 0; }
.history-item-query {
  font-size: 14px; font-weight: 500; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.history-item-date { font-size: 12px; color: var(--muted); margin-top: 3px; }
.history-del {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px; border-radius: 6px; flex-shrink: 0; line-height: 1;
  opacity: 0; transition: opacity .12s, color .12s, background .12s;
}
.history-item:hover .history-del { opacity: 1; }
.history-del:hover { color: var(--ng); background: var(--ng-soft); }
.history-empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; }

/* ===== フッター ===== */
.footer {
  max-width: 920px; margin: 0 auto; padding: 28px 24px;
  text-align: center; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--line);
}

/* ===== トースト ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 80;
  animation: toast-in .2s;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  .hero { padding: 48px 0 16px; }
  .hero-title { font-size: 26px; }
  .hero-subtitle { font-size: 15px; }
  .report-body { padding: 22px 20px 26px; }
  .header-inner, .main { padding-left: 16px; padding-right: 16px; }
  .header-actions { gap: 10px; }
  .header-nav { gap: 2px; padding: 3px; }
  .nav-link { padding: 6px 11px; font-size: 13px; }
  .brand-name { font-size: 16px; }
  /* スペース確保のため検索履歴はアイコンのみ表示 */
  #btn_open_history span { display: none; }
  #btn_open_history { padding: 8px; }
}
