/* 웹 공지 뷰어 — 게임 웹뷰 전용 (세로·가로 모두). 색은 토큰으로만: 게임 톤에 맞출 일이 생기면 :root 만 고친다 */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1b1d22;
  --muted: #6b7280;
  --line: #e4e6eb;
  --accent: #2f6fed;
  --new: #e5484d;
  --code-bg: #eef0f3;
  color-scheme: light;
}

/* 다크: 기기 설정을 따르되 ?theme=light|dark 로 강제 가능 (notice.js 가 data-theme 부착) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c;
    --surface: #1e2128;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --line: #2c3039;
    --accent: #6b9bff;
    --new: #ff6b6e;
    --code-bg: #2a2e37;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171c;
  --surface: #1e2128;
  --text: #e8eaee;
  --muted: #9aa1ad;
  --line: #2c3039;
  --accent: #6b9bff;
  --new: #ff6b6e;
  --code-bg: #2a2e37;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display 를 지정한 클래스(.back 등)가 hidden 속성을 이기지 않게 */

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 상단 바 — 노치 영역 회피 */
.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: -10px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.back:active { background: var(--line); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 max(0px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(0px, env(safe-area-inset-left));
}

/* 목록 */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.list a:active { background: var(--line); }
.list .title {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.pin {
  flex: none;
  display: inline-flex;
  margin-top: 3px;
  color: var(--accent);
}
.badge {
  flex: none;
  margin-top: 2px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--new);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}
.date {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* 목록 한 칸 = 글자(제목·요약·날짜) + 오른쪽 썸네일 */
.item-text {
  flex: 1;
  min-width: 0;
}
.summary {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;   /* 요약은 2줄까지 — 넘치면 … */
  -webkit-box-orient: vertical;
}
.thumb {
  flex: none;
  width: 96px;
  height: 54px;   /* 16:9 */
  border-radius: 6px;
  object-fit: cover;
  background: var(--code-bg);
}

/* 상세 */
.detail {
  padding: 20px 16px 32px;
  background: var(--surface);
  min-height: calc(100vh - 52px);
}
.detail-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.detail .date {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

/* 본문 — 서버가 마크다운에서 변환한 HTML */
.body { word-break: keep-all; overflow-wrap: anywhere; }
.body > :first-child { margin-top: 0; }
.body p, .body ul, .body ol, .body blockquote, .body pre, .body table { margin: 0 0 14px; }
.body h1, .body h2, .body h3, .body h4 { margin: 22px 0 10px; line-height: 1.4; }
.body h1 { font-size: 20px; }
.body h2 { font-size: 18px; }
.body h3, .body h4 { font-size: 16px; }
.body ul, .body ol { padding-left: 22px; }
.body li + li { margin-top: 4px; }
.body a { color: var(--accent); }
.body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px auto;
  border-radius: 8px;
}
.body blockquote {
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--code-bg);
  border-radius: 0 8px 8px 0;
}
.body blockquote > :last-child { margin-bottom: 0; }
.body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: 0.92em;
}
.body pre { padding: 12px; overflow-x: auto; background: var(--code-bg); border-radius: 8px; }
.body pre code { padding: 0; background: none; }
.body hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
}
.body th, .body td { padding: 6px 10px; border: 1px solid var(--line); }
.body th { background: var(--code-bg); }

/* 빈 목록·오류 */
.state {
  padding: 64px 16px;
  text-align: center;
  color: var(--muted);
}
.state p { margin: 0 0 16px; }
.retry {
  padding: 8px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
