/* ============================================================
   bibimbap — 공통 스타일
   외부 라이브러리 없음 · 순수 CSS · JSP 전역 적용용
   <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bibimbap.css">
   ============================================================ */

/* ---------- 1. 디자인 토큰 ---------- */
:root {
  /* 색상 */
  --color-bg:            #F5F0E8;  /* 페이지 배경 */
  --color-card:          #FFFFFF;  /* 카드 표면 */
  --color-field-bg:      #FBF8F2;  /* 입력란 배경 */
  --color-accent:        #D4A853;  /* 골든 액센트(주요 버튼) */
  --color-accent-strong: #C2912F;  /* 링크·강조 텍스트 */
  --color-accent-soft:   #FBEFD6;  /* 액센트 옅은 배경(뱃지) */
  --color-accent-press:  #C79A40;  /* 버튼 hover/active */

  --color-text:        #241F18;  /* 본문 텍스트 */
  --color-text-muted:  #6E6555;  /* 보조 텍스트 */
  --color-text-faint:  #9A8F7C;  /* placeholder·메타 */
  --color-on-accent:   #3A2E15;  /* 골든 버튼 위 글자색 */

  --color-border:      #E7DECE;  /* 기본 보더 */
  --color-border-soft: #EDE4D4;  /* 구분선 */

  --color-danger:      #B24A2C;  /* 에러 텍스트 */
  --color-danger-bg:   #FBE6DF;  /* 에러 배경 */
  --color-ok:          #4E7A48;  /* 성공 텍스트 */
  --color-ok-bg:       #E4F0E0;  /* 성공 배경 */

  /* 모양 */
  --radius-sm:  8px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;
  --radius-pill: 999px;

  /* 타이포 */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- 1-D. 다크 모드 토큰 오버라이드 ---------- */
/* 값 출처: header.jsp html[data-theme="dark"] .site-header 블록
     --header-bg: #1a1a1a  → --color-bg
     --header-text: #f5f0e8 → --color-text
     --header-muted: rgba(245,240,232,.65) → --color-text-muted / --color-text-faint
     --header-border: rgba(255,255,255,.06) → --color-border / --color-border-soft
     card/field-bg: header-bg 보다 소폭 밝은 표면
     accent: 라이트와 동일 유지 */
html[data-theme="dark"] {
  --color-bg:            #1a1a1a;               /* header --header-bg */
  --color-card:          #222018;               /* 표면 — header-bg 보다 살짝 밝음 */
  --color-field-bg:      #1e1c14;               /* 입력란 — bg 보다 살짝 어두움 */

  --color-text:          #f5f0e8;               /* header --header-text */
  --color-text-muted:    rgba(245, 240, 232, 0.65);  /* header --header-muted */
  --color-text-faint:    rgba(245, 240, 232, 0.40);  /* muted 보다 더 희미 */
  --color-on-accent:     #3A2E15;               /* 골든 버튼 위 글자 — 라이트와 동일 */

  --color-border:        rgba(255, 255, 255, 0.08);  /* header --header-border 소폭 강조 */
  --color-border-soft:   rgba(255, 255, 255, 0.06);  /* header --header-border */

  --color-accent:        #D4A853;               /* 라이트와 동일 */
  --color-accent-strong: #e8a54b;               /* header --accent (다크에서 밝게) */
  --color-accent-soft:   rgba(212, 168, 83, 0.15);   /* 옅은 골든 배경 */
  --color-accent-press:  #C79A40;               /* 라이트와 동일 */

  --color-danger:        #e07050;               /* 다크에서 가독 보강 */
  --color-danger-bg:     rgba(178, 74, 44, 0.18);
  --color-ok:            #6aad60;               /* 다크에서 가독 보강 */
  --color-ok-bg:         rgba(78, 122, 72, 0.18);
}

/* ---------- 2. 베이스 ---------- */
body {
  margin: 0;
  background: var(--color-bg);
  font-family: var(--font-sans);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
::selection { background: #F1D79B; }

/* main 영역 공통 컨테이너(선택) */
.page { max-width: 1120px; margin: 0 auto; padding: 48px 24px; }
.page--center { display: flex; justify-content: center; }

/* ---------- 3. 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-color: var(--color-accent);
}
.btn-primary:hover { background: var(--color-accent-press); border-color: var(--color-accent-press); }

.btn-ghost {
  background: var(--color-card);
  color: var(--color-on-accent);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-field-bg); }

.btn--block { width: 100%; }
.btn--lg { padding: 15px 28px; font-size: 16px; }

/* 비활성 (입력 전 등) */
.btn:disabled,
.btn[disabled],
button:disabled {
  background: #EFE7D7;
  color: #B3A88E;
  border-color: #EFE7D7;
  cursor: not-allowed;
}

/* ---------- 4. 폼 요소 ---------- */
.field { margin-top: 16px; }
.field:first-child { margin-top: 0; }

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.label { font-weight: 600; font-size: 13px; color: var(--color-text-muted); }
.req { color: var(--color-danger); }
.count { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-faint); }

.input,
.textarea {
  width: 100%;
  font: inherit;
  color: var(--color-text);
  background: var(--color-field-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.input::placeholder,
.textarea::placeholder { color: var(--color-text-faint); }
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}

/* 도움말 / 검증 메시지 */
.help { font-size: 12px; color: var(--color-text-faint); margin: 6px 0 0; }

.form-error {
  font-size: 12.5px;
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 10px 0 0;
}
.form-ok {
  font-size: 12px;
  color: var(--color-ok);
  margin: 6px 0 0;
}

/* ---------- 5. 비밀번호 필드 (보기 토글) ---------- */
.pw-field {
  display: flex;
  align-items: center;
  background: var(--color-field-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
}
.pw-field:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.pw-field input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font: inherit;
  color: var(--color-text);
  padding: 0;
}
.pw-toggle {
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: 0 0 0 10px;
}
.pw-toggle:hover { color: var(--color-text-muted); }

/* 비밀번호 강도 막대 — input의 data-level(0~3)에 반응 */
.pw-meter { display: flex; gap: 6px; margin-top: 8px; }
.pw-meter span { flex: 1; height: 5px; border-radius: 3px; background: #E2D9C8; }
.pw-meter[data-level="1"] span:nth-child(1) { background: var(--color-danger); }
.pw-meter[data-level="2"] span:nth-child(-n+2) { background: var(--color-accent); }
.pw-meter[data-level="3"] span { background: var(--color-ok); }

/* ---------- 6. 칩 (정렬·필터) ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  text-decoration: none;
  cursor: pointer;
}
.chip:hover { background: var(--color-field-bg); }
.chip--on {
  font-weight: 700;
  color: var(--color-on-accent);
  background: #F1D79B;
  border-color: #F1D79B;
}

/* ---------- 7. 카드 ---------- */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 30px;
}

/* ---------- 8. Empty / Error State ---------- */
.empty-state {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 64px 32px;
  text-align: center;
}
.empty-state svg { display: block; margin: 0 auto; }
.empty-state .code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--color-accent-strong);
  margin-top: 18px;
}
.empty-state h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text);
  margin: 18px 0 0;
}
.empty-state .code + h3 { margin-top: 8px; }
.empty-state p {
  color: var(--color-text-muted);
  margin: 8px auto 0;
  max-width: 400px;
  line-height: 1.6;
}
.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- 9. 보조 링크 ---------- */
.link { color: var(--color-accent-strong); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-quiet { color: var(--color-text-faint); text-decoration: underline; }

/* ============================================================
   화면별 레이아웃 컴포넌트 (홈 / 게임상세 / 약관 / 프로필 / 폼)
   ============================================================ */

/* ---------- 10. 페이지 헤더(섹션 제목) ---------- */
.section-eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--color-accent-strong); }
.section-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 0; color: var(--color-text); }
.section-desc { color: var(--color-text-muted); margin: 8px 0 0; line-height: 1.6; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- 11. 홈 검색 / 정렬 / 게임 그리드 ---------- */
.search-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.search-row .input { flex: 1; min-width: 240px; }
.sort-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.sort-label { font-size: 13px; color: var(--color-text-faint); margin-right: 4px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.game-card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: inherit; display: block; }
.game-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.game-card .thumb { position: relative; height: 140px; background: linear-gradient(135deg, #EDE3D2, #E2D4BC); display: flex; align-items: center; justify-content: center; }
.game-card .thumb .num { position: absolute; top: 10px; left: 10px; font-family: var(--font-mono); font-size: 11px; background: #fff; border-radius: 6px; padding: 3px 8px; color: var(--color-on-accent); }
.game-card .body { padding: 14px; }
.game-card .body .name { font-weight: 700; }
.game-card .body .sub { font-size: 13px; color: var(--color-text-faint); margin-top: 3px; }

.empty-card { border: 1px dashed #CBBE9E; border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; color: #9A8B6E; min-height: 206px; text-decoration: none; }
.empty-card .plus { font-size: 30px; line-height: 1; }
.empty-card .t { font-weight: 700; color: #7A6B4D; margin-top: 8px; }
.empty-card .s { font-size: 12.5px; margin-top: 4px; }

/* ---------- 12. 게임 상세 ---------- */
.detail-meta { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-top: 12px; font-size: 14px; color: var(--color-text-muted); }
.detail-meta .sep { color: #D8CDB8; }
.detail-meta .muted { color: var(--color-text-faint); }
.badge-soft { background: var(--color-accent-soft); color: #A9781F; border-radius: var(--radius-sm); padding: 6px 12px; font-weight: 600; }

.player { position: relative; aspect-ratio: 16 / 9; background: #15110C; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-top: 16px; }
.play-btn { background: var(--color-accent); color: var(--color-on-accent); font-weight: 700; border: none; border-radius: var(--radius-pill); padding: 13px 28px; font-size: 15px; cursor: pointer; }
.player .tag { position: absolute; top: 12px; right: 12px; font-family: var(--font-mono); font-size: 11px; background: rgba(255,255,255,.15); color: #fff; border-radius: 6px; padding: 4px 9px; }
.player .fs { position: absolute; bottom: 12px; right: 12px; font-size: 12px; background: rgba(255,255,255,.14); color: #fff; border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; }
.review-cta { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 24px; text-align: center; margin-top: 16px; }
.review-cta strong { color: var(--color-text); }
.review-cta p { font-size: 13.5px; color: var(--color-text-muted); margin: 4px 0 0; }

/* ---------- 13. 별점 입력 (순수 CSS hover, JS 없음) ---------- */
.rating { display: inline-flex; flex-direction: row-reverse; }
.rating input { position: absolute; opacity: 0; pointer-events: none; }
.rating label { font-size: 28px; line-height: 1; color: #E2D9C8; cursor: pointer; padding: 0 1px; }
.rating label:hover,
.rating label:hover ~ label,
.rating input:checked ~ label { color: var(--color-accent); }

/* ---------- 14. 이용약관 (목차 + 본문) ---------- */
.terms { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }
.terms-toc { position: sticky; top: 24px; align-self: start; border-right: 1px solid var(--color-border-soft); padding-right: 8px; }
.terms-toc .toc-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--color-text-faint); margin-bottom: 10px; }
.terms-toc a { display: block; font-size: 13.5px; color: var(--color-text-muted); padding: 7px 0 7px 14px; text-decoration: none; }
.terms-toc a:hover { color: var(--color-text); }
.terms-toc a.on { color: var(--color-on-accent); font-weight: 700; border-left: 2px solid var(--color-accent); padding-left: 12px; }
.terms-body section { padding: 18px 0; border-bottom: 1px solid var(--color-border-soft); scroll-margin-top: 24px; }
.terms-body section:last-child { border-bottom: none; }
.terms-body h3 { font-size: 17px; font-weight: 800; color: var(--color-text); margin: 0; }
.terms-body p { margin: 8px 0 0; line-height: 1.7; color: #4A4234; font-size: 14px; }
@media (max-width: 720px) { .terms { grid-template-columns: 1fr; } .terms-toc { position: static; border-right: none; } }

/* ---------- 15. 프로필 ---------- */
.profile-head { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 22px; display: flex; align-items: center; gap: 18px; }
.avatar { width: 64px; height: 64px; border-radius: 16px; background: var(--color-accent-soft); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; color: var(--color-accent-strong); flex: 0 0 auto; }
.game-row { display: flex; align-items: center; gap: 14px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--color-border-soft); }
.game-row .meta { flex: 1; }
.game-row .meta .sub { display: block; font-size: 12.5px; color: var(--color-text-faint); margin-top: 2px; }

/* 공개/비공개 토글 (체크박스 기반, JS 없음) */
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--color-text-faint); font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 34px; height: 18px; border-radius: var(--radius-pill); background: #E2D9C8; position: relative; transition: background .15s ease; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.switch input:checked + .track { background: var(--color-ok); }
.switch input:checked + .track::after { left: 18px; }
.switch .state-on { display: none; }
.switch input:checked ~ .state-on { display: inline; color: var(--color-ok); }
.switch input:checked ~ .state-off { display: none; }

/* ---------- 16. 라이브 미리보기 (모집글 작성) ---------- */
.preview-card { position: sticky; top: 24px; align-self: start; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--color-border-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
