/* Global Styles */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #4338CA;
    --secondary: #8B5CF6;
    --accent: #EC4899;
    --dark: #1F2937;
    --light: #F9FAFB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
    background-color: #F9FAFB;
    color: #1F2937;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* Custom Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Reveal Animation on Scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Game Board Styles */
#game-board {
    display: grid;
    gap: 2px;
    background-color: #E5E7EB;
    padding: 12px;
    border-radius: 16px;
    box-shadow: inset 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

/* Cell Styles */
.cell {
    background-color: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    min-width: 32px;
    min-height: 32px;
    font-size: clamp(14px, 5vw, 18px);
    transition: all 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.cell-revealed {
    background-color: #F3F4F6;
    border: 1px solid #D1D5DB;
    cursor: default;
    box-shadow: none;
    transform: scale(0.98);
}

.cell-flagged {
    background-color: #FEE2E2;
    position: relative;
    border-color: var(--danger);
}

.cell-flagged::before {
    content: '🚩';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(16px, 6vw, 20px);
    animation: bounce 0.5s ease;
}

.cell-mine::before {
    content: '💣';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(16px, 6vw, 20px);
    animation: shake 0.3s ease;
}

/* Number Colors */
.cell-number-1 {
    color: #0000ff;
}

.cell-number-2 {
    color: #008000;
}

.cell-number-3 {
    color: #ff0000;
}

.cell-number-4 {
    color: #000080;
}

.cell-number-5 {
    color: #800000;
}

.cell-number-6 {
    color: #008080;
}

.cell-number-7 {
    color: #000000;
}

.cell-number-8 {
    color: #808080;
}

/* Hover Effects */
.cell:not(.cell-revealed):hover {
    background-color: #d0d0d0;
}

/* Button Hover Effects */
button {
    transition: all 0.2s ease;
}

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

/* Form Input Styles */
input[type="text"],
input[type="email"],
textarea {
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Responsive Game Board */
@media (max-width: 768px) {
    #game-board {
        max-width: 100%;
        overflow-x: auto;
    }
}

/* Hard Mode Cell Adjustments */
.hard-mode {
    gap: 1px !important;
}

.hard-mode .cell {
    min-width: 22px !important;
    min-height: 22px !important;
    font-size: clamp(12px, 4vw, 14px) !important;
}

.hard-mode .cell-flagged::before,
.hard-mode .cell-mine::before {
    font-size: clamp(14px, 5vw, 16px) !important;
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .cell {
        border-width: 2px;
    }
    .cell-revealed {
        border-width: 1px;
    }
}

/* Print Styles */
@media print {
    header,
    nav,
    footer,
    button {
        display: none;
    }
    body {
        background: white;
        color: black;
    }
}