/* System Fonts & Colors */
:root {
    --system-blue: #007AFF;
    --system-background: #F2F2F7;
    --system-secondary: #FFFFFF;
    --system-text: #1C1C1E;
    --system-border: rgba(0, 0, 0, 0.1);
    --block-border: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
    --system-background: #000000;
    --system-secondary: #1C1C1E;
    --system-text: #FFFFFF;
    --system-border: rgba(255, 255, 255, 0.1);
    --block-border: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--system-background);
    color: var(--system-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header Styling */
header {
    background-color: var(--system-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 12px 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 600;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background-color: var(--system-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Main Game Area */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-area {
    width: 500px;
    margin: 0 auto;
}

.game-container {
    position: relative;
    width: 500px;
    height: 500px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    width: 100%;
    height: 100%;
}

.block {
    width: 100%;
    height: 100%;
    background-color: transparent;
    border: 1px solid var(--block-border);
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 30px;
    min-height: 30px;
}

.block:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--shadow-color);
    z-index: 15;
    background-color: transparent;
}

.overlay-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
    pointer-events: none;
}

.overlay-image.hiding {
    transform: translateX(100%);
    opacity: 0;
}

.overlay-image.showing {
    transform: translateX(0);
    opacity: 1;
}

/* Modal/Popup Styling */
#popup, .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.popup-content, .modal-content {
    background: var(--system-secondary);
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px var(--shadow-color);
    max-width: 500px;
    width: calc(100% - 40px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#popup-message {
    font-size: 24px;
    margin-bottom: 24px;
    line-height: 1.4;
    color: var(--system-text);
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 24px;
    color: var(--system-text);
}

.instruction-step p {
    font-size: 18px;
    line-height: 1.5;
}

#popup-close, #instructions-close {
    background-color: var(--system-blue);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

/* Footer */
footer {
    background-color: var(--system-secondary);
    text-align: center;
    padding: 10px 0;
    font-size: 14px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-area, .game-container {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    .header-container {
        flex-direction: column;
        gap: 10px;
    }

    .nav-buttons {
        width: 100%;
        justify-content: center;
    }
}

/* Dark Mode Toggle Button */
#dark-mode-toggle {
    padding: 8px 12px;
    font-size: 16px;
}

.mode-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .mode-icon {
    transform: rotate(360deg);
}
