/* ========================================
   KST 共通スタイルシート
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700;900&display=swap');

/* リセット・基本設定 */
*, *::before, *::after { box-sizing: border-box; }

html { overflow-x: hidden; }

:root {
  /* カラーパレット - 落ち着いた配色 */
  --color-primary: #3574e0;
  --color-primary-dark: #2458b8;
  --color-success: #0fa678;
  --color-success-dark: #0b8a63;
  --color-warning: #e89a0c;
  --color-warning-dark: #c9860a;
  --color-purple: #7e55e0;
  --color-purple-dark: #6940c4;

  /* テキスト */
  --color-text: #1a2332;
  --color-text-muted: #5e6e82;
  --color-text-light: #8d9bb0;

  /* 背景 */
  --color-bg: #f5f7fa;
  --color-bg-card: rgba(255, 255, 255, 0.95);
  --color-border: rgba(140, 155, 175, 0.18);

  /* シャドウ - 多層的で控えめ */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.03), 0 6px 20px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.06);

  /* 角丸 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* フォント */
  --font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  padding: 16px;
  font-family: var(--font-family);
  background: linear-gradient(160deg, #f0f2f6 0%, #e4e8ee 30%, #d5dbe5 60%, #b8c2d0 100%);
  min-height: 100vh;
  color: var(--color-text);
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* コンテナ */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

/* カード */
.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ヘッダー */
h1 {
  margin: 0 0 20px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ナビゲーション */
.nav {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  border: 1px solid rgba(255, 255, 255, 0.45);
  position: sticky;
  top: 8px;
  z-index: 1000;
}

.nav-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
  white-space: nowrap;
}

.nav-search {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}

.nav-search input {
  width: 100%;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--font-family);
  outline: none;
  transition: all 0.2s ease;
}

.nav-search input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(53, 116, 224, 0.1);
  background: #fff;
}

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: transparent;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
}

.nav-link.active {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* フォーム要素 */
label {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 6px 0;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.2s ease;
  background: #fff;
}

input:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(53, 116, 224, 0.1);
}

/* ボタン */
.btn {
  padding: 10px 20px;
  font-size: 14px;
  font-family: var(--font-family);
  border-radius: var(--radius-full);
  border: none;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(53, 116, 224, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
  color: #fff;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 166, 120, 0.25);
}

.btn-warning {
  background: linear-gradient(135deg, var(--color-warning), var(--color-warning-dark));
  color: #fff;
}

.btn-warning:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 154, 12, 0.25);
}

.btn-purple {
  background: linear-gradient(135deg, var(--color-purple), var(--color-purple-dark));
  color: #fff;
}

.btn-purple:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(126, 85, 224, 0.25);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ピル（タグ） */
.pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: #f9fafb;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* 結果表示 */
.results {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fbfdff;
}

.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--color-border);
}

.kv .k {
  color: var(--color-text-muted);
}

.kv .v {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  font-size: 22px;
  color: var(--color-success);
  min-width: 72px;
  text-align: right;
}

/* ガイドメッセージ */
.guide {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  color: #b91c1c;
  font-weight: 700;
}

/* グリッドレイアウト */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* レスポンシブ対応 - タブレット */
@media (max-width: 900px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 20px;
  }

  .card {
    padding: 16px;
  }
}

/* レスポンシブ対応 - スマートフォン */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .wrap {
    gap: 12px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .nav {
    padding: 8px 10px;
    border-radius: var(--radius-md);
    position: static;
    overflow: hidden;
  }

  .nav-brand {
    font-size: 16px;
  }

  .nav-title {
    font-size: 14px;
  }

  .nav-search {
    flex: 1 1 100%;
    max-width: none;
    order: 10;
  }

  .nav-link-home {
    margin-left: auto;
  }

  .nav-links {
    order: 1;
    width: 100%;
    margin-left: 0;
    justify-content: center;
    margin-top: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }

  .nav-link {
    padding: 6px 10px;
    font-size: 11px;
    flex-shrink: 0;
  }

  h1 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  input, select {
    padding: 10px 12px;
    font-size: 14px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .kv {
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
  }

  .kv .v {
    font-size: 20px;
    text-align: left;
  }

  .pill {
    padding: 4px 10px;
    font-size: 11px;
  }

  .results {
    padding: 12px;
  }
}

/* 凡例 */
.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.2);
  display: inline-block;
}

.dot.green { background: #7fc97f; }
.dot.yellow { background: #f2c14e; }
.dot.white { background: #fff; border: 1px solid #111; }

/* SVGラッパー */
.svg-wrap {
  padding: 12px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border: 1px solid #eee;
  overflow: hidden;
}

.svg-wrap svg {
  display: block;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  height: auto;
}

/* 空状態 */
.empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 60px 20px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
}

/* トースト通知 */
.toast {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: 6px;
}

/* アクションボタン群 */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* フッター */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: 20px;
}
