:root {
  --coral: #ef7185;
  --coral-deep: #d7546a;
  --teal: #64c9c6;
  --lime: #d7dd72;
  --ink: #35363a;
  --ink-soft: #696c73;
  --ink-faint: #96989e;
  --paper: #fffdfb;
  --paper-warm: #faf4ef;
  --line: rgba(66, 69, 75, .13);
  --font-round: 'Kosugi Maru', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  --font-body: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  line-height: 1.8;
  letter-spacing: .025em;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

a:focus-visible {
  outline: 3px solid rgba(239, 113, 133, .36);
  outline-offset: 4px;
}

.cross-page-bubble {
  position: fixed;
  right: max(20px, calc(env(safe-area-inset-right) + 12px));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 30;
  display: flex;
  width: min(242px, calc(100vw - 32px));
  min-height: 76px;
  align-items: center;
  gap: 12px;
  padding: 10px 17px 10px 10px;
  border: 1px solid rgba(239, 113, 133, .24);
  border-radius: 24px 24px 7px 24px;
  background: rgba(255, 253, 251, .94);
  box-shadow: 0 16px 42px rgba(53, 54, 58, .15);
  color: var(--ink);
  text-decoration: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.cross-page-bubble:hover {
  border-color: rgba(239, 113, 133, .48);
  box-shadow: 0 20px 48px rgba(53, 54, 58, .2);
  transform: translateY(-3px);
}

.cross-page-bubble-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(66, 69, 75, .08);
  border-radius: 16px;
  background: #fff;
}

.cross-page-bubble-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
}

.cross-page-bubble-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
  font-family: var(--font-round);
  line-height: 1.45;
}

.cross-page-bubble-copy small {
  color: var(--coral-deep);
  font-size: .64rem;
  letter-spacing: .12em;
}

.cross-page-bubble-copy strong {
  font-size: .84rem;
  font-weight: 400;
  white-space: nowrap;
}

/* Full-width chat home */
.home-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 9% 6%, rgba(100, 201, 198, .16), transparent 27rem),
    radial-gradient(circle at 91% 23%, rgba(239, 113, 133, .15), transparent 30rem),
    radial-gradient(circle at 45% 86%, rgba(215, 221, 114, .13), transparent 28rem),
    var(--paper);
}

.chat-home { overflow: hidden; }

.chat-hero {
  position: relative;
  display: grid;
  min-height: 68svh;
  place-items: center;
  padding: 7rem clamp(1.25rem, 5vw, 5rem) 8.5rem;
  isolation: isolate;
}

.chat-hero::before {
  position: absolute;
  inset: 7% 10%;
  z-index: -2;
  border: 1px dashed rgba(66, 69, 75, .08);
  border-radius: 48% 52% 45% 55% / 56% 43% 57% 44%;
  content: '';
  transform: rotate(-3deg);
}

.chat-hero-copy {
  position: relative;
  z-index: 2;
  width: min(980px, 92vw);
  text-align: center;
}

.chat-hero-kicker {
  margin: 0 0 1.15rem;
  color: var(--coral-deep);
  font-family: var(--font-round);
  font-size: clamp(.78rem, 1.2vw, .92rem);
  letter-spacing: .16em;
}

.chat-hero h1 {
  margin: 0;
  color: #303136;
  font-family: var(--font-round);
  font-size: clamp(2.35rem, 6.4vw, 5.6rem);
  font-weight: 400;
  letter-spacing: .035em;
  line-height: 1.22;
  white-space: nowrap;
}

.chat-hero h1 span {
  display: block;
  margin-top: .16em;
  color: var(--coral-deep);
  font-size: .55em;
}

.chat-hero-lead {
  margin: 2rem auto 0;
  color: var(--ink-soft);
  font-size: clamp(.9rem, 1.35vw, 1.02rem);
  line-height: 2;
}

.ambient-bubble {
  position: absolute;
  z-index: 1;
  padding: .72rem 1.05rem;
  border: 1px solid rgba(66, 69, 75, .08);
  border-radius: 1.4rem 1.4rem 1.4rem .45rem;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 16px 48px rgba(64, 64, 70, .06);
  color: var(--ink-soft);
  font-family: var(--font-round);
  font-size: clamp(.72rem, 1vw, .88rem);
  letter-spacing: .04em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.ambient-bubble::after {
  position: absolute;
  bottom: -7px;
  left: 16px;
  width: 15px;
  height: 15px;
  border-bottom: 1px solid rgba(66, 69, 75, .08);
  border-left: 1px solid rgba(66, 69, 75, .08);
  background: rgba(255, 255, 255, .78);
  content: '';
  transform: skewY(-34deg) rotate(-16deg);
}

.ambient-bubble--one { top: 17%; left: 7%; transform: rotate(-5deg); }
.ambient-bubble--two { top: 13%; right: 8%; transform: rotate(4deg); }
.ambient-bubble--three { bottom: 29%; left: 13%; transform: rotate(3deg); }
.ambient-bubble--four { right: 13%; bottom: 25%; transform: rotate(-4deg); }

.topic-cloud {
  position: absolute;
  right: 1.25rem;
  bottom: 2.25rem;
  left: 1.25rem;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
}

.topic-chip {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: .4rem .85rem;
  border: 1px solid rgba(66, 69, 75, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  color: var(--ink-soft);
  font-family: var(--font-round);
  font-size: .76rem;
  text-decoration: none;
  backdrop-filter: blur(7px);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.topic-chip:nth-child(2n) { transform: rotate(1.2deg); }
.topic-chip:nth-child(3n) { transform: rotate(-1.5deg); }
.topic-chip:hover { border-color: var(--coral); background: #fff; transform: translateY(-2px); }
.topic-chip.is-active { border-color: transparent; background: var(--ink); color: #fff; }

.bubble-section {
  position: relative;
  min-height: 45svh;
  padding: 3rem clamp(1.25rem, 4vw, 4rem) 5rem;
}

.bubble-section::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(250, 244, 239, .25), rgba(250, 244, 239, .75));
  content: '';
}

.bubble-section-label {
  margin: 0 auto 1rem;
  color: var(--ink-faint);
  font-family: var(--font-round);
  font-size: .78rem;
  letter-spacing: .14em;
  text-align: center;
}

.bubble-stage {
  position: relative;
  width: 100%;
  height: var(--stage-height);
  min-height: 360px;
  margin: 0 auto;
}

.story-bubble {
  position: absolute;
  top: var(--bubble-y);
  left: var(--bubble-x);
  display: block;
  width: min(var(--bubble-w), calc(100vw - 3rem));
  padding: 1.35rem 1.4rem 1.45rem;
  border: 1px solid rgba(66, 69, 75, .1);
  border-radius: 2rem 2rem 2rem .65rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 55px rgba(64, 64, 70, .08);
  text-decoration: none;
  transform: rotate(var(--bubble-tilt));
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.story-bubble::after {
  position: absolute;
  bottom: -11px;
  left: 22px;
  width: 24px;
  height: 24px;
  border-bottom: 1px solid rgba(66, 69, 75, .1);
  border-left: 1px solid rgba(66, 69, 75, .1);
  background: #fff;
  content: '';
  transform: skewY(-34deg) rotate(-16deg);
}

.story-bubble.is-right { border-radius: 2rem 2rem .65rem 2rem; }
.story-bubble.is-right::after {
  right: 22px;
  left: auto;
  border-right: 1px solid rgba(66, 69, 75, .1);
  border-left: 0;
  transform: skewY(34deg) rotate(16deg);
}

.story-bubble:hover {
  z-index: 4;
  border-color: rgba(239, 113, 133, .38);
  box-shadow: 0 24px 70px rgba(64, 64, 70, .13);
  transform: rotate(0) translateY(-6px);
}

.story-bubble-category {
  display: inline-block;
  margin-bottom: .65rem;
  color: var(--coral-deep);
  font-family: var(--font-round);
  font-size: .7rem;
  letter-spacing: .08em;
}

.story-bubble h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-round);
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  font-weight: 400;
  line-height: 1.65;
}

.story-bubble p {
  display: -webkit-box;
  margin: .75rem 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: .78rem;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.story-bubble-read {
  display: block;
  margin-top: 1rem;
  color: var(--ink-faint);
  font-size: .68rem;
  text-align: right;
}

.empty-bubble {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(360px, calc(100vw - 3rem));
  padding: 1.55rem 1.7rem;
  border-radius: 2rem 2rem 2rem .65rem;
  background: #fff;
  box-shadow: 0 18px 55px rgba(64, 64, 70, .08);
  text-align: center;
  transform: translate(-50%, -50%) rotate(-1deg);
}

.empty-bubble p { margin: 0; font-family: var(--font-round); }
.empty-bubble span { display: block; margin-top: .35rem; color: var(--ink-faint); font-size: .76rem; }

.bubble-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
  color: var(--ink-faint);
  font-size: .78rem;
}

.bubble-pagination a { color: var(--ink-soft); text-decoration: none; }
.bubble-pagination a:hover { color: var(--coral-deep); }

.home-footer {
  padding: 2rem 1rem 3rem;
  color: var(--ink-faint);
  font-family: var(--font-round);
  font-size: .7rem;
  text-align: center;
}
.home-footer p { margin: 0; }

/* Standalone article */
.article-page {
  background:
    linear-gradient(90deg, rgba(239, 113, 133, .055), transparent 14%, transparent 86%, rgba(100, 201, 198, .055)),
    var(--paper);
}

.article-shell {
  width: min(760px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7.5rem) 0 4.5rem;
}

.article-header {
  margin-bottom: 3.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.article-site-label {
  margin: 0 0 1rem;
  color: var(--coral-deep);
  font-family: var(--font-round);
  font-size: .72rem;
  letter-spacing: .12em;
}

.article-title {
  margin: 0 0 1.3rem;
  color: #2f3034;
  font-family: var(--font-round);
  font-size: clamp(2rem, 5.5vw, 3.45rem);
  font-weight: 400;
  letter-spacing: .025em;
  line-height: 1.45;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .75rem;
  color: var(--ink-faint);
  font-size: .75rem;
}

.article-reading-time-sep { margin-right: .3em; }
.article-tags { display: flex; flex-wrap: wrap; gap: .4rem; }

.article-tag {
  display: inline-flex;
  align-items: center;
  padding: .2rem .62rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: .68rem;
  text-decoration: none;
}

.article-tag--cat { border-color: rgba(239, 113, 133, .22); color: var(--coral-deep); }
.article-tag--cat:hover { background: rgba(239, 113, 133, .07); }

.article-body {
  color: #45464b;
  font-size: clamp(.98rem, 1.6vw, 1.06rem);
  line-height: 2.05;
}

.article-body h2 {
  margin: 4.25rem 0 1.2rem;
  color: #303136;
  font-family: var(--font-round);
  font-size: clamp(1.4rem, 2.8vw, 1.85rem);
  font-weight: 400;
  letter-spacing: .035em;
  line-height: 1.55;
}

.article-body h2::before {
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: .9rem;
  border-radius: 3px;
  background: var(--coral);
  content: '';
}

.article-body h3 {
  margin: 3rem 0 .9rem;
  color: #34353a;
  font-family: var(--font-round);
  font-size: 1.18rem;
  font-weight: 400;
}

.article-body h4 { margin: 2.25rem 0 .75rem; font-size: 1.02rem; }
.article-body p { margin: 0 0 1.55rem; }
.article-body ul, .article-body ol { margin: 0 0 1.7rem; padding-left: 1.5rem; }
.article-body li { margin: .45rem 0; padding-left: .2rem; }
.article-body li::marker { color: var(--coral-deep); }
.article-body a { color: var(--coral-deep); text-underline-offset: .2em; }
.article-body strong { color: #303136; font-weight: 700; }
.article-body hr { margin: 3rem 0; border: 0; border-top: 1px solid var(--line); }
.article-body img { display: block; max-width: 100%; height: auto; margin: 2rem auto; border-radius: 18px; }

.article-body blockquote {
  margin: 2rem 0;
  padding: 1.1rem 1.35rem;
  border-left: 3px solid var(--teal);
  border-radius: 0 14px 14px 0;
  background: rgba(100, 201, 198, .08);
  color: var(--ink-soft);
}

.article-body code {
  padding: .1em .38em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-warm);
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: .86em;
}

.article-body pre {
  margin: 1.8rem 0;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  border-radius: 14px;
  background: #2f3035;
  color: #f5f1ed;
  line-height: 1.7;
}

.article-body pre code { padding: 0; border: 0; background: transparent; color: inherit; }
.article-body .table-wrap { margin: 2rem 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.article-body table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.article-body th, .article-body td { padding: .7rem .8rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.article-body th { background: var(--paper-warm); color: var(--ink); font-weight: 700; }

.toc {
  margin: 2.4rem 0 3.25rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(250, 244, 239, .72);
  font-size: .84rem;
}

.toc-title { margin: 0 0 .65rem; color: var(--ink-faint); font-family: var(--font-round); font-size: .7rem; letter-spacing: .1em; }
.toc ol { margin: 0; padding-left: 1.35rem; }
.toc li { margin: .35rem 0; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--coral-deep); }
.toc .toc-h3 { margin-left: 1rem; font-size: .78rem; }

.related-tools {
  margin-top: 4rem;
  padding: 2rem;
  border: 1px solid rgba(239, 113, 133, .16);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(239, 113, 133, .12), transparent 13rem),
    var(--paper-warm);
  text-align: center;
}

.related-tools-kicker {
  margin: 0 0 .55rem;
  color: var(--coral-deep);
  font-family: var(--font-round);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.related-tools-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-round);
  font-size: 1.25rem;
  line-height: 1.5;
}
.related-tools-description {
  max-width: 30rem;
  margin: .75rem auto 1.35rem;
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.8;
}
.related-tools-list { display: flex; justify-content: center; }
.related-tool-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1.3rem;
  border-radius: 999px;
  background: var(--coral-deep);
  box-shadow: 0 12px 30px rgba(215, 84, 106, .2);
  color: #fff;
  font-family: var(--font-round);
  font-size: .85rem;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.related-tool-link:hover { box-shadow: 0 16px 36px rgba(215, 84, 106, .28); transform: translateY(-2px); }

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.article-nav a { display: block; color: var(--ink-soft); text-decoration: none; }
.article-nav a:hover .article-nav-title { color: var(--coral-deep); }
.article-nav-label { display: block; margin-bottom: .35rem; color: var(--ink-faint); font-size: .68rem; }
.article-nav-title { display: block; font-family: var(--font-round); font-size: .82rem; line-height: 1.65; transition: color .2s ease; }
.article-nav .next { text-align: right; }

.article-footer {
  padding: 1rem 1rem 3.5rem;
  color: var(--ink-faint);
  font-family: var(--font-round);
  font-size: .72rem;
  text-align: center;
}
.article-footer a { text-decoration: none; }
.article-footer a:hover { color: var(--coral-deep); }

/* 404 */
.not-found-page {
  display: grid;
  min-height: 100vh;
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(circle at 18% 20%, rgba(100, 201, 198, .16), transparent 24rem),
    radial-gradient(circle at 86% 70%, rgba(239, 113, 133, .14), transparent 25rem),
    var(--paper);
}

.not-found-bubble {
  align-self: center;
  width: min(480px, calc(100% - 2.5rem));
  margin: 4rem auto;
  padding: 2.6rem 2rem;
  border-radius: 2.5rem 2.5rem 2.5rem .8rem;
  background: #fff;
  box-shadow: 0 22px 70px rgba(64, 64, 70, .1);
  text-align: center;
}
.not-found-code { margin: 0; color: var(--coral); font-family: var(--font-round); font-size: .8rem; letter-spacing: .15em; }
.not-found-bubble h1 { margin: .7rem 0; font-family: var(--font-round); font-size: 1.5rem; font-weight: 400; }
.not-found-bubble p:not(.not-found-code) { margin: 0; color: var(--ink-soft); font-size: .86rem; }
.not-found-bubble a { display: inline-block; margin-top: 1.5rem; color: var(--coral-deep); font-family: var(--font-round); font-size: .82rem; text-underline-offset: .25em; }

@media (max-width: 760px) {
  .chat-hero { min-height: 640px; padding: 6rem 1.25rem 9.5rem; }
  .chat-hero::before { inset: 12% -12%; }
  .chat-hero-copy { width: min(560px, 100%); }
  .chat-hero h1 { font-size: clamp(1.75rem, 8.8vw, 2.6rem); white-space: normal; }
  .chat-hero-lead br { display: none; }
  .ambient-bubble { font-size: .68rem; }
  .ambient-bubble--one { top: 8%; left: -1rem; }
  .ambient-bubble--two { top: 13%; right: -1.5rem; }
  .ambient-bubble--three { bottom: 26%; left: -1.4rem; }
  .ambient-bubble--four { right: -1.25rem; bottom: 23%; }
  .topic-cloud { bottom: 2rem; gap: .42rem; }
  .topic-chip { min-height: 34px; padding: .3rem .65rem; font-size: .68rem; }

  .bubble-section { padding: 2.5rem 1rem 4rem; }
  .bubble-stage {
    display: flex;
    height: auto !important;
    min-height: 300px;
    flex-direction: column;
    gap: 2.1rem;
    padding: 1.5rem 0;
  }
  .story-bubble {
    position: relative;
    top: auto;
    left: auto;
    width: min(88%, 390px);
    transform: rotate(var(--bubble-tilt));
  }
  .story-bubble:nth-child(odd) { align-self: flex-start; }
  .story-bubble:nth-child(even) { align-self: flex-end; }
  .empty-bubble { position: relative; top: auto; left: auto; margin: auto; transform: rotate(-1deg); }

  .article-shell { width: min(100% - 2rem, 680px); padding-top: 3.5rem; }
  .article-header { margin-bottom: 2.6rem; }
  .article-title { font-size: clamp(1.85rem, 8.5vw, 2.65rem); }
  .article-meta { align-items: flex-start; }
  .article-tags { width: 100%; margin-top: .2rem; }
  .article-body { line-height: 1.95; }
  .article-body h2 { margin-top: 3.4rem; }
  .related-tools { padding: 1.6rem 1.1rem; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav .next { text-align: left; }
  .article-page .article-footer {
    padding-bottom: max(7rem, calc(env(safe-area-inset-bottom) + 6.5rem));
  }

  .cross-page-bubble {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 206px;
    min-height: 66px;
    gap: 9px;
    padding: 8px 14px 8px 8px;
    border-radius: 21px 21px 6px 21px;
  }

  .cross-page-bubble-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .cross-page-bubble-copy strong { font-size: .78rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .topic-chip, .story-bubble, .related-tool-link, .cross-page-bubble { transition: none; }
}
