/* ==========================================================================
   짬툴 (JJAMTOOL) — 공용 디자인 시스템
   순수 CSS. 외부 폰트/라이브러리 없음 (로딩 속도 = SEO 점수)
   ========================================================================== */

:root {
  --bg:        #0e1015;
  --bg-soft:   #161a22;
  --bg-card:   #1b202a;
  --line:      #2a3140;
  --line-soft: #222836;

  --text:      #e8ecf4;
  --text-dim:  #a3adc0;
  --text-mute: #6f7b90;

  --brand:     #f2b544;   /* 짬툴 시그니처: 놋쇠빛 금색 */
  --brand-ink: #1a1408;
  --maru:      #e0854a;   /* 정담마루 계열 — 흙빛 주황 */
  --night:     #6f7ce0;   /* 새벽세시 계열 — 심야 보라 */

  --ok:        #4ec9a5;
  --warn:      #f0b32e;
  --bad:       #ef6a6a;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --maxw:      1080px;

  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic",
          "맑은 고딕", "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: ui-monospace, "D2Coding", "Consolas", "Menlo", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f6f7fa;
    --bg-soft:   #ffffff;
    --bg-card:   #ffffff;
    --line:      #dfe3ec;
    --line-soft: #eaedf3;
    --text:      #171b23;
    --text-dim:  #4d5768;
    --text-mute: #7d8798;
    --brand:     #c98a12;
    --brand-ink: #ffffff;
    --shadow:    0 8px 24px rgba(20,25,40,.08);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
  word-break: keep-all;
  overflow-wrap: break-word;
}

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

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

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; letter-spacing: -.02em; }
h1 { font-size: clamp(1.65rem, 4.2vw, 2.4rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 700; margin-top: 2.2em; }
h3 { font-size: 1.08rem; font-weight: 700; margin-top: 1.8em; }
p  { margin: 0 0 1em; }

/* ---------- 레이아웃 ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

header.site {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.logo {
  font-weight: 900; font-size: 1.15rem; color: var(--text);
  letter-spacing: -.03em; display: flex; align-items: center; gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 12px var(--brand);
}
.nav nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.nav nav a {
  color: var(--text-dim); font-size: .92rem; font-weight: 600;
  padding: 6px 11px; border-radius: 8px;
}
.nav nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav nav a.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }

main { padding: 34px 0 70px; }

footer.site {
  border-top: 1px solid var(--line-soft);
  padding: 30px 0 50px; color: var(--text-mute); font-size: .87rem;
}
footer.site .fnav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
footer.site a { color: var(--text-dim); }

/* ---------- 카드 / 그리드 ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: block;
  color: inherit;
  transition: transform .16s ease, border-color .16s ease;
}
a.card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p  { margin: 0; color: var(--text-dim); font-size: .93rem; line-height: 1.6; }
.card .tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand);
}
.card .tag.maru  { background: color-mix(in srgb, var(--maru) 16%, transparent);  color: var(--maru); }
.card .tag.night { background: color-mix(in srgb, var(--night) 20%, transparent); color: var(--night); }

/* ---------- 폼 요소 ---------- */
textarea, input[type=text], input[type=number], select {
  width: 100%;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.7;
}
textarea { min-height: 190px; resize: vertical; }
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: var(--text-dim); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: var(--brand-ink);
  border: none; border-radius: var(--radius-sm);
  padding: 11px 20px; font-family: inherit; font-size: .96rem; font-weight: 800;
  cursor: pointer; transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--line);
}
.btn.ghost:hover { color: var(--text); border-color: var(--text-mute); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 통계 타일 ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 18px 0; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.stat .k { font-size: .78rem; color: var(--text-mute); font-weight: 700; letter-spacing: .02em; }
.stat .v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .v small { font-size: .8rem; font-weight: 700; color: var(--text-mute); margin-left: 2px; }
.stat.ok   .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.bad  .v { color: var(--bad); }

/* ---------- 알림 배너 ---------- */
.note {
  border-left: 3px solid var(--brand);
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px; margin: 18px 0; font-size: .93rem; color: var(--text-dim);
}
.note.ok  { border-color: var(--ok); }
.note.bad { border-color: var(--bad); }
.note strong { color: var(--text); }

/* ---------- 표 ---------- */
.tablewrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; min-width: 460px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--text-mute); font-size: .8rem; font-weight: 700; letter-spacing: .03em; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- FAQ ---------- */
details.faq {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 16px; margin-bottom: 10px; background: var(--bg-soft);
}
details.faq summary {
  cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none;
  display: flex; justify-content: space-between; gap: 12px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "＋"; color: var(--text-mute); font-weight: 400; }
details.faq[open] summary::after { content: "－"; }
details.faq > div { padding-bottom: 14px; color: var(--text-dim); font-size: .94rem; }

/* ---------- 광고 슬롯 ---------- */
.adslot {
  margin: 30px 0; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--text-mute); font-size: .8rem;
}
.adslot:empty::before { content: "광고 영역"; }

/* ---------- 게임 공용 ---------- */
.gamestage {
  background: #05070c; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; position: relative;
}
canvas { display: block; width: 100%; height: auto; touch-action: manipulation; }

.hud {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 11px 15px; background: var(--bg-soft); border-bottom: 1px solid var(--line);
  font-size: .88rem; font-weight: 700;
}
.hud .sep { flex: 1; }
.hud b { color: var(--brand); font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }

.breadcrumb { font-size: .84rem; color: var(--text-mute); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-mute); }

.lead { font-size: 1.05rem; color: var(--text-dim); margin-bottom: 26px; }

.kbd {
  font-family: var(--mono); font-size: .82rem; padding: 2px 7px;
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; background: var(--bg-soft); color: var(--text-dim);
}

ul.clean { padding-left: 20px; color: var(--text-dim); }
ul.clean li { margin-bottom: .5em; }

@media (max-width: 600px) {
  body { font-size: 15px; }
  main { padding: 24px 0 50px; }
  .nav { gap: 10px; padding: 10px 16px; }
  .nav nav { width: 100%; margin-left: 0; }
  .nav nav a { padding: 5px 9px; font-size: .86rem; }
}
