/* Global Styles */
:root {
    --primary-color: #4a6fa5;
    --secondary-color: #ff9e6d;
    --accent-color: #6daedb;
    --haptic-color: #9c27b0;
    --background-color: #f9f9f9;
    --text-color: #333;
    --success-color: #4CAF50;
    --error-color: #f44336;
    --modal-background: rgba(0, 0, 0, 0.5);
    --achievement-color: #ffd700;
    --card-front-color: #4a6fa5;
    --card-back-color: #6daedb;
    --card-matched-color: #4CAF50;
    --haptic-color: #9c27b0;
    --mobile-color: #ff5722;
}

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

body {
    font-family: 'Comic Neue', cursive;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
}

.user-profile {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
}

.profile-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

.profile-button:hover {
    background-color: #ff8c5a;
    transform: scale(1.05);
}

.profile-info {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
}

.profile-info.hidden {
    display: none;
}

#user-display-name {
    font-weight: bold;
    margin-right: 10px;
}

.streak-badge {
    background-color: var(--secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Navigation Styles */
nav {
    margin-bottom: 30px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

nav ul {
    display: flex;
    list-style: none;
    justify-content: center;
}

nav ul li {
    padding: 15px 0;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    padding: 15px 25px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

nav ul li a:hover {
    color: var(--accent-color);
}

nav ul li a.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

/* Main Content Styles */
main {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

section {
    margin-bottom: 40px;
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
    font-size: 2rem;
}

.hidden-section {
    display: none;
}

.active-section {
    display: block;
}

/* Braille Grid Styles */
.braille-grid, .contractions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.braille-letter, .contraction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f0f0f0;
}

.braille-letter:hover, .contraction-item:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-5px);
}

.braille-letter.active, .contraction-item.active {
    background-color: var(--primary-color);
    color: white;
}

.letter {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
}

/* Braille Display Styles */
.braille-display {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-top: 30px;
    padding: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    flex-wrap: wrap;
}

.braille-cell {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    width: 100px;
    height: 150px;
    margin-right: 30px;
}

.braille-cell.large {
    width: 120px;
    height: 180px;
}

.braille-cell.large .dot {
    width: 40px;
    height: 40px;
}

.dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #ddd;
    border: 2px solid #bbb;
    transition: all 0.3s ease;
}

.dot.active {
    background-color: var(--secondary-color);
    border-color: #e67e22;
    transform: scale(1.1);
}

.braille-info {
    flex: 1;
    min-width: 250px;
}

.braille-info h3 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Number Sign Container */
.number-sign-container {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    display: none; /* Hidden by default, shown via JavaScript */
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.number-sign-container p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.number-sign-cell {
    width: 80px;
    height: 120px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    background-color: var(--primary-color);
    border-radius: 10px;
    padding: 10px;
}

.grid-section-header {
    margin-top: 20px;
    margin-bottom: 10px;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-align: center;
}

.grid-section-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

/* Contractions Styles */
.grade-selector, .contractions-categories {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.grade-button, .category-button {
    background-color: #f0f0f0;
    border: none;
    padding: 10px 20px;
    margin: 0 10px 10px 0;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.3s ease;
}

.grade-button:hover, .category-button:hover {
    background-color: var(--accent-color);
    color: white;
}

.grade-button.active, .category-button.active {
    background-color: var(--primary-color);
    color: white;
}

.contractions-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.contraction-item {
    position: relative;
}

.contraction-text {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.contraction-type {
    font-size: 0.8rem;
    color: var(--accent-color);
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 5px;
    border-radius: 10px;
}

.grade-info {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    border-left: 5px solid var(--primary-color);
}

.grade-info h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Practice Area Styles */
.practice-area {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

/* Practice Modes */
.practice-modes {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.mode-button {
    padding: 10px 20px;
    background-color: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 30px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-button:hover {
    background-color: #e0e0e0;
}

.mode-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.practice-prompt {
    margin-bottom: 30px;
}

.practice-prompt p {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.answer-area {
    margin-bottom: 20px;
}

#practice-answer {
    padding: 10px;
    font-size: 1.5rem;
    width: 80px;
    text-align: center;
    margin-right: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

#check-answer {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#check-answer:hover {
    background-color: #3a5a8c;
}

.feedback {
    margin: 20px 0;
    font-size: 1.2rem;
    min-height: 30px;
}

.feedback.correct {
    color: var(--success-color);
}

.feedback.incorrect {
    color: var(--error-color);
}

#next-practice {
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#next-practice:hover {
    background-color: #ff8c5a;
}

/* Typing Mode */
.hidden {
    display: none;
}

.typing-target {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    background-color: #f0f0f0;
    padding: 5px 15px;
    border-radius: 10px;
    margin: 0 5px;
}

.typing-instructions {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    text-align: center;
}

.typing-cell .dot {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.typing-cell .dot::after {
    content: attr(data-key);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    color: #666;
    opacity: 0.7;
}

.typing-cell .dot:hover {
    transform: scale(1.1);
}

.typing-cell .dot.active::after {
    color: white;
}

.typing-controls {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.typing-controls button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-typing {
    background-color: var(--accent-color);
    color: white;
}

#submit-typing:hover {
    background-color: #5a9ac9;
}

#clear-typing {
    background-color: #f0f0f0;
    color: #666;
}

#clear-typing:hover {
    background-color: #e0e0e0;
}

.keyboard-button {
    margin-top: 15px;
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.keyboard-button:hover {
    background-color: #3a5a85;
}

#next-typing {
    padding: 10px 20px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 15px;
}

#next-typing:hover {
    background-color: #ff8c5a;
}

/* Games Styles */
.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.game-card {
    background-color: #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.play-button {
    margin-top: 15px;
    padding: 8px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.play-button:hover {
    background-color: #5a9bc7;
}

#game-area {
    margin-top: 30px;
    padding: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
}

/* About Section Styles */
.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.about-content h3 {
    color: var(--primary-color);
    margin: 25px 0 15px;
    font-size: 1.5rem;
}

.about-content ul {
    margin-left: 30px;
    margin-bottom: 20px;
}

.about-content li {
    margin-bottom: 10px;
}

.about-image {
    display: block;
    max-width: 300px;
    margin: 20px auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Footer Styles */
footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #777;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-background);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--error-color);
}

.settings-form {
    margin-top: 20px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--primary-color);
}

.setting-group input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
}

.setting-group.checkbox {
    display: flex;
    align-items: center;
}

.setting-group.checkbox label {
    margin-bottom: 0;
    margin-left: 10px;
}

.save-settings-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
    width: 100%;
}

.save-settings-btn:hover {
    background-color: #3a5a8c;
}

.setting-info {
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(156, 39, 176, 0.1); /* Light purple using haptic-color with transparency */
    border-left: 3px solid var(--haptic-color);
    border-radius: 5px;
}

.setting-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 200;
    max-width: 300px;
    transform: translateX(400px);
    transition: transform 0.5s ease;
    border-left: 5px solid var(--achievement-color);
}

/* Update Notification */
.update-notification {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 200;
    max-width: 300px;
    transform: translateY(150px);
    transition: transform 0.5s ease;
    border-left: 5px solid var(--accent-color);
}

.achievement-notification.show {
    transform: translateX(0);
}

.update-notification.show {
    transform: translateY(0);
}

.achievement-content h3 {
    color: var(--achievement-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

#achievement-name {
    font-weight: bold;
    margin-bottom: 5px;
}

#achievement-description {
    font-size: 0.9rem;
    color: #666;
}

.update-content h3 {
    color: var(--accent-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.update-content p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.update-content button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 10px;
}

#update-button {
    background-color: var(--accent-color);
    color: white;
}

#update-button:hover {
    background-color: #5a9ac9;
}

#dismiss-button {
    background-color: #f0f0f0;
    color: #666;
}

#dismiss-button:hover {
    background-color: #e0e0e0;
}

/* Offline Notification */
.offline-notification {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--error-color);
    color: white;
    text-align: center;
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.offline-notification.show {
    transform: translateY(0);
}

.offline-content p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    nav ul {
        flex-wrap: wrap;
    }
    
    .braille-display {
        flex-direction: column;
    }
    
    .braille-cell {
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .games-container {
        grid-template-columns: 1fr;
    }
}

/* Memory Match Game Styles */
.memory-game-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.game-info {
    display: flex;
    gap: 20px;
    font-size: 1.1rem;
    font-weight: bold;
}

.game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.game-button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.game-button:hover {
    background-color: var(--accent-color);
}

#difficulty-select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
}

.memory-game-board {
    display: grid;
    gap: 10px;
    margin: 0 auto;
    perspective: 1000px;
}

.grid-3x4 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

.grid-4x5 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.grid-5x6 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(5, 1fr);
}

.memory-card {
    height: 120px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transform: scale(1);
    transition: transform 0.5s;
}

.memory-card:hover {
    transform: scale(1.03);
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.memory-card.matched .card-back {
    background-color: var(--success-color);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transform-style: preserve-3d;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-front {
    background-color: var(--primary-color);
    color: white;
    font-size: 2rem;
}

.card-back {
    background-color: var(--accent-color);
    color: white;
    transform: rotateY(180deg);
}

.card-letter {
    font-size: 3rem;
    font-weight: bold;
}

.braille-pattern {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    width: 60px;
    height: 90px;
}

.braille-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    border: 2px solid white;
}

.braille-dot.active {
    background-color: white;
}

.game-instructions {
    margin-top: 30px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border-left: 5px solid var(--primary-color);
}

.game-completion-message {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-completion-message h3 {
    color: var(--success-color);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.game-completion-message p {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.game-completion-message .game-button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .memory-card {
        height: 100px;
    }
    
    .card-letter {
        font-size: 2.5rem;
    }
    
    .braille-pattern {
        width: 50px;
        height: 75px;
    }
    
    .braille-dot {
        width: 15px;
        height: 15px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-info {
        width: 100%;
        justify-content: space-between;
    }
}

/* Haptic Feedback Styles */
.settings-section-title {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--haptic-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.test-button {
    padding: 8px 16px;
    background-color: var(--haptic-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.test-button:hover {
    background-color: #7b1fa2;
}

#haptic-intensity {
    width: 70%;
    vertical-align: middle;
}

#haptic-intensity-value {
    display: inline-block;
    width: 25px;
    text-align: center;
    font-weight: bold;
}

/* Mobile Optimization Styles */
.fullscreen-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--mobile-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
}

.fullscreen-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Touch zones visualization (for debugging) */
.touch-zone {
    position: absolute;
    border: 2px dashed rgba(255, 87, 34, 0.5);
    background-color: rgba(255, 87, 34, 0.1);
    pointer-events: none;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: rgba(255, 87, 34, 0.7);
}

/* Mobile device specific styles */
.mobile-device .braille-cell {
    transform: scale(1.2);
}

.mobile-device .dot {
    width: 40px;
    height: 40px;
}

.mobile-device nav ul {
    justify-content: space-around;
}

.mobile-device .practice-area input[type="text"] {
    font-size: 1.2rem;
    padding: 15px;
}

.mobile-device button {
    padding: 12px 24px;
    font-size: 1.1rem;
}

/* Hide mobile-only elements by default */
.mobile-only {
    display: none;
}

/* Show mobile-only elements on mobile devices */
.mobile-device .mobile-only {
    display: block;
}
