/* ── 창(지도·캐릭터·메뉴) ── */
.panel {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b));
}
.panel-box {
  width: min(440px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.18s ease;
}
.panel-wide { width: min(720px, 100%); }
/* 옆 창: 게임을 가리지 않고 한쪽에 붙는다(바깥은 그대로 조작 가능) */
.panel-side { background: none; pointer-events: none; padding-top: calc(70px + var(--safe-t)); padding-bottom: calc(110px + var(--safe-b)); }
.panel-side .panel-box { pointer-events: auto; }
.panel-left { justify-content: flex-start; padding-left: 16px; }
.panel-right { justify-content: flex-end; padding-right: 16px; }
.panel-sidebox { width: min(460px, 100%); }
@media (max-width: 900px) {
  .panel-side { background: rgba(0, 0, 0, 0.5); pointer-events: auto; justify-content: center; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); }
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h3 { margin: 0; font-size: 20px; color: var(--accent-2); }
.panel-note { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.close-btn {
  position: relative; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--line); background: #1c1b1a;
}
.close-btn::before, .close-btn::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 2px; background: var(--text);
}
.close-btn::before { transform: translate(-50%, -50%) rotate(45deg); }
.close-btn::after { transform: translate(-50%, -50%) rotate(-45deg); }
.close-btn:hover { border-color: var(--accent); }

/* 지도 */
.map-list { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding-right: 4px; }
.map-card {
  position: relative; display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid #2c2a26;
  transition: border-color 0.15s ease;
}
.map-card:not(:disabled):hover { border-color: var(--accent); }
.map-card.is-current { border-color: var(--sky); }
.map-card.is-locked { opacity: 0.55; }
.map-card.is-locked .map-icon { filter: grayscale(1); }
.map-icon { width: 64px; height: 64px; border-radius: 10px; flex: none; }
.map-body { flex: 1; min-width: 0; }
.map-head { display: flex; align-items: center; gap: 8px; }
.map-title { font-size: 17px; font-weight: 900; }
.map-danger { width: 22px; height: 22px; object-fit: contain; }
.map-desc { color: #cfc7b6; font-size: 13px; margin: 4px 0; line-height: 1.5; }
.map-meta { color: var(--muted); font-size: 12px; }
.map-lock { width: 28px; height: 28px; flex: none; }
.map-here { position: absolute; right: 10px; top: 8px; font-size: 11px; font-weight: 700; color: var(--sky); }

/* 캐릭터 */
.char-body { min-height: 0; padding-right: 6px; }
.cp-top { display: flex; gap: 16px; align-items: flex-start; }
.cp-portrait { width: 150px; height: 150px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: #1a1814; flex: none; }
.cp-info { flex: 1; min-width: 0; }
.cp-name { font-size: 22px; font-weight: 900; }
.cp-class { color: var(--accent-2); font-size: 14px; margin: 2px 0 10px; }
.cp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.cp-stat { display: flex; justify-content: space-between; font-size: 14px; border-bottom: 1px solid #2a2824; padding: 3px 0; }
.cp-stat-k { color: var(--muted); }
.cp-stat-v { font-weight: 700; }
.cp-section { margin: 18px 0 8px; font-size: 15px; color: var(--accent-2); }
.cp-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* 채움 막대(경험치) */
.gauge { position: relative; height: 16px; border-radius: 8px; overflow: hidden; background: rgba(0, 0, 0, 0.6); border: 1px solid #2c2820; }
.gauge-fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(var(--p, 0)); background: linear-gradient(180deg, #f6c66a, #b8741c); }
.gauge-guard .gauge-fill { background: linear-gradient(180deg, #e9cf8f, #9a7428); }
.gauge-text { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 700; line-height: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
.cp-xp-label { font-size: 12px; color: var(--muted); margin: -4px 0 3px; }
.cp-xp { margin-bottom: 10px; }
.gp-top .gauge { margin: 8px 0 4px; }

/* 수호자 */
.gp-top { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(20, 20, 24, 0.6); }
.gp-level { font-size: 22px; font-weight: 900; color: var(--r5); }
.gp-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cp-point-row.is-capped .cp-point-value { color: var(--accent-2); }
.gp-reset { margin-top: 12px; width: 100%; }

/* 다른 사람의 장비(읽기 전용) */
.cp-equip-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid #2a2824; font-size: 13px; }
.cp-equip-slot { width: 52px; flex: none; color: var(--muted); }
.cp-equip-icon { width: 28px; height: 28px; object-fit: contain; flex: none; }
.cp-equip-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-equip-name.is-empty { color: var(--muted); font-weight: 400; }

/* 능력치 분배 */
.cp-points .cp-section { display: flex; align-items: baseline; gap: 10px; }
.cp-points-left { font-size: 12px; font-weight: 700; color: var(--muted); }
.cp-points-left.has-points { color: var(--accent-2); }
.cp-point-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid #2a2824; }
.cp-point-text { flex: 1; min-width: 0; }
.cp-point-name { font-weight: 700; font-size: 14px; display: flex; gap: 8px; align-items: baseline; }
.cp-point-value { color: var(--accent-2); font-size: 15px; }
.cp-point-desc { color: var(--muted); font-size: 12px; line-height: 1.5; }
.cp-plus {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--accent); background: linear-gradient(180deg, #3a2e1c, #241c10);
}
.cp-plus::before, .cp-plus::after { content: ''; position: absolute; left: 50%; top: 50%; background: var(--accent-2); transform: translate(-50%, -50%); }
.cp-plus::before { width: 14px; height: 2px; }
.cp-plus::after { width: 2px; height: 14px; }
.cp-plus:hover:not(:disabled) { background: linear-gradient(180deg, #5a4426, #3a2c16); }
.cp-plus:disabled { border-color: #3a342a; opacity: 0.4; }

/* 서버 방 목록 */
.dialog-wide { width: min(560px, 92vw); }
.room-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; margin-bottom: 12px; padding-right: 4px; }
.room-empty { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; border: 1px dashed #3a342a; border-radius: 10px; }
.room-card { text-align: left; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid #2c2a26; }
.room-card:hover:not(:disabled) { border-color: var(--accent); }
.room-card.is-full { opacity: 0.5; }
.room-card.is-here { opacity: 1; border-color: var(--accent-2); cursor: default; }
.room-card.is-here .room-card-map { color: var(--accent-2); }
.room-card-head { display: flex; gap: 10px; align-items: baseline; }
.room-card-code { font-weight: 900; letter-spacing: 0.15em; color: var(--sky); }
.room-card-map { font-size: 13px; color: var(--accent-2); }
.room-card-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.room-card-players { font-size: 12px; color: #cfc7b6; margin-top: 3px; }

/* 메뉴·설정 */
.menu-room { margin-bottom: 12px; }
.room-copy { width: 100%; }
.settings { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.setting { display: flex; align-items: center; gap: 12px; }
.setting-label { width: 76px; font-size: 14px; color: #cfc7b6; }
.help-keys { font-size: 13px; color: var(--muted); line-height: 1.9; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); }
.help-keys b { color: var(--text); font-weight: 700; }
.is-touch .help-keys { display: none; }
.menu-actions { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 560px) {
  .cp-top { flex-direction: column; align-items: center; text-align: center; }
  .cp-stats { text-align: left; width: 100%; }
  .map-icon { width: 48px; height: 48px; }
}

/* ── 조작 방식 선택 ── */
.setting-controls { flex-wrap: wrap; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { appearance: none; border: none; background: transparent; padding: 8px 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.is-on { background: linear-gradient(180deg, #e8a33a, #b8741c); color: #1a1208; }
.help-row { display: flex; gap: 8px; }
.help-row b { flex: none; min-width: 64px; color: var(--accent-2); }

/* ── 업데이트 소식 ── */
.news-list { display: flex; flex-direction: column; gap: 14px; padding-right: 6px; max-height: 70vh; }
.news-item { border: 1px solid #2c2a26; border-radius: 12px; background: var(--panel-2); padding: 12px 14px; }
.news-item.is-new { border-color: var(--accent); }
.news-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.news-ver { font-weight: 800; color: var(--accent-2); font-size: 15px; }
.news-date { color: var(--muted); font-size: 13px; }
.news-title { font-weight: 700; font-size: 15px; flex-basis: 100%; }
.news-new { font-size: 11px; font-weight: 800; color: #1a1208; background: var(--accent); border-radius: 6px; padding: 1px 6px; }
.news-points { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.6; }
.is-touch .setting-controls { display: none; }

/* ── 기술 창 ── */
.skill-body { display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.sk-bar { display: flex; gap: 8px; justify-content: center; }
.sk-slot {
  appearance: none; position: relative; width: 60px; height: 60px; border-radius: 10px; padding: 0;
  background: radial-gradient(circle at 50% 35%, #34302a, #16140f); border: 1px solid #4a4234;
}
.sk-slot.is-sel { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(246, 198, 106, 0.35); }
.sk-slot.is-empty .sk-slot-icon { opacity: 0.25; }
.sk-slot-icon { position: absolute; inset: 7px; width: calc(100% - 14px); height: calc(100% - 14px); object-fit: contain; }
.sk-slot-key { position: absolute; left: 4px; top: 2px; font-size: 10px; font-weight: 700; color: #d8cfbd; text-shadow: 0 1px 2px #000; }
.sk-tools { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.sk-hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.sk-list { display: flex; flex-direction: column; gap: 6px; }
.sk-row {
  appearance: none; display: flex; gap: 10px; align-items: flex-start; text-align: left; font-family: inherit;
  padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid #2c2a26; color: var(--text);
}
.sk-row:hover { border-color: var(--line); }
.sk-row.is-sel { border-color: var(--accent-2); background: rgba(232, 163, 58, 0.1); }
.sk-row.is-placed .sk-row-tag { color: var(--accent-2); }
.sk-row.is-locked { opacity: 0.45; }
.sk-row-icon { width: 40px; height: 40px; object-fit: contain; flex: none; }
.sk-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sk-row-name { font-weight: 800; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.sk-row-tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.sk-row-meta { font-size: 12px; color: var(--sky); }
.sk-row-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 캐릭터 창 능력치 합계 */
.cp-point-bonus { margin-left: 6px; font-size: 12px; color: var(--good); font-weight: 700; }

/* ── 고정 크기 창: 내용이 바뀌어도 창 크기는 그대로, 넘치면 안쪽만 스크롤 ── */
.panel-box { overflow: hidden; }
.panel-head { flex: none; }
.panel-wide { width: min(720px, 100%); height: min(620px, 100%); }
.panel-sidebox { width: min(500px, 100%); height: min(880px, 100%); }
.panel-menu-box { width: min(440px, 100%); height: min(600px, 100%); overflow-y: auto; }
.map-list, .char-body, .news-list { flex: 1; min-height: 0; max-height: none; }
.skill-body { flex: 1; min-height: 0; padding-right: 0; }
.sk-bar, .sk-tools { flex: none; }
.sk-tools { min-height: 44px; }
.sk-hint { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sk-list { flex: 1; min-height: 0; padding-right: 4px; }
.sk-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-list { height: 46vh; max-height: none; }
.dialog-wide { height: auto; }
@media (max-width: 900px) {
  .panel-sidebox, .panel-wide, .panel-menu-box { height: 100%; }
}
.map-ally { color: var(--good); max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 저장 데이터 옮기기(타이틀) */
.save-box { max-height: 92vh; overflow-y: auto; }
.save-sec { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid #2c2a26; }
.save-sec-title { margin: 0; font-size: 15px; color: var(--accent-2); }
.save-row { display: flex; flex-wrap: wrap; gap: 8px; }
.save-note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.save-code { display: none; height: 88px; resize: none; font-family: ui-monospace, Consolas, monospace; font-size: 11px; letter-spacing: 0; text-transform: none; text-align: left; }
.save-code.is-on { display: block; }
