@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #e0e0e0;
    color: #333;
    line-height: 1.6;
    overflow-y: scroll;
}

header {
    background: linear-gradient(to bottom, #3a87d4 0%, #2a7cd1 100%);
    color: white;
    padding: 0.7em 1.5em;
    text-align: left;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1a5fad;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 10;
    min-height: 50px;
}

header h1 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 500;
    flex-grow: 1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

header .error-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

#show-tutorial-button,
#show-history-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.6em;
    cursor: pointer;
    padding: 0;
    margin-left: 15px;
    line-height: 1;
    transition: transform 0.1s ease, color 0.2s ease;
    touch-action: manipulation;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

#show-tutorial-button:before {
    content: '?';
    font-weight: bold;
}

#show-history-button:before {
    content: '🗓️'; /* Calendar icon or similar */
    font-size: 1.3em;
}

#show-tutorial-button:hover,
#show-history-button:hover {
    color: white;
}

#show-tutorial-button:active,
#show-history-button:active {
    transform: scale(0.9);
    background-color: rgba(0,0,0,0.1);
}

nav#categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1.2em 1em;
    background-color: #ffffff;
    gap: 12px;
    margin: 0 15px 20px 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5;
}

nav#categories button {
    padding: 15px 20px;
    border: 1px solid #dcdcdc;
    border-radius: 7px;
    cursor: pointer;
    background-color: #f8f8f8;
    font-size: 1.1rem;
    font-weight: 500;
    flex-grow: 1;
    min-width: 150px;
    max-width: 250px;
    text-align: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    touch-action: manipulation;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

nav#categories button:hover {
    background-color: #eef2f7;
    border-color: #cce0f0;
    box-shadow: 0 3px 6px rgba(0,0,0,0.12);
}

nav#categories button:active {
    transform: scale(0.97);
    background-color: #dceefc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

nav#categories button.active {
    background-color: #007bff;
    color: white;
    font-weight: 700;
    border-color: #007bff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

main#character-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    padding: 0 15px 20px 15px;
    text-align: center;
    position: relative;
    z-index: 2;
    background-color: #ffffff;
    margin: 0 15px 20px 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding-top: 15px;
    padding-bottom: 15px;
}

.character-cell {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 8px;
    cursor: pointer;
    font-size: 2rem;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s ease, transform 0.1s ease, box-shadow 0.2s ease;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    touch-action: manipulation;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    color: #333;
}

.character-cell:hover {
    background-color: #eef2f7;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.character-cell:active {
    transform: scale(0.96);
    background-color: #dceefc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.character-cell.copied {
    background-color: #28a745 !important;
    color: white;
    transition: background-color 0.1s ease;
}

/* Style for the hidden character */
.secret-character-trigger {
    opacity: 0; /* Make it invisible */
    pointer-events: all; /* Ensure it's still clickable */
    cursor: pointer; /* Show it's interactive */
}

/* For better discoverability during development, or if a hint is needed later: */
/* .secret-character-trigger:hover { opacity: 0.1; } */

#copy-feedback {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 123, 255, 0.95);
    color: white;
    padding: 14px 30px;
    border-radius: 30px;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease-in-out, bottom 0.5s ease;
    pointer-events: none;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    min-width: 150px;
    text-align: center;
}

#copy-feedback.hidden {
    opacity: 0;
    bottom: 15px;
}

#copy-feedback.warning {
    background-color: rgba(255, 193, 7, 0.95);
    color: #343a40;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Base styles for overlays (Tutorial and History) */
#tutorial-overlay,
#update-history-overlay,
#secret-unicodes-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(8px);
    animation: fadeInOverlay 0.3s ease-out;
}

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

#tutorial-overlay.hidden,
#update-history-overlay.hidden,
#secret-unicodes-overlay.hidden {
    display: none;
}

/* Base styles for overlay content boxes */
#tutorial-content,
#update-history-content,
#secret-unicodes-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 10px;
    max-width: 95%;
    width: 450px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    text-align: left;
    color: #333;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInTutorial 0.4s ease-out;
}

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

#tutorial-content h2,
#update-history-content h2,
#secret-unicodes-content h2 {
    margin-top: 0;
    color: #0056b3;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 700;
}

#secret-unicodes-content p {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.95em;
    color: #555;
}

/* Styles for the character display within the secret modal */
#secret-character-display.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    padding: 10px;
    background-color: #f0f8ff;
    border-radius: 8px;
    border: 1px solid #cceeff;
    max-height: 40vh;
    overflow-y: auto;
}

/* Specific styles for Update History */
#history-list {
    list-style: none; /* Remove default bullet points */
    padding: 0;
    margin: 0;
}

#history-list li {
    background-color: #e6f7ff;
    border: 1px solid #b3e0ff;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 1.05em;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#history-list li:last-child {
    margin-bottom: 0;
}

#history-list li:before {
    content: '✨'; /* Bullet point icon */
    margin-right: 12px;
    font-size: 1.2em;
    line-height: 1;
    flex-shrink: 0;
}

.tutorial-step {
    margin-bottom: 25px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tutorial-step .step-number {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    font-weight: bold;
    font-size: 1em;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tutorial-step p {
    margin: 0;
    flex-grow: 1;
    font-size: 1.05em;
    line-height: 1.7;
    display: flex; /* Make paragraph a flex container to align icon and text */
    align-items: center; /* Vertically center icon with text */
    gap: 8px; /* Space between icon and text */
}

.tutorial-step-icon {
    font-size: 1.2em; /* Slightly larger than text */
    line-height: 1;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.animation-preview {
    width: 100%;
    height: 90px;
    background: linear-gradient(#a8dadc, #457b9d);
    border: 1px solid #ced4da;
    border-radius: 8px;
    margin-top: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.15);
}

.animation-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25px;
    background-color: #495057;
    z-index: 1;
    background-image: linear-gradient(to right, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) 60%, transparent 60%);
    background-size: 40px 100%;
    animation: road-line 1s linear infinite;
}

@keyframes road-line {
    from { background-position: 0 0; }
    to { background-position: -40px 0; }
}

.animated-truck {
    font-size: 3em;
    position: absolute;
    bottom: 10px;
    left: -15%;
    color: red;
    line-height: 1;
    animation: drive 8s linear infinite;
    z-index: 2;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

@keyframes drive {
    0% { left: -15%; }
    100% { left: 115%; }
}

#tutorial-close-button,
#history-close-button,
#secret-unicodes-close-button {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.15em;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    touch-action: manipulation;
    margin-top: 25px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

#tutorial-close-button:hover,
#history-close-button:hover,
#secret-unicodes-close-button:hover {
    background-color: #218838;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#tutorial-close-button:active,
#history-close-button:active,
#secret-unicodes-close-button:active {
    transform: scale(0.98);
    background-color: #1e7e34;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tutorial-warning {
    margin-top: 25px;
    padding: 20px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    color: #856404;
    font-size: 1em;
    line-height: 1.6;
}

.tutorial-warning p {
    margin: 0;
    font-size: 1em;
}

.tutorial-warning strong {
    color: #664d03;
}

@media (max-width: 600px) {
    header {
        padding: 0.6em 1em;
        margin-bottom: 15px;
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    }

    header h1 {
        font-size: 1.3em;
    }

    header .error-icon {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    #show-tutorial-button,
    #show-history-button {
        font-size: 1.4em;
        width: 24px;
        height: 24px;
        margin-left: 10px;
    }

    #show-history-button:before {
        font-size: 1.1em;
    }

    nav#categories {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0.8em 10px;
        margin: 0 10px 15px 10px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    }

    nav#categories button {
        min-width: auto;
        max-width: none;
        flex-grow: 0;
        width: 100%;
        padding: 13px 15px;
        font-size: 1.05rem;
        border-radius: 5px;
    }

    main#character-display {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 8px;
        padding: 10px;
        margin: 0 10px 15px 10px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    }

    .character-cell {
        font-size: 1.6rem;
        padding: 10px 5px;
        border-radius: 5px;
    }

    .character-cell.copied {
        background-color: #28a745 !important;
        color: white;
    }

    #copy-feedback {
        bottom: 18px;
        padding: 12px 25px;
        font-size: 0.95em;
        border-radius: 25px;
        min-width: unset;
    }

    #tutorial-content,
    #update-history-content,
    #secret-unicodes-content {
        max-width: 95%;
        padding: 25px;
        max-height: 88vh;
    }

    #tutorial-content h2,
    #update-history-content h2,
    #secret-unicodes-content h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
    }

    #history-list li {
        padding: 12px 15px;
        margin-bottom: 8px;
        font-size: 1em;
    }

    #history-list li:before {
        margin-right: 10px;
        font-size: 1.1em;
    }

    .tutorial-step {
        margin-bottom: 20px;
        gap: 10px;
    }

    .tutorial-step .step-number {
        width: 22px;
        height: 22px;
        font-size: 0.9em;
    }

    .tutorial-step p {
        font-size: 1em;
        line-height: 1.6;
    }

    .tutorial-step-icon {
        font-size: 1.1em; /* Adjust icon size for mobile */
    }

    .animation-preview {
        height: 80px;
        margin-top: 15px;
        border-radius: 6px;
    }

    .animation-preview::after {
        height: 20px;
        background-size: 30px 100%;
        animation: road-line-mobile 1s linear infinite;
    }

    @keyframes road-line-mobile {
        from { background-position: 0 0; }
        to { background-position: -30px 0; }
    }

    .animated-truck {
        font-size: 2.5em;
        bottom: 8px;
        color: red;
    }

    #tutorial-close-button,
    #history-close-button,
    #secret-unicodes-close-button {
        padding: 12px 15px;
        font-size: 1.1em;
        margin-top: 20px;
        border-radius: 5px;
    }

    .tutorial-warning {
        margin-top: 20px;
        padding: 15px;
        border-radius: 5px;
    }

    #secret-unicodes-content p {
        font-size: 0.9em;
    }
    #secret-character-display.character-grid {
        max-height: 35vh;
    }
}