@import url('https://fonts.googleapis.com/css2?family=Uncial+Antiqua&family=IM+Fell+English&display=swap');

body {
    font-family: 'IM Fell English', serif;
    text-align: center;
    background-color: #0d0d0d;
    color: #e0e0e0;
    padding: 20px;
    height: 100%;
}

h1 {
    font-size: 3.5em;
    color: #f4f4f4;
    text-shadow: 3px 3px 10px rgba(255, 140, 0, 0.8);
    font-family: 'Uncial Antiqua', serif;
    font-display: optional;
    animation: flicker 2s infinite alternate;
}


.time {
    font-size: 3.5em;
    color: #f4f4f4;
    text-shadow: 3px 3px 10px rgba(255, 140, 0, 0.8);
    font-family: 'Uncial Antiqua', serif;
    animation: flicker 2s infinite alternate;
    transition: opacity 5s ease-in;
}

.win-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10em;
    font-family: 'Uncial Antiqua', serif;
    color: #f4f4f4;
    text-shadow: 3px 3px 10px rgba(255, 140, 0, 0.8);
    z-index: 1001;
    opacity: 0;
    transition: opacity 5s ease-in, opacity .5s ease-out;
}

@keyframes flicker {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0.8;
    }
}

input,
button {
    padding: 12px 16px;
    margin: 12px;
    border-radius: 8px;
    font-size: 1.2em;
    font-family: 'IM Fell English', serif;
    border: 2px solid #444444;
    background-color: #222;
    color: #ddd;
    box-shadow: 0 0 8px rgba(255, 140, 0, 0.6);
    transition: all 0.3s ease;
}

button:hover {
    background-color: #bb4d00;
    transform: scale(1.1);
}

.container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Align to the left */
    margin-top: 20px;
    overflow-x: auto;
    /* Enable horizontal scrolling */
    width: 100%;
    padding-left: 10px;
    /* Optional: space from the left edge */
    padding-right: 10px;
    /* Optional: space from the right edge */
}

.scroll-container {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
}

.attribute-table {
    display: inline-block;
    min-width: max-content;
    margin-top: 20px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.7);
    background: #0d0d0d;
    border-radius: 10px;
    padding: 10px;
}

.attribute-header {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    font-weight: bold;
    font-size: 1.5em;
    color: #f4f4f4;
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
    background: #0d0d0d;
    border-radius: 8px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
    word-wrap: break-word;
    /* Ensure long text wraps */
    white-space: normal;
    /* Allow text to wrap */
    overflow-wrap: break-word;
    /* Ensure long words break and don't overflow */
    max-width: 100%;
    /* Ensure the width doesn't grow out of control */
    border-bottom: 5px solid #bb4d00;
}

.attribute-header-box {
    width: 140px;
    aspect-ratio: 1;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 1.5em;
    border: 2px solid transparent;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: background-color 0.3s ease, transform 0.2s ease;
    word-wrap: break-word;
}

.attribute-row {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    background: #0d0d0d;
    border-radius: 8px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
    word-wrap: break-word;
    /* Ensure long text wraps */
    white-space: normal;
    /* Allow text to wrap */
    overflow-wrap: break-word;
    /* Ensure long words break and don't overflow */
    max-width: 100%;
    /* Ensure the width doesn't grow out of control */
}

.attribute-box {
    width: 140px;
    aspect-ratio: 1;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    font-size: 1.5em;
    background-color: #222222;
    border: 2px solid #444444;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: background-color 0.3s ease, transform 0.2s ease;
    word-wrap: break-word;
}

.attribute-box:hover {
    transform: scale(1.05);
}

.correct {
    background-color: #4b6f44;
    color: white;
}

.incorrect {
    background-color: #6f2d34;
    color: white;
}

.partial {
    background-color: #bb4d00;
    color: white;
}

.higher {
    background-color: #6f2d34;
    color: white;
}

.lower {
    background-color: #6f2d34;
    color: white;
}

.hidden {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.reveal {
    opacity: 1;
    transform: scale(1);
}

.arrow {
    width: 0;
    height: 0;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.higher::after {
    position: absolute;
    bottom: 1px;
    left: 0;
    width: 100%;
    clip-path: polygon(97% 60%, 80% 60%, 80% 5%, 20% 5%, 20% 60%, 3% 60%, 50% 95%);
    height: 100%;
    background: rgba(0, 0, 0, .5);
    content: "";
    z-index: -1;
    opacity: 1;
    transition: background-color .3s ease
}


.lower::after {
    position: absolute;
    left: 0;
    width: 100%;
    clip-path: polygon(97% 40%, 80% 40%, 80% 95%, 20% 95%, 20% 40%, 3% 40%, 50% 5%);
    height: 100%;
    background: rgba(0, 0, 0, .5);
    content: "";
    z-index: -1;
    opacity: 1;
    transition: background-color .3s ease;
}

.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    /* Darken the background */
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: #222;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    width: 300px;
    position: relative;
    color: #f4f4f4;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.9);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.close-btn:hover {
    color: #f4f4f4;
}

/* Stats Panel Styles */
#statsContent {
    display: none;
}

.stats-panel, .session-stats-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgba(26, 26, 26, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid #bb4d00;
    box-shadow: 0 0 15px rgba(187, 77, 0, 0.4);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
}

.achievements-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: rgba(26, 26, 26, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid #bb4d00;
    box-shadow: 0 0 15px rgba(187, 77, 0, 0.4);
    z-index: 1000;
    min-width: 250px;
    max-width: 300px;
}

.achievements-panel-title {
    color: #bb4d00;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.achievements-content {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.achievement-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    border-color: #bb4d00;
    background: rgba(187, 77, 0, 0.1);
}

.achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.achievement-title {
    font-weight: bold;
    color: #ddd;
    font-size: 0.9em;
}

.achievement-item.unlocked .achievement-title {
    color: #bb4d00;
}

.achievement-desc {
    font-size: 0.8em;
    color: #aaa;
    margin-bottom: 6px;
    font-style: italic;
}

.achievement-progress-bar {
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.achievement-progress-fill {
    height: 100%;
    background: #bb4d00;
    width: 0%;
    transition: width 0.5s ease;
}

.achievement-progress-text {
    font-size: 0.7em;
    color: #888;
    text-align: right;
    margin-top: 2px;
}

.stats-panel-title, .session-stats-title {
    color: #bb4d00;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    cursor: pointer;
    user-select: none;
}

.stats-panel-title:hover {
    color: #ff6b1a;
}

.stats-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-compact-item {
    text-align: center;
}

.stat-compact-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #bb4d00;
}

.stat-compact-label {
    font-size: 0.75em;
    color: #aaa;
    margin-top: 2px;
}

.distribution-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #444;
    /*display: none;*/
}

.distribution-section.expanded {
    display: block;
}

.distribution-section h3 {
    color: #bb4d00;
    margin: 0 0 10px 0;
    font-size: 1em;
}

.distribution-row {
    display: flex;
    align-items: center;
    margin: 5px 0;
    gap: 8px;
}

.distribution-label {
    width: 25px;
    text-align: right;
    color: #aaa;
    font-size: 0.85em;
}

.distribution-bar {
    height: 20px;
    background-color: #bb4d00;
    border-radius: 4px;
    min-width: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    color: white;
    font-weight: bold;
    font-size: 0.75em;
    transition: width 0.3s ease;
}

/* Session stats specific */
.session-stat {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    color: #f4f4f4;
    font-size: 0.9em;
}

.session-stat-label {
    color: #aaa;
}

.session-stat-value {
    color: #bb4d00;
    font-weight: bold;
}

/* Tablet responsiveness */
@media (max-width: 768px) {
    .time {
        font-size: 2em;
    }

    body {
        background-size: contain;
    }

    .attribute-header {
        font-size: 1.2em;
        gap: 10px;
    }

    .attribute-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .attribute-header-box {
        width: 80px;
        font-size: 1em;
    }

    .attribute-box {
        width: 100px;
        min-width: 80px;
        font-size: 1.1em;
    }

    .achievements-panel {
        top: 10px;
        left: 10px;
        padding: 12px 15px;
        min-width: 180px;
        max-width: 280px;
    }

    .stats-panel, .session-stats-panel {
        top: 10px;
        right: 10px;
        padding: 12px 15px;
        min-width: 180px;
        max-width: 280px;
    }

    .achievements-panel-title,
    .stats-panel-title,
    .session-stats-title {
        font-size: 1em;
    }

    .achievement-item {
        padding: 8px;
        margin-bottom: 6px;
    }

    .achievement-title {
        font-size: 0.85em;
    }

    .achievement-desc {
        font-size: 0.75em;
    }

    .achievement-progress-text {
        font-size: 0.65em;
    }

    .stat-compact-value {
        font-size: 1.3em;
    }

    .stat-compact-label {
        font-size: 0.7em;
    }
    
    .session-stat {
        font-size: 0.85em;
    }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .time {
        font-size: 2em;
    }

    .body {
        background-size: contain;
    }

    .attribute-header {
        font-size: 1em;
        gap: 5px;
    }

    .attribute-header-box {
        width: 80px;
        font-size: 1em;
    }

    .attribute-box {
        width: 80px;
        font-size: 1em;
    }

    .attribute-row {
        gap: 5px;
        font-size: 1em;
    }

    .container {
        padding-left: 5px;
    }

    #particles-js {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 999;
    }

    .achievements-panel {
        top: 5px;
        left: 5px;
        padding: 8px 10px;
        min-width: 120px;
        max-width: 45%;
    }

    .stats-panel, .session-stats-panel {
        top: 5px;
        right: 5px;
        padding: 8px 10px;
        min-width: 120px;
        max-width: 45%;
    }

    .achievements-panel-title,
    .stats-panel-title,
    .session-stats-title {
        font-size: 0.85em;
        margin-bottom: 6px;
    }

    .achievement-item {
        padding: 6px;
        margin-bottom: 5px;
    }

    .achievement-title {
        font-size: 0.75em;
    }

    .achievement-desc {
        font-size: 0.65em;
    }

    .achievement-progress-bar {
        height: 4px;
    }

    .achievement-progress-text {
        font-size: 0.6em;
    }

    .stats-compact {
        gap: 5px;
    }

    .stat-compact-value {
        font-size: 1.1em;
    }

    .stat-compact-label {
        font-size: 0.65em;
    }

    .distribution-label {
        font-size: 0.75em;
        width: 20px;
    }

    .distribution-bar {
        font-size: 0.7em;
    }
    
    .session-stat {
        font-size: 0.75em;
    }
}
