*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.5;
    background-color: #f8fafc;
    color: #334155;
    padding: 20px;
}

h1 {
    font-size: 2.25rem;
    line-height: 1.1;
    margin-top: 0;
    margin-bottom: 0.5em;
    color: #1e293b;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.25;
    margin-top: 2em;
    margin-bottom: 1em;
    color: #1e293b;
}

h3 {
    font-size: 1.25rem;
    line-height: 1.25;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: #1e293b;
}

p {
    margin-top: 0;
    margin-bottom: 1em;
}

/* Architecture Diagram Styles */
.architecture-diagram {
    display: flex;
    flex-direction: column;
    gap: 80px; /* Space between rows for vertical connections */
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.diagram-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 120px; /* Space between components in a row for horizontal connections */
    position: relative;
}

.component-box {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    width: 280px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative; /* Essential for positioning pseudo-element lines */
    z-index: 2; /* Ensures boxes appear above connection lines */
}

.component-box h3 {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 0.5em;
    color: #1e293b;
}

.component-box p {
    font-size: 0.9rem;
    margin-top: 0;
    margin-bottom: 0.25em; /* Reduced margin for smaller text within boxes */
    color: #475569;
}

/* Specific Box Colors matching README mermaid diagram */
.component-box.frontend { background-color: #f9f; } /* pink */
.component-box.api-gateway { background-color: #bbf; } /* light blue */
.component-box.backend { background-color: #fbf; } /* light pink/purple */
.component-box.cdn { background-color: #afa; } /* light green */
.component-box.load-balancer { background-color: #afa; } /* light green */
.component-box.queue-system { background-color: #f9f; } /* pink */
.component-box.tool-engine { background-color: #bbf; } /* light blue */

/* Connection Lines using pseudo-elements */
.component-box::before,
.component-box::after {
    content: '';
    position: absolute;
    background-color: #94a3b8; /* Slate 400 for lines */
    z-index: 1; /* Lines appear below boxes, but above other content if z-index is lower */
}

/* Horizontal connection (to the right) */
.component-box.has-right-connection::after {
    width: 120px; /* Matches the gap between boxes */
    height: 2px;
    top: 50%;
    right: -120px; /* Extends from the right edge into the gap */
    transform: translateY(-50%);
}

/* Horizontal connection (to the left) - uses ::after if no right connection to avoid conflict */
.component-box.has-left-connection:not(.has-right-connection)::after {
    width: 120px; /* Matches the gap between boxes */
    height: 2px;
    top: 50%;
    left: -120px; /* Extends from the left edge into the gap */
    transform: translateY(-50%);
}

/* Vertical connection (downwards) */
.component-box.has-down-connection::before {
    width: 2px;
    height: 80px; /* Matches the gap between rows */
    bottom: -80px; /* Extends from the bottom edge into the gap */
    left: 50%;
    transform: translateX(-50%);
}