
:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --ink: #232220;
  --text: #232220;
  --muted: #7a766c;
  --line: #e8e4d9;
  --line-strong: #d8d4c8;
  --accent: #c4502e;
  --accent-deep: #a8401f;
  --accent-soft: #f9ebe4;
  --accent-faint: #fcf4ef;
  --border: #e8e4d9;
  --success: #3d7a45;
  --danger: #b3361f;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(35,34,32,.05);
  --shadow-md: 0 4px 16px rgba(35,34,32,.07);
  --shadow-lg: 0 14px 40px rgba(35,34,32,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "SUITE", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  background:
    repeating-linear-gradient(92deg, rgba(96,64,24,.045) 0 2px, rgba(96,64,24,0) 2px 110px),
    repeating-linear-gradient(88deg, rgba(255,240,210,.05) 0 3px, rgba(255,240,210,0) 3px 70px),
    linear-gradient(180deg, #c9a877 0%, #b89460 60%, #ad8a58 100%);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ───── 헤더 ───── */
header.site { border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; background: rgba(250,248,243,.9); backdrop-filter: blur(8px); }
.nav-wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; height: 60px; gap: 18px; }
.logo { font-weight: 800; font-size: 17.5px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo .logo-kim { display: flex; flex: none; transition: transform .25s cubic-bezier(.34,1.8,.64,1); }
.logo:hover .logo-kim { transform: rotate(-8deg) scale(1.12); }
nav.main { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav.main::-webkit-scrollbar { display: none; }
nav.main a { padding: 6px 11px; font-size: 14px; color: var(--muted); border-radius: 8px; white-space: nowrap; transition: background .12s, color .12s; }
nav.main a:hover { color: var(--ink); background: rgba(0,0,0,.045); }
nav.main a.active { color: var(--accent); font-weight: 700; background: var(--accent-soft); }

/* 책상 위 종이 시트 */
main {
  max-width: 920px; margin: 26px auto 36px; padding: 40px 32px 64px;
  background: var(--bg);
  border: 1.5px solid rgba(35,34,32,.45);
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(35,34,32,.22), 0 20px 48px rgba(58,38,10,.32);
}
.kicker { font-size: 13px; font-weight: 700; letter-spacing: .14em; color: var(--accent); margin-bottom: 10px; }
h1 { font-size: 42px; line-height: 1.22; letter-spacing: -0.03em; font-weight: 800; }
.lede { color: var(--muted); font-size: 17px; margin: 14px 0 0; max-width: 30em; }
h2 { font-size: 21px; letter-spacing: -0.01em; margin: 40px 0 10px; }
h3 { font-size: 16.5px; margin: 22px 0 6px; }
p { margin: 8px 0; }

/* ───── 홈 히어로 ───── */
.hero { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.hero > div:first-child { flex: 1; min-width: 260px; }
.kim-hero { flex: none; display: flex; flex-direction: column; align-items: center; gap: 0; }
.kim-hero .kim-stage { animation: kimBob 3.2s ease-in-out infinite; }
@keyframes kimBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.kim-bubble {
  position: relative; background: var(--surface); border: 1.5px solid var(--ink);
  border-radius: 14px; padding: 10px 16px; font-size: 14.5px; font-weight: 600;
  box-shadow: 3px 3px 0 rgba(35,34,32,.12); margin-bottom: 14px; max-width: 240px; text-align: center;
}
.kim-bubble::after {
  content: ""; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 13px; height: 13px; background: var(--surface);
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
}
.kim-hero .kim-name { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .08em; margin-top: 4px; }

/* ───── 게임 목록(공략·블로그) ───── */
.game-list { margin: 44px 0 8px; border-top: 1px solid var(--line-strong); }
.game-list .row {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 8px; border-bottom: 1px solid var(--line);
  transition: background .15s, padding .15s; border-radius: 0 0 0 0;
}
.game-list .row:hover { background: var(--surface); padding-left: 16px; }
.game-list .num { font-size: 13px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; width: 24px; }
.game-list .body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.game-list strong { font-size: 19px; letter-spacing: -0.01em; }
.game-list .desc { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.game-list svg { color: var(--muted); flex-shrink: 0; transition: color .15s, transform .15s; }
.game-list .row:hover svg { color: var(--accent); transform: translateX(3px); }
.game-list .go { font-size: 13px; color: var(--muted); }

.about { max-width: 640px; }
.about p { color: #4d4a43; font-size: 15.5px; }

/* ───── 게임 페이지 공통 ───── */
.game-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.game-head h1 { font-size: 25px; }
main.game { padding-top: 28px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.game-head .toolbar { margin-left: auto; }
.hint { font-size: 13.5px; color: var(--muted); margin: -8px 0 16px; }

button, select {
  font: inherit; font-size: 14px; padding: 8px 15px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, transform .08s, box-shadow .12s;
}
button:hover, select:hover { background: #f6f4ed; border-color: #c9c4b4; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
button:active { transform: scale(.96); box-shadow: none; }
.stat { font-size: 14px; color: var(--muted); padding: 8px 2px; font-variant-numeric: tabular-nums; }
.stat b { color: var(--ink); }
.msg { margin: 14px 0; font-weight: 600; min-height: 24px; }
.msg.win { color: var(--success); }
.msg.lose { color: var(--danger); }

details.how { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 8px; max-width: 640px; }
details.how summary {
  cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted);
  padding: 10px 0; list-style: none; letter-spacing: .04em;
}
details.how summary:hover { color: var(--ink); }
details.how summary::before { content: "+"; margin-right: 8px; color: var(--accent); font-weight: 700; }
details.how[open] summary::before { content: "−"; }
details.how summary::-webkit-details-marker { display: none; }
details.how p { font-size: 14.5px; color: #4d4a43; }
details.how h2 { font-size: 15px; margin: 18px 0 4px; }

footer.site { padding: 0 20px 30px; font-size: 13px; color: #5c4628; }
footer.site > div { max-width: 920px; margin: 0 auto; }
footer.site a { color: #5c4628; margin-right: 14px; text-decoration: underline; text-decoration-color: rgba(92,70,40,.35); }
footer.site a:hover { color: #2e2210; }

/* ───── 공략·글 ───── */
.guide { max-width: 660px; }
.guide h1 { font-size: 30px; }
.guide .sub { color: var(--muted); margin: 8px 0 24px; }
.guide p, .guide li { font-size: 15.5px; color: #3c3a34; }
.guide ul, .guide ol { padding-left: 22px; margin: 8px 0; }
.guide .tip { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 16px 0; font-size: 14.5px; }
table.rule { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14.5px; }
table.rule th, table.rule td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
table.rule th { background: var(--surface); }

.guide-list { margin-top: 32px; border-top: 1px solid var(--line-strong); }

.diagram { margin: 14px 0 20px; }
.diagram .mini { display: grid; gap: 3px; width: max-content; user-select: none; }
.diagram .mini div {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; border-radius: 6px; background: #e3e0d5; color: var(--ink);
}
.diagram .mini .o { background: var(--surface); border: 1px solid var(--line); }
.diagram .mini .mine { background: #f3d3c9; }
.diagram .mini .safe { background: #d9e7d4; }
.diagram .cap { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: 28em; }
.diagram .mini .c1 { color: #2c5e9e; } .diagram .mini .c2 { color: var(--success); }
.sgrid { display: grid; grid-template-columns: repeat(9, 30px); width: max-content; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.sgrid div {
  height: 30px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
  background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.sgrid div:nth-child(3n) { border-right: 2px solid var(--ink); }
.sgrid div:nth-child(9n) { border-right: none; }
.sgrid .hl { background: #f3e3b8; }
.sgrid .tgt { background: #d9e7d4; color: var(--success); }
.sgrid .xw { background: #d9e4f3; color: #2c5e9e; }

@media (max-width: 960px) {
  main { margin-left: 12px; margin-right: 12px; }
}
@media (max-width: 640px) {
  h1 { font-size: 31px; }
  .game-head h1 { font-size: 21px; }
  .game-head .toolbar { margin-left: 0; }
  main { margin: 14px 8px 24px; padding: 26px 14px 48px; }
  .hero { gap: 10px; }
  .kim-hero { margin: 0 auto; }
}

/* 모바일 길게 누르기 시 텍스트 선택/돋보기 메뉴 방지 (게임 보드) */
#grid, #grid *, #board, #board *, #stage, #stage *, #omok, #numpad, #numpad * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ───── 게임 종료 모달 ───── */
.pm-overlay { position: fixed; inset: 0; background: rgba(35,34,32,.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; animation: pmFade .15s ease; }
@keyframes pmFade { from { opacity: 0; } }
.pm-modal { position: relative; background: var(--bg); border: 2px solid var(--text); border-radius: 18px; max-width: 360px; width: 100%; padding: 28px 24px 20px; text-align: center; box-shadow: 8px 8px 0 rgba(35,34,32,.18), 0 24px 60px rgba(0,0,0,.25); animation: pmPop .22s cubic-bezier(.34,1.56,.64,1); }
@keyframes pmPop { from { transform: scale(.85); opacity: 0; } }
.pm-ico { width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: flex-end; justify-content: center; background: var(--accent-soft); overflow: hidden; }
.pm-stamp {
  position: absolute; top: 14px; right: 14px; width: 60px; height: 60px;
  border: 2px solid #c0392b; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4.5px #c0392b;
  color: #c0392b; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; letter-spacing: .12em; text-indent: .12em;
  transform: rotate(-14deg); opacity: .88; pointer-events: none;
  animation: pmStamp .3s cubic-bezier(.34,1.56,.64,1) .25s backwards;
}
@keyframes pmStamp { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } }
.pm-ico.lose { background: #f3ece9; }
.pm-ico.draw { background: #f3f1ea; }
.pm-modal h2 { font-size: 23px; letter-spacing: -0.01em; margin-bottom: 4px; }
.pm-modal h2.pm-win { color: var(--success); }
.pm-modal h2.pm-lose { color: var(--danger); }
.pm-stats { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; margin-top: 14px; }
.pm-line { font-size: 15.5px; font-weight: 600; margin: 5px 0; color: #4a463e; }
.pm-btns { margin-top: 16px; }
.pm-btns .pm-big { width: 100%; padding: 12px 0; font-size: 16px; }
.pm-row { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.pm-row button { flex: 1; }

/* ───── 김부장 한마디 (말풍선) ───── */
.kim-note { display: flex; gap: 14px; align-items: flex-end; max-width: 500px; margin: 30px auto 0; }
.kim-note > div:first-child { flex: none; }
.kim-note p {
  position: relative; flex: 1; margin: 0 0 10px; background: var(--surface);
  border: 1.5px solid var(--ink); border-radius: 14px; border-bottom-left-radius: 4px;
  padding: 11px 15px; font-size: 13.5px; color: #4d4a43;
  box-shadow: 3px 3px 0 rgba(35,34,32,.1);
}
.kim-note p::before {
  content: ""; position: absolute; left: -8px; bottom: 9px;
  width: 12px; height: 12px; background: var(--surface); transform: rotate(45deg);
  border-left: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
}
.kim-note b { color: var(--accent); display: block; font-size: 12px; letter-spacing: .04em; margin-bottom: 1px; }

/* ───── 결재 서류 헤더 (스도쿠 등) ───── */
.doc-head { display: flex; align-items: stretch; gap: 10px; max-width: 480px; margin: 0 auto 12px; }
.doc-title { flex: 1; display: flex; align-items: center; font-weight: 700; font-size: 13.5px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 10px; padding: 6px 12px; box-shadow: 3px 3px 0 rgba(35,34,32,.08); }
.doc-sign { display: flex; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: 3px 3px 0 rgba(35,34,32,.08); }
.doc-sign > div { width: 52px; display: flex; flex-direction: column; }
.doc-sign > div + div { border-left: 1.5px solid var(--ink); }
.doc-sign span { font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line-strong); padding: 2px 0; letter-spacing: .06em; }
.doc-sign b { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: #4d4a43; min-height: 26px; }
.doc-sign b[data-kim-face] svg { display: block; }
@media (max-width: 480px) { .doc-title { font-size: 12px; padding: 6px 9px; } .doc-sign > div { width: 45px; } }

/* ───── 홈 종목 카드 ───── */
.fam-wrap { margin-top: 34px; }
.fam2 {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s;
}
.fam2:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.fam2-head { display: flex; gap: 13px; align-items: center; margin-bottom: 14px; }
.fam2 .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.fam2 strong { font-size: 17.5px; display: block; letter-spacing: -0.01em; }
.fam2 .desc { font-size: 13px; color: var(--muted); display: block; margin-top: 1px; }
.subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 9px; }
.sub {
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 13px; line-height: 1.5;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.sub b { font-size: 14.5px; display: block; }
.sub span { font-size: 12px; color: var(--muted); display: block; margin-top: 1px; }
.sub:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sub:hover b { color: var(--accent); }
.sub.main { border-color: #e6c4b4; background: var(--accent-faint); }
.og { font-size: 10.5px; font-weight: 700; color: var(--accent); border: 1px solid #e0b8a6; border-radius: 99px; padding: 0 6px; margin-left: 6px; font-style: normal; vertical-align: 2px; }

@media (prefers-reduced-motion: reduce) {
  .kim-hero .kim-stage { animation: none; }
  html { scroll-behavior: auto; }
}

/* ───── 홈 v2: 단순화 레이아웃 ───── */
.sec-title { display: flex; align-items: baseline; gap: 10px; margin: 38px 0 14px; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.sec-title small { font-size: 13px; font-weight: 600; color: var(--muted); }
.daily2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.daily-card {
  display: block; background: var(--accent-faint); border: 1.5px solid #e6c4b4; border-radius: 14px;
  padding: 18px 20px; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.daily-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.daily-card b { font-size: 18px; }
.daily-card > span { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.daily-card .go { display: block; font-style: normal; font-size: 13.5px; font-weight: 700; color: var(--accent); margin-top: 12px; }
.play-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.play-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .12s, box-shadow .12s;
}
.play-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.play-main { display: flex; gap: 12px; align-items: center; }
.play-main .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.play-main b { font-size: 17px; display: block; letter-spacing: -0.01em; }
.play-main > div > span { font-size: 12.5px; color: var(--muted); display: block; margin-top: 1px; }
.play-card:hover .play-main b { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.chips a { font-size: 12px; font-weight: 600; padding: 3px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); transition: color .12s, border-color .12s; }
.chips a:hover { color: var(--accent); border-color: var(--accent); }
