/* Elementos ocultos */
#preload-cache {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Very large screens: keep wide layout with extra spacing */
@media (min-width: 1024px) {
    .modal {
        max-width: 900px;
    }
    .modal-podium {
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-end;
        gap: 20px;
        padding: 20px;
    }
    /* Give more room to the first place on wide layout */
    .modal-podium .podium-place.first {
        flex: 0 1 48%;
        max-width: 520px;
    }
    .modal-podium .podium-place.second,
    .modal-podium .podium-place.third {
        flex: 1 1 26%;
        max-width: 320px;
    }
    /* Allow flex items to actually shrink so text can wrap instead of squeezing neighbors */
    .modal-podium .podium-place { min-width: 0; }
    /* Allow long names to wrap without squeezing neighbors */
    #modal-main-name,
    .podium-place h2,
    .podium-place h4 {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        line-height: 1.2;
        margin-top: 6px;
    }
    #modal-main-name { text-wrap: balance; font-size: clamp(1.2rem, 2.2vw, 1.8rem); }
    .podium-place.first img { width: 120px; height: 120px; }
    .podium-place img { width: 88px; height: 88px; }
}

/* Tablet middle layout: first full-width highlight, second/third side-by-side */
@media (min-width: 600px) and (max-width: 900px) {
    .modal {
        max-width: 90vw;
    }

    .modal-content {
        padding-top: 12px;
    }

    .modal-podium {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "first first"
            "second third";
        align-items: center;
        justify-items: center;
        gap: 16px;
        padding: 16px;
    }

    .podium-place.first { grid-area: first; order: 0; top: 0; }
    .podium-place.second { grid-area: second; order: 0; top: 0; }
    .podium-place.third { grid-area: third; order: 0; top: 0; }

    .podium-place.first img { width: 104px; height: 104px; }
    .podium-place img { width: 72px; height: 72px; }
}

/* Estilo para imagens dentro do preload-cache */
#preload-cache img {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Geral */
:root {
    --background-dark: #121212;
    --card-background: #1e1e1e;
    --primary-color: #bb86fc;
    --primary-light: #d1a4ff;
    --primary-dark: #9a67ea;
    --text-light: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --highlight-gold: #FFD700;
    --highlight-silver: #C0C0C0;
    --highlight-bronze: #CD7F32;
    --tier-gold-bg: rgba(255, 215, 0, .1);
    --tier-silver-bg: rgba(192, 192, 192, .1);
    --tier-bronze-bg: rgba(205, 127, 50, .1);
    --success-color: #4caf50;
    --error-color: #f44336;
    --warning-color: #ff9800;
    --info-color: #2196f3;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-dark);
    background-image: linear-gradient(135deg, #1a1a1a 0%, #121212 100%);
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#quiz-app {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

#screen-container {
    position: relative;
    width: 100%;
}

/* Telas */
.screen {
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.hidden {
    display: none !important;
}

/* Tela Inicial */
#start-screen {
    position: relative;
    overflow: hidden;
}

.start-screen-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--background-dark), #3a3a5e);
    overflow: hidden;
    filter: blur(5px);
    opacity: 0.7;
    z-index: 0;
}

.start-screen-background img {
    position: absolute;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
    filter: grayscale(100%);
}

.start-screen-background img:nth-child(1) { top: 10%; left: 5%; width: 80px; animation-delay: 0s; }
.start-screen-background img:nth-child(2) { top: 30%; left: 80%; width: 100px; animation-delay: 4s; }
.start-screen-background img:nth-child(3) { top: 70%; left: 20%; width: 90px; animation-delay: 8s; }
.start-screen-background img:nth-child(4) { top: 50%; left: 50%; width: 120px; animation-delay: 12s; }
.start-screen-background img:nth-child(5) { top: 20%; left: 30%; width: 70px; animation-delay: 16s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, 20px) scale(1.1); }
    100% { transform: translate(0, 0) scale(1); }
}

.start-screen-content {
    position: relative;
    z-index: 1;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 500px;
}

.start-screen-content h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: var(--text-light);
}

#character-intro-display {
    width: 200px;
    height: 200px;
    margin: 20px auto;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
}

#intro-character-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out, transform 0.3s ease;
}

#intro-character-img.visible {
    opacity: 1;
}

#character-intro-display:hover #intro-character-img {
    transform: scale(1.1);
}

#dynamic-quotes {
    height: 50px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#dynamic-quotes .quote {
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.1em;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

#dynamic-quotes .quote.visible {
    opacity: 1;
}

.action-button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.action-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.action-button.secondary {
    background-color: var(--secondary-color);
    margin-right: 15px;
}

.action-button.secondary:hover {
    background-color: #5a6268;
}

/* Emphasize the 'Compartilhar' button on results screen */
#result-modal-button {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-dark);
    box-shadow: 0 0 0 0 rgba(187, 134, 252, 0.6), 0 6px 18px rgba(0,0,0,0.35);
}

#result-modal-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(187, 134, 252, 0.15), 0 8px 22px rgba(0,0,0,0.4);
}

.credits {
    margin-top: 30px;
    font-size: 0.8em;
    color: var(--text-muted);
}

.credits a {
    color: var(--primary-color);
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

/* Tela do Quiz */
#quiz-screen {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.quiz-main-content {
    flex-grow: 1;
    max-width: 80%;
    margin: 0 auto;
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#top-character-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 15px 25px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#top-character-display:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

#top-character-display p {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: var(--text-muted);
}

#top-character-display img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--highlight-gold);
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

#top-character-display:hover img {
    transform: scale(1.05);
}

#top-character-display h3 {
    margin: 0;
    color: var(--text-light);
    font-size: 1.3em;
}

/* Mobile podium container */
#top-characters-mobile {
    display: none;
    width: 100%;
    justify-content: center;
    gap: 10px;
    margin: 10px 0 20px;
}

#top-characters-mobile .podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

#top-characters-mobile .podium-place img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: transform 0.2s ease;
}

#top-characters-mobile .podium-place.first img {
    width: 72px;
    height: 72px;
    border-color: var(--highlight-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

#top-characters-mobile .podium-place.second img {
    border-color: var(--highlight-silver);
}

#top-characters-mobile .podium-place.third img {
    border-color: var(--highlight-bronze);
}

#top-characters-mobile .podium-rank {
    font-size: 0.8em;
    font-weight: 600;
    margin-top: 6px;
    color: var(--text-muted);
}

@keyframes bounceUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes highlightPulse {
    0% { box-shadow: 0 0 6px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 18px rgba(255, 215, 0, 0.7); }
    100% { box-shadow: 0 0 6px rgba(255, 215, 0, 0.3); }
}

@media (max-width: 1024px) {
    #top-characters-mobile {
        display: flex;
    }

    #character-ranking-sidebar {
        display: none;
    }

    #top-character-display {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 10px 12px;
    }

    #top-character-display img {
        width: 60px;
        height: 60px;
        margin-bottom: 0;
    }

    #top-character-display h3 {
        font-size: 1.1em;
    }
}

#question-container p {
    font-size: 1.4em;
    margin-bottom: 30px;
    color: var(--text-light);
    font-weight: 600;
}

#answers-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 500px;
}

#answers-container button {
    background-color: var(--background-dark);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    text-align: left;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Only apply hover transform on devices that actually hover */
@media (hover: hover) and (pointer: fine) {
  #answers-container button:hover {
      background-color: #3a3a5e;
      border-color: var(--primary-color);
      transform: translateX(5px);
  }
}

#answers-container button:focus,
#answers-container button:active {
    outline: none;
    box-shadow: none;
}

#answers-container button:disabled,
#answers-container button:disabled:hover,
#answers-container button:disabled:active,
#answers-container button:disabled:focus {
    background-color: var(--background-dark);
    border-color: var(--border-color);
    transform: none;
    box-shadow: none;
    cursor: default;
}

/* Ranking Sidebar (Tray) */
#character-ranking-sidebar {
    width: 300px;
    background-color: var(--card-background);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    #quiz-screen {
        flex-direction: column;
        padding: 20px;
    }

    .quiz-main-content {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        order: 2;
    }

    #character-ranking-sidebar {
        order: 1;
        position: static;
        width: 100%;
        max-width: 100%;
        margin-bottom: 20px;
        max-height: none;
        padding: 10px;
    }

    #character-tray {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: thin;
    }

    .tray-character {
        flex-direction: column;
        flex: 0 0 70px;
        min-width: 70px;
        height: 100px;
        gap: 5px;
        justify-content: center;
    }

    .tray-character-image-wrapper {
        width: 40px;
        height: 40px;
        margin-right: 0;
    }

    .tray-character-name {
        font-size: 0.75em;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .screen {
        padding: 15px;
    }

    .start-screen-content {
        padding: 25px;
    }

    .start-screen-content h1 {
        font-size: 2em;
    }

    #answers-container button {
        padding: 12px 15px;
        font-size: 1em;
    }

    #main-result-card {
        padding: 20px;
    }

    #main-result-card img {
        width: 100px;
        height: 100px;
    }

    .modal {
        padding: 20px;
        max-height: 95vh;
    }

    .modal-podium {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .podium-place.second, .podium-place.third {
        top: 0;
        order: 0;
    }

    .podium-place.first {
        order: -1;
    }

    #character-glossary {
        width: 90%;
    }

    .quiz-main-content {
        padding: 0;
    }
}

@media (max-width: 480px) {
    .start-screen-content {
        padding: 20px 15px;
    }

    .start-screen-content h1 {
        font-size: 1.6em;
    }

    .start-subtitle {
        font-size: 0.9em;
        padding: 0 10px;
    }

    #character-intro-display {
        width: 140px;
        height: 140px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .action-button {
        width: 100%;
    }

    .quiz-main-content {
        padding: 0;
    }

    #question-container p {
        font-size: 1.1em;
    }

    #results-screen {
        padding: 15px;
    }

    #main-result-card {
        padding: 15px;
    }

    #all-results-container {
        padding: 15px;
    }

    .result-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .result-bar span {
        width: auto;
    }

    .progress-container {
        width: 100%;
    }

    .podium-place img {
        width: 60px;
        height: 60px;
    }

    .podium-place.first img {
        width: 80px;
        height: 80px;
    }

    .share-input-group {
        flex-direction: column;
        gap: 10px;
    }

    .share-input-group button,
    .share-input-group input {
        border-radius: 5px;
    }
}

#character-tray {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tray-character {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px; /* Espaçamento entre a imagem e o nome */
    padding: 8px 12px;
    margin: 4px 0;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: 
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), 
        background-color 0.3s ease, 
        border-color 0.3s ease;
    will-change: transform;
    transform-style: preserve-3d; /* Garante que as transformações 3D se comportem bem */
    box-sizing: border-box; /* Impede que padding/border aumentem o tamanho */
}

.tray-character.highlight-main {
    border-color: var(--highlight-gold);
    background-color: rgba(255, 215, 0, 0.1);
}

.tray-character.highlight-secondary {
    border-left: 4px solid var(--highlight-silver);
    background-color: rgba(192, 192, 192, 0.15); 
}

.tray-character-image-wrapper {
    position: relative;
    width: 45px;
    height: 45px;
    margin-right: 12px;
    flex-shrink: 0;
}

.tray-character-image-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.tray-character-name {
    flex-grow: 1;
    font-size: 0.9em;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.level-badge {
    position: absolute;
    bottom: -5px; /* Ajuste para posicionar corretamente */
    right: -5px; /* Ajuste para posicionar corretamente */
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--card-background); /* Borda para destaque */
}

/* Destaques no tray */
.tray-character.highlight-main .tray-character-image-wrapper img {
    border-color: var(--highlight-gold);
}

.tray-character.highlight-secondary .tray-character-image-wrapper img {
    border-color: var(--highlight-silver);
}


/* Estilos do Seletor de Idioma */
#language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1001; /* Garante que fique acima de outros elementos */
}

.language-flag {
    width: 30px;
    height: 20px;
    cursor: pointer;
    border-radius: 3px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.language-flag:hover {
    opacity: 1;
    transform: scale(1.1);
}

.language-flag.active {
    border-color: var(--highlight-gold);
    opacity: 1;
    box-shadow: 0 0 10px var(--highlight-gold);
}

/* Tela de Resultados */
#results-screen {
    display: flex; /* Garante que é um flex container */
    flex-direction: column;
    justify-content: center; /* Centraliza o conteúdo verticalmente */
    align-items: center; /* Centraliza o conteúdo horizontalmente */
    padding: 30px;
    text-align: center;
    width: 100%;
    max-width: 80%;
    margin: 0 auto;
    min-height: 100vh; /* Garante que a tela ocupe toda a altura */
    box-sizing: border-box;
}

#main-result-card {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    margin-bottom: 40px;
    max-width: 400px;
    width: 100%;
    border: 2px solid var(--highlight-gold);
}

#main-result-card p {
    font-size: 1.2em;
    color: var(--text-muted);
    margin-bottom: 15px;
}

#main-result-card img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--highlight-gold);
    margin-bottom: 20px;
}

#main-result-card h2 {
    font-size: 2em;
    color: var(--text-light);
    margin: 0;
}

#all-results-container {
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 100%;
    text-align: left;
    margin-bottom: 30px;
}

#all-results-container h3 {
    font-size: 1.3em;
    color: var(--text-light);
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.result-bar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.result-bar span {
    width: 150px; /* Largura fixa para o nome do personagem */
    font-size: 0.95em;
    color: var(--text-light);
}

.progress-container {
    flex-grow: 1; /* Ocupa o espaço restante */
    background-color: #3a3a5e;
    border-radius: 5px;
    height: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%; /* Inicia em 0% */
    border-radius: 5px;
    display: flex;
    justify-content: flex-end; /* Alinha o texto da porcentagem à direita */
    align-items: center;
    padding-right: 5px;
    box-sizing: border-box;
    transition: width 0.8s ease-out; /* Animação mais suave */
    color: white;
    font-size: 0.75em;
    font-weight: bold;
}

.results-actions {
    margin-top: 30px;
}

/* Sidebar (Glossário) e Modais */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* When an overlay is active, show its modal content */
.modal-overlay.active .modal {
    opacity: 1;
    transform: translateY(0);
}

/* Ensure character detail modal stacks above other modals when both present */
#char-detail-modal-overlay.modal-overlay {
    z-index: 2100;
}

.modal {
    background-color: var(--card-background); /* Fundo sólido */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: var(--modal-vmargin, 4vh) auto;
}

.modal img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    display: block;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.modal-content {
    text-align: center;
}

/* Character detail modal: circular image and centered layout */
#char-detail-modal .modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#char-detail-img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--highlight-gold);
    margin: 8px auto 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

@media (max-width: 480px) {
    #char-detail-img {
        width: 110px;
        height: 110px;
    }
}

@media (min-width: 1024px) {
    #char-detail-img {
        width: 160px;
        height: 160px;
    }
}

/* Force compact layout regardless of width when needed */
.modal.compact {
    max-width: 95vw;
    max-height: calc(100vh - 8vh);
}

.modal.compact .modal-podium {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "first first"
        "second third";
    align-items: center;
    justify-items: center;
    gap: 14px;
    padding: 12px;
}

.modal.compact .podium-place.first { grid-area: first; order: 0; top: 0; }
.modal.compact .podium-place.second { grid-area: second; order: 0; top: 0; }
.modal.compact .podium-place.third { grid-area: third; order: 0; top: 0; }

.modal.compact .podium-place.first img { width: 96px; height: 96px; }
.modal.compact .podium-place img { width: 64px; height: 64px; }

.modal-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
}

.podium-place img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid var(--border-color);
}

.podium-place .podium-rank {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-muted);
}

.podium-place h2, .podium-place h4 {
    margin: 5px 0;
    color: var(--text-light);
    font-weight: 600;
}

.podium-place p {
    margin: 0;
    font-size: 1.1em;
    color: var(--primary-light);
    font-weight: bold;
}

.podium-place.first {
    order: 2;
}

.podium-place.second {
    order: 1;
    position: relative;
    top: -20px;
}

.podium-place.third {
    order: 3;
    position: relative;
    top: -20px;
}

.podium-place.first img {
    width: 110px;
    height: 110px;
    border-color: var(--highlight-gold);
    box-shadow: 0 0 20px var(--highlight-gold);
}

.podium-place.second img {
    border-color: var(--highlight-silver);
}

.podium-place.third img {
    border-color: var(--highlight-bronze);
}

.quote-text {
    font-style: italic;
    font-size: 1.1em;
    color: var(--text-muted);
    margin: 25px auto;
    max-width: 80%;
}

.share-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Modal responsiveness for tablets/phones */
@media (max-width: 1024px) {
    .modal {
        max-width: 95vw;
        padding: 16px;
        margin: 4vh auto;
        max-height: calc(100vh - 8vh);
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .modal.compact .modal-podium {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 12px;
    }

    .modal.compact .podium-place {
        width: 100%;
        max-width: 360px;
    }

    .modal.compact .podium-place.first img {
        width: 96px;
        height: 96px;
    }

    .modal.compact .podium-place img {
        width: 64px;
        height: 64px;
    }

    .modal.compact .podium-place.second,
    .modal.compact .podium-place.third {
        top: 0;
        order: 0;
    }

    .modal.compact .podium-place.first {
        order: -1;
    }
}

@media (max-width: 480px) {
    .modal {
        max-width: 100vw;
        padding: 12px;
        margin: 3vh auto;
        max-height: calc(100vh - 6vh);
    }

    .modal-podium {
        gap: 10px;
        padding: 10px;
    }

    .podium-place.first img {
        width: 84px;
        height: 84px;
    }

    .podium-place img {
        width: 56px;
        height: 56px;
    }
}

.share-section h4 {
    margin-bottom: 15px;
    color: var(--text-light);
}

.share-input-group {
    display: flex;
    justify-content: center;
}

.share-input-group input {
    flex-grow: 1;
    background-color: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 10px;
    border-radius: 5px 0 0 5px;
    font-family: monospace;
}

.share-input-group button {
    border-radius: 0 5px 5px 0;
}

.modal h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8em;
}

.modal p {
    margin-bottom: 15px;
    color: var(--text-light);
}

.modal-overlay.active .modal {
    transform: translateY(0);
    opacity: 1;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    transform: rotate(90deg);
    border-color: var(--primary-color);
}


#character-glossary {
    position: fixed;
    top: 0;
    right: -400px; /* Começa fora da tela */
    width: 350px;
    height: 100%;
    background-color: var(--card-background);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.6);
    z-index: 1001; /* Acima do overlay do modal */
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 25px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

#character-glossary.active {
    right: 0;
}

#sidebar-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 1.2em;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    transform: rotate(90deg);
}



.sidebar-content {
    margin-top: 40px;
    flex-grow: 1;
    overflow-y: auto; /* Permite scroll se o conteúdo for muito longo */
    padding-right: 10px; /* Para evitar que o scrollbar grude no texto */
}

#sidebar-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--highlight-gold);
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#sidebar-img:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#sidebar-name {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--text-light);
}

#sidebar-tier {
    font-size: 1em;
    margin-bottom: 20px;
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
}

#sidebar-desc {
    font-size: 1em;
    color: var(--text-light);
    text-align: left;
}

/* Estilos para o campo de Handle no Modal */
.modal-handle-input {
    margin-top: 25px;
    text-align: center;
}

.modal-handle-input label {
    display: block;
    margin-bottom: 8px;
    color: #eee;
    font-size: 0.9em;
}

.modal-handle-input input[type="text"] {
    background-color: #444;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 8px 12px;
    color: #fff;
    font-size: 1em;
    width: 80%;
    max-width: 250px;
    text-align: center;
}

.modal-handle-input input[type="text"]::placeholder {
    color: #bbb;
}

/* Estilos para a Barra de Progresso */
#progress-container {
    width: 100%;
    margin: 20px 0;
    padding: 0 15px;
    box-sizing: border-box;
}

#progress-bar-container {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    height: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

#progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), #4a9eff);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%
    );
    background-size: 50px 50px;
    animation: progressAnimation 2s linear infinite;
    opacity: 0.5;
}

@keyframes progressAnimation {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

#progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 2;
    pointer-events: none;
    text-align: center;
    width: 100%;
}

#progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.75em;
    color: var(--text-muted);
}

.modal-share-instructions {
    margin-top: 30px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.modal-share-instructions p {
    font-size: 0.9em;
    color: #ccc;
    margin-bottom: 15px;
}

.share-telegram-button {
    display: inline-block;
    background-color: #0088cc; /* Cor do Telegram */
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.share-telegram-button:hover {
    background-color: #007bb6;
}

/* Media Queries para responsividade */
@media (max-width: 992px) {
    #quiz-screen {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 20px;
    }

    #character-ranking-sidebar {
        position: relative;
        top: auto;
        margin-top: 20px;
        width: 100%;
        max-height: none;
    }
    
    .tray-character {
        padding: 10px 12px;
    }
    
    .tray-character-image-wrapper {
        width: 40px;
        height: 40px;
    }

    .start-screen-content h1 {
        font-size: 2em;
    }

    #question-container p {
        font-size: 1.2em;
    }

    #answers-container button {
        font-size: 1em;
        padding: 12px 15px;
    }

    #character-glossary {
        width: 100%;
        right: -100%;
    }

    #character-glossary.active {
        right: 0;
    }

    .modal {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .start-screen-content {
        padding: 25px;
    }

    .start-screen-content h1 {
        font-size: 1.8em;
    }

    .action-button {
        font-size: 1em;
        padding: 10px 20px;
    }
}
/* Force results screen padding - Additional rule */
body #results-screen {
    padding-left: 30px !important;
    padding-right: 30px !important;
    padding-bottom: 30px !important;
}
