*{box-sizing:border-box;}
html,body{
  margin:0; padding:0; width:100%; height:100%; overflow:hidden;
  font-family:"Apple SD Gothic Neo","Malgun Gothic",sans-serif; color:#222;
  background:#dce9f2;
}

#board-canvas{
  position:fixed; inset:0; width:100%; height:100%; display:block;
}

/* ---------- 배경음악 볼륨 컨트롤 (우측 상단, 항상 표시) ---------- */
#bgm-control{
  position:fixed; bottom:16px; right:16px; z-index:200;
  display:flex; align-items:center; gap:8px;
  background:linear-gradient(155deg, rgba(60,42,26,0.82), rgba(38,26,15,0.82));
  backdrop-filter:blur(3px);
  padding:6px 12px 6px 6px; border-radius:20px;
  box-shadow:0 4px 14px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.08);
}
#bgm-toggle{
  width:30px; height:30px; padding:0; border-radius:50%; font-size:15px; line-height:1;
  background:linear-gradient(180deg,#e2b64a,#a8791f);
  box-shadow:0 2px 0 #7a5713, 0 3px 6px rgba(0,0,0,0.3);
  display:flex; align-items:center; justify-content:center;
}
#bgm-volume{
  width:74px; height:16px; cursor:pointer; accent-color:#e2b64a; background:transparent;
}

/* ---------- 설정 화면: 보드판 위에 뜨는 팝업 ---------- */
/* setup-screen 자체는 반투명 배경(뒤에 보드판이 비쳐 보임)이고, 실제 흰색 카드는
   그 안의 #setup-card 하나뿐이다. */
#setup-screen{
  position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center;
  background:rgba(10,22,16,0.6); backdrop-filter:blur(2px);
  padding:24px;
}
#setup-card{
  width:100%; max-width:460px; max-height:88vh; overflow-y:auto;
  padding:24px; background-color:#fffdf7; border-radius:18px;
  box-shadow:0 20px 50px rgba(0,0,0,0.5), 0 0 0 3px rgba(255,255,255,0.08);
}
#setup-card h2{
  font-size:22px; color:#5d3a18; text-align:center; margin-bottom:18px;
}
#setup-card h2 .sub{font-size:13px; color:#8a6d4a; font-weight:400;}
.field{margin-bottom:14px;}
.field label{display:block; font-size:13px; color:#555; margin-bottom:4px;}
.field input, .field select{width:100%; padding:8px; border:1px solid #ccc; border-radius:6px; font-size:14px;}
#playerInputs .prow{display:flex; gap:8px; margin-bottom:8px; align-items:center;}
#playerInputs .prow input[type=text]{flex:1;}
#playerInputs .prow select{width:80px;}

button{
  cursor:pointer; border:none; border-radius:20px; padding:10px 18px;
  font-size:14px; font-weight:800; letter-spacing:0.3px; color:#fff;
  background:linear-gradient(180deg,#42a5f5,#1565c0);
  box-shadow:0 3px 0 #0d47a1, 0 5px 8px rgba(0,0,0,0.25);
}
button:hover{filter:brightness(1.06);}
button:active{transform:translateY(2px); box-shadow:0 1px 0 #0d47a1, 0 2px 4px rgba(0,0,0,0.2);}
button.secondary{background:linear-gradient(180deg,#b0bec5,#78909c); box-shadow:0 3px 0 #455a64, 0 5px 8px rgba(0,0,0,0.2);}
#startBtn{width:100%; margin-top:8px; padding:13px; font-size:16px; border-radius:26px;}
.rules-toggle{background:none; box-shadow:none; color:#1565c0; padding:0; font-weight:600; text-decoration:underline; font-size:13px; display:block; margin-bottom:8px;}
.spoon-hint{font-size:11.5px; color:#8a7a5c; margin-top:-4px;}
#playerInputs .prow .spoon-select{width:100px;}
.rules-toggle:active{transform:none; box-shadow:none;}
#rulesBox{display:none; font-size:12.5px; line-height:1.6; background:#f7f2e4; border-radius:8px; padding:12px; margin-bottom:8px; color:#444;}

/* ---------- 코너 HUD ---------- */
#hud-root{position:fixed; inset:0; pointer-events:none; z-index:10;}
.hud-slot{position:fixed;}
.hud-slot.tl{top:16px; left:16px;}
.hud-slot.tr{top:16px; right:16px;}
.hud-slot.br{bottom:110px; right:16px;}
.hud-slot.bl{bottom:110px; left:16px;}
/* 보드 안쪽, 주사위 위쪽 지점에 JS(repositionPlaza)가 left/top을 찍어주는 자리.
   plaza-actions와 같은 방식으로 그 지점에 중심이 오도록 transform으로 맞춘다. */
#hud-center-top{
  transform:translate(-50%,-50%);
  font-size:13px; color:#fff; background:rgba(0,0,0,0.55);
  padding:6px 16px; border-radius:14px; font-weight:700; white-space:nowrap;
  transition:opacity 150ms ease;
}
#hud-center-top.swapped-out{opacity:0;}
#hud-instruction{
  transform:translate(-50%,-50%);
  font-size:14px; color:#3a2a12; background:#ffd54f;
  padding:8px 20px; border-radius:16px; font-weight:800; white-space:nowrap;
  box-shadow:0 4px 14px rgba(0,0,0,0.35); pointer-events:none;
  opacity:0; visibility:hidden; transition:opacity 180ms ease;
}
#hud-instruction.show{ opacity:1; visibility:visible; }

.pcard{
  position:relative; width:198px; padding:14px 12px 10px; border-radius:16px; pointer-events:auto;
  background:linear-gradient(155deg, #2b3550 0%, #1a2036 100%);
  box-shadow:0 6px 18px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.06);
  border:2px solid rgba(255,255,255,0.12);
}
.pcard.active{border-color:#ffd54f; box-shadow:0 0 0 3px rgba(255,213,79,0.35), 0 6px 18px rgba(0,0,0,0.45);}
.pcard.bankrupt{opacity:0.4;}

.rank-pill{
  position:absolute; top:-12px; left:14px; z-index:1;
  padding:3px 10px; border-radius:14px; font-size:11px; font-weight:900; color:#fff;
  box-shadow:0 2px 6px rgba(0,0,0,0.4), inset 0 0 0 2px rgba(255,255,255,0.5);
}
.rank-pill.r1{background:linear-gradient(180deg,#42a5f5,#1565c0);}
.rank-pill.r2{background:linear-gradient(180deg,#9e9e9e,#616161);}
.rank-pill.r3{background:linear-gradient(180deg,#c98a4b,#8d5a2b);}
.rank-pill.r4{background:linear-gradient(180deg,#7986cb,#3949ab);}

.pcard-body{display:flex; gap:10px; align-items:center;}
.avatar-ring{
  flex:0 0 auto; width:48px; height:48px; border-radius:50%; border:3px solid #fff;
  background:radial-gradient(circle at 35% 30%, #3a4468, #1c2238);
  display:flex; align-items:center; justify-content:center; font-size:24px;
  box-shadow:0 2px 6px rgba(0,0,0,0.4);
}
.pinfo{flex:1; min-width:0;}
.pinfo .pname{
  font-weight:800; font-size:13px; color:#fff; margin-bottom:3px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.stat-row{
  display:flex; align-items:baseline; gap:4px; line-height:1.4;
}
.stat-row.sub{color:#9aa3c0; font-size:10px; margin-top:1px;}
.stat-label{color:#9aa3c0; font-size:10px; flex:0 0 auto;}
.stat-num{color:#ffe27a; font-weight:800; font-size:13px;}
.stat-unit{color:#c7cde0; font-size:9.5px;}

/* 카드 앞에 쌓인 현금 뭉치 */
.cash-stack{position:absolute; left:-10px; bottom:10px; width:26px; height:26px;}
.cash-stack .bill{
  position:absolute; left:0; width:26px; height:9px; border-radius:2px;
  background:linear-gradient(180deg,#c8e6a0,#8bc34a); border:1px solid #5a8a2e;
  box-shadow:0 1px 2px rgba(0,0,0,0.4);
}

/* ---------- 하단 로그 ---------- */
.hud-bottom{
  position:fixed; bottom:16px; left:50%; transform:translateX(-50%);
  width:min(560px, 92vw); pointer-events:auto; z-index:11;
}
#log{
  width:100%; max-height:88px; overflow-y:auto; background:rgba(20,20,26,0.4);
  backdrop-filter:blur(2px);
  border-radius:8px; padding:8px; font-size:11.5px; line-height:1.6;
  box-shadow:0 2px 8px rgba(0,0,0,0.25); color:#fff; text-shadow:0 1px 2px rgba(0,0,0,0.6);
}
#log div{margin-bottom:2px;}

/* ---------- 보드 중앙(연못) 액션 버튼 ---------- */
.plaza-actions{
  position:fixed; transform:translate(-50%,-50%); z-index:12; pointer-events:none;
}
.actions{display:flex; gap:8px; justify-content:center; flex-wrap:wrap; pointer-events:auto;}
/* 보드는 아이소메트릭 기울기(약 35.264도 피치)로 보이므로, 원형 버튼도 세로만
   같은 비율로 찌그러뜨려야 판 위에 눕혀진 원반처럼 보인다. 회전까지 함께 주면
   그림자/하이라이트 방향이 보드의 실제 기울기 축과 어긋나 붕 뜬 것처럼 보이므로
   45도 회전은 넣지 않는다. 내부 라벨은 세로 찌그러짐만 반대로 되돌려 똑바로 유지. */
.actions button.roll-btn{
  width:118px; height:118px; border-radius:50%; padding:0;
  background:radial-gradient(circle at 50% 32%, #f48fd0, #b0399c 70%, #7a1f6e);
  box-shadow:0 6px 0 #5c1554, 0 10px 18px rgba(0,0,0,0.4), inset 0 0 0 3px rgba(255,255,255,0.35);
  transform:scaleY(0.577);
  display:flex; align-items:center; justify-content:center;
}
.actions button.roll-btn:active{transform:scaleY(0.577) translateY(4px); box-shadow:0 2px 0 #5c1554, 0 4px 8px rgba(0,0,0,0.3);}
/* 클릭 이벤트가 없는 "눌린 채로 굳은" 정적 버튼 — 주사위 굴러가는 동안 자리를 지킨다. */
.actions button.roll-btn.roll-ghost{
  transform:scaleY(0.577) translateY(4px); box-shadow:0 2px 0 #5c1554, 0 4px 8px rgba(0,0,0,0.3);
  filter:brightness(0.9); cursor:default;
}
.roll-btn-label{
  display:block; transform:scaleY(1.733);
  font-size:15px; white-space:pre-line; line-height:1.3; text-align:center;
}

/* 구매 시 카드에서 날아가는 지폐 */
.flying-bill{
  position:fixed; width:22px; height:13px; border-radius:2px; z-index:60; pointer-events:none;
  background:linear-gradient(180deg,#c8e6a0,#8bc34a); border:1px solid #5a8a2e;
  transform:translate(-50%,-50%); box-shadow:0 1px 3px rgba(0,0,0,0.4);
}

/* ---------- 모달 ---------- */
.modal-overlay{
  display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5);
  align-items:center; justify-content:center; z-index:50;
}
.modal{
  background:#fffdf7; border-radius:14px; padding:22px; max-width:380px; width:90%; text-align:center;
  border:3px solid #f3e4c4; box-shadow:0 10px 30px rgba(0,0,0,0.4);
}
.modal h3{margin-top:0; color:#5d3a18;}
.modal .modal-btns{display:flex; gap:8px; justify-content:center; margin-top:14px;}

/* 매입/건축 체크리스트 */
.build-rows{display:flex; flex-direction:column; gap:6px; margin:12px 0; text-align:left;}
.build-row{
  display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:8px;
  background:#f2ead6; border:2px solid transparent; cursor:pointer; font-size:13px; font-weight:700; color:#8a7a5c;
}
.build-row.checked{background:#fff3cf; border-color:#e2b64a; color:#5d3a18;}
.build-check{
  width:20px; height:20px; border-radius:5px; border:2px solid #c9b98a; flex:0 0 auto;
  display:flex; align-items:center; justify-content:center; font-size:13px; color:#2e7d32; background:#fff;
}
.build-row.checked .build-check{border-color:#e2b64a; background:#fff9e6;}
.build-row.disabled{cursor:not-allowed; opacity:0.45; background:#ece5d3;}
.build-label{flex:1;}
.build-cost{color:#8d5a2b;}
.build-summary{font-size:12.5px; color:#5d3a18;}
.build-blocked{font-size:12.5px; color:#a33; font-weight:700; margin:6px 0 2px;}

/* ---------- 땅 정보 팝업 ---------- */
.info-modal{max-width:340px; text-align:left; position:relative; padding-top:30px;}
.info-modal h3{margin-top:0; color:#5d3a18;}
.info-close{
  position:absolute; top:10px; right:10px; width:28px; height:28px; padding:0;
  border-radius:50%; background:#efe6d0; color:#5d3a18; box-shadow:none; font-size:14px; font-weight:900;
}
.info-close:active{transform:none; box-shadow:none;}
.info-meta{font-size:12px; color:#8d5a2b; margin-bottom:10px; line-height:1.5;}
.info-body{font-size:13px; color:#4a3a24; line-height:1.65;}

/* ---------- 상태 표시(세무조사/우주여행 대기) ---------- */
.stat-row.status{color:#ffd54f; font-weight:700; margin-top:2px;}
