/* ============================================================
   Math Wizard - 캐릭터 화면 (접두사 .ch-)
   ============================================================ */

/* 밝고 포근한 배경 */
#screen-character {
  background:
    radial-gradient(circle at 14% 16%, rgba(255,255,255,0.8) 0 3px, transparent 4px),
    radial-gradient(circle at 88% 12%, rgba(255,255,255,0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 26%, rgba(255,255,255,0.6) 0 2px, transparent 3px),
    linear-gradient(180deg, #e8f6ff 0%, #fdf6e0 60%, #ffeecf 100%);
}

/* 위치는 공용 .hub-body(상단 바~탭 바 사이)가 잡는다 */
.ch-root {
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 14px 22px 16px;
}

.ch-body { flex: 1; min-height: 0; display: flex; gap: 14px; }

/* ----- 좌측: 캐릭터 정보 ----- */
.ch-left {
  flex: none;
  width: 420px;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 18px 22px;
}
.ch-wizard {
  font-size: 102px;
  line-height: 1.15;
  animation: mw-bob 2.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 12px rgba(80, 60, 140, 0.25));
}
.ch-name-row { display: flex; align-items: center; gap: 10px; font-size: 30px; }
.ch-level {
  background: linear-gradient(180deg, #9b7bf0, var(--c-accent));
  color: #fff;
  font-size: 17px;
  border-radius: 999px;
  padding: 3px 13px;
  box-shadow: var(--shadow-sm);
}
.ch-exp { width: 100%; margin-top: 6px; }
.ch-exp .meter { height: 22px; border-radius: 11px; }
.ch-exp .meter-label { font-size: 13px; }

.ch-stats {
  width: 100%;
  margin-top: 14px;
  display: flex; flex-direction: column;
  gap: 9px;
}
.ch-stat {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 2px solid #efe5cb;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 19px;
  box-shadow: var(--shadow-sm);
}
.ch-stat-ico { font-size: 24px; }
.ch-stat b { margin-left: auto; font-size: 23px; color: var(--c-accent); }

/* ----- 우측: 장비 + 가방 ----- */
.ch-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.ch-equip-panel { flex: none; }
.ch-slots {
  display: flex; justify-content: space-evenly; align-items: flex-start;
  padding: 4px 12px 14px;
}
.ch-slot { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.ch-slot-label { font-size: 16px; color: var(--c-text-soft); }
.ch-slot-empty {
  width: 132px; height: 132px;
  border: 3px dashed #d8cba6;
  border-radius: 14px;
  background: rgba(255,255,255,0.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: #b3a988;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.ch-slot-empty:hover { background: #fff; border-color: var(--c-primary); }
.ch-slot-empty-emoji { font-size: 34px; opacity: 0.55; }

.ch-bag-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ch-tabs { display: flex; gap: 8px; padding: 2px 14px 8px; }
.ch-tab {
  font-family: var(--font);
  font-size: 16px;
  padding: 6px 18px;
  border-radius: 999px;
  border: 2px solid #e2d8bf;
  background: #fff;
  color: var(--c-text-soft);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.ch-tab:hover { border-color: var(--c-accent); color: var(--c-accent); }
.ch-tab.ch-tab-on, .ch-tab.ch-tab-on:hover {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

.ch-bag-grid {
  flex: 1; min-height: 0;
  overflow-y: auto;
  display: flex; flex-wrap: wrap; align-content: flex-start;
  gap: 12px;
  padding: 4px 14px 14px;
}
.ch-bag-grid::-webkit-scrollbar { width: 8px; }
.ch-bag-grid::-webkit-scrollbar-thumb { background: #dcd2b2; border-radius: 4px; }

.ch-bag-empty {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  color: var(--c-text-soft);
  font-size: 18px;
  text-align: center;
  line-height: 1.55;
}
.ch-bag-empty-emoji { font-size: 52px; }

/* ----- 물약 카드 (장착 없음, 정보만) ----- */
.ch-potion-card {
  width: 168px;
  background: #fff;
  border: 2px solid #e3d9c2;
  border-radius: 14px;
  padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center;
  gap: 5px;
  text-align: center;
}
.ch-potion-emoji { font-size: 40px; line-height: 1; }
.ch-potion-emoji img { width: 44px; height: 44px; }
.ch-potion-name { font-size: 16px; }
.ch-potion-desc { font-size: 12.5px; color: var(--c-text-soft); line-height: 1.4; }
.ch-potion-note { font-size: 12px; color: var(--c-accent); }

/* ----- 아이템 상세 팝업 ----- */
.ch-modal-back {
  position: absolute; inset: 0;
  z-index: 600;
  background: rgba(40, 32, 66, 0.5);
  display: flex; align-items: center; justify-content: center;
}
.ch-modal {
  width: 470px;
  max-height: 640px;
  overflow-y: auto;
  background: var(--c-panel);
  border: 4px solid var(--c-panel-border);
  border-radius: 22px;
  padding: 22px 26px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.ch-modal-emoji { font-size: 76px; line-height: 1.15; }
.ch-modal-name { font-size: 30px; margin-top: 2px; }
.ch-modal-rarity { font-size: 16px; margin-top: 2px; }
.ch-modal-desc {
  font-size: 16px;
  color: var(--c-text-soft);
  line-height: 1.5;
  margin-top: 8px;
}
.ch-modal-stats { font-size: 17px; color: var(--c-good-dark); margin-top: 6px; }
.ch-modal-note {
  margin-top: 10px;
  font-size: 16px;
  color: #5a4d91;
  background: var(--c-accent-soft);
  border-radius: 10px;
  padding: 8px 12px;
}

.ch-compare {
  margin-top: 12px;
  background: #f7f1df;
  border: 2px solid #eadfbd;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.ch-compare-title { font-size: 14px; color: var(--c-text-soft); margin-bottom: 2px; }
.ch-cmp-row { font-size: 18px; }
.ch-cmp-up { color: var(--c-good-dark); }
.ch-cmp-down { color: #9a95ad; }

.ch-modal-btns { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }

/* ============================================================
   세로 모드 (720x1280) — body.mw-portrait
   ============================================================ */
body.mw-portrait .ch-root { padding: 12px 16px 14px; }
body.mw-portrait .ch-body {
  flex-direction: column;
  overflow-y: auto;
  gap: 12px;
}
body.mw-portrait .ch-left {
  width: 100%;
  flex: 0 0 auto;
  padding: 12px 16px;
}
body.mw-portrait .ch-wizard { font-size: 64px; }
body.mw-portrait .ch-name-row { font-size: 24px; }
body.mw-portrait .ch-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
body.mw-portrait .ch-stat { font-size: 15px; padding: 8px 10px; gap: 6px; }
body.mw-portrait .ch-stat-ico { font-size: 20px; }
body.mw-portrait .ch-stat b { font-size: 18px; }
body.mw-portrait .ch-right { flex: 0 0 auto; min-height: 0; }
