/* JSON変換ツール — 共通スタイル */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2e3349;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #10b981;
  --error: #ef4444;
  --banner-bg: #0f2318;
  --banner-text: #86efac;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
}

/* ヘッダー */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.logo { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1rem; white-space: nowrap; }

nav { display: flex; gap: 8px; flex-wrap: wrap; }
nav a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
nav a:hover, nav a.active { background: rgba(99,102,241,0.15); color: var(--text); }

/* プライバシーバナー */
.banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  padding: 9px 24px;
  font-size: 0.82rem;
  border-bottom: 1px solid #166534;
  text-align: center;
}

/* メインコンテンツ */
main { flex: 1; padding: 24px; max-width: 1440px; margin: 0 auto; width: 100%; }

h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.subtitle { color: var(--muted); font-size: 0.85rem; margin-bottom: 18px; }

/* アクションバー */
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ボタン */
button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}
button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.98); }

button.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
button.secondary:hover { border-color: var(--accent); background: rgba(99,102,241,0.1); }

button.copy-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 4px 10px;
}
button.copy-btn:hover { border-color: var(--accent); color: var(--text); }

/* エラーメッセージ */
.error-msg {
  display: none;
  color: var(--error);
  font-size: 0.85rem;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.1);
  border-radius: 6px;
  border-left: 3px solid var(--error);
}
.error-msg.visible { display: block; }

/* 2ペインコンバーター */
.converter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  height: calc(100vh - 230px);
  min-height: 360px;
}

.pane { display: flex; flex-direction: column; }

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pane-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
  font-size: 0.83rem;
  padding: 12px;
  resize: none;
  outline: none;
  line-height: 1.65;
  transition: border-color 0.15s;
  tab-size: 2;
}
textarea:focus { border-color: var(--accent); }
textarea.has-error { border-color: var(--error); }

/* JSONスキーマ検証 */
.schema-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.schema-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  height: calc(100vh - 330px);
  min-height: 280px;
}

.schema-input { display: flex; flex-direction: column; }

.result-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  min-height: 90px;
  font-size: 0.88rem;
  line-height: 1.6;
}

.result-empty { color: var(--muted); }
.result-valid { color: var(--success); font-weight: 600; }
.result-invalid .result-title { color: var(--error); font-weight: 600; margin-bottom: 8px; }
.result-invalid .error-list {
  margin-top: 8px;
  padding-left: 20px;
  color: #fca5a5;
  font-size: 0.83rem;
  list-style: disc;
}
.result-invalid .error-list li { margin-bottom: 3px; }

/* トップページ */
.hero {
  text-align: center;
  padding: 52px 0 36px;
}
.hero h1 { font-size: 2rem; margin-bottom: 14px; }
.hero .lead { color: var(--muted); font-size: 0.95rem; max-width: 560px; margin: 0 auto 28px; line-height: 1.7; }

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.82rem;
  color: #a5b4fc;
  margin-bottom: 36px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  max-width: 960px;
  margin: 0 auto;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
  display: block;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .card-icon { font-size: 1.5rem; margin-bottom: 10px; }
.tool-card h2 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.tool-card p { color: var(--muted); font-size: 0.82rem; line-height: 1.55; }

/* フッター */
footer {
  text-align: center;
  padding: 14px;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
}

/* レスポンシブ */
@media (max-width: 768px) {
  .converter { grid-template-columns: 1fr; height: auto; }
  .schema-inputs { grid-template-columns: 1fr; height: auto; }
  textarea { min-height: 180px; }
  header { gap: 12px; }
  .hero h1 { font-size: 1.5rem; }
}
