/* LRLR fun kit: shared look for the short-lived viral toys under /fun/.
   Each toy sets its own palette by overriding the custom properties on :root. */
:root {
  /* Neutral base: a printed-form look. Each toy overrides these tokens. */
  --bg: #d5d8dc;
  --fg: #16181b;
  --muted: #5b616a;
  --line: rgba(22, 24, 27, 0.16);
  --card: #fbfbf8;
  --paper: #fbfbf8;
  --accent: #16181b;
  --accent-ink: #fbfbf8;
  --red: #cf3b2e;
  --radius: 4px;
  --display: "Black Han Sans", "IBM Plex Sans KR", system-ui, sans-serif;
  --body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "IBM Plex Sans KR", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1b1d21; --fg: #ebeae5; --muted: #9a9fa6; --line: rgba(235, 234, 229, 0.16); --card: #24272c; --accent: #ebeae5; --accent-ink: #16181b; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #1b1d21; --fg: #ebeae5; --muted: #9a9fa6; --line: rgba(235, 234, 229, 0.16); --card: #24272c; --accent: #ebeae5; --accent-ink: #16181b; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: inherit; }

.k-app { width: 100%; max-width: 480px; margin: 0 auto; padding-block: 0 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* One screen visible at a time. */
[data-screen] { display: none; }
[data-screen].is-active { display: block; animation: k-in 0.35s ease-out both; }
@keyframes k-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.k-top { display: flex; align-items: center; justify-content: space-between; height: 56px; font-size: 13px; color: var(--muted); }
.k-top a { text-decoration: none; }
.k-top .k-brand { font-family: var(--display); color: var(--fg); font-size: 16px; }

.k-display { font-family: var(--display); font-weight: 400; line-height: 1.2; margin: 0; text-wrap: balance; }
.k-h1 { font-size: clamp(30px, 9vw, 42px); }
.k-h2 { font-size: clamp(22px, 6.4vw, 28px); }
.k-sub { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.k-hl { color: var(--red); }

.k-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 0 18px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--body); font-weight: 600; font-size: 17px;
  cursor: pointer; transition: transform 0.06s, opacity 0.2s; text-decoration: none;
}
.k-btn:active { transform: translateY(2px); }
.k-btn:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.k-btn[disabled] { opacity: 0.3; cursor: not-allowed; transform: none; }
.k-btn.is-ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--fg); font-size: 15px; }
.k-btn.is-small { min-height: 44px; font-size: 14px; }
.k-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.k-stack > * + * { margin-top: 10px; }

.k-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.k-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1.5px solid var(--fg); font-size: 13px; font-weight: 600; }

.k-result-img { display: block; width: 100%; max-width: 100%; height: auto; }

.k-friend { padding: 10px 0 14px; color: var(--muted); font-size: 14px; }

.k-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; white-space: nowrap;
}
.k-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Long-press-to-save sheet for in-app browsers that block downloads. */
.k-sheet { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.82); display: none; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; }
.k-sheet.is-on { display: flex; }
.k-sheet img { max-width: 100%; max-height: 72dvh; border-radius: 16px; }
.k-sheet p { margin: 0; color: #fff; font-weight: 600; }

.k-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; }

.k-section { margin-top: 40px; color: var(--muted); font-size: 14px; }
.k-section h2 { color: var(--fg); font-size: 16px; margin: 26px 0 6px; text-wrap: balance; }
.k-section p { margin: 0 0 10px; max-width: 65ch; }

.k-foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.k-foot p { margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) {
  [data-screen].is-active { animation: none; }
}

/* Banner ad (kit/ads.js). Hidden until a slot fills it. */
.k-ad { display: none; margin: 28px 0 0; min-height: 0; }
.k-ad.is-on { display: block; }
.k-ad-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; text-align: center; }
.k-ad:has(ins[data-ad-status="unfilled"]) { display: none; }

/* Explainer article under each toy's intro (AdSense wants readable content, 11-18). */
.guide { margin-top: 28px; }
.guide h2 { font-family: var(--display); font-weight: 400; font-size: clamp(22px, 6.2vw, 26px); line-height: 1.25; margin: 0 0 10px; }
.guide h3 { font-size: 17px; margin: 22px 0 6px; }
.guide p, .guide li { font-size: 15px; line-height: 1.7; }
.guide-list { padding-left: 18px; }
.guide-list li { margin-bottom: 8px; }
.guide-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 13px; background: var(--paper); color: #16181b; border-radius: 6px; overflow: hidden; }
.guide-table th, .guide-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid rgba(22, 24, 27, 0.12); vertical-align: top; }
.guide-table th { font-weight: 700; background: #e6e2d4; white-space: nowrap; }
.guide-table td:first-child { white-space: nowrap; font-weight: 700; }
.guide-note { color: var(--muted); font-size: 13px !important; }
