* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    background-color: lightgray;
    margin: 0;
    font-family: Arial, sans-serif;
    overflow-x: hidden;
}

.heading-container {
    border: 4px solid #007bff;
    border-radius: 2px;
    padding: 1rem;
    text-align: center;
    margin: 1rem;
    background-color: #007bff;
    width: 90%;
    max-width: 1200px;
}

.heading-container h1 {
    color: white;
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

#container {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 70vh;
    border: 4px solid #007bff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    border-radius: 15px;
    padding: 2%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#inner-border {
    position: absolute;
    top: 5%;
    left: 2%;
    width: 25%;
    height: 90%;
    border: 4px solid red;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

#inner-border2 {
    position: absolute;
    top: 5%;
    right: 2%;
    width: 25%;
    height: 90%;
    border: 4px solid red;
    display: flex;
    justify-content: center;
    align-items: center;
}

.source-container {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
    align-items: center;
}

.source-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.packet {
    width: 0.8rem;
    height: 0.8rem;
    background-color: #28a745;
    border-radius: 50%;
    position: absolute;
    margin-left: -0.5rem;
    margin-top: -0.3rem;
    transition: opacity 2s;
}

svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

line {
    stroke: red;
    stroke-width: 2;
}

.text-display {
    position: absolute;
    background-color: aqua;
    padding: 0.2rem 0.5rem;
    border: 1px solid #007bff;
    border-radius: 3px;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

#buttonContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 90%;
    max-width: 1200px;
    margin: 1rem 0;
}

button {
    padding: 0.6rem 1.2rem;
    font-family: Arial, sans-serif;
    font-size: clamp(0.9rem, 2vw, 1rem);
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

#questionBox, #responseBox {
    display: none;
    flex-direction: column;
    position: fixed;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 400px;
    background-color: white;
    border: 3px solid #007bff;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

#questionBox textarea, #responseBox textarea {
    width: 100%;
    height: 4rem;
    margin-bottom: 0.5rem;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
}

#questionBox button, #responseBox button {
    width: 5rem;
    margin: 0.3rem auto;
}

#instructionsModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#instructionsContent {
    background-color: white;
    border-radius: 10px;
    padding: 1.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

#instructionsContent h2 {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #007bff;
}

#instructionsContent p {
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    color: #333;
}

#closeBtn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
}

#instructionsBtn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.6rem 1rem;
    cursor: pointer;
}

.internet-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

footer {
    background-color: #007bff;
    color: white;
    text-align: center;
    padding: 0.5rem;
    width: 100%;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    position: relative;
    margin-top: auto;
}

footer a {
    color: white;
    text-decoration: none;
}

.animated-text {
    position: absolute;
    background-color: yellow;
    padding: 0.2rem 0.5rem;
    border: 1px solid #007bff;
    border-radius: 3px;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    transition: opacity 2s;
    pointer-events: none;
}

.questions {
    transition: transform ease-in-out 2.6s;
}

.hidden {
    display: none;
}

.cloud {
    position: absolute;
    width: 15vw;
    max-width: 200px;
    height: 5vw;
    max-height: 60px;
    background: aqua;
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.text-display2 {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
}

.source-item img {
    width: 100%;
    max-width: 100px;
}

#inner-border2 img {
    width: 100%;
    max-width: 200px;
}

.internet-container img {
    width: 100%;
    max-width: 100px;
}

/* Responsive Headings */
h3 {
    font-weight: bold;
    color: #007bff;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
}

h3.clients {
    position: absolute;
    top: 1%;
    left: 40%;
}

h3.internet {
    position: relative;
    top: 1%;
    left: 50%;
    transform: translateX(-50%);
}

h3.server {
    position: absolute;
    top: 1%;
    right: 40%;
}

/* Responsive Arrows */
#image1, #image4 {
    position: absolute;
    left: 25%;
    top: 20%;
    width: clamp(80px, 10vw, 120px);
    height: auto;
}

#image2, #image5 {
    position: absolute;
    left: 25%;
    bottom: 20%;
    width: clamp(80px, 10vw, 120px);
    height: auto;
}

#image3, #image6 {
    position: absolute;
    left: 45%;
    top: 50%;
    width: clamp(80px, 10vw, 120px);
    height: auto;
}

/* Media Queries */
@media (max-width: 1024px) {
    #container {
        height: 60vh;
    }

    #inner-border, #inner-border2 {
        width: 30%;
    }

    .source-item img {
        max-width: 80px;
    }

    #inner-border2 img {
        max-width: 150px;
    }
}

@media (max-width: 768px) {
    #container {
        height: 50vh;
        flex-direction: column;
        padding: 1rem;
    }

    #inner-border {
        width: 40%;
        height: 40%;
        top: 5%;
        left: 5%;
    }

    #inner-border2 {
        width: 40%;
        height: 40%;
        bottom: 5%;
        right: 5%;
        top: auto;
    }

    .internet-container {
        top: 50%;
        transform: translate(-50%, -50%);
    }

    h3.clients {
        top: 2%;
        left: 5%;
    }

    h3.internet {
        top: 45%;
    }

    h3.server {
        bottom: 2%;
        right: 5%;
        top: auto;
    }

    #image1, #image4 {
        left: 20%;
        top: 15%;
        width: clamp(60px, 8vw, 100px);
    }

    #image2, #image5 {
        left: 20%;
        bottom: 15%;
        width: clamp(60px, 8vw, 100px);
    }

    #image3, #image6 {
        left: 40%;
        top: 45%;
        width: clamp(60px, 8vw, 100px);
    }
}

@media (max-width: 480px) {
    .heading-container {
        padding: 0.5rem;
    }

    #container {
        height: 80vh;
        padding: 0.5rem;
    }

    #inner-border, #inner-border2 {
        width: 45%;
        height: 35%;
    }

    .source-item img {
        max-width: 60px;
    }

    #inner-border2 img {
        max-width: 120px;
    }

    .internet-container img {
        max-width: 80px;
    }

    #questionBox, #responseBox {
        width: 90%;
        bottom: 15%;
    }

    #buttonContainer {
        gap: 0.5rem;
    }

    button {
        padding: 0.5rem 1rem;
        font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    }

    footer {
        font-size: clamp(0.8rem, 1.8vw, 1rem);
        padding: 0.5rem;
    }

    #image1, #image4 {
        left: 15%;
        top: 10%;
        width: clamp(50px, 7vw, 80px);
    }

    #image2, #image5 {
        left: 15%;
        bottom: 10%;
        width: clamp(50px, 7vw, 80px);
    }

    #image3, #image6 {
        left: 35%;
        top: 40%;
        width: clamp(50px, 7vw, 80px);
    }
}