/* Base Styles and Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f5f0;
    background-image: url('../images/paper-texture.svg');
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Palatino Linotype', 'Book Antiqua', serif;
    font-weight: normal;
    color: #5a4b3c;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #d3c5a8;
    text-align: center;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #6d5c47;
}

p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Container */
.container {
    width: 80%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation Bar */
.navbar {
    background-color: #5a4b3c;
    color: #f8f5f0;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo i {
    margin-right: 10px;
    font-size: 1.8rem;
    color: #d3c5a8;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: #f8f5f0;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: #d3c5a8;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #d3c5a8;
    transition: width 0.3s;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

/* Hero Section */
.hero {
    background-color: #e9e2d5;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/hero-pattern.svg');
    opacity: 0.05;
    z-index: 0;
}

.hero .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-content {
    flex: 1;
    max-width: 500px;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.sudoku-preview {
    padding: 20px;
    background-color: #f8f5f0;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #d3c5a8;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background-color: #8b6e4e;
    color: #f8f5f0;
    text-decoration: none;
    font-size: 1.1rem;
    border-radius: 5px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-family: 'Georgia', serif;
}

.btn-primary:hover {
    background-color: #6d5c47;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    background-color: transparent;
    color: #8b6e4e;
    text-decoration: none;
    font-size: 1rem;
    border-radius: 5px;
    transition: all 0.3s;
    border: 1px solid #8b6e4e;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #8b6e4e;
    color: #f8f5f0;
}

/* Features Section */
.features {
    padding: 4rem 0;
    background-color: #f8f5f0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-item {
    text-align: center;
    padding: 2rem;
    background-color: #e9e2d5;
    border-radius: 10px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #8b6e4e;
}

/* How to Play Section */
.how-to-play {
    padding: 4rem 0;
    background-color: #e9e2d5;
}

.instructions {
    max-width: 800px;
    margin: 0 auto;
}

.instruction-step {
    display: flex;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.step-number {
    font-size: 1.8rem;
    color: #8b6e4e;
    font-weight: bold;
    margin-right: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f5f0;
    border-radius: 50%;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

/* Testimonials Section */
.testimonials {
    padding: 4rem 0;
    background-color: #f8f5f0;
}

.testimonials-slider {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.testimonial-item {
    padding: 2rem;
    background-color: #e9e2d5;
    border-radius: 10px;
    position: relative;
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 1.5rem;
    position: relative;
    padding: 0 1rem;
}

.testimonial-text::before, .testimonial-text::after {
    content: '"';
    font-size: 3rem;
    position: absolute;
    color: #d3c5a8;
}

.testimonial-text::before {
    top: -20px;
    left: 0;
}

.testimonial-text::after {
    bottom: -40px;
    right: 0;
}

.testimonial-author {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

.author-avatar {
    width: 50px;
    height: 50px;
    background-color: #8b6e4e;
    color: #f8f5f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
}

.author-info h4 {
    margin-bottom: 0.2rem;
}

.author-info p {
    margin-bottom: 0;
    color: #6d5c47;
    font-size: 0.9rem;
}

/* Newsletter Section */
.newsletter {
    padding: 4rem 0;
    background-color: #5a4b3c;
    color: #f8f5f0;
    text-align: center;
}

.newsletter h2 {
    color: #f8f5f0;
    border-bottom-color: #8b6e4e;
}

.newsletter-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.newsletter-form input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Georgia', serif;
}

.newsletter-form button {
    white-space: nowrap;
}

/* Footer */
.footer {
    background-color: #3c3227;
    color: #f8f5f0;
    padding: 2rem 0;
}

.footer .container {
    display: flex;
    flex-direction: column;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.footer-logo i {
    margin-right: 10px;
    font-size: 1.8rem;
    color: #d3c5a8;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: #f8f5f0;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #d3c5a8;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #5a4b3c;
    color: #f8f5f0;
    border-radius: 50%;
    transition: all 0.3s;
    text-decoration: none;
}

.footer-social a:hover {
    background-color: #8b6e4e;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #5a4b3c;
}

/* Celebration Screen Styles */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-in-out;
}

.celebration-container {
    background-color: #f8f5f0;
    padding: 3rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: scaleIn 0.5s ease-out;
}

.celebration-icon {
    font-size: 5rem;
    color: #8b6e4e;
    margin-bottom: 1.5rem;
    animation: bounce 2s infinite;
}

.celebration-container h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: none;
}

.solve-time {
    font-size: 1.2rem;
    margin: 1.5rem 0;
    font-weight: bold;
    color: #6d5c47;
}

.celebration-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.confetti {
    position: fixed;
    top: -10px;
    z-index: 3000;
    animation: fall linear forwards;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes fall {
    0% {
        top: -10px;
        transform: translateX(0) rotate(0deg);
    }
    100% {
        top: 100vh;
        transform: translateX(var(--x-offset, 0px)) rotate(var(--rotation, 0deg));
    }
}

/* Game Page Styles */
.game-container {
    padding: 2rem 0;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.difficulty-selector {
    padding: 10px 15px;
    background-color: #e9e2d5;
    border: 1px solid #d3c5a8;
    border-radius: 5px;
    font-family: 'Georgia', serif;
    font-size: 1rem;
    color: #5a4b3c;
}

.timer {
    font-size: 1.5rem;
    color: #5a4b3c;
    font-weight: bold;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 1px;
    background-color: #333;
    max-width: 500px;
    margin: 0 auto;
    border: 3px solid #5a4b3c;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.preview-grid {
    max-width: 300px;
}

.grid-cell {
    background-color: #f8f5f0;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.preview-grid .grid-cell {
    font-size: 1rem;
}

.grid-cell:hover {
    background-color: #e9e2d5;
}

.grid-cell.fixed {
    background-color: #e9e2d5;
    font-weight: bold;
    color: #5a4b3c;
}

.grid-cell.editable {
    background-color: #fff;
}

.grid-cell.selected {
    background-color: #d3c5a8;
}

.grid-cell.error {
    background-color: #f8d7da;
    color: #721c24;
}

.grid-cell.highlight {
    background-color: #e9d5b3;
}

/* 3x3 subgrid borders */
.grid-cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.grid-cell:nth-child(9n) {
    border-right: none;
}

.grid-cell:nth-child(n+19):nth-child(-n+27),
.grid-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 2rem auto;
}

.number-btn {
    padding: 15px;
    background-color: #e9e2d5;
    border: 1px solid #d3c5a8;
    border-radius: 5px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Georgia', serif;
}

.number-btn:hover {
    background-color: #d3c5a8;
    transform: translateY(-2px);
}

.number-btn.selected {
    background-color: #8b6e4e;
    color: #f8f5f0;
}

/* Page Styles */
.page-content {
    padding: 4rem 0;
}

.page-section {
    margin-bottom: 3rem;
}

/* About Page */
.about-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.about-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Contact Page */
.contact-info {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-email {
    display: inline-block;
    margin-top: 1rem;
    font-size: 1.2rem;
    color: #8b6e4e;
    text-decoration: none;
    transition: color 0.3s;
}

.contact-email:hover {
    color: #5a4b3c;
    text-decoration: underline;
}

/* Privacy Policy and Terms Pages */
.policy-content,
.terms-content {
    max-width: 800px;
    margin: 0 auto;
}

.policy-section,
.terms-section {
    margin-bottom: 2rem;
}

.policy-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.policy-table th,
.policy-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #d3c5a8;
}

.policy-table th {
    background-color: #e9e2d5;
    color: #5a4b3c;
}

.policy-table tr:hover {
    background-color: #f8f5f0;
}

/* Responsive Design */
@media (max-width: 992px) {
    .hero .container {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-image {
        justify-content: center;
        margin-top: 2rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .container {
        width: 90%;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .sudoku-grid {
        max-width: 350px;
    }
    
    .grid-cell {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .sudoku-grid {
        max-width: 300px;
    }
    
    .grid-cell {
        font-size: 1rem;
    }
}