@import url('https://fonts.googleapis.com/css2?family=Dela+Gothic+One&family=M+PLUS+Rounded+1c:wght@500;700;800&family=Noto+Sans+JP:wght@500;700;900&family=Shippori+Mincho:wght@600;700;800&family=Black+Han+Sans&family=Jua&family=Nanum+Myeongjo:wght@700;800&family=Noto+Sans+KR:wght@500;700;900&display=swap');

/* ---- Japanese Manga Horizontal Typography (html[lang="ja"]) ---- */
html[lang="ja"] body.mw {
  --font-balloon: "M PLUS Rounded 1c", "Zen Maru Gothic", "Noto Sans JP", sans-serif;
  --font-comic: "M PLUS Rounded 1c", "Noto Sans JP", sans-serif;
  --font-sfx: "Dela Gothic One", "Rampart One", "Noto Sans JP", sans-serif;
  --font-serif: "Shippori Mincho", "Noto Serif JP", Georgia, serif;
}
html[lang="ja"] .bubble,
html[lang="ja"] .bubble .copy,
html[lang="ja"] .copy[data-speaker]::before,
html[lang="ja"] .ph-item,
html[lang="ja"] .notify {
  font-family: "M PLUS Rounded 1c", "Zen Maru Gothic", "Noto Sans JP", sans-serif !important;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.52;
  line-break: strict;
  word-break: normal;
  overflow-wrap: anywhere;
  text-transform: none !important;
}
html[lang="ja"] .bubble .who,
html[lang="ja"] .bubble .sb-who,
html[lang="ja"] .caption .who {
  font-family: "Noto Sans JP", "M PLUS Rounded 1c", sans-serif !important;
  letter-spacing: 0.06em;
  text-transform: none !important;
}
html[lang="ja"] .caption,
html[lang="ja"] .caption .copy,
html[lang="ja"] .cover-hook,
html[lang="ja"] body[data-series="kai-guang"] .logo,
html[lang="ja"] body[data-series="kai-guang"] .kg-title-main,
html[lang="ja"] body[data-series="kai-guang"] .kg-title-sub,
html[lang="ja"] body[data-series="kai-guang"] .kg-narr .copy {
  font-family: "Shippori Mincho", "Noto Serif JP", Georgia, serif !important;
  line-break: strict;
  letter-spacing: 0.04em;
}
html[lang="ja"] .sfx,
html[lang="ja"] .mw-sfx,
html[lang="ja"] .bubble.shout .copy,
html[lang="ja"] .bubble.kg-crack .copy {
  font-family: "Dela Gothic One", "Noto Sans JP", sans-serif !important;
  letter-spacing: 0.04em;
  text-transform: none !important;
}
/* CRITICAL FIX: kai-guang.js wraps space-delimited words in .kg-ghost-w { display:inline-block; white-space:nowrap }.
   Japanese has no spaces, so without overriding .kg-ghost-w to inline + normal wrap, ghost speech overflows mobile! */
html[lang="ja"] .kg-ghost-w {
  display: inline !important;
  white-space: normal !important;
}

/* ---- Korean Webtoon Typography (html[lang="ko"]) ---- */
html[lang="ko"] body.mw {
  --font-balloon: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-comic: "Noto Sans KR", "Jua", sans-serif;
  --font-sfx: "Black Han Sans", "Jua", "Noto Sans KR", sans-serif;
  --font-serif: "Nanum Myeongjo", Georgia, serif;
}
html[lang="ko"] .bubble,
html[lang="ko"] .bubble .copy,
html[lang="ko"] .copy[data-speaker]::before,
html[lang="ko"] .ph-item,
html[lang="ko"] .notify {
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif !important;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.48;
  word-break: keep-all;
  overflow-wrap: break-word;
  text-transform: none !important;
}
html[lang="ko"] .bubble .who,
html[lang="ko"] .bubble .sb-who,
html[lang="ko"] .caption .who {
  font-family: "Noto Sans KR", sans-serif !important;
  letter-spacing: 0.02em;
  text-transform: none !important;
}
html[lang="ko"] .caption,
html[lang="ko"] .caption .copy,
html[lang="ko"] .cover-hook,
html[lang="ko"] body[data-series="kai-guang"] .logo,
html[lang="ko"] body[data-series="kai-guang"] .kg-title-main,
html[lang="ko"] body[data-series="kai-guang"] .kg-title-sub,
html[lang="ko"] body[data-series="kai-guang"] .kg-narr .copy {
  font-family: "Nanum Myeongjo", "Noto Sans KR", Georgia, serif !important;
  word-break: keep-all;
  letter-spacing: -0.01em;
}
html[lang="ko"] .sfx,
html[lang="ko"] .mw-sfx,
html[lang="ko"] .bubble.shout .copy,
html[lang="ko"] .bubble.kg-crack .copy {
  font-family: "Black Han Sans", "Noto Sans KR", sans-serif !important;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none !important;
}

/* Shared cover logo accent compatibility when logoHtml uses <em> */
body[data-series="kai-guang"] .logo em {
  color: var(--kg-red);
  font-style: normal;
}
html[lang="ja"] .bubble.kg-crack .copy,
html[lang="ko"] .bubble.kg-crack .copy {
  max-width: min(86cqw, 360px);
  white-space: normal;
}

/* My Family Chat localized phone sender avatar colours */
.ph-msg[data-who="母"] .ph-av, .ph-msg[data-who="お母さん"] .ph-av, .ph-msg[data-who="어머니"] .ph-av, .ph-msg[data-who="엄마"] .ph-av { background: #7d2633; }
.ph-msg[data-who="雨婷"] .ph-av, .ph-msg[data-who="ユーティン"] .ph-av, .ph-msg[data-who="유팅"] .ph-av { background: #d08a4e; }
.ph-msg[data-who="俊"] .ph-av, .ph-msg[data-who="ジュン"] .ph-av, .ph-msg[data-who="준"] .ph-av { background: #2c3442; }
.ph-msg[data-who="父"] .ph-av, .ph-msg[data-who="お父さん"] .ph-av, .ph-msg[data-who="아버지"] .ph-av, .ph-msg[data-who="아빠"] .ph-av { background: #5a4a3a; }

/* Till Death Do Us Play localized bride hair-colour name chips */
.bub .sb-who[data-who="カズ"], .bub .sb-who[data-who="카즈"] { background: #e4e1db; color: #111; }
.bub .sb-who[data-who="ツグミ"], .bub .sb-who[data-who="츠구미"] { background: #e9b62a; color: #111; }
.bub .sb-who[data-who="メイ"], .bub .sb-who[data-who="메이"] { background: #111; color: #f2f0ed; outline: 1.5px solid #f2f0ed; }
.bub .sb-who[data-who="リカ"], .bub .sb-who[data-who="리카"] { background: #ef6aa6; color: #111; }
.bub .sb-who[data-who="アキラ"], .bub .sb-who[data-who="아키라"] { background: #d3343f; color: #fff; }
.bub .sb-who[data-who="ナオ"], .bub .sb-who[data-who="나오"] { background: #b6a1e2; color: #111; }
.bub .sb-who[data-who="一同"], .bub .sb-who[data-who="全員"], .bub .sb-who[data-who="일동"], .bub .sb-who[data-who="전원"] { background: #8e8a84; color: #111; }

/* ---- Japanese lettering breaks between phrases (see /reader/i18n.js) ---- */
html[lang="ja"] .bubble .copy.ph {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
html[lang="ja"] .bubble .copy.ph .ph-run {
  display: inline-block;
  white-space: nowrap;
}
