* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.container {
    width: 100%;
    max-width: 900px;
    height: 600px;
    position: relative;
    perspective: 1200px;
}

.store {
    width: 100%;
    height: 100%;
    background-color: #f0f0e8;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform-style: preserve-3d;
}

/* 창문 스타일 */
.window-frame {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 60%;
    background-color: #8ab9d2;
    border: 20px solid #6b5644;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.window-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    pointer-events: none;
}

.window-inner:before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    width: 10px;
    background-color: #6b5644;
    transform: translateX(-50%);
    z-index: 3;
}

.window-inner:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: #6b5644;
    transform: translateY(-50%);
    z-index: 3;
}

#rain-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* 창밖 컨테이너 스타일 */
.outside-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15; /* z-index를 높게 설정해서 반드시 보이도록 */
    pointer-events: none;
    overflow: visible;
}

/* 행인 컨테이너 */
#passersby-container {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 100;
    pointer-events: none;
}

/* 행인 스타일 */
.passerby {
    position: absolute;
    width: 60px;
    height: 120px;
    bottom: 0;
    transform: translateZ(10px);
    transition: left 10s linear;
    z-index: 100;
    pointer-events: none;
}

/* 행인 몸체 */
.passerby-body {
    position: absolute;
    width: 20px;
    height: 30px;
    bottom: 20px; /* 다리를 위한 공간 확보 */
    left: 5px;
    background-color: #333;
    border-radius: 5px 5px 0 0;
}

/* 행인 머리 */
.passerby-head {
    position: absolute;
    width: 15px;
    height: 15px;
    bottom: 50px; /* 몸체 위치에 맞춰 조정 */
    left: 7.5px;
    background-color: #555;
    border-radius: 50%;
}

/* 행인 다리 - 왼쪽 */
.passerby-leg-left {
    position: absolute;
    width: 8px;
    height: 20px;
    bottom: 0;
    left: 5px;
    background-color: #222;
    border-radius: 0 0 5px 5px;
}

/* 행인 다리 - 오른쪽 */
.passerby-leg-right {
    position: absolute;
    width: 8px;
    height: 20px;
    bottom: 0;
    left: 17px;
    background-color: #222;
    border-radius: 0 0 5px 5px;
}

/* 모션 효과 클래스 - 걷기 동작 */
.walking-motion .passerby-leg-left {
    animation: legWalkLeft 1s infinite;
}

.walking-motion .passerby-leg-right {
    animation: legWalkRight 1s infinite;
}

@keyframes legWalkLeft {
    0%, 100% { height: 20px; bottom: 0; }
    50% { height: 15px; bottom: 5px; }
}

@keyframes legWalkRight {
    0%, 100% { height: 15px; bottom: 5px; }
    50% { height: 20px; bottom: 0; }
}

/* 우산 */
.umbrella {
    position: absolute;
    width: 40px;
    height: 20px;
    bottom: 35px;
    left: -5px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50% 50% 0 0;
    transform: translateZ(10px);
}

.umbrella::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 20px;
    bottom: -20px;
    left: 50%;
    background-color: #333;
    transform: translateX(-50%);
}

/* 다양한 색상의 우산 */
.umbrella-red { background-color: rgba(255, 0, 0, 0.7); }
.umbrella-blue { background-color: rgba(0, 0, 255, 0.7); }
.umbrella-green { background-color: rgba(0, 128, 0, 0.7); }
.umbrella-yellow { background-color: rgba(255, 255, 0, 0.7); }
.umbrella-purple { background-color: rgba(128, 0, 128, 0.7); }

/* 바닥 */
.floor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%;
    background-color: #d2c9b8;
    z-index: 1;
    transform: rotateX(30deg) translateZ(-10px) translateY(15px);
    transform-origin: bottom;
    background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
                      linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 25px 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) inset;
}

/* 테이블과 의자 */
.table-area {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%) translateZ(10px);
    width: 180px;
    height: 160px;
    z-index: 2;
    transform-style: preserve-3d;
}

.table {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateZ(15px);
    width: 80px;
    height: 80px;
    background-color: #8b6c54;
    border-radius: 5px;
    z-index: 3;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), 0 0 40px rgba(0,0,0,0.1) inset;
}

.table:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: #9d7e66;
    border-radius: 5px 5px 0 0;
    transform: translateY(-10px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.chair {
    position: absolute;
    bottom: 0;
    width: 50px;
    height: 80px;
    z-index: 2;
    transform-style: preserve-3d;
}

.chair:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: #8b6c54;
    border-radius: 5px;
    transform: translateZ(5px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.chair:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    width: 30px;
    height: 40px;
    background-color: #8b6c54;
    border-radius: 5px;
    transform: translateZ(10px);
    box-shadow: 2px 4px 5px rgba(0,0,0,0.3);
}

.chair-left {
    left: 15px;
}

.chair-right {
    right: 15px;
}

/* 왼쪽 선반 */
.left-shelf {
    position: absolute;
    top: 50px;
    left: 20px;
    width: 80px;
    height: 70%;
    background-color: #94826a;
    z-index: 2;
    display: flex;
    flex-direction: column;
    transform: translateZ(20px) rotateY(5deg);
    transform-style: preserve-3d;
    box-shadow: 5px 0 15px rgba(0,0,0,0.2);
}

.left-shelf:before {
    content: '';
    position: absolute;
    top: 0;
    right: -5px;
    width: 5px;
    height: 100%;
    background-color: #7d6e58;
    transform: rotateY(-90deg);
    transform-origin: right;
}

.left-shelf:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 40px,
        rgba(0, 0, 0, 0.1) 40px,
        rgba(0, 0, 0, 0.1) 42px
    );
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0,0,0,0.1) inset;
}

/* 카운터 */
.counter {
    position: absolute;
    bottom: 20%;
    right: 30px;
    width: 160px;
    height: 100px;
    background-color: #a9957b;
    border-radius: 5px 5px 0 0;
    z-index: 2;
    transform: translateZ(20px) rotateY(-2deg);
    transform-style: preserve-3d;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.2);
}

.counter:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: #b9a58b;
    border-radius: 5px 5px 0 0;
}

.register {
    position: absolute;
    top: 10px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: #333;
    border-radius: 5px;
    z-index: 3;
    transform: translateZ(10px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.register:after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 30px;
    height: 10px;
    background-color: #555;
    border-radius: 3px;
}

.products {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 80px;
    height: 30px;
    background-color: #ddd;
    z-index: 3;
    transform: translateZ(5px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    justify-content: space-around;
    padding: 2px;
}

.products:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shine 2s infinite linear;
}

@keyframes shine {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* 냉장고 */
.refrigerator {
    position: absolute;
    top: 50px;
    right: 30px;
    width: 120px;
    height: 250px;
    background-color: #e0e0e0;
    border: 5px solid #ccc;
    z-index: 2;
    transform: translateZ(30px) rotateY(-3deg);
    transform-style: preserve-3d;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.3);
}

.refrigerator:before {
    content: '';
    position: absolute;
    top: 30px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #ccc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.refrigerator-side {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: 5px;
    height: 100%;
    background-color: #d0d0d0;
    transform: rotateY(90deg);
    transform-origin: right;
}

.refrigerator:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.7),
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.7)
    );
    pointer-events: none;
    box-shadow: 0 0 8px rgba(255,255,255,0.6) inset;
}

/* 냉장고 손잡이 */
.refrigerator-handle {
    position: absolute;
    top: 60px;
    right: 10px;
    width: 8px;
    height: 35px;
    background-color: #999;
    border-radius: 4px;
    transform: translateZ(5px);
    box-shadow: -1px 0 3px rgba(0,0,0,0.2);
}

.refrigerator-handle:before {
    content: '';
    position: absolute;
    top: 100px;
    left: 0;
    width: 8px;
    height: 35px;
    background-color: #999;
    border-radius: 4px;
    box-shadow: -1px 0 3px rgba(0,0,0,0.2);
}

/* 사람 캐릭터 스타일 */
.character {
    position: absolute;
    bottom: 20%;
    width: 35px;
    height: 70px;
    z-index: 10;
    transform-style: preserve-3d;
    transition: all 0.5s ease-in-out;
}

.character-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40px;
    border-radius: 8px 8px 0 0;
    transform: translateZ(5px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.character-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateZ(5px);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* 색상 배리에이션을 위한 클래스 */
.character-color-1 .character-body { background-color: #3498db; }
.character-color-1 .character-head { background-color: #ffd3b6; }

.character-color-2 .character-body { background-color: #e74c3c; }
.character-color-2 .character-head { background-color: #f5d7c4; }

.character-color-3 .character-body { background-color: #2ecc71; }
.character-color-3 .character-head { background-color: #ffe5d8; }

.character-color-4 .character-body { background-color: #9b59b6; }
.character-color-4 .character-head { background-color: #f0d0b0; }

/* 말풍선 스타일 */
.speech-bubble {
    position: absolute;
    padding: 8px 12px;
    border-radius: 15px;
    background-color: white;
    color: #333;
    font-size: 10px;
    max-width: 120px;
    opacity: 0;
    transform: translateZ(50px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 50;
    transition: opacity 0.3s ease-in-out;
    word-break: keep-all;
    line-height: 1.3;
    font-family: 'Nanum Gothic', sans-serif;
    top: -60px;
    left: -40px;
}

.speech-bubble:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 15px;
    border-width: 8px 6px 0;
    border-style: solid;
    border-color: white transparent transparent;
}

.speech-bubble.visible {
    opacity: 1;
}

/* 새 고객 들어오는 애니메이션 */
@keyframes enterStore {
    0% { transform: translateX(-50px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

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

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* 수익 표시 영역 스타일 */
.profit-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.profit-box {
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 10px 15px;
    color: white;
    font-family: 'Nanum Gothic', sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateZ(100px);
    min-width: 130px;
    text-align: center;
}

.profit-label {
    font-size: 12px;
    margin-bottom: 5px;
    opacity: 0.8;
}

.profit-amount {
    font-size: 18px;
    font-weight: bold;
    color: #2ecc71;
}

.profit-animation {
    position: absolute;
    font-size: 14px;
    font-weight: bold;
    color: #2ecc71;
    opacity: 0;
    pointer-events: none;
}

/* 수익 증가 애니메이션 */
@keyframes profitIncrease {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(-40px); opacity: 0; }
}

/* 상품 아이템 스타일 */
.product-item {
    position: absolute;
    width: 20px;
    height: 30px;
    border-radius: 2px;
    z-index: 11;
    transform: translateZ(15px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

/* 상품 종류별 스타일 */
.product-drink {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    height: 25px;
    width: 15px;
}

.product-drink:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px 2px 0 0;
}

.product-snack {
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
    height: 20px;
    width: 22px;
}

.product-snack:after {
    content: '';
    position: absolute;
    top: 40%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.3);
}

.product-ramen {
    background: linear-gradient(to bottom, #f39c12, #d35400);
    height: 28px;
    width: 20px;
}

.product-ramen:before {
    content: '';
    position: absolute;
    top: 5px;
    left: 2px;
    width: 80%;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 1px;
}

.product-box {
    background: linear-gradient(to bottom, #2ecc71, #27ae60);
    height: 18px;
    width: 18px;
}

.product-box:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
    background-size: 10px 10px;
}
