/* 큐다코방 — "밤의 당구장": 어두운 방, 등불 아래 당구대.
   당구대와 공은 scene.js가 three.js로 실시간 렌더링한다(화면 폭 전체 캔버스). 게임 그림은 쓰지 않는다 */
:root {
  --room: #15100c; --room-2: #1d1611; --room-3: #261c15; --line: #3a2c21;
  --text: #f1eadf; --muted: #b9ab98;
  --brass: #e2b25a;
  --red: #cf2d22; --red-hi: #e0473b; --ivory: #f5efe0;
  --danger: #ffb3a7; --danger-bg: rgba(207, 45, 34, .2); --ok: #a8e3bf; --ok-bg: rgba(92, 196, 138, .16);
  --display: "Black Han Sans", "Noto Sans KR", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; scrollbar-color: #4a382a var(--room); background: var(--room); }
body {
  margin: 0; color: var(--text); caret-color: var(--brass);
  word-break: keep-all; overflow-wrap: break-word;
  font: 15px/1.65 "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--room);
  min-height: 100vh;
}
::selection { background: rgba(226, 178, 90, .38); color: #fff; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
a { color: var(--brass); text-underline-offset: 3px; }

/* 첫 화면: 3D 당구대(캔버스)가 화면 폭 전체를 채우고, 글과 카드는 그 위 왼쪽에 */
.hero { position: relative; min-height: clamp(520px, 72vh, 640px); overflow: hidden; isolation: isolate; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -2; opacity: 0; transition: opacity 1.2s cubic-bezier(.16, 1, .3, 1); }
.scene.ready { opacity: 1; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 8, 6, .94) 0%, rgba(11, 8, 6, .78) 26%, rgba(11, 8, 6, .2) 48%, rgba(11, 8, 6, 0) 62%),
    linear-gradient(180deg, rgba(11, 8, 6, 0) 70%, var(--room) 100%);
}
.hero-inner { position: relative; max-width: 1240px; margin: 0 auto; padding: 0 28px 36px; }

/* 머리말 — 로그인한 사람의 닉네임과 로그아웃만 */
.bar { position: absolute; top: 16px; right: 28px; z-index: 2; width: 300px; display: flex; justify-content: center; }  /* 아래 오른쪽 카드 열(300px)과 가운데를 맞춘다 */
.who { display: flex; align-items: center; gap: 8px; }

main { max-width: 1240px; margin: 0 auto; padding: 0 28px 14px; }

.stage { max-width: 380px; padding-top: clamp(28px, 6vh, 64px); }
h1.title { font-family: var(--display); font-weight: 400; font-size: clamp(48px, min(5vw, 8.5vh), 84px); line-height: .95; letter-spacing: -.01em; margin: 0; color: var(--ivory); text-shadow: 0 8px 40px rgba(0, 0, 0, .6); }
.tagline { font-family: var(--display); font-size: clamp(18px, 2.6vh, 24px); color: var(--brass); margin: 10px 0 4px; line-height: 1.3; }
.sub { color: var(--muted); margin: 0 0 clamp(16px, 2.6vh, 24px); padding-left: 16px; font-size: 14px; }  /* 아래 공지 카드의 안쪽 글줄과 맞춘다 */

/* 로그인 전후로 글이 바뀐다: 로그인하면 제목이 작아지고 닉네임이 주인공, 그 아래 게임 시작 */
body[data-user="1"] [data-guest], body:not([data-user="1"]) [data-member] { display: none; }
body[data-user="1"] h1.title { font-size: 24px; color: var(--brass); text-shadow: none; }
.hello { margin: 10px 0 0; font-family: var(--display); font-size: clamp(30px, 5vh, 46px); line-height: 1; color: var(--ivory); text-shadow: 0 8px 40px rgba(0, 0, 0, .6); overflow-wrap: anywhere; }
.hello b { font-weight: 400; }
.hello span { font-size: .55em; color: var(--muted); margin-left: .08em; }
.start-panel { margin-top: 22px; text-align: center; }  /* 카드 없이 장면 위에 바로 놓인다 — 글자는 그림자로 띄운다 */
.start-panel h2, .start-panel .lead { text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .7); }
.start-panel h2 { font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--brass); margin: 0 0 10px; line-height: 1.25; }
.start-panel .btn.big { width: 200px; font-size: 20px; padding: 8px 16px; }
.start-panel .lead { color: var(--muted); margin: 8px 0 0; font-size: 12px; }
#pw-toggle[aria-expanded="true"] { filter: brightness(1.25); }
.account-card .actions { margin-top: 4px; }
.start-panel .note, .start-panel .notice { text-align: left; }

/* 로그인, 게임 시작 카드 — 어두운 판, 위 가장자리에만 등불 빛이 비친다 */
.card {
  position: relative; border-radius: 12px; padding: 14px 18px 14px; font-size: 14px;
  background: linear-gradient(180deg, rgba(43, 32, 24, .92), rgba(20, 15, 11, .94));
  border: 1px solid rgba(241, 228, 191, .12);
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 226, 180, .14);
}
.card h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 0 0 8px; color: var(--ivory); }
.card .lead { color: var(--muted); margin: 0 0 20px; }

/* 로그인, 가입 단추 — 전환과 제출을 겸한다. 고른 쪽이 빨간 단추 */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2px 0 14px; }
.seg .btn { padding: 7px 12px; font-size: 15px; font-weight: 700; }
.seg .btn:not(.primary) { color: var(--muted); font-weight: 500; }
.sr-submit { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 9px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; }
.field > span { font-size: 12px; color: var(--muted); }
.field small { font-size: 11px; line-height: 1.45; color: var(--muted); }
input { width: 100%; padding: 5px 10px; font-size: 14px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 8px; color: var(--text); transition: border-color .15s, background-color .15s; }
input:hover { border-color: rgba(241, 228, 191, .35); }
input:focus { outline: 2px solid var(--brass); outline-offset: -1px; border-color: transparent; }

/* 단추 — 한 덩어리 입체: 위가 밝고 아래가 어두운 둥근 면, 윗가장자리 빛, 아래로 지는 부드러운 그림자 */
.btn {
  position: relative; display: inline-block; cursor: pointer; text-decoration: none; line-height: 1.4;
  border: 1px solid #0d0907; border-radius: 999px; padding: 8px 20px; color: var(--text);
  background: linear-gradient(180deg, #4a382d 0%, #2d2119 55%, #1f1610 100%);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 232, 200, .18), inset 0 -2px 4px rgba(0, 0, 0, .35);
  transition: transform .08s ease-out, box-shadow .12s ease-out, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 6px -3px rgba(0, 0, 0, .8), inset 0 2px 4px rgba(0, 0, 0, .35); }
.btn.small { padding: 3px 14px; font-size: 13px; }
.btn.ghost { background: linear-gradient(180deg, rgba(74, 56, 45, .7), rgba(31, 22, 16, .7)); }
.btn.primary {
  color: #fff; font-weight: 700; border-color: #6e120b; text-shadow: 0 1px 1px rgba(60, 6, 2, .55);
  background: linear-gradient(180deg, #f06a5a 0%, #dc3a28 40%, #c22b19 70%, #a3200f 100%);
  box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .8), 0 2px 0 rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 220, 210, .65), inset 0 -3px 6px rgba(90, 8, 2, .45);
}
.btn.primary:active { box-shadow: 0 3px 8px -4px rgba(0, 0, 0, .8), inset 0 2px 6px rgba(90, 8, 2, .55); }
.btn.wide { width: 100%; margin-top: 4px; padding: 7px 18px; font-size: 15px; }
.btn.big { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .02em; padding: 14px 52px; }
.btn.big.primary { box-shadow: 0 18px 32px -12px rgba(0, 0, 0, .85), 0 0 46px -12px rgba(220, 60, 40, .6), inset 0 2px 0 rgba(255, 220, 210, .6), inset 0 -5px 10px rgba(90, 8, 2, .45); }
.btn.big.primary:active { box-shadow: 0 6px 12px -6px rgba(0, 0, 0, .8), inset 0 3px 8px rgba(90, 8, 2, .55); }
.btn:disabled { filter: saturate(.6) brightness(.8); cursor: progress; transform: none; }

/* 알림 글 */
.note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.notice { padding: 9px 14px; border-radius: 8px; background: var(--danger-bg); color: var(--danger); margin: 12px 0 0; font-size: 14px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
#loading { margin-top: 0; }
.lead, .sub, .note, .steps b, .notice-item .body { text-wrap: pretty; }

/* 아래쪽: 설치, 공지, 계정 */
.lower { margin-top: 0; display: flex; flex-direction: column; gap: 22px; }
.panel { background: var(--room-2); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.2; margin: 0 0 6px; color: var(--ivory); }
.panel h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.panel .lead { color: var(--muted); margin: 0 0 16px; max-width: 70ch; font-size: 14px; }
.actions { margin-top: 6px; }

/* 설치 순서: 단계마다 왼쪽에 번호 공(3D로 그린 공 + HTML 숫자), 오른쪽에 글 */
.install { padding: 14px 20px 16px; }
.install h2 { display: inline; margin-right: 12px; }
.install .lead { display: inline; margin: 0; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.steps li { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; row-gap: 4px; align-items: start; }
.steps li > :not(.num-ball) { grid-column: 2; }
.steps b { font-size: 15px; line-height: 1.4; padding-top: 5px; }
.steps .note { margin: 0; font-size: 13px; color: #c9bba8; line-height: 1.55; }
.num-ball { position: relative; grid-row: 1 / span 4; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5a4a3a, #1d1611 70%); filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .6)); }
.num-ball img { display: block; width: 32px; height: 32px; }
.num-ball b { position: absolute; inset: 0; display: grid; place-items: center; padding: 0; font: 700 12px/1 "Noto Sans KR", sans-serif; color: #15100c; }
.step-body { margin-top: 6px; }
.step-body .btn { padding: 6px 16px; font-size: 14px; }
details summary { cursor: pointer; color: var(--brass); font-size: 13px; }
details > .note { margin-top: 6px; }

/* 로그인 카드 — 첫 화면 오른쪽 위에 떠 있다 */
.login-float { position: absolute; top: 60px; right: 28px; z-index: 2; width: 300px; display: flex; flex-direction: column; gap: 10px; }

/* 공지 — 왼쪽 글 아래의 작은 판. 많으면 안에서 스크롤 */
.notices-panel { margin-top: 18px; padding: 12px 16px 8px; }
.notices-panel h2 { font-size: 18px; margin: 0 0 2px; }
.notices-panel #notice-list { max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.notices-panel .notice-item summary { padding: 8px 2px; font-size: 14px; }
.notices-panel .notice-item .body { font-size: 13px; padding-bottom: 12px; }
.notices-panel .empty { font-size: 13px; padding: 4px 0 6px; }
.notice-item { border-top: 1px solid var(--line); }
.notice-item:first-child { border-top: 0; }
.notice-item summary { display: flex; gap: 10px; align-items: baseline; padding: 11px 2px; color: var(--text); list-style: none; font-size: 15px; }
.notice-item summary::-webkit-details-marker { display: none; }
.notice-item summary:hover .title { color: var(--ivory); text-decoration: underline; text-underline-offset: 3px; }
.notice-item .title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notice-item .date { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.notice-item .body { padding: 2px 2px 16px; white-space: pre-wrap; overflow-wrap: anywhere; color: #d9cfc1; max-width: 70ch; }
.badge { font-size: 12px; padding: 0 9px; border-radius: 999px; background: rgba(226, 178, 90, .16); color: var(--brass); white-space: nowrap; }
.empty { color: var(--muted); margin: 0; }

/* 좁은 창: 공지와 계정을 한 줄로(이 게임은 PC 전용이라 휴대폰 화면은 따로 맞추지 않는다) */
@media (max-width: 900px) {
  .login-float { position: static; width: auto; margin-top: 20px; }
}
