/* Sortpair — "This or That" look: bright, game-show, family friendly. */

@font-face {
  font-family: "Lilita One";
  src: url("lilita-one.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("nunito.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  /* Turkish headings: Lilita One has no ğ ş İ, so Turkish pages use this similar rounded display face. */
  font-family: "Paytone Sortpair";
  src: url("paytone-tr.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #2D5BFF;
  --blue-light: #3A68FF;
  --navy: #142A8C;
  --yellow: #FFD60A;
  --yellow-dark: #B89A00;
  --coral: #FF6259;
  --coral-dark: #B33A33;
  --teal: #22D3C5;
  --teal-dark: #0C8F86;
  --ink: #10163A;
  --soft: #F3F5FF;
  --soft-border: #CBD3FF;
  --muted: #4A558F;
  --display: "Lilita One", "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  font-weight: 700;
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--blue);
  overflow-x: hidden;
}
/* sunburst behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: repeating-conic-gradient(from 0deg at 50% 22%, var(--blue-light) 0 10deg, var(--blue) 10deg 20deg);
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

a { color: #fff; text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--yellow); }

:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 12px;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--yellow); color: var(--ink); padding: 10px 16px; border-radius: 12px; font-weight: 800;
}
.skip:focus { top: 12px; }

/* ---- Header / footer chrome ---- */
.site-header {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; min-height: 48px; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--yellow); color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--display); font-size: 26px;
  transform: rotate(-8deg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}
.brand-name { font-family: var(--display); font-size: 30px; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.by { display: flex; align-items: center; gap: 6px 16px; font-size: 15px; flex-wrap: wrap; }
.by a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.x-link { background: rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 0 14px; text-decoration: none; }
.x-link:hover { background: rgba(255, 255, 255, 0.28); }

.site-footer { text-align: center; padding: 8px 20px 28px; font-size: 15px; line-height: 1.6; }
.site-footer a { display: inline-block; padding: 4px 2px; }
.site-footer .privacy { color: #E3E9FF; font-size: 14px; font-weight: 600; }

/* nav extras, language switcher, footer links */
a.btn { text-decoration: none; }
.nav-link { font-weight: 800; }
.lang { position: relative; }
.lang summary {
  list-style: none; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 0 14px; font-size: 15px; font-weight: 800; color: #fff;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: "▾"; font-size: 12px; }
.lang summary:hover { background: rgba(255, 255, 255, 0.28); }
.lang ul {
  list-style: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 170px;
  background: #fff; border-radius: 18px; padding: 6px; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.25);
}
.lang li a {
  display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 800;
}
.lang li a:hover, .lang li a[aria-current] { background: var(--soft); color: var(--blue); }
.lang li a[aria-current]::after { content: "✓"; margin-left: auto; }
.site-header { gap: 10px 14px; }
.by { margin-left: auto; }
.footer-links { margin-top: 4px; font-size: 15px; }
.footer-links a { display: inline-block; padding: 4px 2px; }

/* ---- Layout ---- */
#app { overflow-x: clip; width: 100%; max-width: 1040px; margin: 0 auto; padding: 8px 20px 24px; flex: 1; }

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

#screen-entry .container,
#screen-results .container { max-width: 560px; margin: 0 auto; }

h1, h2 { font-family: var(--display); font-weight: 400; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28); }
h1 { font-size: clamp(38px, 9vw, 52px); line-height: 1; margin: 12px 0 8px; }
h1 em, h2 em { font-style: normal; color: var(--yellow); }
.subtitle { font-size: 19px; line-height: 1.35; font-weight: 700; margin-bottom: 16px; }

/* ---- Buttons ---- */
.btn {
  border: 0;
  border-radius: 18px;
  min-height: 56px;
  padding: 0 22px;
  font-size: 19px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active:not(:disabled) { transform: translateY(3px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--yellow); color: var(--ink);
  font-family: var(--display); font-weight: 400; font-size: 28px;
  min-height: 70px; padding: 0 30px; border-radius: 20px;
  box-shadow: 0 8px 0 var(--yellow-dark);
}
.btn-primary:hover:not(:disabled) { background: #FFE23F; }
.btn-primary:active:not(:disabled) { box-shadow: 0 4px 0 var(--yellow-dark); }

.btn-secondary { background: #fff; color: var(--blue); border: 3px solid var(--blue); }
.btn-secondary:hover { background: var(--soft); }

.btn-add {
  width: 60px; min-height: 60px; padding: 0; border-radius: 16px;
  background: var(--teal); color: var(--ink);
  font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1;
  box-shadow: 0 5px 0 var(--teal-dark); flex: none;
}
.btn-add:active { box-shadow: 0 2px 0 var(--teal-dark); }

.btn-ghost {
  background: #fff; color: var(--ink);
  border-radius: 999px; min-height: 48px; padding: 0 22px; font-size: 18px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
}

/* ---- Screen 1: lineup ---- */
.panel { background: #fff; color: var(--ink); border-radius: 26px; padding: 16px; box-shadow: var(--shadow); }

.input-row { display: flex; gap: 10px; }
.input-row input {
  flex: 1; min-width: 0; height: 60px; border-radius: 16px;
  border: 3px solid var(--soft-border); background: var(--soft);
  padding: 0 16px; font-size: 19px; color: var(--ink);
}
.input-row input::placeholder { color: #55609A; opacity: 1; }
.input-row input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(45, 91, 255, 0.25); }

.paste-box { margin-top: 12px; }
.paste-box summary {
  list-style: none; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue); font-size: 16px; font-weight: 800; text-decoration: underline; text-underline-offset: 4px;
}
.paste-box summary::-webkit-details-marker { display: none; }
.paste-box summary::before { content: "＋"; text-decoration: none; display: inline-block; }
.paste-box[open] summary::before { content: "－"; }
.paste-box textarea {
  display: block; width: 100%; margin: 8px 0 10px; padding: 12px 14px; resize: vertical;
  border-radius: 16px; border: 3px solid var(--soft-border); background: var(--soft); font-size: 18px; color: var(--ink);
}
.paste-box textarea:focus { outline: none; border-color: var(--blue); background: #fff; }
.paste-box .btn { width: 100%; }

.item-list { list-style: none; margin-top: 12px; display: grid; gap: 8px; }
.item-list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--soft); border-radius: 16px; padding: 6px 6px 6px 6px; min-height: 56px;
  font-size: 21px; animation: popIn 0.25s ease both;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.15; }

.tile {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 26px; line-height: 1;
  font-family: var(--display); font-weight: 400; color: var(--ink);
}
.tile.c0 { background: #FFE2A0; } .tile.c1 { background: #FFC9C5; } .tile.c2 { background: #C0F3EE; }
.tile.c3 { background: #D9DEFF; } .tile.c4 { background: #FFE2A0; }

.btn-remove {
  width: 48px; height: 48px; border: 0; border-radius: 14px; background: transparent;
  color: var(--muted); font-size: 20px; flex: none;
}
.btn-remove:hover { background: #fff; color: var(--coral-dark); }

.empty-hint { margin-top: 12px; text-align: center; color: var(--muted); font-size: 17px; line-height: 1.35; padding: 8px 6px 4px; }
.empty-hint.hidden { display: none; }

.entry-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
.entry-footer.hidden { display: none; }
.item-count { font-family: var(--display); font-size: 26px; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.entry-footer .btn-primary { flex: 1; max-width: 300px; }

.templates { margin-top: 22px; }
.templates-label { font-size: 17px; margin-bottom: 8px; }
.template-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: rgba(255, 255, 255, 0.18); border: 2px solid rgba(255, 255, 255, 0.75); border-radius: 999px;
  min-height: 48px; padding: 0 16px; color: #fff; font-size: 17px; font-weight: 800;
  transition: background 0.12s ease, transform 0.12s ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.32); }
.chip:active { transform: scale(0.97); }

/* ---- Screen 2: this or that ---- */
.compare-card {
  position: relative; overflow: hidden; border-radius: 30px; padding: 16px 16px 18px;
  background: linear-gradient(172deg, var(--coral) 0 52%, var(--teal) 52% 100%);
  box-shadow: var(--shadow); color: var(--ink);
}
.compare-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(172deg, rgba(255, 255, 255, 0.09) 0 18px, transparent 18px 36px);
}
.compare-card > * { position: relative; }

.compare-hud { display: flex; align-items: center; gap: 12px; }
.progress-text {
  background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 16px; flex: none;
  font-family: var(--display); font-weight: 400; font-size: 19px; white-space: nowrap;
}
.progress-bar { flex: 1; height: 18px; border-radius: 999px; background: #fff; border: 3px solid var(--ink); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--yellow); transition: width 0.3s ease; border-radius: 999px; }

.compare-title { text-align: center; font-size: clamp(32px, 8vw, 44px); line-height: 1; margin: 14px 0 4px; color: var(--ink); text-shadow: none; }

.versus {
  position: relative; display: grid; grid-template-rows: 1fr 1fr; gap: 0;
  min-height: clamp(380px, calc(100dvh - 340px), 560px);
}
.choice-card {
  border: 0; background: transparent; color: var(--ink); border-radius: 22px;
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 12px; text-align: left;
  transition: transform 0.12s ease, background 0.12s ease;
}
.choice-card:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.02); }
.choice-card:active { transform: scale(0.97); background: rgba(255, 255, 255, 0.32); }
.choice-card:focus-visible { outline: 5px solid #fff; outline-offset: -5px; box-shadow: inset 0 0 0 9px var(--ink); }

.choice-emoji { font-size: 76px; line-height: 1.1; flex: none; display: block; }
.choice-emoji.initial {
  width: 88px; height: 88px; border-radius: 50%; background: #fff; color: var(--ink);
  display: grid; place-items: center; font-family: var(--display); font-size: 48px; line-height: 1;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
}
.choice-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.choice-text { font-family: var(--display); font-size: clamp(28px, 7vw, 38px); line-height: 1.05; overflow-wrap: anywhere; hyphens: auto; }
.choice-tap {
  margin-top: 10px; background: #fff; border-radius: 999px; padding: 0 18px; min-height: 48px;
  display: inline-flex; align-items: center; font-size: 19px; font-weight: 800; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
}
.versus.pop .choice-card { animation: popIn 0.22s ease both; }

.vs-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg);
  width: 96px; height: 96px; background: var(--yellow); color: var(--ink); z-index: 2; pointer-events: none;
  clip-path: polygon(50% 0, 61% 14%, 79% 7%, 81% 26%, 98% 31%, 89% 48%, 100% 62%, 83% 70%, 82% 90%, 64% 85%, 50% 100%, 37% 86%, 19% 91%, 17% 71%, 0 62%, 11% 48%, 2% 32%, 19% 26%, 21% 8%, 40% 14%);
  display: grid; place-items: center; font-family: var(--display); font-size: 32px;
}

.compare-foot { text-align: center; margin-top: 10px; }
.compare-foot .btn-ghost { min-width: 200px; }
.key-hint { display: none; margin-top: 10px; font-size: 15px; color: var(--ink); font-weight: 800; }
@media (hover: hover) and (pointer: fine) { .key-hint { display: block; } }

/* Wide screens: split left | right */
@media (min-width: 760px) {
  .compare-card {
    padding: 22px 26px 22px;
    background: linear-gradient(98deg, var(--coral) 0 52%, var(--teal) 52% 100%);
  }
  .compare-card::before { background: repeating-linear-gradient(98deg, rgba(255, 255, 255, 0.09) 0 22px, transparent 22px 44px); }
  .versus { grid-template-rows: none; grid-template-columns: 1fr 1fr; min-height: 400px; gap: 12px; }
  .choice-card { flex-direction: column; text-align: center; gap: 12px; padding: 24px 16px; }
  .choice-body { align-items: center; }
  .choice-emoji { font-size: 120px; }
  .choice-emoji.initial { width: 128px; height: 128px; font-size: 70px; }
  .choice-text { font-size: clamp(38px, 4vw, 52px); }
  .vs-badge { width: 124px; height: 124px; font-size: 42px; }
  .compare-title { font-size: 52px; }
}

/* ---- Screen 3: results ---- */
.results-card { position: relative; }
.results-card::before {
  content: ""; position: absolute; left: -20px; right: -20px; top: -10px; height: 520px; pointer-events: none; opacity: 0.85;
  background-image:
    radial-gradient(circle, var(--yellow) 5px, transparent 6px),
    radial-gradient(circle, var(--coral) 4px, transparent 5px),
    radial-gradient(circle, var(--teal) 5px, transparent 6px);
  background-size: 140px 180px, 190px 150px, 110px 210px;
  background-position: 10px 0, 70px 40px, 30px 90px;
  animation: fall 12s linear infinite;
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
}
@keyframes fall { to { background-position: 10px 180px, 70px 190px, 30px 300px; } }
.results-card > * { position: relative; }
.results-title { font-size: clamp(38px, 9vw, 52px); line-height: 1; margin: 12px 0 0; }
.results-title em { display: block; overflow-wrap: anywhere; }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; align-items: end; margin-top: 18px; text-align: center; color: var(--ink); }
.podium.two { grid-template-columns: 1fr 1fr; }
.pod-who { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pod-emoji { font-size: 46px; line-height: 1.1; }
.p1 .pod-emoji { font-size: 60px; }
.pod-emoji.initial {
  width: 56px; height: 56px; border-radius: 50%; background: #fff; display: grid; place-items: center;
  font-family: var(--display); font-size: 30px; line-height: 1;
}
.p1 .pod-emoji.initial { width: 72px; height: 72px; font-size: 38px; }
.pod-name {
  color: #fff; font-size: 18px; line-height: 1.1; min-height: 40px; max-width: 100%;
  display: flex; align-items: flex-end; justify-content: center; overflow-wrap: anywhere; padding-bottom: 6px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.p1 .pod-name { font-size: 22px; }
.pod-block {
  border-radius: 16px 16px 0 0; display: grid; place-items: start center; padding-top: 8px;
  font-family: var(--display); font-size: 44px; line-height: 1.2; transform-origin: bottom; animation: rise 0.5s ease both;
}
.p1 .pod-block { height: 130px; background: var(--yellow); font-size: 56px; }
.p2 .pod-block { height: 92px; background: #E8ECFF; animation-delay: 0.1s; }
.p3 .pod-block { height: 66px; background: #FFB089; animation-delay: 0.2s; }
@keyframes rise { from { transform: scaleY(0.2); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }

.rest { background: #fff; color: var(--ink); border-radius: 0 0 26px 26px; padding: 16px; box-shadow: var(--shadow); }
.results-list { list-style: none; display: grid; gap: 8px; margin-bottom: 14px; }
.results-list:empty { display: none; }
.results-list li {
  display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 14px;
  padding: 6px 14px 6px 6px; min-height: 52px; font-size: 21px; animation: popIn 0.25s ease both;
}
.rank-badge {
  width: 40px; height: 40px; border-radius: 12px; background: var(--blue); color: #fff; flex: none;
  display: grid; place-items: center; font-family: var(--display); font-size: 22px; line-height: 1;
}
.rank-name { overflow-wrap: anywhere; line-height: 1.15; }

.results-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.results-actions .btn-primary { grid-column: 1 / -1; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px);
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 999px; font-weight: 800; font-size: 18px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .by .by-link { display: none; }
}

@media (max-width: 420px) {
  #app { padding-left: 14px; padding-right: 14px; }
  .site-header { padding-left: 14px; padding-right: 14px; }
  .brand-name { font-size: 26px; }
  .by { font-size: 14px; }
  .x-handle { display: none; }
  .x-link { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Turkish: swap the display face (see @font-face above); keep the logo in Lilita One. */
html[lang="tr"] { --display: "Paytone Sortpair", "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif; }

/* Clear list: small text link on the same row as "Paste a whole list" (paste left, clear right) + undo bar */
.paste-row { position: relative; }
.list-tools { position: absolute; right: 0; top: 0; min-height: 44px; display: flex; align-items: center; max-width: 46%; }
.list-tools.hidden { display: none; }
.btn-clear {
  font: inherit; font-weight: 800; font-size: 15px; line-height: 1.2; text-align: right; cursor: pointer; min-height: 44px; padding: 0 2px;
  color: var(--coral-dark); background: none; border: 0; border-radius: 8px;
  text-decoration: underline; text-underline-offset: 4px;
}
.btn-clear:hover { color: #B3261E; }
.btn-clear:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.paste-row:has(.list-tools:not(.hidden)) .paste-box summary { max-width: calc(100% - min(var(--clear-w, 7em), 46%) - 8px); }
.undo-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
  padding: 10px 14px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 800; font-size: 17px;
}
.undo-bar.hidden { display: none; }
.undo-bar button {
  font: inherit; font-weight: 800; cursor: pointer; color: var(--ink); background: var(--yellow);
  border: 0; border-radius: 999px; padding: 6px 16px; min-height: 40px; box-shadow: 0 3px 0 var(--yellow-dark);
}

/* Russian: Lilita One and Paytone have no Cyrillic. Nunito gets a Cyrillic face (loaded only when a page uses Cyrillic)
   and headings use Rubik ExtraBold. */
@font-face {
  font-family: "Nunito";
  src: url("nunito-ru.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0400-045F, U+0490-0491, U+2116;
}
@font-face {
  font-family: "Rubik Sortpair";
  src: url("rubik-ru.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
html[lang="ru"] { --display: "Rubik Sortpair", "Arial Rounded MT Bold", system-ui, sans-serif; }

/* Chinese and Japanese: system CJK fonts (no web font download). Latin letters and digits still use Nunito. */
html[lang="zh-Hans"] {
  --display: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --body: "Nunito", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}
html[lang="ja"] {
  --display: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --body: "Nunito", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
}
/* CJK display text needs real weight (the Latin display faces are single-weight at 400). */
html[lang="zh-Hans"] .btn-primary,
html[lang="zh-Hans"] .btn-add,
html[lang="zh-Hans"] .tile,
html[lang="zh-Hans"] .item-count,
html[lang="zh-Hans"] .progress-text,
html[lang="zh-Hans"] .choice-emoji.initial,
html[lang="zh-Hans"] .choice-text,
html[lang="zh-Hans"] .vs-badge,
html[lang="zh-Hans"] .pod-emoji.initial,
html[lang="zh-Hans"] .pod-block,
html[lang="zh-Hans"] .rank-badge,
html[lang="zh-Hans"] h1,
html[lang="zh-Hans"] h2,
html[lang="zh-Hans"] .post h2,
html[lang="zh-Hans"] .post-card h2,
html[lang="ja"] .btn-primary,
html[lang="ja"] .btn-add,
html[lang="ja"] .tile,
html[lang="ja"] .item-count,
html[lang="ja"] .progress-text,
html[lang="ja"] .choice-emoji.initial,
html[lang="ja"] .choice-text,
html[lang="ja"] .vs-badge,
html[lang="ja"] .pod-emoji.initial,
html[lang="ja"] .pod-block,
html[lang="ja"] .rank-badge,
html[lang="ja"] h1,
html[lang="ja"] h2,
html[lang="ja"] .post h2,
html[lang="ja"] .post-card h2 { font-weight: 900; letter-spacing: 0; }
html[lang="zh-Hans"] h1, html[lang="ja"] h1 { line-height: 1.2; }

/* The logo word stays in Lilita One in every language. */
html[lang="tr"] .brand-name, html[lang="tr"] .brand-mark,
html[lang="ru"] .brand-name, html[lang="ru"] .brand-mark,
html[lang="zh-Hans"] .brand-name, html[lang="zh-Hans"] .brand-mark,
html[lang="ja"] .brand-name, html[lang="ja"] .brand-mark { font-family: "Lilita One", system-ui, sans-serif; font-weight: 400; }

/* CJK and Cyrillic typography: no synthetic italics for CJK, balanced headings, strict CJK line breaking. */
html[lang="zh-Hans"] em, html[lang="ja"] em { font-style: normal; font-weight: 900; }
html[lang="zh-Hans"] h1, html[lang="zh-Hans"] h2, html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ru"] h1 { text-wrap: balance; }
html[lang="zh-Hans"], html[lang="ja"] { line-break: strict; }

/* ---- Header v2: one line on every width ----
   Desktop: logo, Blog, X handle, language code. Phones (<= 600px): logo, language code, menu button (Blog + X inside). */
.site-header { flex-wrap: nowrap; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.by { margin-left: 0; flex-wrap: nowrap; white-space: nowrap; }
.brand { flex: 0 0 auto; }
.lang summary { white-space: nowrap; }
.lang ul, .menu ul {
  list-style: none; position: absolute; right: 0; left: auto; top: calc(100% + 6px); z-index: 30; min-width: 190px;
  background: #fff; border-radius: 18px; padding: 6px; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.25);
}
.menu { position: relative; display: none; }
.menu summary {
  list-style: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.16); border-radius: 999px; color: #fff;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: rgba(255, 255, 255, 0.3); }
.lang summary:focus-visible, .menu summary:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.menu li a {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 800;
}
.menu li a:hover { background: var(--soft); color: var(--blue); }
.menu-x svg { flex: 0 0 auto; }

@media (max-width: 600px) {
  .by { display: none; }
  .menu { display: block; }
  .site-header { padding-left: 14px; padding-right: 14px; }
}
@media (max-width: 420px) {
  .brand-name { font-size: 26px; }
  .brand { gap: 8px; }
  .lang summary { padding: 0 12px; }
  .lang .globe { display: none; }
  .header-right { gap: 6px; }
}
