* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #efe6d6; }
body { font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #2b2420; }
#gameCanvas { display: block; width: 100vw; height: 100vh; touch-action: none; }
[hidden] { display: none !important; }

button {
  font: inherit; font-size: 15px; cursor: pointer;
  padding: 7px 14px; border-radius: 9px; border: 1px solid #b9a888;
  background: #fffaf0; color: #2b2420;
}
button:hover:not(:disabled) { background: #fff3d6; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: #e8773a; border-color: #b8551f; color: #fff; font-weight: bold; }
button.primary:hover:not(:disabled) { background: #f0884c; }
button.small { font-size: 12px; padding: 3px 8px; }
button.ghost { background: transparent; border-color: transparent; color: #9aa3b5; }

/* 판 위 이름표 */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.lbl {
  position: absolute; transform: translate(0, -50%); white-space: nowrap;
  font-size: 14px; padding: 1px 8px; border-radius: 8px;
  background: rgb(255 255 255 / 65%); color: #3b2f22;
}
.lbl.center { transform: translate(-50%, -50%); }
.lbl.tag { font-weight: bold; }
.lbl.tag.me { background: #e8773a; color: #fff; }
.lbl.good { background: #fce38a; }
.lbl.warn { background: #ffb3a7; }
.lbl.skillname { font-size: 12px; background: #1f4a3c; color: #f4f1e6; }
.lbl.zone { background: rgb(245 158 66 / 85%); color: #fff; }

.banner {
  position: fixed; z-index: 8; transform: translate(-50%, -50%);
  max-width: min(760px, 70vw); padding: 7px 18px; border-radius: 12px;
  background: rgb(35 39 51 / 88%); color: #eef1f7; text-align: center; pointer-events: none;
}
.b-title { font-family: 'Jua', sans-serif; font-size: 20px; }
.b-sub { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.b-hint { font-size: 13px; color: #ffb3a7; }
.b-hint:empty { display: none; }
.actions {
  position: fixed; z-index: 8; transform: translate(-50%, -50%);
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.actions button { box-shadow: 0 2px 6px rgb(0 0 0 / 18%); }

.log {
  position: fixed; left: 12px; top: 50%; transform: translateY(-50%); z-index: 6;
  max-height: 38vh; display: flex; flex-direction: column;
  background: rgb(35 39 51 / 82%); color: #eef1f7; border-radius: 10px; font-size: 12.5px;
}
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; font-weight: bold; }
.log-head button { background: transparent; color: #cfd6e4; border-color: #5a6275; }
.log ol { list-style: none; margin: 0; padding: 0 10px 8px; overflow-y: auto; line-height: 1.5; }
.log li.mine { color: #ffd08a; }
.log.closed ol { display: none; }

.hud { position: fixed; top: 12px; right: 12px; z-index: 10; display: flex; gap: 6px; }
.net {
  position: fixed; bottom: 12px; right: 12px; z-index: 10; font-size: 12px;
  padding: 4px 10px; border-radius: 8px; background: rgb(35 39 51 / 80%); color: #eef1f7;
}

/* 창 */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; background: rgb(0 0 0 / 55%);
}
.overlay[hidden] { display: none; }
.panel {
  max-width: 560px; width: calc(100vw - 32px); max-height: 86vh; overflow-y: auto;
  padding: 20px 24px; border-radius: 12px;
  background: #232733; color: #eef1f7; line-height: 1.6;
}
.panel h1, .panel h2 { font-family: 'Jua', sans-serif; font-weight: normal; margin: 0 0 6px; }
.panel h1 { font-size: 34px; color: #ffd08a; }
.panel h3 { margin: 16px 0 4px; color: #ffd08a; }
.sub { margin: 0 0 14px; opacity: 0.8; }
.hint { font-size: 13px; opacity: 0.7; }
.row { display: block; margin: 6px 0; }
.skill-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; align-items: end; }
.skill-pick label span { display: block; font-size: 13px; opacity: 0.8; }
.skill-pick select { width: 100%; font: inherit; padding: 5px; border-radius: 7px; }
.skill-pick button { grid-column: 1 / -1; justify-self: start; }
.skill-pick.disabled { opacity: 0.35; pointer-events: none; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.link-row { display: flex; gap: 6px; }
.link-row input { flex: 1; font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 7px; border: none; }
#roster { padding-left: 18px; }
#roster li.off { opacity: 0.6; }
.rules-panel ul { padding-left: 20px; margin: 0; }
.skill-list li { cursor: pointer; margin-bottom: 6px; }
.skill-list li:hover { color: #ffd08a; }
.when { font-size: 12px; opacity: 0.65; }
.skill-panel { display: flex; gap: 18px; max-width: 620px; align-items: flex-start; }
.skill-text { flex: 1; }
@media (max-width: 560px) { .skill-panel { flex-direction: column; align-items: center; } }
.go-panel { text-align: center; }
.go-panel h2 { font-size: 34px; color: #ffd08a; }
.go-panel .buttons { justify-content: center; }

/* 튜토리얼 */
.menu-msg { color: #ffb3a7; font-weight: bold; margin: 8px 0 0; }
.menu-msg:empty { display: none; }
.tutorial-box {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin-bottom: 12px; border-radius: 10px;
  background: rgb(232 119 58 / 18%); border: 1px solid rgb(232 119 58 / 55%);
}
.coach {
  position: fixed; left: 12px; z-index: 9; overflow-y: auto;
  padding: 12px 16px 14px; border-radius: 12px;
  background: #232733; color: #eef1f7; line-height: 1.6; font-size: 14px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 30%); border: 2px solid #e8773a;
}
.coach-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; opacity: 0.85; }
.coach-top button { background: transparent; color: #cfd6e4; border-color: #5a6275; }
.coach-bar { height: 5px; margin: 6px 0 10px; border-radius: 3px; background: #3a4052; overflow: hidden; }
.coach-bar div { height: 100%; background: #e8773a; transition: width 0.25s; }
.coach h3 { font-family: 'Jua', sans-serif; font-weight: normal; font-size: 21px; margin: 0 0 6px; color: #ffd08a; }
#coachBody { white-space: pre-line; }
.coach-task {
  margin-top: 10px; padding: 7px 10px; border-radius: 8px;
  background: rgb(255 208 138 / 16%); color: #ffd08a; font-weight: bold;
}
.coach-task::before { content: '👉 '; }
.coach-task:empty { display: none; }
.coach-hint { margin-top: 8px; color: #ffb3a7; font-weight: bold; }
.coach-hint:empty { display: none; }
@media (max-height: 760px) {
  .coach { font-size: 13px; line-height: 1.45; padding: 10px 14px; }
  .coach h3 { font-size: 18px; }
}
.coach .buttons { margin-top: 12px; }
.spots { position: fixed; inset: 0; pointer-events: none; z-index: 7; }
.spot {
  position: absolute; border: 3px solid #e8773a; border-radius: 12px;
  animation: spot 1.1s ease-in-out infinite;
}
@keyframes spot {
  0%, 100% { box-shadow: 0 0 0 0 rgb(232 119 58 / 55%); opacity: 1; }
  50% { box-shadow: 0 0 0 8px rgb(232 119 58 / 0%); opacity: 0.6; }
}
