/* Pimg.me — page shell styles (everything around the editor).
   Sections: tokens, base, frame, wordmark, top bar, stage overlays (home first screen),
   guide, article pages, footer, small screens, CJK. */

:root {
  --paper: #FFF9F4;
  --surface: #fff;
  --ink: #2D2445;
  --ink-mid: #3F3757;
  --ink-quiet: #625A78;
  --rose: #FF5C8A;
  --rose-action: #D92D66;
  --rose-deep: #B8245A;
  --rose-wash: #FFE3EA;
  --rose-rule: #FBCAD7;
  --mint: #7EDCC4;
  --mint-wash: #DDF6EE;
  --honey: #FFD166;
  --honey-wash: #FFF1C9;
  --rule: #EFE6F4;
  --frost: rgba(255, 255, 255, .92);
  --shade: rgba(76, 46, 110, .3);
  --shade-rose: rgba(255, 92, 138, .35);
  --round-face: Nunito, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --edge: 1.5px solid var(--rule);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.7 var(--round-face);
}

a {
  color: var(--rose-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

kbd {
  display: inline-block;
  min-width: 24px;
  padding: 1px 7px;
  border: var(--edge);
  border-bottom-width: 3px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 800 13px/1.6 var(--round-face);
  text-align: center;
}

:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }

/* ---- frame ---- */
.frame { width: min(1120px, 100% - 32px); margin-inline: auto; }
.frame.is-slim { width: min(760px, 100% - 32px); }

/* ---- wordmark (logo + site name) ---- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.01em;
  text-decoration: none;
}
.wordmark img, .fold-btn img {
  display: block;
  flex: none;
  filter: drop-shadow(0 4px 8px var(--shade-rose));
}

/* ---- top bar (article pages) ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: var(--edge);
  background: var(--frost);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.topbar__nav { display: flex; flex-wrap: wrap; gap: 6px; }
.topbar__nav a {
  padding: 6px 12px;
  border-radius: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}
.topbar__nav a:hover { background: var(--rose-wash); }

/* ---- stage: the home page's first screen. The editor fills #pimg-app;
        the shell only floats the brand badge and the corner controls over it. ---- */
#tool {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
}
#pimg-app { position: absolute; inset: 0; z-index: 1; }

.float {
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: var(--edge);
  border-radius: 14px;
  background: var(--frost);
  box-shadow: 0 10px 30px -14px var(--shade);
  color: var(--ink);
  font: 800 14px/1 var(--round-face);
  text-decoration: none;
  cursor: pointer;
}
.float:hover { background: var(--surface); }
.float svg { flex: none; }

.badge {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px 9px 9px;
  border: var(--edge);
  border-radius: 20px;
  background: var(--frost);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px -12px var(--shade);
  pointer-events: auto;
  transition: padding .28s ease, border-radius .28s ease, gap .28s ease;
}
.fold-btn {
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  line-height: 0;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.3, 1.5, .5, 1);
}
.fold-btn:hover { transform: rotate(-8deg) scale(1.06); }
.fold-btn:active { transform: scale(.92); }
.badge__text {
  min-width: 0;
  max-width: 560px;
  max-height: 120px;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .32s ease, opacity .2s ease;
}
.badge__line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge__name {
  color: var(--ink);
  font: 900 20px/1.15 Nunito, var(--round-face);
  letter-spacing: -.02em;
}
.badge__name b { color: var(--rose); font-weight: 900; }
.badge h1 {
  margin: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--rose-wash);
  color: var(--rose-deep);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .01em;
}
.badge__tagline {
  margin: 3px 0 0;
  color: var(--ink-quiet);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
}
.badge.is-shut { gap: 0; padding: 9px; border-radius: 18px; }
.badge.is-shut .badge__text { max-width: 0; max-height: 0; opacity: 0; }

.corner {
  position: absolute;
  z-index: 5;
  left: 16px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.corner > * { pointer-events: auto; }
.corner__down svg { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

.tongue { position: relative; }
.tongue__list {
  position: absolute;
  left: 0;
  bottom: 46px;
  min-width: 150px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: var(--edge);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 20px 40px -16px var(--shade);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.7;
}
.tongue__list[hidden] { display: none; }
.tongue__list a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.tongue__list a:hover { background: var(--rose-wash); }
.tongue__list a[aria-current] { color: var(--rose-deep); }

/* ---- guide (home page below the first screen) ---- */
.howto {
  padding: 72px 0 24px;
  background: linear-gradient(to bottom, var(--surface), var(--paper) 380px);
}

.opener { max-width: 820px; margin: 0 auto 40px; text-align: center; }
.opener__kicker {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--rose-wash);
  color: var(--rose-deep);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.opener h2 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.6vw, 46px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -.02em;
}
.opener__text p { margin: 0 0 12px; color: var(--ink-quiet); font-size: 18.5px; }
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 6px 14px;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  font-size: 14.5px;
  font-weight: 800;
}
.chips li:nth-child(4n+1) { background: var(--mint-wash); border-color: var(--mint); }
.chips li:nth-child(4n+2) { background: var(--honey-wash); border-color: var(--honey); }
.chips li:nth-child(4n+3) { background: var(--rose-wash); border-color: var(--rose-rule); }

.snap { margin: 0; }
.snap img {
  display: block;
  width: 100%;
  border: var(--edge);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 60px -30px var(--shade), 0 8px 20px -12px var(--shade);
}
.snap figcaption {
  margin-top: 10px;
  color: var(--ink-quiet);
  font-size: 14.5px;
  font-weight: 700;
  text-align: center;
}
.snap.is-wide { max-width: 1040px; margin: 0 auto 24px; transform: rotate(-.6deg); }
.snap.is-phone { max-width: 340px; margin-inline: auto; }
.snap.is-phone img { border: 6px solid var(--ink); border-radius: 34px; }

.topic { margin: 84px 0; }
.topic h2 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.015em;
}
.topic h3 { margin: 0 0 6px; font-size: 19px; font-weight: 900; line-height: 1.3; }
.topic p { margin: 0 0 12px; }
.topic ul, .topic ol.plain { margin: 0 0 12px; padding-left: 1.2em; }
.topic li { margin: 4px 0; }
.topic li::marker { color: var(--rose); }
.topic .lead { max-width: 760px; color: var(--ink-quiet); font-size: 18px; }
.topic .tip {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--mint-wash);
  font-size: 16px;
  font-weight: 700;
}

.pair { display: grid; grid-template-columns: 1fr 1.25fr; align-items: center; gap: 48px; }
.pair__words p, .pair__words li { color: var(--ink-mid); }
.pair.is-mirrored .pair__words { order: 2; }

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  margin: 0;
  padding: 22px 20px 18px;
  border: var(--edge);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 16px 30px -24px var(--shade);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 15px;
  background: var(--paper);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-6deg);
}
.steps li:nth-child(1)::before { background: var(--rose-wash); }
.steps li:nth-child(2)::before { background: var(--honey-wash); }
.steps li:nth-child(3)::before { background: var(--mint-wash); }
.steps p { margin: 0; color: var(--ink-quiet); font-size: 16px; }

.ways { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 22px; }
.way { padding: 18px 18px 16px; border: var(--edge); border-radius: 24px; background: var(--surface); }
.way svg {
  display: block;
  width: 100%;
  height: 110px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--paper);
}
.way svg rect { stroke: var(--ink); stroke-width: 2.5; }
.way p { margin: 0; color: var(--ink-quiet); font-size: 15.5px; }

.keymap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}
.keymap > div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: var(--edge);
  border-radius: 16px;
  background: var(--surface);
  font-size: 15.5px;
}
.keymap dt { flex: none; white-space: nowrap; }
.keymap dd { margin: 0; }

.ask { margin: 10px 0; border: var(--edge); border-radius: 18px; background: var(--surface); overflow: hidden; }
.ask summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 16px 20px;
  font-size: 17.5px;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}
.ask summary::-webkit-details-marker { display: none; }
.ask summary svg {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 7px;
  border-radius: 10px;
  background: var(--rose-wash);
  color: var(--rose-deep);
  transition: transform .2s;
}
.ask[open] summary svg { transform: rotate(45deg); }
.ask p { margin: 0; padding: 0 20px 18px; color: var(--ink-mid); }
.ask p + p { margin-top: -8px; }

.finale {
  margin: 84px 0 40px;
  padding: 40px 24px;
  border-radius: 32px;
  background: linear-gradient(135deg, var(--rose-wash), var(--honey-wash) 55%, var(--mint-wash));
  text-align: center;
}
.finale p { margin: 0 0 16px; font-size: clamp(22px, 3vw, 30px); font-weight: 900; line-height: 1.25; }
.finale a {
  display: inline-flex;
  align-items: center;
  height: 54px;
  padding: 0 26px;
  border-radius: 18px;
  background: var(--rose-action);
  box-shadow: 0 14px 26px -12px var(--shade-rose);
  color: var(--surface);
  font-size: 17px;
  font-weight: 900;
  text-decoration: none;
}
.finale a:hover { transform: translateY(-2px); }

/* ---- article pages (about, privacy, terms) ---- */
.article { padding: 48px 0 72px; }
.article h1 {
  margin: 0 0 6px;
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.article__date { margin: 0 0 24px; color: var(--ink-quiet); font-size: 15px; font-weight: 700; }
.article__body h2 { margin: 34px 0 8px; font-size: 24px; font-weight: 900; }
.article__body h3 { margin: 22px 0 6px; font-size: 19px; font-weight: 900; }
.article__body p, .article__body li { color: var(--ink-mid); }
.article__body ul, .article__body ol { padding-left: 1.2em; }

/* ---- footer ---- */
.base { padding: 40px 0 28px; border-top: var(--edge); background: var(--surface); }
.base__row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 24px; }
.base__about { margin: 8px 0 0; max-width: 420px; color: var(--ink-quiet); font-size: 15px; }
.base__links { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.base__pages { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.base__pages a { color: var(--ink); font-size: 15px; font-weight: 800; text-decoration: none; }
.base__pages a:hover { color: var(--rose-deep); }
.base__langs { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.base__langs a { color: var(--ink-quiet); font-size: 14px; font-weight: 700; text-decoration: none; }
.base__langs a[aria-current] { color: var(--rose-deep); }
.base__note { margin-top: 22px; margin-bottom: 0; color: var(--ink-quiet); font-size: 13.5px; }

/* ---- smaller screens ---- */
@media (max-width: 960px) {
  .steps, .ways { grid-template-columns: repeat(2, 1fr); }
  .pair { grid-template-columns: 1fr; gap: 22px; }
  .pair.is-mirrored .pair__words { order: 0; }
}

@media (max-width: 720px) {
  body { font-size: 16.5px; }

  .badge { top: 10px; left: 10px; right: 10px; gap: 10px; padding: 7px 12px 7px 7px; border-radius: 18px; }
  .badge.is-shut { right: auto; padding: 7px; }
  .fold-btn img { width: 34px; height: 34px; }
  .badge__name { font-size: 18px; }
  .badge h1 { padding: 1px 9px; font-size: 12px; }
  .badge__tagline { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; }

  /* no room at the bottom next to the editor dock: the guide link becomes an
     icon button under the badge, languages stay reachable in the footer */
  .corner { top: 72px; right: 12px; bottom: auto; left: auto; }
  .tongue { display: none; }
  .corner__down { width: 46px; height: 46px; padding: 0; justify-content: center; border-radius: 15px; }
  .corner__down span { display: none; }
  .corner__down svg { width: 20px; height: 20px; }

  .howto { padding-top: 44px; }
  .opener { text-align: left; }
  .opener__text p { font-size: 17px; }
  .chips { justify-content: flex-start; }
  .snap.is-wide { transform: none; }
  .snap img, .snap.is-phone img { border-radius: 16px; }
  .topic { margin: 60px 0; }
  .base__links { align-items: flex-start; }
}

@media (max-width: 520px) {
  .steps, .ways { grid-template-columns: 1fr; }
  .topbar__nav a { padding: 6px 8px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .corner__down svg { animation: none; }
  .badge, .badge__text, .fold-btn { transition: none; }
}

/* ---- Chinese, Japanese and Korean pages ---- */
.cjk { line-height: 1.85; letter-spacing: .01em; }
.cjk-zh { --round-face: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; }
.cjk-ja { --round-face: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif; }
.cjk-ko { --round-face: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif; word-break: keep-all; }
.cjk .opener__kicker { letter-spacing: .06em; text-transform: none; }
.cjk .opener h2 { font-size: clamp(28px, 4vw, 42px); line-height: 1.3; }
.cjk .topic h2 { line-height: 1.4; }
.cjk-ja h1, .cjk-ja h2, .cjk-ja h3 { letter-spacing: .02em; }
.cjk-ja .pair__words, .cjk-zh .pair__words { line-break: strict; }
.cjk-ko .opener h2, .cjk-ko .topic h2, .cjk-ko .article h1, .cjk-ko .finale p, .cjk-ko .steps li::before {
  font-family: Jua, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}
