/* HOMEツールズ 共通デザインシステム */

/* ===== リセット & ベース ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== CSS変数 ===== */
:root {
  /* カラー */
  --color-primary:       #2563eb;
  --color-primary-dark:  #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-success:       #16a34a;
  --color-success-light: #f0fdf4;
  --color-danger:        #dc2626;
  --color-danger-light:  #fef2f2;
  --color-warning:       #d97706;
  --color-warning-light: #fffbeb;

  /* テキスト */
  --text-primary:   #1a1a1a;
  --text-secondary: #374151;
  --text-muted:     #6b7280;
  --text-hint:      #9ca3af;

  /* 背景 */
  --bg-page:    #f5f5f5;
  --bg-card:    #ffffff;
  --bg-subtle:  #f3f4f6;

  /* ボーダー */
  --border:       #e5e5e5;
  --border-focus: #2563eb;

  /* 角丸 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* フォント */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;

  /* レイアウト */
  --nav-height:  48px;
  --max-width:   900px;
  --page-pad:    1.5rem;
}

/* ===== ベース ===== */
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
}

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

/* ===== ナビゲーション ===== */
.ht-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--page-pad);
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: auto;
  scrollbar-width: none;
}
.ht-nav::-webkit-scrollbar { display: none; }

.ht-logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.ht-logo span { color: var(--color-primary); }
.ht-logo:hover { text-decoration: none; }

.ht-nav-sep {
  color: var(--border);
  flex-shrink: 0;
}

.ht-links {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.ht-links a {
  font-size: 12px;
  color: #374151;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.ht-links a:hover { background: var(--bg-subtle); color: var(--text-primary); }
.ht-links a.active { background: var(--color-primary); color: #fff; }

/* ===== ページレイアウト ===== */
.ht-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--page-pad);
}

.ht-head { margin-bottom: 1.5rem; }
.ht-head h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.ht-head p  { font-size: 14px; color: var(--text-secondary); }

/* ===== カード ===== */
.ht-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.ht-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* ===== フォーム ===== */
.ht-input,
input[type=text].ht,
input[type=url].ht,
input[type=number].ht,
textarea.ht,
select.ht {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.15s;
}
.ht-input:focus,
input[type=text].ht:focus,
input[type=url].ht:focus,
input[type=number].ht:focus,
textarea.ht:focus,
select.ht:focus {
  outline: none;
  border-color: var(--border-focus);
}

.ht-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.ht-input-row {
  display: flex;
  gap: 8px;
}
.ht-input-row .ht-input { flex: 1; }

/* ===== ボタン ===== */
.ht-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
}
.ht-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ht-btn-primary { background: var(--color-primary); color: #fff; }
.ht-btn-primary:hover { background: var(--color-primary-dark); }

.ht-btn-success { background: var(--color-success); color: #fff; }
.ht-btn-success:hover { background: #15803d; }

.ht-btn-danger { background: var(--color-danger); color: #fff; }
.ht-btn-danger:hover { background: #b91c1c; }

.ht-btn-ghost {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.ht-btn-ghost:hover { background: var(--border); color: var(--text-primary); }

.ht-btn-sm { padding: 5px 12px; font-size: 12px; }
.ht-btn-xs { padding: 3px 8px; font-size: 11px; }

/* ===== アラート ===== */
.ht-alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 1rem;
}
.ht-alert-error   { background: var(--color-danger-light);  color: #991b1b; border: 1px solid #fecaca; }
.ht-alert-success { background: var(--color-success-light); color: #166534; border: 1px solid #bbf7d0; }
.ht-alert-warning { background: var(--color-warning-light); color: #78350f; border: 1px solid #fde68a; }
.ht-alert-info    { background: var(--color-primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== バッジ ===== */
.ht-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.ht-badge-security { background: #fef2f2; color: #991b1b; }
.ht-badge-network  { background: #eff6ff; color: #1d4ed8; }
.ht-badge-life     { background: #f0fdf4; color: #166534; }
.ht-badge-tool     { background: #faf5ff; color: #6d28d9; }
.ht-badge-game     { background: #fff7ed; color: #c2410c; }

/* ===== テーブル ===== */
.ht-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ht-table th {
  background: #f3f4f6;
  color: #111;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.ht-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
  color: #1a1a1a;
}
.ht-table tr:last-child td { border-bottom: none; }

/* ===== フッター ===== */
.ht-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.ht-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--page-pad);
}
.ht-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.ht-footer-col h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.ht-footer-col ul { list-style: none; }
.ht-footer-col li { margin-bottom: 4px; }
.ht-footer-col a {
  font-size: 13px;
  color: #374151;
  text-decoration: none;
}
.ht-footer-col a:hover { color: var(--color-primary); text-decoration: underline; }
.ht-footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}
.ht-footer-bottom a { color: #4b5563; }
.ht-footer-bottom a:hover { color: var(--color-primary); }

/* ===== ユーティリティ ===== */
.ht-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.ht-mono { font-family: monospace; }
.ht-text-sm { font-size: 13px; }
.ht-text-xs { font-size: 12px; }
.ht-text-muted { color: #4b5563; }
.ht-text-hint  { color: #6b7280;  }
.ht-text-primary-color { color: var(--color-primary); }
.ht-text-success { color: var(--color-success); }
.ht-text-danger  { color: var(--color-danger);  }

.ht-flex { display: flex; align-items: center; }
.ht-flex-between { display: flex; align-items: center; justify-content: space-between; }
.ht-gap-sm { gap: 6px; }
.ht-gap-md { gap: 12px; }

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  :root { --page-pad: 1rem; }
  .ht-head h1 { font-size: 20px; }
  .ht-card { padding: 1.25rem 1rem; }
  .ht-footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}
@media (max-width: 400px) {
  .ht-footer-grid { grid-template-columns: 1fr; }
}

/* ===== ツール共通レイアウト（旧page_extra_headから移動） ===== */

/* ページラッパー（max-widthはdata属性で制御） */
.tool-wrap         { max-width: var(--max-width); margin: 0 auto; padding: 2rem var(--page-pad); }
.tool-wrap-sm      { max-width: 700px; margin: 0 auto; padding: 2rem var(--page-pad); }
.tool-wrap-lg      { max-width: 960px; margin: 0 auto; padding: 2rem var(--page-pad); }

/* ツールヘッダー */
.tool-head         { margin-bottom: 1.5rem; }
.tool-head h1      { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.tool-head p       { font-size: 14px; color: var(--text-secondary); }

/* カード（common.cssのht-cardと統一） */
.card              { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1rem; }
.card-title        { font-size: 14px; font-weight: 600; margin-bottom: 1rem; }

/* ヒーローバンド */
.hero-band         { padding: 2rem var(--page-pad); }
.hero-band-inner   { max-width: var(--max-width); margin: 0 auto; }
.hero-band h1      { font-size: 24px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.hero-band p       { font-size: 14px; color: var(--text-secondary); }

/* ボタン */
.btn               { background: var(--color-primary); color: #fff; border: none; padding: 9px 20px; border-radius: var(--radius-md); font-size: 14px; font-family: var(--font); font-weight: 500; cursor: pointer; transition: background .15s; }
.btn:hover         { background: var(--color-primary-dark); }
.btn:disabled      { opacity: .5; cursor: not-allowed; }
.btn-sm            { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border); padding: 5px 12px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.btn-sm:hover      { background: var(--border); color: var(--text-primary); }
.btn-gray          { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border); padding: 9px 16px; border-radius: var(--radius-md); font-size: 13px; cursor: pointer; }
.btn-gray:hover    { background: var(--border); }
.btn-green         { background: var(--color-success); color: #fff; border: none; padding: 9px 20px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-green:hover   { background: #15803d; }
.btn-dl            { background: var(--color-success); color: #fff; border: none; padding: 5px 12px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.btn-row           { display: flex; gap: 8px; margin-top: 1rem; flex-wrap: wrap; }
.scan-btn          { display: block; width: 100%; padding: 14px; background: var(--color-primary); color: #fff; border: none; border-radius: var(--radius-lg); font-size: 16px; font-weight: 600; cursor: pointer; transition: background .15s; }
.scan-btn:hover    { background: var(--color-primary-dark); }
.scan-btn:disabled { opacity: .6; cursor: not-allowed; }

/* フォーム */
.input-row         { display: flex; gap: 8px; }
.input-row input   { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 14px; font-family: var(--font); }
.input-row input:focus { outline: none; border-color: var(--border-focus); }
.search-row        { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row input  { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 14px; }
.search-row input:focus { outline: none; border-color: var(--border-focus); }
.option-row        { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--bg-subtle); }
.option-row:last-child { border-bottom: none; }
.option-label      { font-size: 14px; color: var(--text-primary); }

/* タブ */
.tabs              { display: flex; gap: 4px; margin-bottom: 1rem; }
.tab               { padding: 6px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-card); font-size: 13px; cursor: pointer; color: var(--text-secondary); }
.tab.active        { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* エラー・アラート */
.error             { background: var(--color-danger-light); color: #991b1b; padding: 12px 14px; border-radius: var(--radius-md); font-size: 14px; margin-top: 8px; border: 1px solid #fecaca; }

/* レイアウト */
.layout-2col       { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .layout-2col { grid-template-columns: 1fr; } }
.result-grid       { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.section-title     { font-size: 15px; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; }

/* スコアボックス */
.score-box         { border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; color: #fff; margin-bottom: 1rem; }
.score-box.safe    { background: linear-gradient(135deg, #16a34a, #15803d); }
.score-box.caution { background: linear-gradient(135deg, #d97706, #b45309); }
.score-box.danger  { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.score-num         { font-size: 48px; font-weight: 700; line-height: 1; }
.score-label       { font-size: 15px; margin-top: 6px; opacity: .9; }

/* 脆弱性アイテム */
.vuln-item         { padding: 12px 14px; border-radius: var(--radius-md); margin-bottom: 6px; border-left: 4px solid; }
.vuln-critical     { background: #fef2f2; border-color: #dc2626; }
.vuln-high         { background: #fffbeb; border-color: #d97706; }
.vuln-medium       { background: #fff7ed; border-color: #fb923c; }
.vuln-low          { background: #f0fdf4; border-color: #16a34a; }
.vuln-crit         { background: #fef2f2; border-color: #dc2626; }
.vuln-title        { font-size: 13px; font-weight: 600; margin-bottom: 3px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vuln-desc         { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* セーフボックス */
.safe-box          { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; }
.safe-box h3       { color: var(--color-success); font-size: 18px; margin-bottom: 8px; }

/* テキスト出力 */
.output            { width: 100%; height: 300px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); font-family: monospace; font-size: 13px; resize: vertical; background: var(--bg-subtle); line-height: 1.5; }

/* ===== ハンバーガーメニュー ===== */
/* 1025px以上ではハンバーガー非表示・リンクは横並び表示 */
@media (min-width: 1025px) {
  .ht-hamburger { display: none !important; }
  .ht-links { display: flex !important; flex-direction: row; position: static; background: none; border: none; padding: 0; box-shadow: none; width: auto; }
}
.ht-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}
.ht-hamburger span {
  display: block;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.2s;
}
.ht-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ht-hamburger.open span:nth-child(2) { opacity: 0; }
.ht-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1024px) {
  .ht-hamburger { display: flex; }
  .ht-nav { flex-wrap: wrap; padding: 0 1rem; position: relative; }
  .ht-nav-sep { display: none; }
  .ht-links {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .ht-links.open { display: flex; }
  .ht-links a {
    padding: 10px 1.5rem;
    border-radius: 0;
    font-size: 14px;
    border-bottom: 1px solid var(--bg-subtle);
  }
  .ht-links a:last-child { border-bottom: none; }
  .ht-links a.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
  }
}
