:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --secondary: #34a853;
  --accent: #fbbc04;
  --danger: #ea4335;
  --text: #202124;
  --text-secondary: #5f6368;
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --border: #dadce0;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --max-width: 1200px;
}

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

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  color: var(--text);
  background: var(--bg-secondary);
  line-height: 1.8;
  font-size: 16px;
}

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

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo { font-size: 20px; font-weight: 700; color: #fff; }
.site-logo:hover { color: #fff; text-decoration: none; }
.site-logo span { font-weight: 400; font-size: 14px; opacity: 0.85; margin-left: 8px; }

/* Navigation */
.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a {
  color: rgba(255,255,255,0.9);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}
.site-nav a:hover { background: rgba(255,255,255,0.15); color: #fff; text-decoration: none; }
.site-nav a.active { background: rgba(255,255,255,0.2); color: #fff; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}
.hero h1 { font-size: 36px; font-weight: 700; margin-bottom: 12px; }
.hero p { font-size: 18px; opacity: 0.9; max-width: 600px; margin: 0 auto; }

/* Breadcrumb */
.breadcrumb {
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 8px; }

/* Search */
.search-section { padding: 30px 0 10px; }
.search-box {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 2px solid var(--border);
  border-radius: 28px;
  font-size: 16px;
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.search-box .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 18px;
}

/* Category Cards */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  padding: 24px 0;
}
.category-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.category-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.category-card-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.category-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.category-card-header h2 { font-size: 18px; font-weight: 600; }
.category-card-header h2 a { color: var(--text); }
.category-card-header h2 a:hover { color: var(--primary); text-decoration: none; }
.category-card-body { padding: 16px 24px 20px; }
.category-card-body ul { list-style: none; }
.category-card-body li {
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.category-card-body li:last-child { border-bottom: none; }
.category-card-body li a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 4px 0;
}
.category-card-body li a:hover { color: var(--primary); text-decoration: none; }
.category-card-body li a::before {
  content: '▸';
  color: var(--primary);
  font-size: 12px;
  flex-shrink: 0;
}

/* Keyword Page */
.keyword-page { padding: 0 0 60px; }
.keyword-main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
.keyword-content {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}
.keyword-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}
.keyword-content .keyword-en {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 20px;
}
.keyword-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}
.tag-category { background: var(--primary-light); color: var(--primary); }
.tag-difficulty { background: #fce8e6; color: var(--danger); }
.tag-importance { background: #e6f4ea; color: var(--secondary); }

.keyword-content h2 {
  font-size: 22px;
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  color: var(--text);
}
.keyword-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
  color: var(--text);
}
.keyword-content p {
  margin-bottom: 16px;
  line-height: 1.9;
}
.keyword-content ul, .keyword-content ol {
  margin: 0 0 16px 24px;
}
.keyword-content li { margin-bottom: 8px; line-height: 1.8; }

.keyword-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.keyword-content th, .keyword-content td {
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--border);
}
.keyword-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}
.keyword-content tr:hover { background: #fafafa; }

.info-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  font-size: 15px;
}
.info-box.warning {
  background: #fef7e0;
  border-left-color: var(--accent);
}
.info-box.example {
  background: #e6f4ea;
  border-left-color: var(--secondary);
}
.info-box strong { display: block; margin-bottom: 4px; }

/* Sidebar */
.keyword-sidebar { position: sticky; top: 80px; }
.sidebar-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.sidebar-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-card ul { list-style: none; }
.sidebar-card li { padding: 6px 0; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.sidebar-card li:last-child { border-bottom: none; }
.sidebar-card li a { color: var(--text); }
.sidebar-card li a:hover { color: var(--primary); }
.sidebar-card li a::before { content: '▸ '; color: var(--primary); }
.toc-list li a { font-size: 13px; }
.toc-list li a.active { color: var(--primary); font-weight: 600; }

/* Category Page */
.category-page { padding: 0 0 60px; }
.category-header {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 40px;
  margin-bottom: 24px;
}
.category-header h1 { font-size: 28px; margin-bottom: 12px; }
.category-header p { color: var(--text-secondary); line-height: 1.8; }
.keyword-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}
.keyword-list-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.keyword-list-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.keyword-list-card h3 { font-size: 18px; margin-bottom: 8px; }
.keyword-list-card h3 a { color: var(--text); }
.keyword-list-card h3 a:hover { color: var(--primary); }
.keyword-list-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* All keywords list */
.all-keywords-section { padding: 24px 0 60px; }
.alpha-section { margin-bottom: 32px; }
.alpha-section h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 16px;
}
.alpha-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.alpha-list li a {
  display: block;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  transition: background 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.alpha-list li a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.alpha-list li a small { color: var(--text-secondary); margin-left: 8px; font-size: 12px; }

/* Stats */
.stats-bar {
  display: flex;
  gap: 32px;
  justify-content: center;
  padding: 24px 0;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-number { font-size: 32px; font-weight: 700; color: var(--primary); display: block; }
.stat-label { font-size: 14px; color: var(--text-secondary); }

/* Footer */
.site-footer {
  background: #2d2d2d;
  color: rgba(255,255,255,0.7);
  padding: 40px 0 20px;
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; margin-bottom: 32px; }
.footer-col h4 { color: #fff; font-size: 16px; margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col li { padding: 4px 0; }
.footer-col a { color: rgba(255,255,255,0.7); font-size: 14px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px; }

/* Ad slots */
.ad-slot {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 24px 0;
  text-align: center;
  min-height: 100px;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .hero { padding: 40px 0; }
  .categories-grid { grid-template-columns: 1fr; }
  .keyword-main { grid-template-columns: 1fr; }
  .keyword-sidebar { position: static; }
  .keyword-content { padding: 24px; }
  .keyword-content h1 { font-size: 22px; }
  .keyword-list-grid { grid-template-columns: 1fr; }
  .alpha-list { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .site-nav.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--primary); padding: 16px; }
  .mobile-menu-btn { display: block; }
  .stats-bar { gap: 16px; }
  .stat-number { font-size: 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-inner { padding: 0 16px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .category-header { padding: 24px; }
  .keyword-meta { flex-direction: column; }
}
