:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #14161a;
  color: #1d1d1f;
  font-family: system-ui, -apple-system, "Malgun Gothic", sans-serif;
  overflow: hidden;
}

.app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* 무대가 화면 전체를 차지한다 */
.stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #14161a;
  overflow: hidden;
}

video,
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 카메라 영상은 인식용으로만 쓰고 화면에는 그리지 않는다(배경이 보이지 않음) */
video {
  opacity: 0;
  pointer-events: none;
}

canvas {
  pointer-events: none;
}

.hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(80%, 480px);
  text-align: center;
  font-size: 15px;
  line-height: 1.6;
  color: #cfd6e2;
}

/* 조작 영역 안의 상태 표시 */
.status {
  margin: 0;
  max-width: 100%;
  padding: 4px 12px;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  color: #e3e9f4;
  background: rgba(20, 22, 26, 0.6);
  border-radius: 999px;
  word-break: keep-all;
}

/* 하단 조작 영역 (화면 위에 겹쳐 표시) */
.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 12px;
  background: linear-gradient(to top, rgba(20, 22, 26, 0.88), rgba(20, 22, 26, 0));
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid #c9ced8;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
}

.btn.primary {
  background: #2f6df6;
  border-color: #2f6df6;
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.note {
  margin: 0;
  max-width: 520px;
  font-size: 11px;
  line-height: 1.45;
  color: #b7c0cf;
  text-align: center;
}

/* ---------- 동물 쓰다듬기 미니게임 ---------- */

/* 위쪽 기분·점수 패널 */
.pet-hud {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(92%, 520px);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(20, 22, 26, 0.62);
}

/* 라운지 로그인한 사용자 표시 이름 */
/* 상단 사용자 정보 줄: 이름 · 코인 · 루캣 잔액 · 점수 */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.player {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #c9d6ea;
  word-break: keep-all;
}

.user-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lucat {
  font-size: 12px;
  font-weight: 700;
  color: #8fd3ff;
  white-space: nowrap;
}

.mood-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mood-label {
  font-size: 12px;
  font-weight: 700;
  color: #ff9fbc;
}

.mood-bar {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.mood-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: #ff7aa8;
  transition: width 120ms linear;
}

.mood-num {
  min-width: 32px;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: #e3e9f4;
}

.pet-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.score {
  font-size: 12px;
  color: #b7c0cf;
}

/* ---------- 동물 고르기 · 이름 짓기 ---------- */
.name-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 10;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(88%, 360px);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(23, 26, 32, 0.96);
  color: #e3e9f4;
}

.name-card[hidden] {
  display: none;
}

.name-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.animal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.animal-btn {
  flex: 1 1 28%;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #e3e9f4;
  cursor: pointer;
}

.animal-btn.is-active {
  border-color: #ff9fbc;
  background: #ff9fbc;
  color: #1d1d1f;
}

.name-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #b7c0cf;
}

.name-field input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  color: #1d1d1f;
  background: #fff;
  border: 1px solid #c9ced8;
  border-radius: 10px;
}

.name-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #9aa4b4;
  text-align: center;
}

/* ---------- 코인 · 상점 ---------- */
.coins {
  font-size: 12px;
  font-weight: 700;
  color: #ffd166;
}

.shop-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 11;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(90%, 380px);
  max-height: 88%;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(23, 26, 32, 0.97);
  color: #e3e9f4;
}

.shop-card[hidden] {
  display: none;
}

.shop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.shop-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.shop-coins {
  font-size: 13px;
  font-weight: 700;
  color: #ffd166;
}

.shop-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #9aa4b4;
}

.shop-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-sub {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #ff9fbc;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #e3e9f4;
  cursor: pointer;
}

.shop-item .item-name {
  font-weight: 700;
}

.shop-item .item-meta {
  font-size: 11px;
  color: #b7c0cf;
}

.shop-item.is-on {
  border-color: #ff9fbc;
  background: rgba(255, 159, 188, 0.24);
}

.shop-item:disabled {
  opacity: 0.4;
  cursor: default;
}

/* 루캣 아이템 (충전한 루캣으로만 구매) */
.shop-lucat {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #8fd3ff;
}

.shop-item.lucat-item {
  border-color: rgba(143, 211, 255, 0.45);
  background: rgba(143, 211, 255, 0.12);
}

.shop-item.lucat-item.is-on {
  border-color: #8fd3ff;
  background: rgba(143, 211, 255, 0.3);
}

/* 좁거나 낮은 화면에서는 패널을 줄여 플레이 공간을 확보 */
@media (max-width: 420px), (max-height: 480px) {
  .pet-hud {
    padding: 8px 10px;
    gap: 4px;
  }

  .animal-btn {
    padding: 6px 4px;
    font-size: 12px;
  }
}
