:root {
    --primary: #7c3aed; /* Purple for hover and accents */
    --secondary: #6b21a8; /* Darker purple */
    --text-dark: #333; /* Dark text for body */
    --text-light: #fff; /* White text for hero/footer */
    --shadow: 0 6px 12px rgba(0, 0, 0, 0.2); /* Shadow for depth */
    --transition: all 0.3s ease-in-out; /* Smooth transitions */
}

/* Added to prevent horizontal scrolling */
html, body {
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit; /* Ensure consistent sizing */
}

body {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-dark);
    position: relative;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: transparent;
    margin: 0;
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    max-width: 100vw; /* Added to prevent header overflow */
    overflow-x: hidden; /* Added to prevent header overflow */
}

.header-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center; /* Centers logo */
    align-items: center;
    padding: 0 20px;
    position: relative; /* For button positioning */
}

.header-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.header-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.header-brand a:hover {
    color: var(--primary);
}

.header-brand .brand-text {
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-brand .brand-text span {
    font-size: 1.8rem;
    font-weight: 700;
}

.header-brand .cross {
    font-size: 1.6rem;
    color: var(--primary);
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.brand-logo {
    width: 100px;
    height: 50px;
    object-fit: contain;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7); /* 0.5 = 50% transparent */
    font-size: 1.5rem;
    transition: var(--transition);
    position: absolute;
    right: 30px;
    margin-top: 30px;
}

.icon-button2 {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7); /* 0.5 = 50% transparent */
    font-size: 1rem;
    transition: var(--transition);
    position: absolute;
    left: 20px;
    margin-top: 30px;
}

.icon-button:hover {
    color: var(--primary);
}

footer {
    background-color: rgba(255, 255, 255, 0.9);
    color: #a855f7; /* Original purple text */
    padding: 2px 20px; /* Compact padding */
    text-align: center;
    border: none;
    box-shadow: none;
    position: relative;
    width: 100%;
    z-index: 1000;
    max-width: 100vw; /* Added to prevent footer overflow */
    overflow-x: hidden; /* Added to prevent footer overflow */
}

.footer-content {
    display: flex;
    flex-direction: row; /* Logo to left of text/icons */
    align-items: center; /* Vertically centers content */
    justify-content: center; /* Centers entire group */
    gap: 0px; /* Compact debacle */
    max-width: 1200px; /* Matches header */
    margin: 0 auto;
}

.footer-logo {
    display: flex;
    align-items: center; /* Vertically centers logo */
    flex-shrink: 0; /* Prevents logo shrinking */
    width: 100px;
}

.footer-text-and-icons {
    display: flex;
    flex-direction: column; /* Stacks text and icons */
    align-items: center; /* Centers text/icons */
    gap: 6px; /* Compact spacing */
}

.footer-brand-logo {
    width: 100px; /* CHANGE THIS LINE FOR LOGO WIDTH */
    height: 90px; /* CHANGE THIS LINE FOR LOGO HEIGHT */
    object-fit: contain;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px; /* Original icon spacing */
}

.social-links a.social-icon {
    color: #fff; /* Original white icons */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.social-links a.social-icon:hover {
    color: var(--primary); /* Purple hover */
}

.social-links i {
    font-size: 20px;
    color: inherit;
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-family: "Font Awesome 6 Brands", "Font Awesome 6 Solid", sans-serif;
}

.social-links .icon-fallback {
    display: none;
    font-size: 14px;
    margin-left: 5px;
    font-family: 'Roboto', sans-serif;
}

.social-links i:empty + .icon-fallback {
    display: inline;
}

main {
    width: 100%;
    padding-top: 0;
    min-height: calc(100vh - 120px);
    max-width: 100vw; /* Added to prevent overflow */
    overflow-x: hidden; /* Added to prevent overflow */
}

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.5rem 0; /* Adjusted to prevent overflow */
    background: none; /* Modified for lazy loading */
    transition: none; /* Remove transition for lazy loading */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-image: url('images/placeholder.jpg'); /* Placeholder for lazy loading */
    z-index: 0;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero > * {
    position: relative;
    z-index: 2;
    max-width: 90%;
}

h1 {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 1rem 0;
    font-weight: 400;
}

.verse-container {
    padding: 20px;
    border-radius: 10px;
    margin: 0px auto;
    max-width: 90%;
    text-align: center;
}

.main-verse {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.verse-reference {
    font-size: 1rem;
    font-style: italic;
}

.verse-message {
    font-size: 0.9rem;
    margin-top: 10px;
}

.personalized-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    margin: 1rem 0;
    min-width: 150px;
    transition: var(--transition);
}

.personalized-btn:hover,
.personalized-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--六);
    transform: scale(1.05);
}

.choice-section {
    display: none;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
    animation: slideIn 0.5s ease-out;
}

.choice-section.active {
    display: flex;
}

.choice-section h2 {
    color: var(--text-light);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.choice-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.choice-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
    min-height: 48px;
}

.choice-btn:hover,
.choice-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
    transform: scale(1.05);
}

.mood-section {
    display: none;
    max-width: 90%;
    margin: 1rem auto;
    animation: slideIn 0.5s ease-out;
}

.mood-section.active {
    display: block;
}

.mood-section h2 {
    color: var(--text-light);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.emotion-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns for 3x2 layout */
    gap: 0.5rem;
    max-width: 100%; /* Modified to prevent overflow */
    width: 100%; /* Modified to fit container */
    justify-items: center;
    padding: 0 0.5rem; /* Added to prevent edge overflow */
}

.emotion-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    transition: var(--transition);
    text-decoration: none;
    width: 100px; /* Original size for desktop */
    height: 70px; /* Original size for desktop */
    justify-content: center;
}

.emotion-btn:hover,
.emotion-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
    transform: scale(1.05);
}

.emotion-btn span {
    font-size: 1.2rem;
    text-decoration: none;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .header-brand a {
        font-size: 1.4rem;
    }
    .header-brand .cross {
        font-size: 1.2rem;
    }
    .brand-logo {
        width: 80px;
        height: 40px;
    }
    .icon-button {
        font-size: 1.2rem;
    }
    .footer-brand-logo {
        width: 100px; /* CHANGE THIS LINE FOR LOGO WIDTH */
        height: 75px; /* CHANGE THIS LINE FOR LOGO HEIGHT */
    }
    .hero {
        padding: 0.5rem 0; /* Added to match main */
    }
    .verse-container {
        max-width: 95%; /* Added to prevent overflow */
    }
    .emotion-buttons {
        grid-template-columns: repeat(3, 1fr); /* Maintain 3x2 layout */
        gap: 0.4rem;
        max-width: 100%; /* Ensure no overflow */
    }
    .emotion-btn {
        width: 90px; /* Shrink for mobile */
        height: 60px; /* Shrink forモバイル */
        font-size: 0.7rem;
        padding: 0.3rem;
    }
    .emotion-btn span {
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    .header-brand a {
        font-size: 1.2rem;
    }
    .header-brand .cross {
        font-size: 1rem;
    }
    .brand-logo {
        width: 60px;
        height: 30px;
    }
    .icon-button {
        font-size: 1rem;
    }
    .footer-content {
        flex-direction: column; /* Stack logo, text, icons */
        align-items: center; /* Absolute center */
        gap: 8px; /* Compact spacing */
    }
    .footer-text-and-icons {
        align-items: center; /* Center text/icons */
    }
    .footer-brand-logo {
        width: 100px; /* CHANGE THIS LINE FOR LOGO WIDTH */
        height: 75px; /* CHANGE THIS LINE FOR LOGO HEIGHT */
    }
}

@media (max-width: 480px) {
    .emotion-buttons {
        grid-template-columns: repeat(3, 1fr); /* Maintain 3x2 layout */
        gap: 0.3rem;
    }
    .emotion-btn {
        width: 90px; /* Further shrink for small screens */
        height: 50px; /* Further shrink for small screens */
        font-size: 0.8rem;
        padding: 0.2rem;
    }
    .emotion-btn span {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .header-brand a {
        font-size: 1rem;
    }
    .header-brand .cross {
        font-size: 0.9rem;
    }
    .brand-logo {
        width: 50px;
        height: 25px;
    }
    .icon-button {
        font-size: 0.9rem;
    }
    .footer-content {
        padding: 0 10px; /* Matches header mobile padding */
    }
    .footer-brand-logo {
        width: 100px; /* CHANGE THIS LINE FOR LOGO WIDTH */
        height: 75px; /* CHANGE THIS LINE FOR LOGO HEIGHT */
    }
    .emotion-buttons {
        grid-template-columns: repeat(3, 1fr); /* Maintain 3x2 layout */
        gap: 0.2rem;
    }
    .emotion-btn {
        width: 90px; /* Further shrink for very small screens */
        height: 50px; /* Further shrink for very small screens */
        font-size: 0.7rem;
        padding: 0.15rem;
    }
    .emotion-btn span {
        font-size: 0.8rem;
    }
}

.cross1 {
    font-size: 71px !important; /* Large size */
    color: white !important;    /* White color */
    line-height: 1 !important;
    display: inline-block !important;
    margin-bottom: 50px !important;
    padding: 0 !important;
}

.fact-section {
    margin: 40px 0px 0px 0px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    max-width: 600px;
    text-align: center;
    color: #333;
}

.fact-section p {
    font-size: 0.7em;
    line-height: 1.5;
    margin: 0px;
}

@media (max-width: 768px) {
    .fact-section {
        margin: 30px 0px 0px 0px;
        padding: 15px;
        max-width: 90%;
    }
    .fact-section p {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .fact-section {
        padding: 10px;
    }
    .fact-section p {
        font-size: 0.7em;
    }
}