:root {
  --accent: #408cff;
  --accent-hover: #2f7af0;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e4e6eb;
  --text: #1e2128;
  --dim: #6e7480;
  --ok: #2fb866;
  --bad: #e5484d;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191d;
    --card: #222429;
    --line: #33363d;
    --text: #e8ebf0;
    --dim: #969ca8;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* 위 막대 */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; white-space: nowrap; }
.logo-box { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); position: relative; }
.logo-box::after { content: ""; position: absolute; inset: 7px; border-radius: 2px; background: #fff; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--dim); white-space: nowrap; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.on { color: var(--accent); font-weight: 700; }
.me { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.me .name { font-weight: 700; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--dim); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.big { padding: 14px 28px; font-size: 17px; border-radius: 12px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }

/* 첫 화면 */
.hero {
  margin: 28px 0; padding: 40px 32px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #408cff 0%, #6a5cff 60%, #a259ff 100%);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.hero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.25; }
.hero p { margin: 0; opacity: .9; font-size: 16px; }
.hero .btn { background: #fff; color: #3a3fd0; border-color: #fff; }
.hero .btn:hover { background: #eef1ff; }

h2 { font-size: 20px; margin: 28px 0 14px; }
.muted { color: var(--dim); }
.empty { color: var(--dim); padding: 40px 0; text-align: center; }

/* 게임 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.thumb { aspect-ratio: 16 / 9; background: #ccd; position: relative; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .letter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 700; color: rgba(255,255,255,.92); }
.card-body { padding: 10px 12px 12px; }
.card-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 13px; color: var(--dim); display: flex; justify-content: space-between; gap: 8px; }
.live { color: var(--ok); font-weight: 600; }
.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: 1px; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 6px; background: var(--bg); color: var(--dim); border: 1px solid var(--line); }

/* 게임 페이지 */
.game { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; margin-top: 28px; }
.game .thumb { border-radius: 16px; }
.game h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.25; word-break: break-all; }
.stats { display: flex; gap: 24px; margin: 16px 0; }
.stats b { display: block; font-size: 20px; }
.stats span { font-size: 13px; color: var(--dim); }
.desc { white-space: pre-wrap; word-break: break-word; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 18px; }
.play { width: 100%; margin-top: 8px; }
.servers { margin-top: 18px; }
.server { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.server .who { font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; width: 120px; }
.bar i { display: block; height: 100%; background: var(--accent); }

/* 폼 */
.form { max-width: 380px; margin: 48px auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.form h1 { margin: 0 0 18px; font-size: 22px; }
.form label { display: block; font-size: 13px; color: var(--dim); margin: 12px 0 4px; }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form .btn { width: 100%; margin-top: 18px; }
.form .alt { margin-top: 14px; text-align: center; font-size: 14px; color: var(--dim); }
.form .alt a { color: var(--accent); font-weight: 600; }
.err { color: var(--bad); font-size: 14px; margin-top: 10px; min-height: 1em; }

/* 친구 */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex: none; position: relative; overflow: hidden; }
/* 아바타 전신 그림의 윗부분(머리)만 동그랗게 */
.avatar img { position: absolute; inset: 0; width: 100%; height: 250%; object-fit: cover; object-position: 50% 0; background: #e6e3dc; }
.ulink:hover { color: var(--accent); }
.me .name:hover { color: var(--accent); }
.owner { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.owner .avatar { width: 40px; height: 40px; }
.owner .ulink { font-weight: 700; }
.search { margin: 4px 0 6px; }
.search input { max-width: 420px; }
/* 프로필 */
.profile { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; margin-top: 28px; align-items: start; }
.profile-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; text-align: center; }
.profile-card h1 { margin: 12px 0 0; font-size: 24px; word-break: break-all; }
.fullbody { display: block; width: 100%; aspect-ratio: 0.72; object-fit: contain; border-radius: 12px; background: linear-gradient(180deg, #dfe9f7, #efeae1); }
.fullbody.none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; padding: 16px; }
.fullbody.none span { font-size: 72px; font-weight: 700; }
.fullbody.none small { font-size: 13px; opacity: .9; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; margin-right: 6px; }
.dot.on { background: var(--ok); }
.add { display: flex; gap: 8px; margin-bottom: 16px; }
.add input { flex: 1; }

/* 다운로드 */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step b { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; align-items: center; justify-content: center; margin-bottom: 8px; }

/* 알림 창 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 16px; padding: 24px; max-width: 420px; width: 100%; }
.modal-box h3 { margin: 0 0 8px; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.foot { display: flex; justify-content: space-between; color: var(--dim); font-size: 13px; padding-top: 40px; padding-bottom: 28px; }

@media (max-width: 760px) {
  .game { grid-template-columns: 1fr; }
  .profile { grid-template-columns: 1fr; }
  .profile-card { max-width: 340px; margin: 0 auto; width: 100%; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 24px; }
  .top-in { gap: 10px; }
  .logo { font-size: 0; gap: 0; }
  .nav a { padding: 8px; }
  .me .name { display: none; }
}

/* 만들기 (제작 문서) */
.tabs { display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); margin: 8px 0 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .btn { margin-left: auto; }
.docs { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; max-height: calc(100vh - 96px); overflow-y: auto; }
.toc a { padding: 6px 10px; border-radius: 8px; color: var(--dim); }
.toc a:hover { background: var(--card); color: var(--text); }
.md { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 28px 28px; line-height: 1.7; min-width: 0; }
.md h1 { font-size: 26px; margin: 20px 0 8px; }
.md h2 { font-size: 21px; margin: 32px 0 10px; padding-top: 8px; scroll-margin-top: 76px; }
.md h3 { font-size: 17px; margin: 22px 0 6px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.md code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-family: Consolas, "D2Coding", monospace; font-size: 13.5px; }
.md pre { background: #1b1d23; color: #e6e8ee; border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 13.5px; line-height: 1.55; }
.md blockquote { margin: 12px 0; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; }
.md ul, .md ol { padding-left: 22px; }
.md li.sub { margin-left: 18px; list-style: circle; }
.md .tbl { overflow-x: auto; }
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--bg); }
.md a { color: var(--accent); }
@media (max-width: 760px) {
  .docs { grid-template-columns: 1fr; }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .md { padding: 4px 16px 20px; }
}

/* 찾기 */
.topsearch { flex: 0 1 220px; }
.topsearch input { padding: 7px 12px; border-radius: 999px; font-size: 14px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.person { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: center; transition: transform .12s; }
.person:hover { transform: translateY(-2px); }
.pbody { aspect-ratio: 0.72; background: linear-gradient(180deg, #dfe9f7, #efeae1); display: flex; align-items: center; justify-content: center; }
.pbody img { width: 100%; height: 100%; object-fit: contain; }
.pbody span { width: 64px; height: 64px; border-radius: 50%; color: #fff; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pname { padding: 8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .topsearch { order: 5; flex: 1 1 100%; }
  .topsearch input { padding: 6px 12px; }
}

/* 게임 사진 */
.hero-shot { flex-wrap: nowrap; }
.hero-shot .shot { width: 46%; max-width: 520px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); transform: rotate(1.5deg); }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.shots figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.shots img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.shots figcaption { padding: 10px 12px; font-size: 14px; color: var(--dim); }
@media (max-width: 760px) {
  .hero-shot { flex-wrap: wrap; }
  .hero-shot .shot { width: 100%; transform: none; }
}
