/* =========================
   GLOBAL
========================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #0e0e0e;

  /* 바깥 배경 도트 */
  background-image:
    radial-gradient(circle at 4px 4px, #ff6fae 1px, transparent 1px),
    radial-gradient(circle at 12px 12px, #6fd3ff 1px, transparent 1px);
  background-size: 16px 16px;

  display: flex;
  justify-content: center;
  padding: 20px;
}

/* =========================
   APP FRAME
========================= */
.desktop {
  width: 360px;
}

.window {
  background: transparent;   /* 🔥 핵심 */
  border: 2px solid #888;
}

/* =========================
   TITLE BAR
========================= */
.titlebar {
  background: linear-gradient(#3a6ea5, #2f5f94);
  color: #fff;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.win-btn {
  width: 26px;
  height: 22px;
}

/* =========================
   CHARACTER STAGE
========================= */
.character-stage {
  position: relative;
  height: 360px;
  border-bottom: 2px solid #999;
  overflow: hidden;
  padding-top: 80px;

  background-color: rgba(240,240,240,0.85); /* ⭐️ 살짝 반투명 패널 */
}
  /* ❗ 절대 흰 배경 주지 마 */
  background: transparent;
}

/* =========================
   CAN DOT PATTERN (BACKGROUND)
========================= */
.character-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  pointer-events: none;

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Crect width='56' height='56' fill='transparent'/%3E%3Cg shape-rendering='crispEdges'%3E%3Crect x='10' y='12' width='18' height='28' fill='%2395d5ff'/%3E%3Crect x='10' y='12' width='18' height='4' fill='%2369bfe8'/%3E%3Crect x='10' y='36' width='18' height='4' fill='%2369bfe8'/%3E%3Crect x='12' y='18' width='4' height='18' fill='%23c9f0ff'/%3E%3Crect x='16' y='22' width='8' height='10' fill='%23ffffff'/%3E%3Crect x='16' y='22' width='8' height='2' fill='%23ff6fae'/%3E%3Crect x='16' y='26' width='8' height='2' fill='%23ff6fae'/%3E%3Crect x='16' y='30' width='8' height='2' fill='%23ff6fae'/%3E%3Crect x='10' y='12' width='18' height='28' fill='none' stroke='%23888888' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 56px 56px;
  background-repeat: repeat;
  image-rendering: pixelated;
}
.character-stage > div {
  background: transparent !important;
}
/* =========================
   EFFECT LAYER
========================= */
#effectLayer {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  pointer-events: none;
}

.happy-effect {
  color: #ff6fae;
  font-size: 14px;
  font-weight: bold;
  animation: floatUp 1.2s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(10px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* =========================
   AVATAR
========================= */
.avatar {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  z-index: 10;
}

.avatar img {
  width: 100%;
  display: block;
}

/* =========================
   LAYERS
========================= */
.layer {
  position: absolute;
  left: 0;
  top: 0;
}

.layer.base {
  opacity: 1;
  z-index: 1;
}

.layer.emotion {
  opacity: 0;
  z-index: 2;
}

.layer.emotion.active {
  opacity: 1;
}

/* =========================
   SPEECH BUBBLE (DOT FONT)
========================= */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

.speech-bubble {
  position: absolute;
  top: -58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;

  background: #fff;
  border: 2px solid #444;
  border-radius: 4px;
  padding: 12px 14px;

  min-width: 260px;
  max-width: 320px;

  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: -0.5px;
  text-align: center;
}

.speech-bubble.shaking {
  animation: shake 0.12s infinite;
}

@keyframes shake {
  0%   { transform: translateX(-50%) translateY(0); }
  50%  { transform: translateX(-50%) translateY(1px); }
  100% { transform: translateX(-50%) translateY(0); }
}

/* =========================
   SECTIONS
========================= */
.section {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
  border-top: 2px solid #999;
}

.section-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.chat-log {
  background: #fff;
  border: 2px inset #aaa;
  padding: 6px;
  height: 60px;
  overflow-y: auto;
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 6px;
  font-size: 13px;
}

/* =========================
   GAUGES
========================= */
.bar {
  background: #ccc;
  margin-bottom: 6px;
  position: relative;
  height: 22px;
  font-size: 11px;
  padding-left: 6px;
  line-height: 22px;
}

.bar .fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
}

.bar.stability .fill {
  background: #9fd3a8;
}

.bar.overflow .fill {
  background: #e08a7f;
}

.status {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}
