:root {
  --page-bg: #f4f7fc;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --surface-accent: #eef4ff;
  --line: #dfe6f2;
  --line-strong: #ccd7ea;
  --text-main: #1f2a44;
  --text-sub: #6d7a92;
  --text-soft: #8d98ad;
  --brand: #3f6df6;
  --brand-strong: #2747c7;
  --brand-soft: #edf3ff;
  --pink-soft: #fff0f6;
  --pink-text: #e04d87;
  --footer-bg: #202c44;
  --shadow-card: 0 24px 60px rgba(31, 42, 68, 0.08);
  --shadow-soft: 0 12px 28px rgba(63, 109, 246, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", "Noto Sans JP", "Hiragino Sans", Meiryo, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(63, 109, 246, 0.08), transparent 32%),
    linear-gradient(180deg, #f8faff 0%, var(--page-bg) 100%);
  line-height: 1.85;
}

a {
  color: inherit;
}

.container {
  width: min(100% - 32px, 920px);
  margin: 0 auto;
  padding: 28px 0 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.back-link {
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  transition: color 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
  color: var(--brand-strong);
  transform: translateX(-2px);
}

.header-share {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.share-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.share-btn.x {
  background: #16181d;
  font-size: 1.25rem;
}

.share-btn.fb {
  background: #3873f0;
  font-size: 1.25rem;
}

.share-btn.line {
  background: #11bf5d;
}

.glass-card {
  background: var(--surface);
  border: 1px solid rgba(223, 230, 242, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 42px 44px 34px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.glass-card.loaded {
  opacity: 1;
  transform: translateY(0);
}

.term-header {
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.term-title {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.term-english {
  display: inline-block;
  margin-top: 12px;
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 600;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge.category {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: rgba(63, 109, 246, 0.16);
}

.badge.level {
  color: var(--pink-text);
  background: var(--pink-soft);
  border-color: rgba(224, 77, 135, 0.18);
}

.term-description {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  padding: 20px 22px;
  background: var(--surface-accent);
  border: 1px solid rgba(63, 109, 246, 0.1);
  border-radius: var(--radius-md);
}

.summary-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--brand);
  border: 2px solid currentColor;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

.summary-text {
  color: var(--brand-strong);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.75;
}

.term-content {
  overflow-wrap: anywhere;
}

.term-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.term-content a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.term-content a:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

.term-content p {
  margin: 0 0 20px;
  color: #4f5c74;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.8;
}

.term-content p:last-child {
  margin-bottom: 0;
}

.term-content h2,
.term-content h3,
.term-content h4 {
  color: var(--text-main);
  line-height: 1.4;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.term-content h2 {
  margin: 56px 0 24px;
  font-size: 1.55rem;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
}

.term-content h2:first-child {
  margin-top: 0;
}

.term-content h3 {
  margin: 40px 0 16px;
  font-size: 1.25rem;
  padding-left: 14px;
  border-left: 5px solid var(--brand);
}

.term-content h4 {
  margin: 32px 0 12px;
  font-size: 1.1rem;
  color: var(--brand-strong);
}

.term-content strong {
  font-weight: 700;
  color: #2c3e50;
  background: linear-gradient(transparent 60%, rgba(63, 109, 246, 0.15) 60%);
}

.term-content ul,
.term-content ol {
  margin: 0 0 24px 1.5rem;
  color: #4f5c74;
  font-size: 1.02rem;
  font-weight: 500;
  padding-left: 0;
}

.term-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.term-content pre {
  background: #1e293b;
  color: #f8fafc;
  padding: 18px 22px;
  border-radius: 12px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 24px 0;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15);
}

.term-content code {
  background: var(--surface-accent);
  color: var(--pink-text);
  padding: 3px 6px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.85em;
  font-weight: 600;
}

.term-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: 400;
}

.term-content br {
  display: block;
  content: "";
  margin-top: 12px;
}

.term-image {
  margin: 24px 0 16px;
}

.term-image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.term-image figcaption {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.internal-link {
  color: var(--brand-strong);
  text-decoration: none;
  font-weight: 800;
}

.internal-link:hover {
  text-decoration: underline;
}

.external-link {
  color: var(--brand-strong);
  text-decoration: underline;
  text-decoration-color: rgba(39, 71, 199, 0.35);
  font-weight: 700;
  word-break: break-word;
}

.collection-section {
  margin-top: 34px;
}

.collection-heading {
  margin: 0 0 18px;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid rgba(223, 230, 242, 0.95);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(31, 42, 68, 0.1);
  border-color: rgba(63, 109, 246, 0.2);
}

.grid-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 800;
}

.grid-title {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.5;
}

.grid-btn {
  display: inline-block;
  margin-top: 4px;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-footer {
  margin-top: 56px;
  padding: 28px 16px 34px;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  background: var(--footer-bg);
}

.site-footer a {
  color: #89a8ff;
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-copy {
  margin: 0;
  font-size: 0.85rem;
}

.ai-prompt-list {
  padding-left: 0 !important;
  list-style: none !important;
}

.ai-prompt-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 8px;
}

.ai-prompt-text {
  flex: 1;
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.5;
}

.ai-prompt-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  color: var(--text-sub);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-prompt-copy:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: rgba(63, 109, 246, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(63, 109, 246, 0.08);
}

.ai-prompt-copy.copied {
  background: #e6f7eb;
  color: #11bf5d;
  border-color: #b2ebd0;
  pointer-events: none;
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 24px, 920px);
    padding-top: 20px;
  }

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

  .glass-card {
    padding: 28px 22px 24px;
    border-radius: 24px;
  }

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

@media (max-width: 480px) {
  .share-btn {
    width: 36px;
    height: 36px;
  }

  .term-description {
    padding: 16px 16px 16px 18px;
  }

  .summary-text {
    font-size: 0.98rem;
  }

  .term-content p {
    font-size: 0.98rem;
  }

  .pros-cons-box {
    padding: 20px 20px;
  }
}

/* --- Pros & Cons --- */
.pros-cons-box {
  margin: 32px 0;
  padding: 24px 28px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.pros-cons-box h3 {
  margin-top: 0 !important;
  border-left: none !important;
  padding-left: 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pros-cons-box h4 {
  margin-top: 24px !important;
}

.pros-cons-box p:last-child,
.pros-cons-box ul:last-child {
  margin-bottom: 0 !important;
}

.pros-cons-box.pros {
  background: #f2fcf5;
  border: 1px solid #b2ebd0;
}

.pros-cons-box.pros h3 {
  color: #11bf5d;
}

.pros-cons-box.pros h3::before {
  content: "✅";
  font-size: 1.1em;
}

.pros-cons-box.cons {
  background: var(--pink-soft);
  border: 1px solid #fccfe3;
}

.pros-cons-box.cons h3 {
  color: var(--pink-text);
}

.pros-cons-box.cons h3::before {
  content: "⚠️";
  font-size: 1.1em;
}

/* --- Tables --- */
.term-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(31, 42, 68, 0.04);
  /* テーブル自体のborderは隠し、td/thのborderと外側のbox-shadowで立体感を出す */
  border-style: hidden;
  outline: 1px solid var(--line);
}

.term-content th,
.term-content td {
  padding: 16px 20px;
  text-align: left;
  border: 1px solid var(--line);
}

.term-content th {
  background: var(--surface-accent);
  color: var(--brand-strong);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.term-content td {
  color: var(--text-sub);
  font-size: 0.95rem;
  line-height: 1.6;
}

.term-content td strong {
  color: var(--text-main);
}

.term-content tbody tr {
  transition: background-color 0.2s ease;
}

.term-content tbody tr:hover {
  background: var(--surface-soft);
}

@media (max-width: 720px) {
  .term-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Scroll to Top Button --- */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(45, 96, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1000;
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--brand-strong);
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(45, 96, 255, 0.4);
}

@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}
