@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');
@import url('https://fonts.googleapis.com/css2?family=Jua&display=swap');

/* =========================================================
   도도한여우 · 공통 디자인 시스템
   컨셉: 팝 뉴브루탈리즘 (두꺼운 외곽선 + 하드 섀도우 + 밝은 컬러)
   모바일/태블릿 우선
   ========================================================= */

:root {
  color-scheme: light;

  --ink: #241a3d;
  --ink-2: #5b4e7a;
  --ink-3: #8f85a8;

  --paper: #fff7ec;
  --paper-2: #ffeede;
  --card: #ffffff;

  --violet: #7c5cff;
  --violet-d: #5b3ce0;
  --pink: #ff5c9e;
  --yellow: #ffd23f;
  --mint: #22ddA0;
  --sky: #3bc3ff;
  --orange: #ff8a3d;
  --red: #ff4d5e;
  --green: #2fc46b;

  --line: #241a3d;
  --bw: 3px;

  --r: 22px;
  --r-sm: 14px;
  --r-lg: 30px;

  --sh: 0 5px 0 var(--line);
  --sh-lg: 0 8px 0 var(--line);
  --sh-sm: 0 3px 0 var(--line);

  --wrap: 640px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);

  /* 상단 앱바 실제 높이 (아이콘 44px + 상하 여백 8px + 아래 테두리 3px) */
  --appbar-h: calc(63px + env(safe-area-inset-top));
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(124, 92, 255, .20), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(255, 92, 158, .18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(59, 195, 255, .18), transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, .font-pop {
  font-family: 'Jua', 'Pretendard Variable', Pretendard, sans-serif;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.28;
  margin: 0;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg, canvas { max-width: 100%; display: block; }

a { color: var(--violet-d); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { touch-action: manipulation; }

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 스크롤 이동 시 고정 앱바에 가려지지 않도록 여백을 둔다
   (scrollIntoView 와 #앵커 링크 모두에 적용됨) */
[data-q-stage],
[data-scroll-anchor],
:target {
  scroll-margin-top: calc(var(--appbar-h) + 14px);
}

/* ---------- 레이아웃 ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 16px;
}
.wrap--wide { max-width: 980px; }

main { padding-bottom: 28px; }

.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 24px; }

/* ---------- 상단 앱바 ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 247, 236, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--bw) solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.appbar__in {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
}
.appbar--wide .appbar__in { max-width: 980px; }

.appbar__title {
  flex: 1;
  min-width: 0;
  font-family: 'Jua', sans-serif;
  font-size: 19px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iconbtn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: 14px;
  box-shadow: var(--sh-sm);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  text-decoration: none !important;
}
.iconbtn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }

/* 로고 버튼(앱바) — 글자까지 잘리지 않도록 전체를 담는다 */
.logo-btn { padding: 2px; overflow: hidden; background: #fff; }
.logo-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- 버튼 ---------- */
.btn {
  --btn-bg: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 22px;
  font-family: 'Jua', sans-serif;
  font-size: 17px;
  color: var(--ink);
  background: var(--btn-bg);
  border: var(--bw) solid var(--line);
  border-radius: 16px;
  box-shadow: var(--sh);
  cursor: pointer;
  -webkit-user-select: none;  user-select: none;
  transition: transform .12s var(--ease-pop), box-shadow .12s, filter .15s;
  text-decoration: none !important;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--line); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn--primary { --btn-bg: var(--violet); color: #fff; }
.btn--pink { --btn-bg: var(--pink); color: #fff; }
.btn--mint { --btn-bg: var(--mint); }
.btn--yellow { --btn-bg: var(--yellow); }
.btn--sky { --btn-bg: var(--sky); }
.btn--orange { --btn-bg: var(--orange); color: #fff; }
.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 42px; padding: 8px 14px; font-size: 15px; border-radius: 13px; }
.btn--lg { min-height: 60px; font-size: 20px; border-radius: 20px; box-shadow: var(--sh-lg); }
.btn--lg:active { transform: translateY(8px); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 130px; }

/* ---------- 카드 / 패널 ---------- */
.card {
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 18px;
}
.card--flat { box-shadow: none; }
.card--tint { background: var(--paper-2); }

.panel {
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  padding: 20px 16px;
}

/* ---------- 칩 / 세그먼트 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 6px 14px;
  font-family: 'Jua', sans-serif;
  font-size: 15px;
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: 999px;
  box-shadow: var(--sh-sm);
  cursor: pointer;
  -webkit-user-select: none;  user-select: none;
  transition: transform .12s, box-shadow .12s, background .15s;
}
.chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.chip.is-on { background: var(--violet); color: #fff; }
.chip--pink.is-on { background: var(--pink); }
.chip--mint.is-on { background: var(--mint); color: var(--ink); }

/* ---------- 입력 ---------- */
.field {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: #fff;
  border: var(--bw) solid var(--line);
  border-radius: 16px;
  box-shadow: inset 0 3px 0 rgba(36, 26, 61, .07);
  font-size: 16px;
}
.field:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124, 92, 255, .22); }
textarea.field { min-height: 120px; line-height: 1.7; resize: vertical; }

.label {
  display: block;
  font-family: 'Jua', sans-serif;
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* ---------- 타자연습 입력창 ----------
   진짜 <input> 은 투명하게 위를 덮고, 보이는 글자는 __echo 로 직접 그린다.
   (한글 IME 조합 버퍼를 건드리지 않기 위해 input.value 를 비우지 않는 구조) */
.type-input {
  position: relative;
  width: 100%;
  min-height: 56px;
  background: #fff;
  border: var(--bw) solid var(--line);
  border-radius: 16px;
  box-shadow: inset 0 3px 0 rgba(36, 26, 61, .07);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.type-input.is-focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, .22);
}
.type-input__view {
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 12px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.type-input__view::-webkit-scrollbar { display: none; }
.type-input__echo {
  flex: 0 0 auto;
  white-space: pre;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}
.type-input__echo.is-empty { color: var(--ink-3); font-weight: 400; }
.type-input__caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background: var(--violet);
  vertical-align: -.2em;
  margin-left: 1px;
  animation: caretBlink 1.05s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.type-input__real {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 17px;
  color: transparent;
  caret-color: transparent;
}
.type-input__real::selection { background: rgba(124, 92, 255, .18); }
.type-input__real:disabled { cursor: default; }

/* ---------- 통계 타일 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.stat {
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-sm);
  padding: 8px 6px;
  text-align: center;
}
.stat__k { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.stat__v { font-family: 'Jua', sans-serif; font-size: 24px; line-height: 1.2; }
.stat--violet { background: #efeaff; }
.stat--pink { background: #ffe7f1; }
.stat--mint { background: #ddfaef; }
.stat--yellow { background: #fff4cf; }

/* ---------- 진행바 ---------- */
.progress {
  height: 18px;
  background: #fff;
  border: var(--bw) solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transition: width .35s var(--ease-pop);
}

/* ---------- 배지 ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-family: 'Jua', sans-serif;
  font-size: 13px;
  background: var(--yellow);
  border: 2px solid var(--line);
  border-radius: 999px;
}

/* ---------- 모달 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(36, 26, 61, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal.is-open { display: flex; animation: fade .2s; }
.modal__box {
  width: 100%;
  max-width: 400px;
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  padding: 24px 20px;
  text-align: center;
  animation: pop .32s var(--ease-pop);
}
.modal__emoji { font-size: 54px; line-height: 1; }
.modal__title { font-size: 26px; margin: 10px 0 6px; }
.modal__desc { color: var(--ink-2); margin-bottom: 18px; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  z-index: 120;
  padding: 11px 20px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s var(--ease-pop);
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 폭죽 캔버스 ---------- */
#nl-confetti {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
}

/* ---------- 게임 카드 그리드(메인) ---------- */
.gamegrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 560px) { .gamegrid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 860px) { .gamegrid { grid-template-columns: repeat(4, 1fr); } }

.gcard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 14px 14px;
  background: var(--card);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh);
  color: var(--ink);
  text-decoration: none !important;
  overflow: hidden;
  transition: transform .16s var(--ease-pop), box-shadow .16s;
}
.gcard::after {
  content: '';
  position: absolute;
  right: -26px; top: -26px;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--gc, var(--yellow));
  opacity: .55;
}
.gcard:hover { transform: translateY(-4px); box-shadow: 0 9px 0 var(--line); }
.gcard:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.gcard__emoji { position: relative; font-size: 38px; line-height: 1.1; }
.gcard__name { position: relative; font-family: 'Jua', sans-serif; font-size: 17px; margin-top: 4px; }
.gcard__desc { position: relative; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }

/* ---------- 섹션 헤더 ---------- */
.sechead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sechead h2 { font-size: 22px; }
.sechead__tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- 히어로 ---------- */
.hero {
  text-align: center;
  padding: 30px 0 26px;
}
.hero h1 {
  font-size: clamp(28px, 8vw, 44px);
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 var(--line);
}
.hero p { margin-top: 12px; color: var(--ink-2); font-size: 15px; }
.hero__logo {
  display: inline-block;
  font-size: 56px;
  animation: bob 2.6s ease-in-out infinite;
}
.hero__logo-img {
  width: min(46vw, 178px);
  height: auto;
  aspect-ratio: 1;
  margin-inline: auto;
  background: #fff;
  border: var(--bw) solid var(--line);
  border-radius: 28px;
  box-shadow: var(--sh-lg);
  animation: bob 3.4s ease-in-out infinite;
}

/* ---------- SEO 본문 ---------- */
.article {
  margin-top: 30px;
  background: rgba(255, 255, 255, .72);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  padding: 20px 18px;
}
.article h2 { font-size: 20px; margin-bottom: 8px; }
.article h3 { font-size: 16.5px; margin: 18px 0 6px; }
.article p { font-size: 14.5px; color: var(--ink-2); line-height: 1.75; }
.article ul, .article ol { padding-left: 20px; margin: 6px 0; }
.article li { font-size: 14.5px; color: var(--ink-2); line-height: 1.75; margin: 3px 0; }
.article details {
  border-top: 2px dashed #d9d0e8;
  padding: 12px 0 4px;
}
.article details summary {
  font-family: 'Jua', sans-serif;
  font-size: 15.5px;
  cursor: pointer;
  list-style: none;
}
.article details summary::-webkit-details-marker { display: none; }
.article details summary::before { content: 'Q. '; color: var(--violet); }
.article details p { margin-top: 8px; padding-left: 18px; }

/* ---------- 연관 게임 ---------- */
.related { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .related { grid-template-columns: repeat(4, 1fr); } }
.related a {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 10px;
  background: #fff;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-sm);
  font-family: 'Jua', sans-serif;
  font-size: 14.5px;
  color: var(--ink);
  text-decoration: none !important;
}
.related a:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }

/* ---------- 푸터 ---------- */
.site-foot {
  margin-top: 36px;
  padding: 26px 0 calc(30px + env(safe-area-inset-bottom));
  border-top: var(--bw) solid var(--line);
  background: rgba(255, 255, 255, .6);
}
.foot-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 12px;
}
@media (min-width: 640px) { .foot-cols { grid-template-columns: repeat(4, 1fr); } }
.foot-tit { font-family: 'Jua', sans-serif; font-size: 15px; margin-bottom: 6px; }
.foot-cols ul { list-style: none; }
.foot-cols li { margin: 3px 0; }
.foot-cols a { font-size: 13.5px; color: var(--ink-2); }
.foot-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}
.foot-brand img {
  width: 46px;
  height: 46px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 13px;
  object-fit: cover;
}
.foot-brand b { font-family: 'Jua', sans-serif; font-size: 18px; }
.foot-copy { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--ink-3); }

/* ---------- 애니메이션 ---------- */
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }
@keyframes tada { 0%{transform:scale(1)} 40%{transform:scale(1.18) rotate(4deg)} 100%{transform:scale(1)} }

.is-shake { animation: shake .4s; }
.is-tada { animation: tada .45s var(--ease-pop); }
.is-pop { animation: pop .3s var(--ease-pop); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 게임 공용 유틸 ---------- */
.noselect { user-select: none; -webkit-user-select: none; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.tiny { font-size: 13px; }
.mt { margin-top: 14px; }
.mt-lg { margin-top: 24px; }
.hidden { display: none !important; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
