/* =========================================================
   THE MAZE — 로그인 / 회원가입
   이미지 에셋 (assets/ 폴더에 넣으면 자동 적용, 없으면 CSS 대체색 사용)
   - bg-main.jpg      : UI 없는 메인 배경 (PC용, 가로)
   - bg-main-m.jpg    : 모바일 세로 크롭 (선택)
   - btn-stone.jpg    : 돌 질감 버튼 텍스처
   - panel-stone.jpg  : 회원가입 패널 텍스처
   ========================================================= */

:root {
  /* v177: 아이콘 크기 4단계 — 아이콘(선 · 그림)은 이 넷 중 하나만 씀 */
  --ico-sm: 16px;  /* 글줄 안 · 작은 버튼(닫기 X · 타이머 · 탭 안) */
  --ico-md: 20px;  /* 일반 버튼 · 목록 · 게이지 · 입력칸 */
  --ico-lg: 24px;  /* 위 줄 · 아래 메뉴 · 머리 아이콘 */
  --ico-xl: 32px;  /* 안내 팝업 · 카드 대표 아이콘 */
  /* v182 · v184: 올린 아이콘 그림(assets/ui/icon/*.svg 선 아이콘) — 선 굵기(파일 칸 24 기준, 화면에 보이는 굵기)와 크기 비율 */
  --ico-line: 1.25;
  --ico-scale: .88;   /* 칸 안에서 88% 크기로 가운데 (1 = 칸 꽉 채움) */
  /* v177: 버튼 크기 3단계 — 높이는 이 셋만, 창 · 팝업의 주 버튼은 글자 길이 + 최소 너비(가로로 늘이지 않음) */
  --btn-h-sm: 36px;  /* 목록 · 줄 안의 작은 버튼 */
  --btn-h: 46px;     /* 기본 (입력칸 높이와 같음) */
  --btn-h-lg: 52px;  /* 큰 주 버튼 (로그인 · 카드 · 가방 상세) */
  --btn-w: 140px;    /* 창 · 팝업 바닥 버튼 최소 너비 */

  color-scheme: dark;

  /* 색 */
  --ink: #e9e6df;          /* 기본 글자 */
  --ink-dim: #a29f98;      /* 보조 글자 */
  --ink-faint: #6f6c66;    /* 힌트, 영문 장식 */
  --line: rgba(var(--ink-rgb), .16);
  --line-strong: rgba(var(--ink-rgb), .5);
  --panel: rgba(var(--bg-1-rgb), .7);
  --field: rgba(var(--bg-0-rgb), .5);
  --danger: var(--red-light);
  --ok: var(--green-light);

  /* ---------- 디자인 토큰 (색 · 글자) — 여기 값만 바꾸면 게임 전체가 같이 바뀝니다 ---------- */
  /* 글자색 단계: 가장 밝은 → 가장 흐린 */
  --ink-hi: #f2efe8;   --ink-hi-rgb: 242,239,232;   --ink-rgb: 233,230,223;

  /* 브랜드 붉은색 (= 메드잭) */
  --red: #c0544a;        --red-rgb: 192,84,74;
  --red-deep: #8a2e25;   --red-deep-rgb: 138,46,37;
  --red-light: #d98b7f;  --red-light-rgb: 217,139,127;

  /* 포지션 대표색 — DB positions.accent 와 같은 값. 게임 안의 같은 계열 색은 모두 여기서 나옵니다 */
  --pos-runner: var(--gold-light); --pos-runner-rgb: var(--gold-light-rgb);     /* 러너 · 노랑 (금색 계열 전부) */
  --pos-builder: var(--teal-light); --pos-builder-rgb: var(--teal-light-rgb);    /* 빌더 · 청록 (공사 계열) */
  --pos-medjack: var(--red); --pos-medjack-rgb: var(--red-rgb);    /* 메드잭 · 붉은색 (브랜드색) */
  --pos-harvester: var(--green-light); --pos-harvester-rgb: var(--green-light-rgb);  /* 하베스터 · 초록 (식량 · 성공 계열) */
  --pos-slicer: var(--violet); --pos-slicer-rgb: var(--violet-rgb);     /* 슬라이서 · 회청 (집회 계열) */

  --gold: var(--pos-runner);  --gold-rgb: 201,162,74;
  --gold-light: #dfc792;      --gold-light-rgb: 223,199,146;
/* 종이 위 금색 글씨 */
  --teal: var(--pos-builder); --teal-rgb: 74,163,163;
  --teal-light: #92c8c8;
  --green: var(--pos-harvester); --green-rgb: 127,159,95;
  --green-light: #b2c59f;     --green-light-rgb: 178,197,159;
  --violet: var(--pos-slicer); --violet-rgb: 139,147,173;
/* 정신력 게이지 */
/* 짝 · 관계 */

  /* 도감 · 편지 종이 위 글씨 */
  --paper-ink: #2b231a;  --paper-ink-rgb: 43,35,26;
  --paper-ink-2: #4a3d2c;

  /* ============ 글자 체계 (v166 · 게임 · 홈페이지 같은 값) ============
     글자 크기는 아래 이름으로만 씁니다. px · em 숫자를 직접 쓰지 않습니다.
     ① 제목      --fs-title     화면 · 창(모달)의 가장 큰 제목
     ② 부제목    --fs-subtitle  창 안 소제목 · 사건 제목 · 상세 이름
     ③ 항목 제목 --fs-item      카드 · 목록 한 줄의 이름
     ④ 본문      --fs-body      기본 글 · 판 · 편지 · 설명 본문
     ⑤ 서브 텍스트 --fs-sub     안내 · 보조 설명 · 작은 버튼 · 탭
     ⑥ 주의사항  --fs-note      주의 · 캡션 · 날짜 · 영문 머리말
     기능용(글 역할 아님): --fs-input 입력칸 · 큰 버튼(16px 미만이면 아이폰 확대) · --fs-badge 숫자 뱃지 · --fs-display 큰 숫자 · 시계
     휴대폰(760px 이하)은 제목 · 부제목만 한 단계 작아집니다. */
  --fs-title: 28.5px;
  --fs-subtitle: 22.5px;
  --fs-item: 17.5px;
  --fs-body: 14.5px;
  --fs-sub: 13.5px;
  --fs-note: 12.5px;
  --fs-input: 16.5px;
  --fs-badge: 11.5px;
  --fs-display: 40.5px;
  /* 연출용 (홈 첫 화면 · 세계관 인트로 · 출석 · 첫 화면 제목처럼 화면 너비에 따라 커지는 큰 글씨) */
  --fs-hero: clamp(44px, 7vw, 88px);
  --fs-hero-sub: clamp(32px, 4.6vw, 56px);
  --fs-hero-item: clamp(24px, 3.2vw, 40px);
  /* 예전 이름 (새 코드에서는 쓰지 않음 — 위 이름으로 바꿔 둠) */
  --fs-h1: var(--fs-title); --fs-h2: var(--fs-subtitle); --fs-h3: var(--fs-item);
  --fs-lg: var(--fs-body); --fs-md: var(--fs-body); --fs-sm: var(--fs-sub); --fs-xs: var(--fs-note);
  --fs-xl: var(--fs-input); --fs-2xs: var(--fs-badge);

  /* 글꼴: 제목 · 본문 모두 프리텐다드 (영상 · 연출 문구만 노토 산스) */
  --font-title: var(--font);
  --font-body: var(--font);

  /* 자간 */
  /* 146번: 실무 기준 — 프리텐다드는 자간 조정 없이 쓰도록 만든 글꼴, 한글 본문 · 버튼 · 라벨은 0, 큰 제목만 살짝 좁힘 */
  --ls-ui: 0;           /* 한글 버튼 · 라벨 */
  --ls-label: 0;        /* 한글 섹션 머리말 */
  --ls-title: -.02em;   /* 22px 이상 큰 제목 */
  --ls-eyebrow: .3em;   /* 영문 대문자 장식 (GATE · EXPLORATION …) */

  /* 행간 */
  --lh-snug: 1.2;       /* 제목 · 숫자 */
  --lh-ui: 1.5;         /* 버튼 · 짧은 줄 */
  --lh-body: 1.6;       /* 기본 */
  --lh-read: 1.8;       /* 길게 읽는 글 */

  /* 글꼴 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;

  /* 크기 */
  --field-h: 46px;
  --radius: 0;

  /* 안전 영역 (노치) */
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* v167 색 통일: 바탕 · 돌 · 나무 · 종이 단계 (직접 쓰던 색을 모두 여기로 모음) */
  --bg-0: #080908;  --bg-1: #0e0f0e;  --bg-2: #151614;  --bg-3: #1b1c1a;--stone: #4f4c46;--wood: #3a2618;  --paper: #efe3c7;/* 나무 명패 · 바랜 금빛 글씨 */
/* 상태 아이콘 디버프 테두리 */
  /* 모든 색의 rgb 값 (반투명이 필요할 때 rgba(var(--이름-rgb), .5)) */
  --bg-0-rgb: 8,9,8; --bg-1-rgb: 14,15,14; --bg-2-rgb: 21,22,20; --bg-3-rgb: 27,28,26;--danger-rgb: 217,139,127;--ink-dim-rgb: 162,159,152; --ink-faint-rgb: 111,108,102;--ok-rgb: 178,197,159; --paper-rgb: 239,227,199;--paper-ink-2-rgb: 74,61,44;    --stone-rgb: 79,76,70;--teal-light-rgb: 146,200,200;--wood-rgb: 58,38,24;
  /* v177 · v185: 회청 — 정신력 · 슬라이서 · 집회 (= DB positions.accent 슬라이서 #8b93ad).
     ★ v177에서 정신력 보라(#9a8fcb)와 합칠 때 보라 값이 남아 회청 자리가 모두 보라가 됐었음 → 회청으로 되돌림. 보라 쓰지 말 것 */
  --violet: #8b93ad; --violet-rgb: 139,147,173;
}

*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
/* v180: 아이폰 사파리는 문서 자체(html)의 스크롤바를 CSS로 못 숨김 → 문서는 고정, body가 스크롤 (안쪽 상자라 숨김 규칙이 먹음) */
html { overflow: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all; /* 한글 단어 중간에서 줄바꿈 방지 */
  line-height: var(--lh-body); /* 146번: 실무 기준 행간 1.6 (따로 안 준 곳이 기본값 약 1.2로 좁았음) */
  overflow-x: hidden; overflow-y: auto;
}
p, h1, h2 { margin: 0; }
/* 146번: 제목은 한 줄 기준 1.3 (두 줄로 넘어가도 붙지 않게) */
h1, h2, h3, h4 { line-height: 1.3; }
button, input { font: inherit; color: inherit; }
/* v185: 링크도 주변 글자색 — <a>로 만든 버튼(캐릭터 생성 등)이 브라우저 기본 링크색(파랑보라)으로 보였음 (홈페이지는 원래 이렇게 돼 있음) */
a, a:visited { color: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 배경 ---------- */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(var(--bg-0-rgb), .3) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 70%, rgba(var(--bg-0-rgb), .5) 100%),
    url("../assets/bg-main.jpg") center 45% / cover no-repeat,
    radial-gradient(ellipse at 50% 30%, var(--stone) 0%, var(--bg-2) 55%, var(--bg-0) 100%);
}

/* ---------- 상단 ---------- */
.top {
  position: absolute; inset: 0 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(24px, 4vw, 38px) clamp(20px, 4.4vw, 72px);
  padding-top: calc(clamp(24px, 4vw, 38px) + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 26px; }
.brand__logo {
  width: 52px; height: 74px; flex: none;
  fill: rgba(var(--ink-rgb), .5); stroke: rgba(var(--ink-rgb), .3); stroke-width: .6;
}
.brand__title {
  font-size: var(--fs-body); font-weight: 400; letter-spacing: var(--ls-eyebrow); color: var(--ink-dim);
}
.brand__sub {
  margin-top: 14px;
  font-size: var(--fs-note); letter-spacing: var(--ls-eyebrow); color: var(--ink-faint);
}
.tagline {
  display: grid; gap: 14px; justify-items: end; margin-top: 18px;
  font-size: var(--fs-note); letter-spacing: var(--ls-eyebrow); color: var(--ink-faint);
}
.tagline span::after {
  content: ""; display: inline-block; width: 20px; height: 1px;
  margin-left: 14px; vertical-align: middle; background: var(--ink-faint);
}

/* ---------- 레이아웃 ---------- */
.stage {
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  /* 로그인 영역을 화면 아래쪽에 붙이고, 위로 공지·FAQ·일러스트가 쌓임 */
  padding: 150px 20px clamp(28px, 7vh, 80px);
}

/* ---------- 패널 공통 + 모서리 브래킷 ---------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.panel::before {
  content: ""; position: absolute; inset: -7px; pointer-events: none;
  --c: var(--line-strong); --s: 14px;
  background:
    linear-gradient(var(--c) 0 0) top left    / var(--s) 1px,
    linear-gradient(var(--c) 0 0) top left    / 1px var(--s),
    linear-gradient(var(--c) 0 0) top right   / var(--s) 1px,
    linear-gradient(var(--c) 0 0) top right   / 1px var(--s),
    linear-gradient(var(--c) 0 0) bottom left / var(--s) 1px,
    linear-gradient(var(--c) 0 0) bottom left / 1px var(--s),
    linear-gradient(var(--c) 0 0) bottom right/ var(--s) 1px,
    linear-gradient(var(--c) 0 0) bottom right/ 1px var(--s);
  background-repeat: no-repeat;
}

/* ---------- 입력칸 ---------- */
.field {
  position: relative; display: flex; align-items: center;
  min-width: 0;
  height: var(--field-h);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.field:focus-within { border-color: var(--line-strong); }
.field.is-invalid { border-color: var(--danger); }
.field__icon {
  width: var(--ico-md); height: var(--ico-md); margin: 0 14px 0 16px; flex: none;
  fill: none; stroke: var(--ink-dim); stroke-width: 1.3;
}
.field input {
  flex: 1; min-width: 0; width: 100%; height: 100%;
  padding: 0 14px 0 0;
  background: none; border: 0; outline: 0;
  font-size: var(--fs-input); /* 16px 미만이면 iOS가 확대함 */
}
.field input::placeholder { color: var(--ink-dim); }
/* 아이콘 없이 쓰는 입력칸: 왼쪽 여백을 모든 화면에서 같게 */
.field > input:first-child { padding-left: 16px; }
.field > input:first-child::placeholder,
.field > textarea::placeholder { color: var(--ink-faint); }
/* 여러 줄 입력칸 (어느 화면이든 같은 모양) */
.field:has(> textarea) { height: auto; align-items: stretch; }
.field > textarea {
  flex: 1; width: 100%; min-height: 96px; margin: 0; padding: 12px 16px;
  background: none; border: 0; outline: 0; resize: vertical;
  font: inherit; font-size: var(--fs-input); line-height: var(--lh-body); color: inherit;
}
/* 브라우저 자동완성 때 생기는 파란 배경 없애기 */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-0) inset;
  transition: background-color 9999s ease-out;
}
.field__hint {
  position: absolute; right: 16px;
  font-size: var(--fs-sub); color: var(--ink-faint); pointer-events: none;
  transition: opacity .15s;
}
.field input:not(:placeholder-shown) ~ .field__hint:not(.field__hint--timer) { opacity: 0; }
.field:has(.field__eye) .field__hint { right: 52px; }
.field__eye {
  display: grid; place-items: center;
  width: 44px; height: 100%; margin-right: 2px;
  background: none; border: 0;
}
.field__eye svg {
  width: var(--ico-md); height: var(--ico-md); fill: none; stroke: var(--ink-dim); stroke-width: 1.3;
}
.field__hint--timer { font-variant-numeric: tabular-nums; color: var(--ink-dim); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 18px;
  height: var(--btn-h); padding: 0 20px;
  border-radius: var(--radius);
  font-size: var(--fs-input); font-weight: 500; letter-spacing: var(--ls-ui);
  transition: filter .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn--stone {
  color: var(--ink-hi); font-weight: 700;
  border: 1px solid rgba(var(--ink-hi-rgb), .3);
  box-shadow: inset 0 0 0 1px rgba(var(--bg-0-rgb), .3), 0 2px 10px rgba(var(--bg-0-rgb), .5);
  text-shadow: 0 1px 2px rgba(var(--bg-0-rgb), .7);
  background:
    url("../assets/btn-stone.jpg") center / cover,
    radial-gradient(ellipse at 30% 30%, var(--ink-faint) 0%, var(--stone) 60%, var(--stone) 100%);
}
.btn--stone:not(:disabled):hover { filter: brightness(1.12); }
.btn--ghost {
  background: rgba(var(--bg-0-rgb), .3);
  border: 1px solid var(--line-strong);
}
.btn--ghost:not(:disabled):hover { border-color: rgba(var(--ink-rgb), .7); background-color: rgba(var(--ink-rgb), .04); }
.btn--sm { height: var(--btn-h-sm); font-size: var(--fs-body); padding: 0 16px; }
.btn--lg { width: 100%; height: var(--btn-h-lg); font-size: var(--fs-item); letter-spacing: var(--ls-ui); }
.btn__arrow { width: 24px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.btn.is-loading { pointer-events: none; opacity: .7; }

.textlink {
  background: none; border: 0; padding: 4px 0;
  font-size: var(--fs-sub); color: var(--ink-dim);
}
.textlink:hover { color: var(--ink); }
.textlink--under { text-decoration: underline; text-underline-offset: 4px; color: var(--ink); font-size: var(--fs-body); }

:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.field input:focus-visible { outline: 0; }

/* ---------- 체크박스 ---------- */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-sub); color: var(--ink-dim); }
.check input {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 15px; height: 15px; border: 1px solid var(--line-strong); border-radius: 0;
  background: var(--field); display: grid; place-items: center; cursor: pointer;
}
.check input::after {
  content: ""; width: 7px; height: 4px; margin-top: -2px;
  border: solid var(--ink); border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg);
  opacity: 0;
}
.check input:checked { border-color: var(--ink-dim); }
.check input:checked::after { opacity: 1; }
.check input:checked + span { color: var(--ink); }

/* ---------- 메시지 ---------- */
.form-msg { min-height: 0; font-size: var(--fs-sub); text-align: center; color: var(--red-light); }
.form-msg:empty { display: none; }
.form-msg.is-ok { color: var(--green-light); }

/* =========================================================
   로그인 패널
   ========================================================= */
.login {
  width: min(610px, 100%);
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 12px 26px;
  padding: 22px 22px 18px;
}
.login__fields, .login__actions { display: grid; gap: 12px; align-content: start; }
.login__actions .btn--stone { height: var(--btn-h-lg); font-size: var(--fs-item); }
.login__actions .btn--ghost { height: var(--btn-h-sm); }
.login__options {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 18px;
  margin-top: 4px;
}
.login__options .textlink { margin-left: auto; }
.login .form-msg { grid-column: 1 / -1; }
.panel__motto {
  grid-column: 1 / -1;
  margin-top: 4px;
  text-align: center; font-size: var(--fs-note); letter-spacing: var(--ls-eyebrow); color: var(--ink-faint);
}

/* =========================================================
   회원가입 모달
   ========================================================= */
.modal {
  max-height: calc(100% - 32px);
  padding: 7px; /* 브래킷이 잘리지 않도록 */
  margin: auto;
  background: none; border: 0; color: inherit;
  overflow: visible;
}
.modal::backdrop { background: rgba(var(--bg-0-rgb), .7); }
.modal[open] { animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.signup {
  max-height: calc(100dvh - 46px);
  overflow: hidden auto;
  padding: 40px clamp(20px, 6vw, 44px) 26px;
  text-align: center;
  background:
    url("../assets/panel-stone.jpg") center / cover,
    radial-gradient(ellipse at 50% 0%, var(--bg-3) 0%, var(--bg-2) 55%, var(--bg-1) 100%);
  border-color: var(--line);
}
.signup__eyebrow { font-size: var(--fs-note); letter-spacing: var(--ls-eyebrow); color: var(--ink-faint); }
.signup__title {
  margin-top: 14px;
  font-size: clamp(var(--fs-title), 7vw, var(--fs-display)); font-weight: 700; letter-spacing: var(--ls-label);
  text-indent: .14em; /* 자간으로 생긴 오른쪽 여백 보정 */
}
.signup__lead { margin-top: 14px; font-size: var(--fs-body); letter-spacing: var(--ls-label); color: var(--ink-dim); line-height: var(--lh-body); }
.rule { margin: 26px 0; height: 1px; border: 0; background: var(--line); }

.signup__fields { display: grid; gap: 14px; text-align: left; }
.signup .field { height: 50px; }
.field-row { display: grid; grid-template-columns: 1fr 150px; gap: 14px; }
.field-row .btn { height: var(--btn-h-lg); }
.field-row.code-row { grid-template-columns: 1fr; gap: 8px; }
.code-row:not([hidden]) { animation: rise .25s ease-out; }
.reset-step { display: grid; gap: 14px; animation: rise .25s ease-out; }
.code-row__note { font-size: var(--fs-sub); color: var(--ink-faint); padding-left: 2px; }

.signup .form-msg { margin-top: 16px; }
.signup .btn--lg { margin-top: 26px; }
.signup__foot { font-size: var(--fs-body); color: var(--ink-dim); }
.signup__foot .textlink { margin-left: 10px; }

/* =========================================================
   로그인 화면: 일러스트 + 공지·FAQ
   ========================================================= */
.lobby { position: relative; width: min(610px, 100%); display: grid; gap: 14px; }

/* 캐릭터 일러스트: 오른쪽 게시판 위에 걸터앉은 느낌으로 살짝 겹침 */
.lobby__art {
  position: absolute; right: 0; bottom: calc(100% - 14px); z-index: 0;
  width: 50%; max-height: 42vh; object-fit: contain; object-position: bottom center;
  pointer-events: none; user-select: none;
}
.lobby > .panel { z-index: 1; }

/* 게시판: 왼쪽 세로 탭 + 오른쪽 목록, 위아래 사선 띠 */
.boards {
  display: grid; grid-template-columns: 150px minmax(0, 1fr);
  padding: 16px 0;
}
.boards::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  --hatch: repeating-linear-gradient(-45deg, rgba(var(--ink-rgb), .3) 0 4px, transparent 4px 10px);
  background:
    var(--hatch) top / 100% 10px no-repeat,
    var(--hatch) bottom / 100% 10px no-repeat;
}
.boards::before { display: none; }   /* 게시판 패널은 모서리 꺾쇠 없음 */

.boards__tabs { display: grid; grid-template-rows: 1fr 1fr; gap: 2px; padding-left: 12px; }
.btab {
  position: relative;
  display: grid; align-content: center; justify-items: center; gap: 4px;
  min-height: 66px; padding: 10px 8px;
  background: rgba(var(--ink-hi-rgb), .04); border: 1px solid transparent;
  color: var(--ink-faint);
  transition: color .2s, background-color .2s;
}
.btab strong { font-size: var(--fs-item); font-weight: 700; letter-spacing: var(--ls-ui); }
.btab span { font-size: var(--fs-note); letter-spacing: var(--ls-label); }
.btab:not(.is-active):hover { color: var(--ink-dim); background: rgba(var(--ink-hi-rgb), .04); }
.btab.is-active {
  color: var(--ink);
  border-color: rgba(var(--ink-hi-rgb), .16);
  box-shadow: inset 0 0 0 1px rgba(var(--bg-0-rgb), .3);
  background:
    url("../assets/btn-stone.jpg") center / cover,
    radial-gradient(ellipse at 30% 30%, var(--stone) 0%, var(--stone) 60%, var(--stone) 100%);
  text-shadow: 0 1px 2px rgba(var(--bg-0-rgb), .7);
}
.btab.is-active span { color: var(--ink-dim); }
/* 선택된 탭 오른쪽의 작은 화살표 */
.btab.is-active::after {
  content: ""; position: absolute; right: -7px; top: 50%;
  border: 6px solid transparent; border-left-color: var(--ink-dim);
  border-right-width: 0;
  transform: translateY(-50%);
}

.boards__body { position: relative; min-width: 0; padding: 0 20px 0 22px; }
.boards__body::after {
  content: ""; position: absolute; left: 22px; right: 20px; bottom: 0; height: 26px;
  background: linear-gradient(180deg, rgba(var(--bg-1-rgb), 0), rgba(var(--bg-1-rgb), .9));
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.boards__body.has-more::after { opacity: 1; }

.board__list {
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start;
  height: 134px; overflow-y: auto; scrollbar-width: none;
}
.board__list::-webkit-scrollbar { display: none; }
.board__empty { padding: 14px 0; font-size: var(--fs-sub); color: var(--ink-faint); }
.post-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 44px; padding: 0 2px;
  background: none; border: 0; border-bottom: 1px solid rgba(var(--ink-rgb), .08);
  font-size: var(--fs-body); text-align: left; color: var(--ink);
  transition: color .15s, background-color .15s;
}
.post-item:hover, .post-item:focus-visible { background: rgba(var(--ink-hi-rgb), .04); }
.post-item__icon { flex: none; width: var(--ico-md); height: var(--ico-md); fill: none; stroke: var(--ink-dim); stroke-width: 1.4; }
.post-item__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-item__date { flex: none; margin-left: auto; padding-left: 10px; font-size: var(--fs-sub); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.post-item__pin {
  flex: none; padding: 1px 6px; font-size: var(--fs-note); letter-spacing: var(--ls-ui);
  color: var(--ink); border: 1px solid var(--line-strong);
}
.post-item__new {
  flex: none; display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: var(--fs-note); font-style: normal; font-weight: 700; color: var(--bg-2);
  background: var(--gold); box-shadow: inset 0 0 0 1px rgba(var(--bg-0-rgb), .3);
}

/* 글 보기 모달 */
.post {
  display: grid; gap: 14px;
  max-height: calc(100dvh - 46px);
  padding: 34px clamp(20px, 5vw, 36px) 26px;
  background:
    url("../assets/panel-stone.jpg") center / cover,
    radial-gradient(ellipse at 50% 0%, var(--bg-3) 0%, var(--bg-2) 55%, var(--bg-1) 100%);
  overflow: hidden auto; scrollbar-width: none;
}
.post::-webkit-scrollbar { display: none; }
.post .rule { margin: 4px 0; }
.post__meta { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-note); letter-spacing: var(--ls-label); color: var(--ink-faint); }
.post__title { font-size: var(--fs-subtitle); font-weight: 700; line-height: var(--lh-ui); letter-spacing: var(--ls-ui); }
.post__body { font-size: var(--fs-body); line-height: var(--lh-read); color: var(--ink-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.post__body a { color: var(--ink); text-underline-offset: 3px; }
.post__a { font-weight: 700; color: var(--ink); }
.post__foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.post__foot .btn { min-width: 120px; }

/* =========================================================
   안내 모달
   ========================================================= */
.notice {
  display: grid; gap: 14px;
  padding: 36px clamp(20px, 6vw, 32px) 28px;
  text-align: center;
  background:
    url("../assets/panel-stone.jpg") center / cover,
    radial-gradient(ellipse at 50% 0%, var(--bg-3) 0%, var(--bg-2) 55%, var(--bg-1) 100%);
}
.notice__title { font-size: var(--fs-subtitle); font-weight: 700; letter-spacing: var(--ls-label); text-indent: .1em; }
.notice__body { font-size: var(--fs-body); line-height: var(--lh-read); color: var(--ink-dim); white-space: pre-line; }
.notice__btn { justify-self: center; min-width: var(--btn-w); margin-top: 10px; }   /* v177: 창 너비로 늘이지 않음 */

/* =========================================================
   반응형
   ========================================================= */
@media (max-width: 900px) {
  .tagline { display: none; }
}

@media (max-width: 640px) {
  .bg {
    background:
      linear-gradient(180deg, rgba(var(--bg-0-rgb), .5) 0%, rgba(0,0,0,0) 25%, rgba(var(--bg-0-rgb), .16) 55%, rgba(var(--bg-0-rgb), .7) 100%),
      url("../assets/bg-main-m.jpg") center / cover no-repeat,
      url("../assets/bg-main.jpg") 50% 45% / cover no-repeat,
      radial-gradient(ellipse at 50% 30%, var(--stone) 0%, var(--bg-2) 55%, var(--bg-0) 100%);
  }
  .brand { gap: 16px; }
  .brand__logo { width: 34px; height: 48px; }
  .brand__title { font-size: var(--fs-sub); letter-spacing: var(--ls-eyebrow); }
  .brand__sub { margin-top: 8px; font-size: var(--fs-note); letter-spacing: var(--ls-label); }

  .stage { padding-top: 120px; padding-bottom: 24px; }
  .login { grid-template-columns: 1fr; padding: 18px 16px 16px; }
  .login__actions .btn--stone,
  .login__actions .btn--ghost { height: var(--btn-h); }
  .login__options { flex-wrap: wrap; gap: 14px; }

  .field-row { grid-template-columns: 1fr 112px; gap: 10px; }
  .signup .field__hint { font-size: var(--fs-sub); }
}

@media (max-width: 640px) {
  .lobby__art { display: none; }
  .boards { grid-template-columns: 96px minmax(0, 1fr); }
  .boards__tabs { padding-left: 10px; }
  .btab { min-height: 58px; }
  .btab strong { font-size: var(--fs-body); }
  .btab span { font-size: var(--fs-badge); letter-spacing: var(--ls-label); }
  .boards__body { padding: 0 12px 0 16px; }
  .boards__body::after { left: 16px; right: 12px; }
  .board__list { height: 120px; }
  .post-item { height: 40px; gap: 8px; font-size: var(--fs-sub); }
  .post-item__icon { width: var(--ico-sm); height: var(--ico-sm); }
  .post-item__date { font-size: var(--fs-note); }
}

/* 세로가 짧은 PC 화면은 일러스트 숨김 */
@media (min-width: 641px) and (max-height: 740px) {
  .lobby__art { display: none; }
}

@media (max-width: 360px) {
  .field-row { grid-template-columns: 1fr; }
  .signup .field__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 스크롤바 숨김 (스크롤은 그대로 가능) ---------- */
html, .signup {
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* 구형 Edge */
}
html::-webkit-scrollbar,
.signup::-webkit-scrollbar { display: none; }  /* Chrome, Safari, Whale */

/* 소리 버튼 (첫 화면 · 캐릭터 화면) */
.gsound-float {
  position: fixed; z-index: 30; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
  color: var(--ink-dim); background: rgba(var(--bg-0-rgb), .7); border: 1px solid rgba(var(--ink-rgb), .16); border-radius: 50%;
}
.gsound-float:hover { color: var(--ink-hi); border-color: rgba(var(--ink-rgb), .5); }
.gsound-float svg { width: var(--ico-md); height: var(--ico-md); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.gsound-float.is-muted { opacity: .5; }
.gaudio--float { left: auto !important; right: 18px; }
.gaudio {
  position: fixed; z-index: 40; width: 280px; padding: 14px 16px 12px; display: grid; gap: 10px;
  background: rgba(var(--bg-1-rgb), .9); border: 1px solid rgba(var(--ink-rgb), .3); box-shadow: 0 18px 40px rgba(var(--bg-0-rgb), .7); color: var(--ink);
}
.gaudio[hidden] { display: none; }
.gaudio__h { margin: 0; font-size: var(--fs-note); letter-spacing: var(--ls-eyebrow); color: var(--ink-dim); }
.gaudio__row { display: grid; grid-template-columns: 34px 46px 1fr 28px; align-items: center; gap: 10px; }
.gaudio__toggle { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; background: none; border: 1px solid rgba(var(--ink-rgb), .16); color: var(--ink-dim); }
.gaudio__toggle.is-on { color: var(--ink); border-color: rgba(var(--ink-rgb), .3); background: rgba(var(--ink-rgb), .08); }
.gaudio__toggle svg { width: var(--ico-md); height: var(--ico-md); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.gaudio__label { font-size: var(--fs-sub); }
.gaudio input[type="range"] { width: 100%; accent-color: var(--gold); }
.gaudio em { font-style: normal; font-size: var(--fs-note); text-align: right; color: var(--ink-dim); }
.gaudio__note { margin: 0; font-size: var(--fs-note); color: var(--ink-dim); }

/* 대표 버튼 (붉은 막 + 돌 버튼 그림) — 게임 시작 · 받기 등 가장 중요한 버튼 하나에만 */
.btn--accent {
  border-color: rgba(var(--red-rgb), .9);
  background: linear-gradient(rgba(var(--red-deep-rgb), .7), rgba(var(--red-deep-rgb), .7)), url("../assets/btn-stone.jpg") center / cover, var(--red-deep);
}
.btn--accent:not(:disabled):hover {
  filter: none; border-color: var(--red);
  background: linear-gradient(rgba(var(--red-deep-rgb), .7), rgba(var(--red-deep-rgb), .7)), url("../assets/btn-stone.jpg") center / cover, var(--red-deep);
  box-shadow: 0 0 18px rgba(var(--red-rgb), .3), inset 0 0 0 1px rgba(var(--bg-0-rgb), .3);
}

/* =========================================================
   이 기기 설정 (prefs.js)
   ========================================================= */
/* 읽는 글 크기 */
html.has-ts :is(.gmsg__body, .fdm__body, .letter__inner, .prof__text, .inote__body, .wres__text, .note__body, .galert__body, .help__body, .bk__desc) { zoom: var(--ts, 1); }
/* 글꼴: 읽는 글만 */
html.pf-text :is(.gmsg__body, .fdm__body, .letter__inner, .letter__inner *, .prof__text, .inote__body, .wres__text, .note__body, .galert__quote, .help__body, .bk__desc) { font-family: var(--read-font) !important; }
/* 글꼴: 화면 전체 */
html.pf-all body, html.pf-all body :is(button, input, textarea, select) { font-family: var(--read-font) !important; }
/* 화면 효과 줄이기: 흔들림 · 깜빡임 · 번쩍임 · 정신력 어두워짐 */
html.prefs-calm .wfx-layer, html.prefs-calm body::after { display: none !important; }
html.prefs-calm :is(.is-shake, .wres, .gweather i, .wfx, .gbadge) { animation: none !important; }
html.prefs-calm * { scroll-behavior: auto !important; }

/* =========================================================
   스크롤바 숨기기 (사이트 전체) — 스크롤은 그대로 돼요
   ========================================================= */
* { scrollbar-width: none !important; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none; background: transparent; }

/* 누르기 쉬운 크기 */
.field--select select { height: 100%; min-height: 36px; }

/* =========================================================
   첫 화면 분위기 (ambience.js): 배경 바로 위, 글자 · 버튼 아래
   ========================================================= */
.amb { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.amb-vignette { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 55%, rgba(0,0,0,0) 45%, rgba(var(--bg-0-rgb), .5) 100%); }
body.is-rain .bg { filter: brightness(.85) saturate(.9); }

/* =========================================================
   휴대폰 (v98)
   ========================================================= */
/* 좌우로 넘기는 칸 아래의 점 (swipe.js) */
.sdots { display: none; }
@media (max-width: 760px) {
  .sdots { display: flex; justify-content: center; gap: 6px; margin: 10px 0 2px; }
  .sdots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(var(--ink-rgb), .16); transition: background-color .2s, width .2s; }
  .sdots i.is-on { width: 16px; border-radius: 0; background: var(--red-light); }
}

/* 첫 화면: 공지 / FAQ 탭을 위로, 목록은 아이디 칸과 같은 폭 */
@media (max-width: 640px) {
  .boards { grid-template-columns: 1fr; padding: 16px 0 14px; }
  .boards__tabs { grid-template-rows: none; grid-template-columns: 1fr 1fr; gap: 2px; padding: 0 16px 10px; }
  .btab { display: flex; align-items: baseline; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 6px; }
  .btab strong { font-size: var(--fs-body); }
  .btab.is-active::after { right: auto; left: 50%; top: auto; bottom: -7px; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--ink-dim); border-bottom-width: 0; }
  .boards__body { padding: 0 16px; }
  .boards__body::after { left: 16px; right: 16px; }
  .board__list { height: 160px; }
}
@media (max-width: 640px) { .btab span { white-space: nowrap; font-size: var(--fs-badge); letter-spacing: var(--ls-ui); } }
@media (max-width: 380px) { .btab span { display: none; } }

/* 서버 점검 안내: 공식 홈페이지 버튼 */
.notice__body .notice__link { display: inline-block; margin-top: 14px; padding: 8px 14px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: var(--fs-sub); }
.notice__body .notice__link:hover { border-color: var(--red); color: var(--red-light); }
.notice__body.is-ban { text-align: left; max-height: 50vh; overflow-y: auto; }

/* 로고 그림 (assets/logo.png · 160 × 224 투명 PNG) — 크기는 .brand__logo 그대로 */
.brand__logo--img { object-fit: contain; fill: initial; stroke: initial; }
.brand__logo--img[hidden] { display: none; }

/* 글자 로고 (assets/logo-text.png · 높이 80 · 가로 자유 투명 PNG) — 누르면 첫 화면
   높이는 옆 심볼 높이의 약 45% (글자 윗선 ~ 아랫선이 그림 꽉 차게 잘랐을 때 심볼과 어울리는 비율) */
a.brand, a.gbar__brand, a.gmbar__brand { color: inherit; text-decoration: none; }
.brand__word { display: block; width: auto; max-width: none; height: 34px; }   /* 첫 화면 · 캐릭터 선택 · 만들기: 심볼 74px 옆 */
.brand__word[hidden] { display: none; }
.gbar__title .brand__word { height: 17px; }                                      /* 게임 상단 바: 심볼 36px 옆 */
.gmbar__word .brand__word { height: 14px; }                                      /* GM 상단: 심볼 30px 옆 */
@media (max-width: 760px) { .brand .brand__word { height: 22px; } }              /* 휴대폰 첫 화면: 심볼 48px 옆 */

/* ★ 심볼 로고 · 글자 로고 높이를 똑같이 (그림이 들어왔을 때) — 숫자 하나만 바꾸면 둘 다 바뀜 */
.brand { --logo-h: 40px; }
.gbar__brand { --logo-h: 26px; }
.gmbar__brand { --logo-h: 22px; }
.brand img.brand__logo--img, .gbar__brand img.brand__logo--img, .gmbar__brand img.brand__logo--img,
.brand img.brand__word, .gbar__brand img.brand__word, .gmbar__brand img.brand__word { height: var(--logo-h); width: auto; max-width: none; }
.brand img.brand__word[hidden], .gbar__brand img.brand__word[hidden], .gmbar__brand img.brand__word[hidden],
.brand img.brand__logo--img[hidden], .gbar__brand img.brand__logo--img[hidden], .gmbar__brand img.brand__logo--img[hidden] { display: none; }
@media (max-width: 760px) { .brand { --logo-h: 30px; } .gbar__brand { --logo-h: 24px; } }

/* =========================================================
   123번: 가입 약관 동의 체크 (게임 첫 화면)
   ========================================================= */
.agree { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 0; text-align: left; font-size: var(--fs-sub); line-height: var(--lh-ui); color: var(--ink); cursor: pointer; }
.agree input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--red-deep); cursor: pointer; }
.agree a { color: var(--red-light); text-decoration: underline; text-underline-offset: 2px; }
.agree.is-invalid span { color: var(--red-light); }
.agree input { appearance: none; -webkit-appearance: none; display: grid; place-content: center; border: 1px solid rgba(var(--ink-rgb), .5); background: rgba(var(--bg-0-rgb), .3); border-radius: 0; }
.agree input:checked { background: var(--red-deep); border-color: var(--red-deep); }
.agree input:checked::after { content: ""; width: 9px; height: 5px; border: solid var(--ink-hi); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }

/* v165 휴대폰 세로 고정: 휴대폰을 가로로 돌리면 화면을 가리고 '세로로 돌려 주세요' (홈 화면 앱은 manifest가 세로로 고정) */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 540px) {
  html::after {
    content: "화면을 세로로 돌려 주세요";
    position: fixed; inset: 0; z-index: 2147483647;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; text-align: center;
    font-size: var(--fs-body); letter-spacing: var(--ls-ui); color: var(--ink);
    background: var(--bg-1) url("../assets/app/icon-192.png") center calc(50% - 64px) / 72px 72px no-repeat;
    padding-top: 110px;
  }
  body { overflow: hidden; }
  dialog[open] { visibility: hidden !important; }   /* 열린 창은 맨 위 층이라 덮이지 않음 → 가로일 때만 숨김 */
  dialog::backdrop { background: var(--bg-1); }
}

/* v166 글자 체계: 휴대폰에서는 제목 · 부제목만 한 단계 작게 (나머지는 PC와 같음) */
@media (max-width: 760px) { :root { --fs-title: 22.5px; --fs-subtitle: 19.5px; } }

/* ==========================================================
   v167 창 너비: 작은 창 S 560 · 중간 M 920 · 큰 창 L 1180 세 가지만
   (게임 화면 창은 glade.css '창 크기 통일' 블록, 여기는 첫 화면 · 캐릭터 · 만들기 · GM 페이지 창)
   너비가 바뀐 창은 안쪽 여백 · 간격을 같은 비율로 키우거나 줄여서, 예전과 똑같은 비율로 보이게 함
   · 확인 창(notice) 420 → S 560 : ×1.345
   · 글 보기 · GM 편집(post) 620 → S 560 : ×0.9
   · 이미지 자르기(crop) 380 → S 560 : ×1.49
   휴대폰(760px 이하)은 화면 너비에 맞추므로 예전 그대로.
   ========================================================== */
:root { --mw-s: 560px; --mw-m: 920px; --mw-l: 1180px; }
.modal { width: min(var(--mw-s), calc(100% - 32px)); }
.modal--notice, .modal--post, .modal--crop { width: min(var(--mw-s), calc(100% - 32px)); }
@media (min-width: 761px) {
  .modal--notice .notice { gap: 19px; padding: 48px 43px 38px; }
  .modal--post .post { gap: 13px; padding: 31px 32px 23px; }
  .modal--crop .crop { gap: 24px; padding: 48px 36px 36px; }
  .modal--crop .crop__view { width: min(448px, 70vw); }
}

/* v176~177: 아이콘 그림 (assets/ui/icon/icon-<이름>.svg · .png, common.js) — 코드 선 아이콘과 같은 자리 · 같은 크기 토큰 */
[data-ico].has-ico > svg { display: none; }
.uico { display: block; width: var(--ico-lg); height: var(--ico-lg); object-fit: contain; flex: none; }
.uico--mask { background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.gbar__menu .uico { width: var(--ico-md); height: var(--ico-md); background: var(--ink-dim); }
@media (max-width: 760px) { .gquick__btn .uico { width: var(--ico-md); height: var(--ico-md); } }

/* v181: 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대함 → 휴대폰에서는 모든 입력칸을 --fs-input(16.5) */
@media (max-width: 760px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), textarea, select { font-size: var(--fs-input) !important; }
}
