body {
    background-color: #161616; /* Grey background */
    font-family: 'Press Start 2P', 'Courier New', monospace; /* Pixel-style font with fallback */
    text-align: center;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Flexible height */
    overflow-y: auto; /* Allow vertical scrolling */
    position: relative; /* For positioning stars */
    color: #ffffff;
}

header {
    margin-top: 40px;
    position: relative;
    z-index: 2;
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
    transform: translateX(-30px);
}

.title-logo {
    height: 80px;
    max-height: 80px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(33, 150, 243, 0.5));
    margin-right: -10px;
    display: block;
}

h1 {
    color: #ffffff;
    font-size: 1.5rem;
    margin: 0;
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px rgba(33, 150, 243, 0.7), 0 0 35px rgba(33, 150, 243, 0.7), 0 0 40px rgba(33, 150, 243, 0.7), 0 0 50px rgba(33, 150, 243, 0.7), 0 0 75px rgba(33, 150, 243, 0.7);
    animation: glow 3s ease-in-out infinite alternate;
}

h1 .mobile-break-title {
    display: none;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px rgba(33, 150, 243, 0.7), 0 0 35px rgba(33, 150, 243, 0.7), 0 0 40px rgba(33, 150, 243, 0.7), 0 0 50px rgba(33, 150, 243, 0.7), 0 0 75px rgba(33, 150, 243, 0.7);
    }
    to {
        text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff, 0 0 40px rgba(33, 150, 243, 0.9), 0 0 70px rgba(33, 150, 243, 0.9), 0 0 80px rgba(33, 150, 243, 0.9), 0 0 100px rgba(33, 150, 243, 0.9), 0 0 150px rgba(33, 150, 243, 0.9);
    }
}

@keyframes glow-mobile-subtle {
    from {
        text-shadow: 0 0 2px rgba(33, 150, 243, 0.3), 0 0 4px rgba(33, 150, 243, 0.2);
    }
    to {
        text-shadow: 0 0 4px rgba(33, 150, 243, 0.4), 0 0 8px rgba(33, 150, 243, 0.3);
    }
}

@keyframes shimmer-load {
    0% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
    25% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 8px rgba(33, 150, 243, 0.6), 0 0 15px rgba(33, 150, 243, 0.5), 0 0 25px rgba(33, 150, 243, 0.4);
    }
    50% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 12px rgba(33, 150, 243, 0.8), 0 0 20px rgba(33, 150, 243, 0.7), 0 0 35px rgba(33, 150, 243, 0.6);
    }
    75% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 8px rgba(33, 150, 243, 0.6), 0 0 15px rgba(33, 150, 243, 0.5), 0 0 25px rgba(33, 150, 243, 0.4);
    }
    100% {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 3px rgba(33, 150, 243, 0.3), 0 0 6px rgba(33, 150, 243, 0.2);
    }
}

h2 {
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 20px;
}

main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: rgba(30, 30, 40, 0.7);
    padding: 30px;
    border-radius: 8px;
    margin: 20px auto;
}

/* Form Styles */
#coincidence-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

label {
    display: block;
    color: #ffffff;
    font-size: 0.7rem;
    margin-bottom: 10px;
    text-align: center;
}

textarea {
    width: 100%;
    max-width: 600px;
    padding: 15px;
    background-color: rgba(22, 22, 22, 0.8);
    border: 2px solid #ffffff;
    color: #ffffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.6rem;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
    border-radius: 4px;
    min-height: 120px;
}

textarea:focus {
    outline: none;
    border-color: #9C27B0;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

button {
    background-color: #4A148C;
    color: #ffffff;
    border: 2px solid #ffffff;
    padding: 10px 20px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    margin: 10px;
    box-shadow: 0 0 12px rgba(156, 39, 176, 0.8), 0 0 18px rgba(156, 39, 176, 0.6), 0 0 24px rgba(156, 39, 176, 0.4);
}

button:hover {
    background-color: #38006B;
    box-shadow: 0 0 15px rgba(156, 39, 176, 1), 0 0 25px rgba(156, 39, 176, 0.8), 0 0 35px rgba(156, 39, 176, 0.6);
}

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

button:disabled {
    background-color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

#publish-btn {
    background-color: rgba(64, 224, 208, 0.7);
    border-color: rgba(64, 224, 208, 0.9);
    margin-top: 20px;
    box-shadow: 0 0 12px rgba(64, 224, 208, 0.6), 0 0 18px rgba(64, 224, 208, 0.4);
}

#publish-btn:hover {
    background-color: rgba(64, 224, 208, 0.85);
    border-color: rgba(64, 224, 208, 1);
    box-shadow: 0 0 15px rgba(64, 224, 208, 0.8), 0 0 25px rgba(64, 224, 208, 0.6);
}

#new-coincidence-btn {
    margin-top: 20px;
    background-color: rgba(138, 43, 226, 0.7);
    border-color: rgba(138, 43, 226, 0.9);
    align-self: center;
    box-shadow: 0 0 12px rgba(138, 43, 226, 0.6), 0 0 18px rgba(138, 43, 226, 0.4);
}

#new-coincidence-btn:hover {
    background-color: rgba(138, 43, 226, 0.85);
    border-color: rgba(138, 43, 226, 1);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.8), 0 0 25px rgba(138, 43, 226, 0.6);
}

/* Loading Display */
#loading-container {
    margin-top: 30px;
    text-align: center;
    padding: 40px 20px;
}

#loading-message {
    font-size: 0.8rem;
    color: #ffffff;
    margin-top: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* SEO Intro Paragraph */
.seo-intro {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    text-align: left;
}

.seo-intro p {
    font-size: 0.55rem;
    line-height: 1.6;
    color: rgba(200, 200, 200, 0.8);
    margin: 0;
    font-style: italic;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

/* Results Display */
#results-container {
    margin-top: 30px;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#interpretation-output {
    background-color: rgba(22, 22, 22, 0.8);
    border: 2px solid #ffffff;
    padding: 30px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #ffffff;
    word-wrap: break-word;
    min-height: 400px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    width: 100%;
    max-width: 600px;
}

/* Social Share Buttons */
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background-color: rgba(30, 30, 40, 0.5);
    border-radius: 4px;
    width: 100%;
    max-width: 600px;
}

.share-label {
    color: #ffffff;
    font-size: 0.6rem;
    margin-right: 5px;
}

.share-btn {
    padding: 8px 15px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.5rem;
    border: 2px solid #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    background-color: transparent;
    text-decoration: none;
    display: inline-block;
}

.share-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.share-facebook {
    border-color: #1877F2;
    color: #1877F2;
}

.share-facebook:hover {
    background-color: rgba(24, 119, 242, 0.2);
    box-shadow: 0 0 10px rgba(24, 119, 242, 0.5);
}

.share-twitter {
    border-color: #1DA1F2;
    color: #1DA1F2;
}

.share-twitter:hover {
    background-color: rgba(29, 161, 242, 0.2);
    box-shadow: 0 0 10px rgba(29, 161, 242, 0.5);
}

.share-linkedin {
    border-color: #0077B5;
    color: #0077B5;
}

.share-linkedin:hover {
    background-color: rgba(0, 119, 181, 0.2);
    box-shadow: 0 0 10px rgba(0, 119, 181, 0.5);
}

.share-copy {
    border-color: #9C27B0;
    color: #9C27B0;
}

.share-copy:hover {
    background-color: rgba(156, 39, 176, 0.2);
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

/* Colored titles for interpretation categories */
#interpretation-output .title-description {
    color: #FFD700; /* Gold */
    font-size: 0.9rem;
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

#interpretation-output .title-interpretation {
    color: #00FF88; /* Bright Green */
    font-size: 0.75rem;
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: bold;
}

#interpretation-output .title-life-message {
    color: #00BFFF; /* Deep Sky Blue */
    font-size: 0.75rem;
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: bold;
}

#interpretation-output .title-journal-prompt {
    color: #FF1493; /* Deep Pink */
    font-size: 0.75rem;
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: bold;
}

/* Error Display */
#error-container {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(244, 67, 54, 0.2);
    border: 2px solid #f44336;
    border-radius: 4px;
}

#error-message {
    color: #ff6b6b;
    font-size: 0.7rem;
    margin: 0;
}

/* Last Request Notification */
#last-request-notification {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 193, 7, 0.2);
    border: 2px solid #FFC107;
    border-radius: 4px;
    text-align: center;
    animation: pulse-notification 2s ease-in-out infinite;
}

#last-request-notification p {
    color: #FFC107;
    font-size: 0.7rem;
    margin: 0;
    font-weight: bold;
}

@keyframes pulse-notification {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 15px rgba(255, 193, 7, 0.8);
    }
}

/* Star Animation Styles */
#stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; /* Let clicks pass through to elements below */
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: white;
    z-index: 1;
}

.twinkle {
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.shooting-star {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: white;
    animation: shoot 2s linear forwards;
    z-index: 1;
}

@keyframes shoot {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(150px, 150px) scale(0.2);
        opacity: 0;
    }
}

/* Published Page Styles */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.featured-entry {
    background-color: rgba(22, 22, 22, 0.8);
    border: 2px solid #FFD700;
    padding: 20px;
    border-radius: 4px;
    text-align: left;
}

.featured-entry h3 {
    color: #FFD700;
    font-size: 0.7rem;
    margin-bottom: 10px;
}

.entries-directory {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.entry-item {
    background-color: rgba(22, 22, 22, 0.8);
    border: 2px solid #ffffff;
    padding: 20px;
    border-radius: 4px;
    text-align: left;
    transition: border-color 0.3s;
}

.entry-item:hover {
    border-color: #9C27B0;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.entry-date {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.5rem;
}

.entry-symbol {
    color: #00BFFF;
    font-size: 0.7rem;
    font-weight: bold;
}

.entry-excerpt {
    color: #ffffff;
    font-size: 0.6rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.entry-life-message {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.55rem;
    font-style: italic;
    margin-bottom: 10px;
}

.entry-full {
    margin-top: 12px;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    text-align: left;
    white-space: pre-line;
}

.btn-link {
    color: #9C27B0;
    font-size: 0.7rem;
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    border: 2px solid #9C27B0;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.btn-link:hover {
    background-color: rgba(156, 39, 176, 0.2);
}

/* Published Link */
.published-link {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 0.5rem 1rem;
    background-color: rgba(30, 30, 40, 0.9);
    border: 2px solid #ffffff;
    border-radius: 4px;
    color: #ffffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 0.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(79, 195, 247, 0.8), 0 0 12px rgba(79, 195, 247, 0.6), 0 0 16px rgba(79, 195, 247, 0.4);
}

.published-link:hover {
    background-color: rgba(156, 39, 176, 0.3);
    border-color: #9C27B0;
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 0 10px rgba(79, 195, 247, 1), 0 0 15px rgba(79, 195, 247, 0.8), 0 0 20px rgba(79, 195, 247, 0.6);
}

/* Responsive Design */
@media (max-width: 1024px) {
    /* iPad and tablet adjustments */
    .title-container {
        transform: translateX(-20px);
    }
    
    .title-logo {
        height: 60px;
        max-height: 60px;
        max-width: 60px;
        margin-right: -8px;
    }
    
    h1 {
        font-size: 1rem;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 3px rgba(33, 150, 243, 0.3), 0 0 6px rgba(33, 150, 243, 0.2);
        animation: shimmer-load 2s ease-in-out 1, glow-mobile-subtle 3s ease-in-out 2s infinite alternate;
    }
    
    h1 .mobile-break-title {
        display: none;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) and (pointer: coarse) {
    /* Reduce the glow on touch devices (e.g., iPad) to keep the title readable. */
    h1 {
        text-shadow: 0 0 6px rgba(255, 255, 255, 0.4), 0 0 10px rgba(33, 150, 243, 0.3);
        animation: glow-mobile-subtle 3s ease-in-out infinite alternate;
    }
}

@media (max-width: 768px) {
    .title-container {
        gap: 15px;
        transform: translateX(-15px);
    }
    
    .title-logo {
        height: 45px;
        max-height: 45px;
        max-width: 45px;
        margin-right: -6px;
    }
    
    h1 {
        font-size: 0.9rem;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 3px rgba(33, 150, 243, 0.3), 0 0 6px rgba(33, 150, 243, 0.2);
        animation: shimmer-load 2s ease-in-out 1, glow-mobile-subtle 3s ease-in-out 2s infinite alternate;
    }
    
    h1 .mobile-break-title {
        display: block;
    }
    
    h2 {
        font-size: 0.9rem;
    }
    
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    textarea {
        font-size: 0.5rem;
        min-height: 100px;
    }
    
    #interpretation-output {
        font-size: 0.75rem;
        line-height: 1.6;
        padding: 20px;
    }
    
    button {
        font-size: 0.6rem;
        padding: 12px 24px;
    }
    
    label {
        font-size: 0.6rem;
    }
    
    .published-link {
        font-size: 0.4rem;
        padding: 0.4rem 0.8rem;
    }
    
    .share-buttons {
        padding: 10px;
        gap: 8px;
    }
    
    .share-btn {
        font-size: 0.45rem;
        padding: 6px 12px;
    }
    
    .share-label {
        font-size: 0.5rem;
    }
}

@media (max-width: 480px) {
    .title-container {
        gap: 12px;
        transform: translateX(-40px);
    }
    
    .title-logo {
        height: 35px;
        max-height: 35px;
        max-width: 35px;
        margin-right: -5px;
    }
    
    h1 {
        font-size: 0.8rem;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 2px rgba(33, 150, 243, 0.3), 0 0 4px rgba(33, 150, 243, 0.2);
        animation: shimmer-load 2s ease-in-out 1, glow-mobile-subtle 3s ease-in-out 2s infinite alternate;
    }
    
    h1 .mobile-break-title {
        display: block;
    }
    
    .container {
        padding: 15px;
    }
    
    textarea {
        font-size: 0.45rem;
        padding: 10px;
        min-height: 80px;
    }
    
    #interpretation-output {
        font-size: 0.7rem;
        line-height: 1.9;
        padding: 15px;
        min-height: 250px;
    }
    
    button {
        font-size: 0.5rem;
        padding: 10px 20px;
    }
    
    .published-link {
        font-size: 0.35rem;
        padding: 0.3rem 0.6rem;
        bottom: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .published-link:hover {
        transform: translateX(-50%) scale(1.05);
    }
    
    .share-buttons {
        padding: 8px;
        gap: 6px;
        flex-direction: column;
    }
    
    .share-btn {
        font-size: 0.4rem;
        padding: 5px 10px;
        width: 100%;
        max-width: 200px;
    }
    
    .share-label {
        font-size: 0.45rem;
        margin-bottom: 5px;
    }
}

/* Pixel Oracle Home Button - Top Right Corner */
.home-button {
    position: fixed;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.35rem;
    transition: all 0.3s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: none;
    gap: 0.25rem;
    opacity: 0.6;
}

.home-button:hover {
    background: transparent;
    transform: scale(1.05);
    box-shadow: none;
}

.home-crystal {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.home-button:hover .home-crystal {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.home-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #ffffff;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.home-button:hover .home-tooltip {
    opacity: 1;
}

.home-url {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    color: rgba(200, 200, 200, 0.7);
    text-shadow: 
        0 0 3px rgba(200, 200, 200, 0.6),
        0 0 6px rgba(200, 200, 200, 0.4);
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.home-button:hover .home-url {
    color: rgba(255, 255, 255, 1);
    text-shadow: 
        0 0 5px rgba(255, 255, 255, 1),
        0 0 10px rgba(255, 255, 255, 0.8);
}

/* Responsive styles for home button */
@media (max-width: 1024px) {
    .home-button {
        padding: 0.25rem;
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.2rem;
        opacity: 0.5;
    }

    .home-crystal {
        width: 32px;
        height: 32px;
        opacity: 0.6;
    }

    .home-tooltip {
        font-size: 0.5rem;
        padding: 0.3rem 0.5rem;
    }

    .home-url {
        font-size: 0.35rem;
        opacity: 0.6;
    }
}

@media (max-width: 768px) {
    .home-button {
        padding: 0.2rem;
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.18rem;
        opacity: 0.55;
    }

    .home-crystal {
        width: 28px;
        height: 28px;
        opacity: 0.65;
    }

    .home-tooltip {
        font-size: 0.45rem;
        padding: 0.3rem 0.45rem;
    }

    .home-url {
        font-size: 0.3rem;
        opacity: 0.65;
    }
}

@media (max-width: 480px) {
    .home-button {
        padding: 0.15rem;
        top: 0.5rem;
        right: 0.5rem;
        border-width: 1px;
        border-radius: 4px;
        opacity: 0.6;
        gap: 0.15rem;
    }

    .home-crystal {
        width: 20px;
        height: 20px;
        opacity: 0.7;
    }

    .home-tooltip {
        font-size: 0.4rem;
        padding: 0.25rem 0.4rem;
    }

    .home-url {
        font-size: 0.25rem;
        opacity: 0.7;
    }
}

