:root {
  color-scheme: light;
  --bg-primary: #faf9f5;
  --bg-surface: #ffffff;
  --bg-elevated: #f3f1ec;
  --text-primary: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #78716c;
  --border-color: #e7e5e4;
  --border-strong: #d6d3d1;
  --accent-primary: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #f0fdfa;
  --ad-border: #d6d3d1;
  --ad-bg: #f5f5f4;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
  --max-width: 1024px;
  --font-sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Noto Sans JP", "Yu Gothic UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  font-family: var(--font-sans);
  line-height: 1.75;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Navigation */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0.5rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.site-nav ul {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.site-nav a:hover {
  color: var(--accent-primary);
}

/* Main Layout */
main {
  flex: 1;
  padding: 1.75rem 0 3.5rem;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--text-muted);
}

.hero-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

h1 {
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  line-height: 1.38;
  margin: 0 0 0.75rem;
  color: var(--text-primary);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.4;
  margin: 2rem 0 0.9rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-primary);
}

h3 {
  font-size: 1.12rem;
  line-height: 1.45;
  margin: 1.4rem 0 0.55rem;
  color: var(--text-primary);
}

.page-lead {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
}

.tag-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  background-color: var(--accent-soft);
  color: var(--accent-primary);
  border: 1px solid rgba(15, 118, 110, 0.2);
  font-weight: 700;
  font-size: 0.78rem;
}

/* AIO / LLMO Summary Box */
.summary-box {
  background-color: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin: 1.35rem 0;
}

.summary-box-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 0.45rem;
  color: var(--accent-primary);
}

.summary-box ul {
  margin: 0;
  padding-left: 1.25rem;
}

.summary-box li + li {
  margin-top: 0.35rem;
}

/* Single Adsterra Banner Slot (Strict 1-per-page with CLS & Responsive Containment) */
.ad-unit-single {
  contain: layout style paint;
  background-color: var(--ad-bg);
  border: 1px solid var(--ad-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem 1rem;
  margin: 1.5rem auto;
  text-align: center;
  width: 100%;
  max-width: 760px;
}

.ad-disclosure {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.55rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.ad-slot-viewport {
  min-height: 90px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
}

.ad-placeholder-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Interactive Feature / Tool Container */
.interactive-box {
  contain: layout style;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

/* Cards & Responsive Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 1.15rem;
  margin: 1.35rem 0;
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--accent-primary);
}

.card h3 {
  margin-top: 0.55rem;
}

.card h3 a {
  color: var(--text-primary);
  text-decoration: none;
}

.card h3 a:hover {
  color: var(--accent-primary);
}

/* Off-screen Deferred Rendering for Heavy Content Below the Fold */
.deferred-section {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 280px;
}

/* Content Cards, Responsive Tables & Disclosures */
.content-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.94rem;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  text-align: left;
  vertical-align: top;
}

th {
  background-color: var(--bg-elevated);
  font-weight: 700;
  color: var(--text-primary);
}

details {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.75rem;
}

summary {
  font-weight: 700;
  cursor: pointer;
  min-height: 28px;
}

details[open] summary {
  margin-bottom: 0.6rem;
  color: var(--accent-primary);
}

/* Forms & Touch-Friendly Interactive Controls */
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background-color: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .btn:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
}

.tag-filter-btn {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  font-size: 0.86rem;
}

.tag-filter-btn:hover {
  background-color: var(--accent-soft);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

pre {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

/* Footer */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 1.75rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* Responsive Breakpoints (Tablet & Mobile) */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.65rem 0;
    gap: 0.5rem;
  }

  .site-nav ul {
    gap: 0.4rem 1rem;
  }

  main {
    padding: 1.25rem 0 2.5rem;
  }

  .hero-section,
  .content-section,
  .interactive-box {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  .summary-box {
    padding: 1rem 1.1rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.85rem;
  }

  .hero-section,
  .content-section,
  .interactive-box {
    padding: 1rem;
  }

  th, td {
    padding: 0.5rem 0.6rem;
    font-size: 0.88rem;
  }

  .ad-unit-single {
    padding: 0.6rem 0.5rem 0.8rem;
  }
}
