/* Math Match Game Styles */

body {
    font-family: 'Comic Sans MS', 'Chalkboard', 'Arial Rounded MT Bold', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f5e9d7;
    margin: 0;
    padding: 20px;
    background-image: linear-gradient(45deg, rgba(255, 204, 153, 0.1) 25%, transparent 25%, transparent 50%, rgba(255, 204, 153, 0.1) 50%, rgba(255, 204, 153, 0.1) 75%, transparent 75%, transparent);
    background-size: 40px 40px;
}

/* Header container for title and auth buttons */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 900px;
    margin-bottom: 20px;
}

h1 {
    color: #4a3c31;
    font-size: 48px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* Auth buttons styling */
.auth-buttons {
    display: flex;
    align-items: center;
}

#auth-button, #sign-out-button {
    padding: 10px 15px;
    font-size: 16px;
    background-color: #6cc644;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

#auth-button:hover, #sign-out-button:hover {
    transform: scale(1.05);
    background-color: #7ed957;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-display-name {
    font-size: 16px;
    color: #4a3c31;
    font-weight: bold;
}

/* Authentication Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: #f5e9d7;
    margin: 10% auto;
    padding: 30px 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalFadeIn 0.3s;
}

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

.close-button {
    color: #4a3c31;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover {
    color: #f5c6a5;
}

#auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #d9c8a9;
    margin-left: -10px;
    margin-right: -10px;
}

.auth-tab {
    background-color: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    color: #4a3c31;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.auth-tab.active {
    color: #6cc644;
    border-bottom: 3px solid #6cc644;
    font-weight: bold;
}

.auth-tab:hover:not(.active) {
    background-color: #f7d1b5;
    color: #4a3c31;
}

.auth-form h2 {
    color: #4a3c31;
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    font-size: 28px;
    font-family: 'Comic Sans MS', 'Chalkboard', 'Arial Rounded MT Bold', sans-serif;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a3c31;
    font-weight: bold;
    font-size: 18px;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid #d9c8a9;
    border-radius: 8px;
    font-size: 16px;
    background-color: #fffef0;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #6cc644;
    outline: none;
}

.auth-submit-button {
    width: 100%;
    padding: 14px;
    background-color: #6cc644;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.2s, transform 0.2s;
    font-family: 'Comic Sans MS', 'Chalkboard', 'Arial Rounded MT Bold', sans-serif;
}

.auth-submit-button:hover {
    background-color: #7ed957;
    transform: scale(1.02);
}

.form-error {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    min-height: 20px;
}

.form-success {
    color: #27ae60;
    font-size: 14px;
    margin-top: 5px;
    min-height: 20px;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: #6cc644;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.2s;
    font-weight: bold;
}

.auth-links a:hover {
    color: #4a3c31;
    text-decoration: underline;
}

.menu-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    width: 100%;
    max-width: 800px;
}

#level-selection, #settings-menu, #tier-selection, #level-selection-tier {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.level-button, .settings-button, .save-settings, .back-button, .main-button {
    margin: 5px;
    padding: 12px 24px;
    font-size: 16px;
    background-color: #f5c6a5;
    color: #4a3c31;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.main-button {
    width: 200px;
    margin: 10px;
    font-size: 18px;
    padding: 15px 30px;
    background-color: #6cc644;
    color: white;
}

.main-button:hover {
    background-color: #7ed957;
    transform: scale(1.05);
}

.level-button:hover, .settings-button:hover, .save-settings:hover, .back-button:hover {
    transform: scale(1.05);
    background-color: #f7d1b5;
}

#game-board {
    display: grid;
    gap: 15px;
    margin: 20px auto;
    max-width: 800px;
    justify-content: center;
}

.card {
    width: 120px;
    height: 120px;
    background-color: #f5e9d7;
    border: 3px solid #d9c8a9;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #4a3c31;
    cursor: pointer;
    transition: transform 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 5px;
    flex: 0 0 auto;
}

.card:hover {
    transform: scale(1.05);
}

.card.matched {
    background-color: #a8e4a0;
    cursor: default;
}

.card.selected {
    background-color: #f7d1b5;
}

#info {
    display: flex;
    justify-content: space-between;
    width: 400px;
    margin-top: 10px;
    background-color: #f5c6a5;
    padding: 10px 20px;
    border-radius: 15px;
    color: #4a3c31;
    font-size: 18px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#message {
    font-size: 20px;
    margin-top: 10px;
    color: #4a3c31;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#restart-button, #back-to-levels, #back-to-main-during-game {
    margin-top: 10px;
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}



#restart-button {
    background-color: #6cc644;
    color: white;
}

#back-to-levels, #back-to-main-during-game {
    background-color: #f5c6a5;
    color: #4a3c31;
    margin-left: 10px;
}

#restart-button:hover, #back-to-levels:hover, #back-to-main-during-game:hover {
    transform: scale(1.05);
}

#restart-button:hover {
    background-color: #7ed957;
}

#back-to-levels:hover, #back-to-main-during-game:hover {
    background-color: #f7d1b5;
}

p {
    color: #4a3c31;
    font-size: 18px;
    margin: 10px 0;
}

#button-container {
    margin-top: 10px;
}

.settings-option {
    margin: 10px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.settings-option label {
    margin-right: 10px;
    color: #4a3c31;
    font-size: 16px;
    min-width: 150px;
}

.settings-note {
    font-size: 14px;
    color: #8a7a66;
    font-style: italic;
    margin-left: 10px;
}

.settings-info {
    background-color: #f7d1b5;
    border-radius: 10px;
    padding: 10px 15px;
    margin: 10px 0;
    width: 100%;
}

.settings-info p {
    font-size: 16px;
    margin: 5px 0;
    color: #4a3c31;
    font-weight: bold;
}

.settings-info ul {
    margin: 5px 0;
    padding-left: 20px;
}

.settings-info li {
    font-size: 14px;
    color: #4a3c31;
    margin: 3px 0;
}

/* Settings notification styles */
.settings-notification {
    background-color: #ffe9c8;
    border: 2px solid #f5c6a5;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    width: 100%;
    color: #4a3c31;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: opacity 1s ease;
}

.settings-notification h4 {
    margin: 0 0 10px 0;
    color: #e67e22;
    font-size: 18px;
}

.settings-notification ul {
    margin: 10px 0;
    padding-left: 20px;
}

.settings-notification li {
    margin: 5px 0;
    font-size: 14px;
}

.settings-notification p {
    margin: 10px 0 0 0;
    font-style: italic;
    font-size: 14px;
}

.settings-notification.fade-out {
    opacity: 0;
}

.settings-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #6cc644;
}

.settings-option select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #d9c8a9;
    background-color: #f5e9d7;
    color: #4a3c31;
    font-size: 16px;
}

/* Tier selection styles */
.tiers-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.tier-card {
    width: 220px;
    padding: 20px;
    background-color: #f5e9d7;
    border: 3px solid #d9c8a9;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}

.tier-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.tier-card h3 {
    color: #4a3c31;
    margin-top: 0;
    font-size: 24px;
}

.tier-card p {
    color: #6a584b;
    font-size: 14px;
}

.tier-card.locked {
    opacity: 0.7;
    background-color: #e5d9c7;
    cursor: not-allowed;
}

.lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
}

.lock-icon-small {
    font-size: 14px;
    margin-left: 5px;
}

.level-range {
    font-weight: bold;
    color: #4a3c31;
    margin-top: 15px;
}

/* Level grid for tier selection */
.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
    width: 100%;
    max-width: 600px;
}

.level-button.locked {
    opacity: 0.7;
    background-color: #e5d9c7;
    cursor: not-allowed;
}

/* Settings sections */
.settings-section {
    background-color: #f5e9d7;
    border-radius: 15px;
    padding: 15px 25px;
    margin: 10px 0;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    color: #4a3c31;
    margin-top: 0;
    border-bottom: 1px solid #d9c8a9;
    padding-bottom: 5px;
}

/* Animation styles */

/* Match animation */
.match-pulse {
    animation: pulse 1.5s ease-in-out;
    box-shadow: 0 0 15px #6cc644;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Mismatch animation */
.mismatch-shake {
    animation: shake 0.5s ease-in-out;
    background-color: #ffdddd !important;
}

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

/* Confetti particles */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* Score change indicators */
.score-indicator {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    transform: translate(-50%, -50%);
    animation: float-up 1s ease-out forwards;
    z-index: 1000;
    pointer-events: none;
}

.score-up {
    color: #6cc644;
}

.score-down {
    color: #e74c3c;
}

@keyframes float-up {
    0% { transform: translate(-50%, -50%); opacity: 1; }
    100% { transform: translate(-50%, -100px); opacity: 0; }
}

/* Tier transition overlay */
.tier-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fade-in 0.5s ease-in;
    color: white;
}

.tier-badge {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    animation: badge-appear 1s ease-out;
    color: white;
    text-align: center;
}

.tier-badge h2 {
    margin: 0;
    padding: 0;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.tier-icon {
    font-size: 64px;
    margin: 10px 0;
}

.tier-badge.easy { background: linear-gradient(135deg, #a8e4a0, #6cc644); }
.tier-badge.medium { background: linear-gradient(135deg, #f5c6a5, #e67e22); }
.tier-badge.hard { background: linear-gradient(135deg, #f5a5a5, #e74c3c); }
.tier-badge.expert { background: linear-gradient(135deg, #a5c6f5, #3498db); }

@keyframes badge-appear {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.tier-transition-overlay h3 {
    font-size: 32px;
    margin: 10px 0;
    color: white;
}

.tier-transition-overlay p {
    font-size: 18px;
    margin: 10px 0 20px 0;
    max-width: 600px;
    text-align: center;
    color: white;
}

.continue-button {
    padding: 12px 30px;
    font-size: 18px;
    background-color: #6cc644;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.2s;
    margin-top: 20px;
}

.continue-button:hover {
    transform: scale(1.05);
    background-color: #7ed957;
}

.fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fade-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Level complete message */
.level-complete-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 900;
    text-align: center;
    animation: pop-in 0.5s ease-out;
}

@keyframes pop-in {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
