/* ==========================================================================
   게임 정보 사이트 스타일
   색·간격은 :root 의 변수만 바꾸면 전체 톤이 함께 바뀝니다.
   ========================================================================== */

:root {
  --bg: #0e1117;
  --bg-soft: #161b24;
  --bg-card: #1b2130;
  --line: #2a3243;
  --text: #e6e9ef;
  --text-dim: #9aa4b8;
  --text-faint: #6b7488;
  --accent: #4f8cff;
  --accent-soft: #1e3358;
  --good: #4fd18b;
  --warn: #ffb454;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, 'Segoe UI', 'Malgun Gothic', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------------------------------------------ 헤더 / 푸터 */

.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #131a26, var(--bg));
  padding: 28px 0 24px;
}

.logo {
  margin: 0;
  font-size: 26px;
  letter-spacing: 2px;
  font-weight: 800;
}
.logo span { color: var(--accent); }

.tagline {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

.site-footer {
  margin-top: 64px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ------------------------------------------------------------ 패널 공통 */

.panel {
  margin: 24px 0;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.panel-hint {
  margin-left: 8px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: #56607a;
}

.loading-text { color: var(--text-faint); font-size: 14px; }

/* ------------------------------------------------------------ 장르 칩 */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.chip .count {
  margin-left: 6px;
  font-size: 11.5px;
  opacity: .65;
}

/* ------------------------------------------------------------ 필터 */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 11.5px;
  letter-spacing: .5px;
  color: var(--text-faint);
  font-weight: 700;
}

.field select {
  appearance: none;
  min-width: 150px;
  padding: 9px 32px 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239aa4b8' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

/* ------------------------------------------------------------ 제목 검색 */

.field-search { flex: 1 1 260px; max-width: 360px; }

.search-wrap { position: relative; display: block; }

.search-wrap input {
  width: 100%;
  padding: 9px 34px 9px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='6.8' cy='6.8' r='4.8' stroke='%239aa4b8' stroke-width='1.6'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%239aa4b8' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat left 11px center;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.search-wrap input::placeholder { color: var(--text-faint); }
/* 브라우저가 기본으로 넣는 X 버튼은 우리 것과 겹치므로 숨긴다 */
.search-wrap input::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: #2f3a52;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: #c2434a; color: #fff; }

.field select:focus-visible,
.search-wrap input:focus-visible,
.chip:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.result-count {
  margin: 0 0 2px auto;
  font-size: 13px;
  color: var(--text-dim);
}
.result-count strong { color: var(--text); }

/* ------------------------------------------------------------ 포토뷰 */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .16s, border-color .16s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #3d4a63;
}

/* 이미지 영역은 라운지를 여는 버튼이다. button 기본 모양을 지운다. */
.card-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  aspect-ratio: 16 / 9;
  background: #10141d;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
}

/* 이미지에 올렸을 때 나타나는 "라운지 열기" 안내 */
.thumb-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 11, 18, .72);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  opacity: 0;
  transition: opacity .16s;
}

.card-thumb:hover .thumb-hint,
.card-thumb:focus-visible .thumb-hint { opacity: 1; }

/* 대체 화면 위에 이미지를 겹쳐 올린다. 둘 다 absolute 라서 뒤에 오는 img 가 위에 그려지고,
   이미지 로딩이 실패하면 JS 가 <img> 를 제거해 아래의 대체 화면이 드러난다. */
.card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 이미지가 없거나 로딩에 실패했을 때 보여주는 대체 화면 */
.thumb-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-faint);
  background: linear-gradient(135deg, #1a2130, #232c40);
  word-break: keep-all;
}

.card-body {
  padding: 11px 12px 13px;
}

.card-name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  /* 제목이 길어도 카드 높이가 흔들리지 않게 두 줄로 고정 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-faint);
}

.badge {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: #9dc0ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

.score { color: var(--good); font-weight: 700; }

.btn-info {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  background: rgba(10, 13, 20, .78);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background .15s;
}

.btn-info:hover { background: var(--accent); }

.empty {
  padding: 48px 0;
  text-align: center;
  color: var(--text-faint);
}

.more-wrap { text-align: center; }

.btn-more {
  margin-top: 28px;
  padding: 11px 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.btn-more:hover { border-color: var(--accent); }

/* ------------------------------------------------------------ 인포 팝업 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

/* 반드시 있어야 하는 규칙.
   HTML 의 hidden 속성은 브라우저 기본 스타일 [hidden]{display:none} 으로 동작하는데,
   위에서 .modal 에 display:grid 를 직접 지정하면 그 기본 규칙을 덮어써 버린다.
   그러면 팝업이 항상 떠 있는 상태가 되어, 반투명 배경이 화면 전체를 가리고
   페이지의 어떤 것도 클릭할 수 없게 된다. */
.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, .74);
  backdrop-filter: blur(2px);
}

.modal-box {
  position: relative;
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: rgba(10, 13, 20, .7);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: #c2434a; }

.modal-hero {
  aspect-ratio: 16 / 6.5;
  background: #10141d;
  position: relative;
}
.modal-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.modal-inner { padding: 20px 24px 26px; }

#modal-title {
  margin: 0 0 4px;
  font-size: 21px;
  line-height: 1.3;
}

.modal-sub {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 13.5px;
}

/* 정보 표 (출시일 / 개발사 / 유통사 / 장르 …) */
.info-table {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 14px;
  margin: 0 0 20px;
  font-size: 14px;
}
.info-table dt { color: var(--text-faint); font-size: 13px; }
.info-table dd { margin: 0; }

.section-block { margin-bottom: 18px; }

.section-block h4 {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: .5px;
  color: var(--accent);
  font-weight: 700;
}

.section-block p { margin: 0; font-size: 14px; color: #d3d8e2; }

.section-block ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: #d3d8e2;
}
.section-block ul li { margin-bottom: 3px; }

.pros h4 { color: var(--good); }
.cons h4 { color: #ff8f8f; }

.no-data {
  font-size: 13px;
  color: var(--text-faint);
  font-style: italic;
}

.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.link-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.link-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------- 팝업 안의 "비슷한 게임" 목록 */

.similar-block {
  margin-top: 24px;
  padding-top: 20px;
  /* 게임 정보와 추천 목록을 가르는 경계선 */
  border-top: 1px solid var(--line);
}

.similar-title {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: .5px;
  color: var(--accent);
  font-weight: 700;
}

.similar-hint {
  margin-left: 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-faint);
}

.similar-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.similar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}

.similar-item:hover {
  border-color: var(--accent);
  background: #1f2738;
}

.similar-thumb {
  flex: 0 0 64px;
  height: 36px;
  border-radius: 5px;
  overflow: hidden;
  background: #10141d;
}

.similar-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.similar-text { min-width: 0; }

.similar-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  /* 제목이 길어도 한 줄로 잘라 목록 높이를 일정하게 유지 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.similar-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-faint);
}

/* ==========================================================================
   라운지 (게임별 게시판)
   ========================================================================== */

.lounge { padding: 22px 24px 26px; }

.lounge-head { margin-bottom: 16px; }

.lounge-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.lounge-badge {
  margin-left: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: #9dc0ff;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 3px;
}

.lounge-sub {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--text-faint);
}

.lounge-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.lounge-count { font-size: 13px; color: var(--text-dim); }

.lounge-loading,
.lounge-empty {
  padding: 34px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}
.lounge-empty.small { padding: 18px 0; font-size: 13px; }

.lounge-error { padding: 24px 0; text-align: center; }
.lounge-error p:first-child { color: #ff9c9c; font-size: 14px; margin: 0 0 8px; }

.lounge-notice {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--warn);
  font-size: 13px;
}

/* ---------------------------------------------------------------- 버튼 */

.btn-primary,
.btn-ghost {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d7bf0; }
.btn-primary:disabled { opacity: .55; cursor: default; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
  font-weight: 500;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-ghost.tiny { padding: 4px 10px; font-size: 12px; }

.link-danger {
  border: none;
  background: none;
  padding: 0;
  color: #ff8f8f;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.link-danger:hover { text-decoration: underline; }

/* ------------------------------------------------------------ 글 목록 */

.post-list { list-style: none; margin: 0; padding: 0; }

.post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 4px;
  border: none;
  border-bottom: 1px solid #222a3a;
  background: none;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.post-row:hover { background: #171e2c; }

.post-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-faint);
}

.post-comments {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: #9dc0ff;
  font-weight: 700;
}

.post-author { color: var(--text-dim); }

/* ------------------------------------------------------------ 글 상세 */

.post-view { padding: 20px 0 4px; }

.post-view-title { margin: 0; font-size: 17px; line-height: 1.35; }

.post-view-meta {
  margin: 6px 0 16px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.post-view-body {
  font-size: 14px;
  line-height: 1.75;
  color: #d3d8e2;
  word-break: break-word;
}

/* ------------------------------------------------------------ 댓글 */

.comment-block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.comment-title {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: .5px;
  color: var(--accent);
}

.comment-list { list-style: none; margin: 0 0 18px; padding: 0; }

.comment {
  padding: 11px 0;
  border-bottom: 1px solid #222a3a;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.comment-author { font-size: 12.5px; font-weight: 600; }
.comment-when { font-size: 11.5px; color: var(--text-faint); }
.comment-head .link-danger { margin-left: auto; }

.comment-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: #d3d8e2;
  word-break: break-word;
}

/* ------------------------------------------------------------ 입력 폼 */

.lounge-form { margin-top: 18px; }
.comment-form { margin-top: 0; }

.form-row { display: flex; gap: 10px; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 11px;
  flex: 1 1 auto;
}

.form-field-pin { flex: 0 0 110px; }

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-faint); }

.form-field input:focus-visible,
.form-field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-hint { margin: 2px 0 10px; font-size: 12px; color: var(--text-faint); }

.form-error {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #35181c;
  border: 1px solid #5c2a30;
  color: #ff9c9c;
  font-size: 13px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 삭제할 때 그 자리에 뜨는 번호 입력칸 */
.pin-ask {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.pin-ask input {
  width: 68px;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
}

.pin-error { font-size: 11.5px; color: #ff9c9c; }

body.modal-open { overflow: hidden; }

/* ------------------------------------------------------------ 모바일 */

@media (max-width: 640px) {
  /* 장르가 28개라 좁은 화면에서는 8줄이 되어 게임 목록이 화면 밖으로 밀린다.
     3줄 정도로 높이를 묶고 그 안에서 스크롤하게 한다. */
  .chip-row {
    max-height: 118px;
    overflow-y: auto;
    padding-bottom: 2px;
    /* 아래가 잘려 있다는 걸 알려주는 페이드 */
    mask-image: linear-gradient(180deg, #000 calc(100% - 14px), transparent);
  }

  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .filters { gap: 12px; }
  .field select { min-width: 0; width: 100%; }
  .field { flex: 1 1 130px; }
  .field-search { flex-basis: 100%; max-width: none; }
  .result-count { flex-basis: 100%; margin: 0; }
  /* 좁은 화면에서는 비슷한 게임을 한 줄에 하나씩 */
  .similar-list { grid-template-columns: 1fr; }

  /* 라운지 */
  .lounge { padding: 16px 16px 22px; }
  .lounge-head h3 { font-size: 17px; }
  /* 글 목록에서 제목이 잘리지 않게 두 줄 구조로 바꾼다 */
  .post-row { flex-direction: column; align-items: flex-start; gap: 5px; }
  .post-title { white-space: normal; }
  .form-row { flex-wrap: wrap; }
  .form-field-pin { flex: 1 1 100px; }
  .modal-inner { padding: 16px 18px 22px; }
  .info-table { grid-template-columns: 70px 1fr; font-size: 13.5px; }
}
