/* Paperlogy 웹폰트 (jsDelivr CDN) */
@font-face {
  font-family: 'Paperlogy';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-4Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Paperlogy';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   공통 템플릿 스타일 — 10개 사이트 공용
   색상 변수만 바꾸면 사이트별 테마 변경 가능
   ============================================ */
:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #273449;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #22c55e;
  --border: #334155;
  --radius: 14px;
  --maxw: 720px;
  --c4-board: #1d4ed8;
  --c4-red: #ef4444;
  --c4-yellow: #facc15;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Paperlogy', -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* 헤더 */
.site-header { padding: 32px 0 24px; text-align: center; }
.site-header h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.subtitle { color: var(--text-dim); margin-top: 8px; font-size: 0.95rem; }

/* 카드 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
}
.card h2 { font-size: 1.2rem; margin-bottom: 16px; }
.card h3 { font-size: 1.05rem; margin: 20px 0 10px; }

/* 입력 필드 */
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
label { display: block; font-size: 0.9rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 5px; }

/* 버튼 */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }

/* 콘텐츠 영역 */
.content p { margin-bottom: 12px; color: var(--text); }
.content ul { margin: 10px 0 16px 20px; }
.content li { margin-bottom: 6px; }
.content details {
  background: var(--card-2); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px;
}
.content summary { cursor: pointer; font-weight: 600; }
.content details p { margin-top: 10px; color: var(--text-dim); }

/* 광고 슬롯 */
.ad-slot {
  position: relative;
  min-height: 100px;
  background: repeating-linear-gradient(45deg, #1a2438, #1a2438 10px, #1c2740 10px, #1c2740 20px);
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto;
}
.ad-top { margin-top: 8px; }
.ad-inline { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.ad-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* 푸터 */
.site-footer { padding: 32px 0 40px; text-align: center; border-top: 1px solid var(--border); margin-top: 24px; }
.footer-tools { font-size: 0.88rem; color: var(--text-dim); margin-bottom: 12px; }
.footer-tools a:not(.tool-chip) { color: var(--primary); text-decoration: none; margin: 0 8px; }
.footer-tools a:not(.tool-chip):hover { text-decoration: underline; }
.copyright { font-size: 0.8rem; color: var(--text-dim); }

/* ============================================
   커넥트4 보드 — 사이트 전용 추가 스타일
   ============================================ */

/* 게임 옵션 (난이도) */
.game-options { display: flex; gap: 12px; margin-bottom: 18px; }
.game-options .field { flex: 1; margin-bottom: 0; }

/* 상태 메시지 */
.game-status {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(99,102,241,0.12));
  border: 1px solid var(--border);
}
.game-status.win { color: var(--accent); }
.game-status.lose { color: #f87171; }
.game-status.draw { color: var(--text-dim); }

/* 보드 래퍼 */
.c4-wrap {
  max-width: 420px;
  margin: 0 auto 8px;
}

/* 열 선택 버튼 (보드 위 화살표 영역) */
.c4-cols {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 0 10px;
  margin-bottom: 6px;
}
.c4-col-btn {
  border: none;
  background: var(--card-2);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 0;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.c4-col-btn:hover:not(:disabled) { background: var(--primary); color: #fff; }
.c4-col-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* 7열 x 6행 보드 */
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: var(--c4-board);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  aspect-ratio: 7 / 6;
}
.cell {
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  aspect-ratio: 1 / 1;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}
.cell .disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translateY(-600%);
}
.cell.filled .disc {
  transform: translateY(0);
  animation: dropDisc 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dropDisc {
  0% { transform: translateY(-600%); }
  70% { transform: translateY(0); }
  82% { transform: translateY(-12%); }
  100% { transform: translateY(0); }
}
.cell.red .disc {
  background: radial-gradient(circle at 35% 30%, #ff7b7b, var(--c4-red) 70%);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.35);
}
.cell.yellow .disc {
  background: radial-gradient(circle at 35% 30%, #fff0a0, var(--c4-yellow) 70%);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.35);
}
.cell.win-cell .disc {
  box-shadow: 0 0 0 3px var(--accent), inset 0 -3px 6px rgba(0,0,0,0.35);
}
.cell.win-cell {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4), 0 0 14px rgba(34,197,94,0.7);
}

/* 점수판 */
.scoreboard { display: flex; gap: 12px; margin: 16px 0 8px; }
.score-item {
  flex: 1; background: var(--card-2); border-radius: 10px; padding: 12px; text-align: center;
}
.score-item span { display: block; font-size: 0.78rem; color: var(--text-dim); }
.score-item strong { display: block; font-size: 1.3rem; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* 반응형 */
@media (max-width: 480px) {
  .site-header h1 { font-size: 1.4rem; }
  .game-options { flex-direction: column; gap: 0; }
  .game-options .field { margin-bottom: 16px; }
  .c4-cols { padding: 0 6px; gap: 4px; }
  .board { gap: 4px; padding: 6px; }
}

/* ===== 푸터 도구·게임 칩 (이모지 나열형) ===== */
.footer-tools-title { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tool-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--card-2, #273449);
  border: 1px solid var(--border, #334155);
  border-radius: 999px;
  color: var(--text, #e2e8f0);
  font-size: 0.86rem; font-weight: 600;
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.tool-chip:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #6366f1);
  background: var(--card, #1e293b);
}
.tool-chip .chip-emoji { font-size: 1.05rem; line-height: 1; }
@media (max-width: 480px) {
  .tool-chip { padding: 7px 11px; font-size: 0.8rem; }
}

/* 푸터 칩 카테고리 분류 */
.chip-group { margin-bottom: 16px; }
.chip-cat {
  display: block; font-size: 0.82rem; font-weight: 700;
  color: var(--text-dim, #94a3b8); margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.chip-group:last-child { margin-bottom: 0; }
