:root {
    /* 부드럽게 움직이는 다크 그라데이션 애니메이션 */
    --bg-gradient: linear-gradient(-45deg, #0f0f0f, #2a2a2a, #1a1a1a, #050505);
    --text-color: #f0f0f0;
    --primary-color: #ff7700;
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; font-family: -apple-system, sans-serif; }
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; touch-action: none; background: #000; }

.ad-container { flex: none; width: 100%; background: #000; display: flex; justify-content: center; align-items: flex-start; z-index: 100; }
.ad-top { 
    /* AdSense JS가 ins 높이를 동적으로 바꾸므로 !important + clip-path로 강제 클리핑 */
    height: 60px !important; 
    max-height: 60px !important;
    min-height: 0 !important;
    flex: 0 0 60px !important;   /* flex-basis도 고정해서 flex layout 팽창 방지 */
    overflow: hidden !important;
    clip-path: inset(0);          /* position:absolute 자식까지 잘라냄 */
    border-bottom: 1px solid #333; 
}
.ad-bottom { height: 100px; border-top: 1px solid #333; }

.main-wrapper { 
    flex: 1; min-height: 0; width: 100%; 
    background: var(--bg-gradient); 
    background-size: 400% 400%;
    animation: gradientMove 15s ease infinite; 
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.app-container { max-width: 1200px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; position: relative; }

.app-header { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; z-index: 10; gap: 10px; }

.room-info { 
    font-weight: 600; color: #fff; background: var(--glass-bg); 
    padding: 6px 12px; border-radius: 12px; border: 1px solid var(--glass-border); 
    backdrop-filter: blur(5px); 
    text-align: center;
    line-height: 1.3;
}

.header-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--glass-border); background: var(--glass-bg); color: #fff; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }

@media screen and (max-width: 480px) {
    .app-header { padding: 10px 15px; }
    
    /* 모바일에서 말줄임표 없이 두 줄로 래핑 */
    .room-info { 
        font-size: 0.85rem; 
        padding: 6px 10px; 
        max-width: 45%; 
        white-space: normal; 
        word-break: break-word; 
    }
    
    .icon-btn { width: 32px; height: 32px; font-size: 0.95rem; }
}

.canvas-container { flex: 1; min-height: 0; position: relative; width: 100%; }
#smokeCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: pointer; }

.chat-input-area { flex: none; height: 70px; display: flex; padding: 10px 20px; background: rgba(20, 20, 20, 0.8); border-top: 1px solid #333; z-index: 10; align-items: center; }
.chat-input-area input { flex: 1; height: 100%; padding: 0 15px; border: 1px solid #555; border-radius: 20px; font-size: 1rem; background: #333; color: #fff; }
.chat-input-area button { height: 100%; margin-left: 10px; padding: 0 25px; border: none; border-radius: 20px; background: var(--primary-color); color: white; font-weight: bold; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(5px); z-index: 1000; justify-content: center; align-items: center; }
.modal.active { display: flex; }

.glass-card { 
    background: rgba(30, 30, 30, 0.95); padding: 2.5rem 2rem; border-radius: 20px; text-align: center; 
    width: 90%; max-width: 400px; color: #fff; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(255,255,255,0.05); 
}
.glass-card h2 { margin-bottom: 1.5rem; color: #fff; font-size: 1.5rem; }
.glow-text { text-shadow: 0 0 10px rgba(255, 255, 255, 0.3); }

/* 모달 애니메이션 */
.pop-anim { animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modern-input { width: 100%; height: 50px; padding: 0 15px; background: #222; color: #fff; border: 1px solid #444; border-radius: 12px; font-size: 1rem; margin-bottom: 15px;}
select.modern-input { appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 1rem top 50%; background-size: 0.65rem auto; }

.nickname-section { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.nickname-section input { margin-bottom: 0; flex: 1; }
.btn-dice { width: 50px; height: 50px; flex-shrink: 0; font-size: 1.5rem; padding: 0; display: flex; justify-content: center; align-items: center; border-radius: 12px; }

.btn { padding: 14px 20px; border: none; border-radius: 12px; font-weight: bold; cursor: pointer; color: white; font-size: 1rem; }
.btn.primary { background: var(--primary-color); }
.btn.secondary { background: #444; color: #eee; }
.btn-group { display: flex; gap: 10px; justify-content: center; }
.btn-group-vertical { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.lighter-btn { width: 100%; font-size: 1.2rem; transition: background 0.3s, box-shadow 0.3s; }
.hidden { display: none !important; }

/* 애니메이션 & 효과 */
.effect-btn { transition: transform 0.1s, filter 0.2s, box-shadow 0.2s; }
.effect-btn:hover { transform: scale(1.03); filter: brightness(1.1); }
.effect-btn:active { transform: scale(0.96); }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    70% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
.pulse-anim { animation: pulse 2s infinite; }

.toast { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); background: rgba(255, 87, 34, 0.9); color: white; padding: 12px 24px; border-radius: 30px; font-size: 0.95rem; z-index: 50; text-align: center; font-weight: bold; animation: fadeInOut 3s forwards; }
@keyframes fadeInOut { 0% { opacity: 0; transform: translate(-50%, -10px); } 10% { opacity: 1; transform: translate(-50%, 0); } 90% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }

/* ====== Age Modal 디자인 업그레이드 ====== */
.age-card {
    background: rgba(20, 20, 20, 0.85);
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 15px 35px rgba(0,0,0,0.8), inset 0 0 20px rgba(255, 119, 0, 0.1);
    padding: 3rem 2rem;
}

.age-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.age-card h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.age-subtext {
    color: #bbb;
    margin-bottom: 30px;
    font-size: 1rem;
    line-height: 1.4;
    padding: 0 10px;
}

.age-btn-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.age-btn-yes {
    background: linear-gradient(45deg, #ff7700, #ff3300);
    font-size: 1.15rem;
    padding: 16px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(255, 119, 0, 0.4);
    font-weight: 800;
    letter-spacing: 0.5px;
}

.age-btn-no {
    background: transparent;
    color: #666;
    font-size: 0.95rem;
    text-decoration: underline;
    border: none;
    box-shadow: none;
    padding: 10px;
}

.age-btn-no:hover {
    color: #aaa;
    transform: none;
    filter: none;
}