body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #000; /* Changed background to black */
    color: #333; /* This will be overridden by gradient for relevant elements */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    /* Apply rainbow gradient to text */
    background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: initial; /* Resetting color to allow gradient to show */
    font-size: 2.5em; /* Make it a bit larger for effect */
}

main {
    background-color: #333; /* Changed main content area to dark grey */
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    box-sizing: border-box; /* Include padding in element's total width and height */
}

/* Apply rainbow gradient to general text within main */
main p {
    background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: initial;
}

#pi-container {
    margin-top: 20px;
    overflow-x: auto; /* Enable horizontal scrolling if content is too wide */
    white-space: pre-wrap; /* Preserve whitespace and wrap text */
    word-wrap: break-word; /* Break long words */
}

#pi-digits {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1em;
    /* Apply rainbow gradient to pi digits */
    background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: initial; /* Resetting color to allow gradient to show */
    white-space: pre-wrap; /* Ensure preformatted text wraps */
    word-break: break-all; /* Break words at any character */
    margin: 0; /* Remove default margin from pre tag */
}

footer {
    margin-top: 30px;
    text-align: center;
    color: #666; /* Keep footer text subtle, not rainbow */
    font-size: 0.9em;
}