:root {
  --brand: #2b4a9b;
  --brand-dark: #1f3878;
  --brand-light: #e8eefb;
  --bg: #f2f3f5;
  --panel: #ffffff;
  --line: #dfe2e8;
  --text: #222;
  --muted: #888;
  --danger: #d64545;
  --ok: #2e9d5b;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ── 헤더 ── */
.top { background: var(--brand); color: #fff; }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.logo span { color: #ffd84d; }
.search { flex: 1; max-width: 420px; display: flex; }
.search input {
  flex: 1; min-width: 0; height: 34px; border: 0; border-radius: 3px 0 0 3px; padding: 0 10px;
}
.search button { height: 34px; border: 0; padding: 0 14px; background: var(--brand-dark); color: #fff; border-radius: 0 3px 3px 0; }
.top-user { margin-left: auto; display: flex; gap: 12px; font-size: 13px; white-space: nowrap; }
.top-user a:hover { text-decoration: underline; }
.top-user .admin { color: #ffd84d; font-weight: 700; }

.gnb { background: var(--brand-dark); }
.gnb .wrap { display: flex; overflow-x: auto; scrollbar-width: none; }
.gnb .wrap::-webkit-scrollbar { display: none; }
.gnb a { color: #dce4f7; padding: 10px 16px; white-space: nowrap; font-weight: 600; }
.gnb a:hover, .gnb a.on { color: #fff; background: rgba(255, 255, 255, .1); }

/* ── 본문 ── */
.layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; padding: 16px 0 40px; }
.panel { background: var(--panel); border: 1px solid var(--line); margin-bottom: 16px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 2px solid var(--brand); font-weight: 700;
}
.panel-head a { font-size: 12px; font-weight: 400; color: var(--muted); }
.panel-body { padding: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid #f0f1f4; }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.game-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.game-card { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #fafbfc; }
.game-card .thumb {
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  background: var(--brand-light); color: var(--brand); font-weight: 700;
}
.game-card .name { padding: 6px 8px; font-size: 13px; }
.game-card .stars { padding: 0 8px 8px; color: #f5a623; font-size: 12px; }

/* 사이드 로그인 박스 */
.login-box .panel-body { display: flex; flex-direction: column; gap: 8px; }
.login-box .hello { font-weight: 700; }
.login-box .links { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ── 폼 ── */
.form-page { max-width: 420px; margin: 40px auto; }
.form-page h1 { font-size: 20px; margin: 0 0 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .row { display: flex; gap: 6px; }
input[type=text], input[type=password], input[type=email] {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 3px; padding: 0 10px; font: inherit;
}
input:focus { outline: 2px solid var(--brand-light); border-color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--danger); }
.btn { height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 3px; padding: 0 14px; white-space: nowrap; }
.btn-primary { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--brand-dark); }
.form-error { color: var(--danger); min-height: 20px; margin-bottom: 8px; }
.form-foot { text-align: center; margin-top: 14px; color: var(--muted); }
.form-foot a { color: var(--brand); font-weight: 600; }

.footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: 12px; text-align: center; }
.top-user .nick em { font-style: normal; color: #ffd84d; font-size: 12px; }
.page { padding: 16px 0 40px; }

/* 공통 버튼 */
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-blue { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-blue:hover { background: var(--brand-dark); }
.btn-red { color: var(--danger); }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }

/* ── 게시판 목록 ── */
.board-table { width: 100%; border-collapse: collapse; }
.board-table th { background: #f7f8fa; font-weight: 600; color: #555; padding: 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.board-table td { padding: 9px 8px; border-bottom: 1px solid #f0f1f4; text-align: center; color: #666; font-size: 13px; }
.board-table td.subject { text-align: left; color: var(--text); font-size: 14px; }
.board-table td.subject a:hover { text-decoration: underline; }
.board-table tr.notice td { background: #fbfcff; }
.board-table .cmt { color: var(--danger); font-size: 12px; margin-left: 4px; font-weight: 600; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 3px; background: var(--brand-light); color: var(--brand); font-weight: 700; margin-right: 4px; }
.badge.notice { background: var(--brand); color: #fff; }
.m-meta { display: none; }
.pager { display: flex; justify-content: center; gap: 4px; padding: 14px; }
.pager a { min-width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; }
.pager a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.board-search { display: flex; gap: 6px; justify-content: center; padding: 0 14px 16px; }
.board-search select, .board-search input { height: 32px; border: 1px solid var(--line); border-radius: 3px; padding: 0 8px; font: inherit; }
.board-search input { width: 220px; }

/* ── 글 보기 ── */
.post-head { padding: 16px; border-bottom: 1px solid var(--line); }
.post-head h1 { font-size: 20px; margin: 0 0 8px; word-break: break-all; }
.post-head .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.post-body { padding: 20px 16px; min-height: 160px; font-size: 15px; line-height: 1.75; word-break: break-all; }
.post-body a { color: var(--brand); text-decoration: underline; }
.like-box { text-align: center; padding: 10px 0 20px; }
.like-btn { border: 2px solid var(--brand); color: var(--brand); background: #fff; border-radius: 30px; padding: 8px 22px; font-weight: 700; }
.like-btn.on { background: var(--brand); color: #fff; }

/* 논쟁 찬반 */
.debate { margin: 0 16px 20px; border: 1px solid var(--line); border-radius: 6px; padding: 14px; background: #fafbfd; }
.debate-title { font-weight: 700; margin-bottom: 10px; text-align: center; }
.debate-bar { display: flex; height: 28px; border-radius: 14px; overflow: hidden; background: #e9ebf0; font-size: 12px; font-weight: 700; color: #fff; }
.debate-bar .pro { background: #3b6fe0; display: flex; align-items: center; padding-left: 10px; transition: width .3s; }
.debate-bar .con { background: #e0533b; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; transition: width .3s; }
.debate-btns { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.debate-btns button { flex: 1; max-width: 180px; height: 40px; border-radius: 4px; border: 2px solid; background: #fff; font-weight: 700; }
.debate-btns .pro { border-color: #3b6fe0; color: #3b6fe0; }
.debate-btns .con { border-color: #e0533b; color: #e0533b; }
.debate-btns .pro.on { background: #3b6fe0; color: #fff; }
.debate-btns .con.on { background: #e0533b; color: #fff; }
.side-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; color: #fff; margin-right: 4px; }
.side-tag.pro { background: #3b6fe0; }
.side-tag.con { background: #e0533b; }

/* 댓글 */
.comments .c-item { padding: 10px 16px; border-bottom: 1px solid #f0f1f4; }
.comments .c-item.pro { border-left: 3px solid #3b6fe0; }
.comments .c-item.con { border-left: 3px solid #e0533b; }
.comments .c-head { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 4px; }
.comments .c-head b { font-weight: 700; }
.comments .c-head .meta { color: var(--muted); font-size: 12px; }
.comments .c-head .del { margin-left: auto; color: var(--muted); font-size: 12px; cursor: pointer; }
.comments .c-body { word-break: break-all; }
.comments .c-deleted { color: var(--muted); font-size: 13px; }
.c-form { padding: 14px 16px; background: #f7f8fa; }
.c-form .sides { display: flex; gap: 12px; margin-bottom: 6px; font-size: 13px; }
.c-form .row { display: flex; gap: 6px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; font: inherit; resize: vertical; }
.c-form textarea { height: 64px; }
.c-form .btn { height: 64px; }

/* 글쓰기 */
.write-form { padding: 16px; }
.write-form textarea { height: 360px; }
.write-form .opts { display: flex; gap: 12px; margin-bottom: 10px; font-size: 13px; }

/* ── 출석 ── */
.att-top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.att-stat { display: flex; gap: 10px; }
.att-stat div { flex: 1; text-align: center; padding: 12px 0; background: #f7f8fa; border-radius: 4px; }
.att-stat b { display: block; font-size: 22px; color: var(--brand); }
.att-stat span { font-size: 12px; color: var(--muted); }
.att-form { display: flex; gap: 6px; margin-top: 12px; }
.att-form .btn { flex: none; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal td { height: 42px; text-align: center; vertical-align: middle; border: 1px solid #f0f1f4; font-size: 13px; }
.cal td.done { background: var(--brand-light); color: var(--brand); font-weight: 700; }
.cal td.done::after { content: "✔"; display: block; font-size: 11px; }
.cal td.today { outline: 2px solid var(--brand); outline-offset: -2px; }
.cal-nav { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 8px; font-weight: 700; }
.cal-nav button { border: 1px solid var(--line); background: #fff; width: 28px; height: 28px; }

/* ── 게임 ── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 3px; font-size: 13px; cursor: pointer; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.game-cards a.game-card:hover { border-color: var(--brand); }
.game-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-card .type { font-size: 11px; color: var(--muted); padding: 0 8px; }
.game-card .stars small { color: var(--muted); }
.game-detail { display: grid; grid-template-columns: 320px 1fr; gap: 20px; padding: 16px; }
.game-detail .thumb { aspect-ratio: 4 / 3; background: var(--brand-light); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; border-radius: 4px; overflow: hidden; }
.game-detail .thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-detail h1 { margin: 0 0 6px; font-size: 22px; }
.game-detail .score { font-size: 28px; font-weight: 800; color: #f5a623; }
.game-detail .score small { font-size: 14px; color: var(--muted); font-weight: 400; }
.dist { margin: 10px 0 14px; }
.dist div { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dist .bar { flex: 1; height: 8px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.dist .bar i { display: block; height: 100%; background: #f5a623; }
.play-btn { height: 46px; padding: 0 28px; font-size: 16px; }
.game-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; display: block; }
.star-input { font-size: 28px; color: #ddd; cursor: pointer; user-select: none; }
.star-input span.on { color: #f5a623; }
.rating-form { padding: 14px 16px; background: #f7f8fa; border-bottom: 1px solid var(--line); }
.rating-form textarea { height: 60px; margin: 6px 0; }
.rank-table td.num { font-weight: 800; color: var(--brand); }

/* ── 관리자 ── */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--brand); margin-bottom: 16px; overflow-x: auto; }
.admin-tabs a { padding: 10px 18px; cursor: pointer; font-weight: 600; color: #666; white-space: nowrap; }
.admin-tabs a.on { background: var(--brand); color: #fff; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-cards div { background: var(--panel); border: 1px solid var(--line); padding: 14px; }
.stat-cards b { display: block; font-size: 24px; color: var(--brand); }
.stat-cards span { color: var(--muted); font-size: 12px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { background: #f7f8fa; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-table td { padding: 7px 6px; border-bottom: 1px solid #f0f1f4; text-align: center; }
.adm-table td.l { text-align: left; }
.adm-table tr.off td { color: #bbb; }
.adm-table select, .adm-table input { height: 28px; border: 1px solid var(--line); font: inherit; font-size: 12px; }
.adm-scroll { overflow-x: auto; }
.game-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; }
.game-form .full { grid-column: 1 / -1; }
.game-form label { display: block; font-size: 12px; color: #666; margin-bottom: 2px; }
.game-form input, .game-form select { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 3px; padding: 0 8px; font: inherit; }
.admin-only { display: none; }
body.is-admin .admin-only { display: revert; }

/* 토스트 */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); background: rgba(20, 25, 40, .92); color: #fff; padding: 10px 18px; border-radius: 20px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 모바일 ── */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { order: -1; }
  .grid2 { grid-template-columns: 1fr; }
  .game-cards { grid-template-columns: repeat(2, 1fr); }
  .search { display: none; }
  .form-page { margin: 20px auto; }
  .top-user .nick em { display: none; }

  /* 게시판: 표 → 리스트 */
  .board-table thead, .board-table td:not(.subject) { display: none; }
  .board-table td.subject { display: block; padding: 10px 12px; }
  .m-meta { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
  .board-search input { width: 100%; }

  .att-top { grid-template-columns: 1fr; }
  .game-detail { grid-template-columns: 1fr; }
  .game-form { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
