body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #ffffff 10%, #d8ffe1 100%);
    color: #333;
    overflow-x: hidden;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

header {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2rem 6rem;
    text-align: center;
    border-bottom: 5px solid #97f8ff;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    overflow-wrap: break-word;
}

header h1 {
    margin: 0;
    font-size: 3rem;
    font-family: 'Dancing Script', cursive;
    animation: fadeIn 2s ease-in-out;
    word-wrap: break-word;
}

/* Updated container to avoid horizontal overflow */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}


main {
    flex: 1;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    margin: 2rem 1rem;
    overflow-y: auto;
}

.sidebar {
    width: 200px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 2rem;
    animation: fadeIn 2s ease-in-out;
    overflow: hidden;
}

.sidebar.left {
    margin-right: 1rem;
}

.sidebar.right {
    margin-left: 1rem;
}

.sidebar img {
    width: 100%;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
}

.sidebar h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #ff758c;
}

.right-sidebar h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #ff758c;
}

.sidebar p {
    margin: 0.5rem 0;
    color: #555;
}

section {
    padding: 3rem 1rem;
    margin: 2rem auto;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 1.5s ease-out;
    position: relative;
    z-index: 2;
}

h2 {
    text-align: center;
    color: #444;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    position: relative;
    display: inline-block;
}

h2:after {
    content: '';
    width: 60px;
    height: 5px;
    background: #ff758c;
    display: block;
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

#about img {
    display: block;
    max-width: 250px;
    margin: 0.5rem auto 1.5rem;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s;
}

#about img:hover {
    transform: scale(1.1);
}

.hidden {
    display: none;
}

#details, .hobby-details {
    text-align: left;
    margin-top: 1rem;
    animation: fadeIn 1s ease;
}

#details h3, .hobby-details h3 {
    color: #ff758c;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

#details p, .hobby-details p {
    margin: 0.5rem 0;
}

.hobby {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    background: linear-gradient(135deg, #ffffff 0%, #e6faeb 100%);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.hobby:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.hobby:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
}

.hobby:hover:before {
    opacity: 1;
}

.hobby img {
    max-width: 150px;
    margin-right: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.hobby:hover img {
    transform: rotate(5deg) scale(1.1);
}

.hobby-info h3 {
    margin: 0 0 0.5rem;
    color: #ff758c;
    font-size: 1.5rem;
}

.hobby-info p {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

.hobby-info audio {
    margin-top: 0.5rem;
    width: 100%;
}

.hobby-link {
    text-decoration: none;
    color: inherit;
}

.social-icon {
    width: 30px;
    height: 30px;
    margin: 0 0.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.social-icon:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

footer {
    text-align: center;
    padding: 1rem 0;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    position: relative;
    z-index: 1;
}

footer .contact-info {
    margin-bottom: 1rem;
}

footer p {
    margin: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.pea {
    position: absolute;
    width: 20px;
    height: 20px;
    font-size: 20px;
    animation: fall 5s linear infinite;
}

@keyframes fall {
    0% { top: -20px; }
    100% { top: 100%; }
}

/* 경고문 */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.popup-content {
    position: relative;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.popup-content p {
    margin: 0;
    font-size: 1.2rem;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #e00000;
    transition: color 0.3s;
    user-select: none; /* Prevent text selection */
}

.close-btn:hover {
    color: #333;
}

.ai-chat-img {
    max-width: 100%;
    margin-top: 1rem;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s;
}

.ai-chat-img:hover {
    transform: scale(1.05);
}

.chat-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.9);
    padding-top: 60px;
}

.chat-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    position: relative;
}

.close-chat-btn {
    color: red;
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
}

.close-chat-btn:hover,
.close-chat-btn:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

#chatWindow {
    display: flex;
    flex-direction: column;
    height: 400px;
}

#messages {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
}

#userInput {
    width: calc(100% - 50px);
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-right: 0.5rem;
}

button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    background-color: #5cb85c;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #4cae4c;
}

/* 모바일 화면 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0;
    }

    .sidebar {
        width: 80%;
        margin: 1rem;
    }

    main {
        flex: 1;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 20px;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
        margin: 2rem 1rem;
        overflow-y: auto;
    }

    main {
        margin: 1rem 0;
    }

    h2 {
        font-size: 2rem;
    }

    .hobby-info h3 {
        font-size: 1.2rem;
    }

    .hobby-info p {
        font-size: 0.9rem;
    }

    header {
        width: 92%;
        height: auto;
        padding: 1rem;
    }

    header h1 {
        font-size: 2.5rem;
    }
}

/* 태블릿 화면 */
@media (min-width: 769px) and (max-width: 1040px) {
    .container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0 1rem;
    }

    header h1 {
        font-size: 2.8rem;
    }

    h2 {
        font-size: 2.2rem;
    }

    .sidebar {
        width: 45%;
        margin: 1rem auto;
    }

    main {
        margin: 1rem auto;
        width: 90%;
    }

    .hobby-info h3 {
        font-size: 1.4rem;
    }

    header {
        width: 100%;
        height: auto;
        padding: 1rem;
    }

    .hobby-info p {
        font-size: 1rem;
    }
}