@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #efeae0;
  --ink: #1c1a17;
  --ink-2: #5d574d;
  --ink-3: #6f685d;          /* 배경 대비 4.5:1 이상 */
  --line: #e2dccf;
  --accent: #ff5a36;         /* 큰 글씨·버튼 배경용 */
  --accent-text: #c23a1a;    /* 작은 글씨용 진한 주황 */
  --accent-ink: #ffffff;
  --accent-soft: #ffe4dc;
  /* 자동 표지: 게임마다 --h(색상)만 바뀐다 */
  --cover-s: 80%;
  --cover-l: 84%;
  --cover-ink-l: 22%;
  --cover-dot: rgba(255, 255, 255, .45);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(28, 26, 23, .06), 0 8px 24px rgba(28, 26, 23, .06);
  --max: 1120px;
  color-scheme: light;
}

/* 다크 모드 = 다크 아케이드 시안 (어두운 배경 + 라임 포인트) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #1a1d24;
    --surface-2: #232731;
    --ink: #e9ecf1;
    --ink-2: #b8c0cc;
    --ink-3: #8a93a3;
    --line: #262a33;
    --accent: #c6ff3d;
    --accent-text: #c6ff3d;
    --accent-ink: #0f1115;
    --accent-soft: rgba(198, 255, 61, .12);
    --cover-s: 45%;
    --cover-l: 30%;
    --cover-ink-l: 92%;
    --cover-dot: rgba(255, 255, 255, .10);
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  /* 줄내림 규칙: 한국어는 어절(띄어쓰기) 단위로만 줄을 바꾼다 */
  word-break: keep-all;
  overflow-wrap: break-word; /* 화면보다 긴 단어·URL만 예외로 끊는다 */
  line-break: strict;        /* 닫는 괄호·문장부호가 줄 맨 앞에 오지 않게 */
}

/* 제목·짧은 문구는 줄 길이를 고르게 맞춰 한 단어만 덩그러니 남지 않게 */
h1, h2, h3, .lead, .card-title, .card-tagline, .cover-text, .hero p, .section-head h2, .soon, .empty, .play-note {
  text-wrap: balance;
}

/* 본문 문단은 마지막 줄에 한 어절만 남는 것을 피한다 */
p, li, td, .desc {
  text-wrap: pretty;
}

/* 버튼·태그·배지·메뉴는 절대 두 줄로 나누지 않는다 */
.btn, .tag, .badge, .nav a, .logo, .filter-label, .section-head a {
  white-space: nowrap;
}

/* 붙어 있어야 읽히는 묶음(예: "15종", "3일 안에")은 <span class="nobr">으로 감싼다 */
.nobr { white-space: nowrap; }

a { color: inherit; }

img { max-width: 100%; display: block; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.logo-mark { font-weight: 900; font-size: 20px; letter-spacing: -.02em; }
.logo-mark b { color: var(--accent); }
/* 제목 속 "시뮬잇"의 "잇"을 로고의 IT와 같은 색으로 */
.brand-it { color: var(--accent); font-weight: inherit; }
.logo-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink-2);
  padding: 8px 12px; border-radius: 10px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 32px; }
.hero h1 {
  font-size: clamp(30px, 6vw, 52px); line-height: 1.15; letter-spacing: -.035em;
  margin: 0 0 14px; font-weight: 850;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; font-size: 18px; color: var(--ink-2); max-width: 560px; }

.search {
  margin-top: 28px; display: flex; gap: 8px; max-width: 560px;
}
.search input {
  flex: 1; min-width: 0; height: 52px; padding: 0 18px; font: inherit; font-size: 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 14px; border: 0;
  font: inherit; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
  background: var(--ink); color: var(--bg);
}
.btn:hover { opacity: .9; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--ink); }

/* ---------- tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.tag:hover { border-color: var(--ink-3); color: var(--ink); }
.tag[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tag-sm { height: 26px; padding: 0 10px; font-size: 12.5px; }

/* ---------- sections ---------- */
.section { padding: 28px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.section-head a { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.section-head a:hover { color: var(--ink); }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

.card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.card-tagline { margin: 0; font-size: 14px; color: var(--ink-2); }
.card-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }

/* 자동 표지(대표 태그). 대표 이미지가 있으면 그 위를 덮는다 */
.cover {
  position: relative; aspect-ratio: 1200 / 630; overflow: hidden;
  background: hsl(var(--h, 20) var(--cover-s) var(--cover-l));
  color: hsl(var(--h, 20) 55% var(--cover-ink-l));
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 16px;
}
/* 대표 이미지(공유용 1200×630)를 태그 표지 위에 덮는다. 못 불러오면 지워져 태그 표지가 보인다 */
.cover img { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; }
.cover::before {
  content: ""; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%;
  background: var(--cover-dot);
}
.cover:has(img)::before { display: none; }
.cover-kicker { position: relative; z-index: 1; font-size: 13px; font-weight: 600; opacity: .85; }
.cover-text {
  position: relative; z-index: 1; font-weight: 850; letter-spacing: -.035em; line-height: 1.2;
  font-size: clamp(21px, 2.4vw, 26px);
}

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 8px;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2);
}
.badge-own { background: var(--accent-soft); color: var(--accent-text); }
.card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 한 줄 목록 (찾기 페이지) ---------- */
.list { display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 12px; min-height: 76px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: inherit;
}
.row:hover { border-color: var(--ink-3); }
.row-rank {
  flex: none; width: 28px; text-align: center;
  font-size: 24px; font-weight: 850; letter-spacing: -.04em; color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.section-note { font-size: 13px; color: var(--ink-3); }
.row-thumb {
  flex: none; width: 52px; height: 52px; border-radius: 12px; overflow: hidden;
  background: hsl(var(--h, 20) var(--cover-s) var(--cover-l));
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title { margin: 0; font-size: 16px; font-weight: 750; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { margin: 0; font-size: 14px; color: var(--ink-2); }
.row-tags { margin: 0; font-size: 13px; color: var(--ink-3); }
.row-side { flex: none; font-size: 13px; font-weight: 700; color: var(--accent-text); white-space: nowrap; }

/* ---------- empty / coming soon ---------- */
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 28px 20px;
  color: var(--ink-3); text-align: center; font-size: 15px;
}
.soon {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px; color: var(--ink-3); min-height: 200px;
}
.soon strong { color: var(--ink); font-size: 16px; }
.soon a {
  display: inline-flex; align-items: center; min-height: 44px; align-self: flex-start;
  color: var(--ink); font-weight: 700; text-underline-offset: 3px;
}

/* ---------- browse ---------- */
.filters { display: grid; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filter-label { font-size: 13px; font-weight: 700; color: var(--ink-3); min-width: 56px; }
.result-count { color: var(--ink-3); font-size: 14px; margin: 18px 0 12px; }

/* ---------- game detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; padding: 40px 0 16px; align-items: start; }
.detail-cover { margin: 0; }
.cover-credit { margin: 8px 2px 0; font-size: 13px; color: var(--ink-3); word-break: keep-all; overflow-wrap: anywhere; }
.detail .cover { border-radius: var(--radius); box-shadow: var(--shadow); }
.detail .cover { padding: 24px; }
.detail .cover-kicker { font-size: 15px; }
.detail .cover-text { font-size: clamp(28px, 3.6vw, 40px); }
.detail h1 { margin: 6px 0 4px; font-size: clamp(30px, 4.5vw, 42px); letter-spacing: -.035em; line-height: 1.2; }
.detail .lead { margin: 0 0 18px; font-size: 18px; color: var(--ink-2); }
.author { margin: 0 0 16px; font-size: 14px; color: var(--ink-2); }
.author strong { color: var(--ink); font-weight: 700; margin: 0 8px 0 4px; }
.desc { margin: 18px 0 22px; color: var(--ink); }
.play-note { font-size: 13px; color: var(--ink-3); margin: 10px 0 0; }
.report { font-size: 13px; color: var(--ink-3); margin-top: 18px; }
.report a { color: var(--ink-2); }

/* ---------- prose pages ---------- */
.prose { max-width: 720px; padding: 40px 0 24px; }
.prose h1 { font-size: 34px; letter-spacing: -.03em; margin: 0 0 8px; }
.prose h2 { font-size: 20px; margin: 32px 0 8px; letter-spacing: -.02em; }
.prose p, .prose li { color: var(--ink-2); }
.prose .meta { color: var(--ink-3); font-size: 14px; margin: 0 0 24px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
.prose th { color: var(--ink); width: 34%; }
.notice {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; color: var(--ink-2);
}

/* ---------- footer ---------- */
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-3); font-size: 14px; }
.site-footer .wrap { display: grid; gap: 10px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-links a { text-decoration: none; color: var(--ink-2); font-weight: 600; }
.foot-links a:hover { color: var(--ink); }
.site-footer p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 태블릿까지는 게임 소개를 한 칸으로 */
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; gap: 22px; padding-top: 20px; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .site-header .wrap { gap: 12px; }
  .logo-sub { display: none; }
  .hero { padding: 36px 0 20px; }
  .hero p { font-size: 16px; }
  .detail .btn { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  /* 손가락으로 누르는 요소는 44px 이상 */
  .logo { min-height: 44px; align-items: center; }
  .nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 10px; font-size: 14px; }
  .tag { height: 44px; padding: 0 16px; }
  .tag-sm { height: 36px; }
  a.tag-sm { height: 44px; }
  .section-head a { min-height: 44px; display: inline-flex; align-items: center; }
  .row-side { display: none; }
}

/* 메뉴에서 목차로 이동할 때 고정된 헤더에 제목이 가리지 않게 */
section[id] { scroll-margin-top: 80px; }

/* 장르 태그 설명 (찾기 화면) */
.tag-info { margin: 18px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 15px; line-height: 1.6; text-wrap: pretty; }
.tag-info strong { color: var(--accent-text); margin-right: 4px; white-space: nowrap; }


/* 광고: "광고" 표시를 붙이고, 게임 버튼과 떨어진 자리에만 둔다 */
.ad { margin: 32px 0 8px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.ad-label { display: block; margin-bottom: 8px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
