:root {
  --primary-color: #2563eb;
  --secondary-color: #0ea5e9;
  --accent-color: #8b5cf6;
  --text-dark: #1e293b;
  --text-gray: #64748b;
  --text-light: #94a3b8;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --border-color: #e2e8f0;
  --transition: all 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  line-height: 1.8;
  color: var(--text-dark);
  background: var(--bg-light);
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  max-width: 900px;
  justify-content: center;
}

.nav-item a {
  font-weight: 500;
  color: white;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: var(--transition);
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-item a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: white;
  border-radius: 3px;
  transition: var(--transition);
}

/* Hero Section */
.hero {
  position: relative;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.85) 0%, rgba(14, 165, 233, 0.85) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 2rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p {
  font-size: 1.2rem;
  line-height: 1.6;
  opacity: 0.95;
}

.hero-small {
  height: 300px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

.hero-cta {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.cta-button {
  padding: 0.8rem 2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.cta-primary {
  background: white;
  color: var(--primary-color);
}

.cta-primary:hover {
  background: var(--bg-light);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.cta-secondary {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid white;
}

.cta-secondary:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Two Column Layout */
.two-column-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.main-content {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.05);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-section {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.sidebar-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 0.5rem;
}

.toc-list a {
  color: var(--text-gray);
  text-decoration: none;
  transition: var(--transition);
  display: block;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.toc-list a:hover {
  color: var(--primary-color);
  padding-left: 0.5rem;
}

.related-links {
  list-style: none;
}

.related-links li {
  margin-bottom: 0.5rem;
}

.related-links a {
  color: var(--text-gray);
  text-decoration: none;
  transition: var(--transition);
  display: block;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.related-links a:hover {
  color: var(--secondary-color);
}

.ad-space {
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  border-radius: 8px;
}

/* Page Header */
.page-header {
  position: relative;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  overflow: hidden;
  margin-bottom: 3rem;
}

.page-header-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.page-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.8) 0%, rgba(139, 92, 246, 0.8) 100%);
  z-index: 1;
}

.page-header-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 2rem;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Content Styles */
.intro-section {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.05);
  margin-bottom: 3rem;
}

.intro-section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.intro-section p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-gray);
  margin-bottom: 1rem;
}

.news-section {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.05);
  margin-bottom: 3rem;
}

.news-section h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--primary-color);
  text-align: center;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.news-card {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--secondary-color);
  transition: var(--transition);
}

.news-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.news-card h3 {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.6;
}

.content-section {
  margin-bottom: 3rem;
}

.content-section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--primary-color);
}

.content-section h3 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.content-section p {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text-gray);
  margin-bottom: 1.5rem;
}

.content-section ul,
.content-section ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.content-section li {
  margin-bottom: 0.5rem;
  color: var(--text-gray);
}

/* Banner Styles */
.amazon-banner {
  background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  margin: 2rem 0;
}

.amazon-banner a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  display: block;
}

.content-banner {
  margin: 2rem auto;
  text-align: center;
  padding: 1rem;
}

/* Additional Classes for Index Page */
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title h2 {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.article-body {
  max-width: 1000px;
  margin: 0 auto;
}

.lead-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-gray);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.feature-card {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0,0,0,0.08);
  transition: var(--transition);
  text-align: center;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 25px rgba(0,0,0,0.12);
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.card-description {
  color: var(--text-gray);
  line-height: 1.6;
}

.news-card-content {
  padding: 1.5rem;
}

.news-card-date {
  font-size: 0.85rem;
  color: var(--secondary-color);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.news-card-title {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--text-dark);
}

.news-card-excerpt {
  font-size: 0.95rem;
  color: var(--text-gray);
  line-height: 1.6;
}

.site-footer {
  background: linear-gradient(135deg, var(--text-dark) 0%, #334155 100%);
  color: white;
  padding: 3rem 2rem 2rem;
  margin-top: 4rem;
}

.footer-title {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.footer-description {
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  max-width: 400px;
}

.footer-heading {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.2);
  text-align: center;
  opacity: 0.8;
}

/* Footer */
footer {
  background: linear-gradient(135deg, var(--text-dark) 0%, #334155 100%);
  color: white;
  padding: 3rem 2rem 2rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 2rem;
}

.footer-section {
  display: flex;
  flex-direction: column;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.footer-links a {
  color: white;
  text-decoration: none;
  transition: var(--transition);
  font-size: 0.95rem;
}

.footer-links a:hover {
  color: var(--secondary-color);
}

.footer-related {
  margin-bottom: 2rem;
}

.footer-related h4 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1rem;
  opacity: 0.9;
}

.footer-related-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-related-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: var(--transition);
  font-size: 0.85rem;
}

.footer-related-links a:hover {
  color: var(--secondary-color);
}

.copyright {
  text-align: center;
  opacity: 0.8;
  font-size: 0.9rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: 70px;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 70px);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
    transition: var(--transition);
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-item {
    width: 100%;
  }

  .nav-item a {
    display: block;
    padding: 1rem;
    border-radius: 8px;
  }

  .hamburger {
    display: flex;
  }

  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .two-column-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .main-content {
    padding: 2rem;
  }

  .sidebar {
    order: -1;
  }

  .intro-section,
  .news-section {
    padding: 2rem;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .footer-related-links {
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
  }
}

@media (max-width: 480px) {
  .hero {
    height: 400px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .page-header {
    height: 200px;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .container {
    padding: 2rem 1rem;
  }

  .two-column-layout {
    padding: 2rem 1rem;
  }

  .main-content {
    padding: 1.5rem;
  }
}



/* === Mobile fix v3 (auto-injected) === */
html, body { overflow-x: hidden; }
img, video, iframe, table { max-width: 100%; }

@media (max-width: 768px) {
  /* ヒーローテキストがviewportからはみ出さないようにする */
  h1, h2, h3 {
    font-size: clamp(1.3rem, 5vw, 2.5rem) !important;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  p, li, td, th, span, a {
    overflow-wrap: break-word;
    word-break: break-word;
  }
  /* 全要素の幅を100vw以内に */
  .container, main, section, article, header, footer, nav,
  [class*="container"], [class*="wrapper"], [class*="content"] {
    max-width: 100vw;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}
/* === End Mobile fix v3 === */
