/* 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: #f59e0b;
  --primary-hover: #d97706;
  --accent: #f59e0b;
  --border: #334155;
  --radius: 14px;
  --maxw: 720px;
}

* { 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: #1a1206;
  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); }

/* ============================================
   2048 게임 전용 스타일
   ============================================ */
.game-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 18px;
}
.score-box {
  background: var(--card-2);
  border-radius: 10px;
  padding: 8px 16px;
  text-align: center;
  min-width: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.score-label { display: block; font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.score-value { display: block; font-size: 1.4rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.btn-restart { width: auto; margin-top: 0; margin-left: auto; padding: 10px 18px; font-size: 0.95rem; align-self: stretch; }

/* 게임판 */
.board-wrap { position: relative; }
.grid-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  background: #273449;
  border-radius: 12px;
  padding: 10px;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
}
/* 타일 셀이 grid 행 높이에 확실히 채워지도록 (aspect-ratio + 1fr row 조합 버그 방지) */
.grid-board > .tile { width: 100%; height: 100%; min-height: 64px; }

/* 타일 */
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #334155;
  font-weight: 800;
  font-size: clamp(1.1rem, 7vw, 2.1rem);
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
  transition: transform 0.08s ease;
}
.tile-empty { background: rgba(255, 255, 255, 0.04); }
.tile-pop { animation: pop 0.12s ease; }
@keyframes pop {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

/* 숫자별 색상 */
.tile-2    { background: #3b4a63; color: #e2e8f0; }
.tile-4    { background: #46597a; color: #e2e8f0; }
.tile-8    { background: #f0a23c; color: #1a1206; }
.tile-16   { background: #f08f2e; color: #1a1206; }
.tile-32   { background: #f3762f; color: #fff; }
.tile-64   { background: #f25c2a; color: #fff; }
.tile-128  { background: #edc850; color: #1a1206; font-size: clamp(0.95rem, 6vw, 1.8rem); }
.tile-256  { background: #edc23e; color: #1a1206; font-size: clamp(0.95rem, 6vw, 1.8rem); }
.tile-512  { background: #edbe2c; color: #1a1206; font-size: clamp(0.95rem, 6vw, 1.8rem); }
.tile-1024 { background: #edb91a; color: #1a1206; font-size: clamp(0.8rem, 5vw, 1.5rem); }
.tile-2048 { background: #edc22e; color: #1a1206; font-size: clamp(0.8rem, 5vw, 1.5rem); box-shadow: 0 0 18px rgba(237, 194, 46, 0.7); }
.tile-big  { background: #16a34a; color: #fff; font-size: clamp(0.8rem, 5vw, 1.5rem); }

/* 게임 오버 오버레이 */
.game-over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.82);
  border-radius: 12px;
  z-index: 5;
}
.game-over-inner { text-align: center; }
.game-over-text { font-size: 1.6rem; font-weight: 800; margin-bottom: 14px; }
.game-over .btn-primary { width: auto; padding: 12px 28px; }

/* 반응형 */
@media (max-width: 480px) {
  .site-header h1 { font-size: 1.4rem; }
  .field-row { flex-direction: column; gap: 0; }
  .game-bar { flex-wrap: wrap; }
  .score-box { min-width: 72px; padding: 6px 12px; }
  .score-value { font-size: 1.2rem; }
}

/* ===== 푸터 도구·게임 칩 (이모지 나열형) ===== */
.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; }
