/* Variáveis globais — cores e espaçamentos recorrentes */
:root {
    --color-text: #202020;
    --color-text-muted: #616161;
    --color-border: #e0e0e0;
    --color-success: #4caf50;
    --color-bg-dark: #1a1a1a;
    --modal-header-padding: 20px;
    --modal-header-border: 1px solid var(--color-border);
    --radius-md: 8px;
}

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

html {
    min-height: 100vh;
}

body {
    min-height: 100vh;
    font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--Colors-Orange-6, #FFC182);
    color: #333;
    display: flex;
    flex-direction: column;
}

.game-page {
    background-color: #ffffff;
}

/* Header: estado “convidado” desde o primeiro paint (evita flash de layout após logout) */
html.palavreco-header-guest #header-user {
  display: none !important;
}

/* Header — altura fixa para não crescer ao exibir avatar/logado */
.header {
    background-color: var(--color-bg-dark);
    color: white;
    padding: 12px 16px;
    min-height: 72px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-button {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

.back-button:hover {
    opacity: 0.8;
}

.back-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.logo {
    height: 30px;
    width: auto;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    object-fit: contain;
}

/* Header: área do usuário logado (avatar + Minha conta + dropdown Sair) */
.header-user {
    margin-left: auto;
    position: relative;
}

.header-user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: white;
}

.header-user-trigger:hover {
    background: rgba(255,255,255,0.1);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0d47a1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.header-user-name {
    font-size: 14px;
    font-weight: 500;
    color: white;
    line-height: 1.2;
}

.header-user-account {
    font-size: 12px;
    color: #ffca36;
    opacity: 0.7255;
    line-height: 1.2;
}

.header-user-trigger:hover .header-user-account {
    opacity: 1;
}

.header-user-chevron-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 2px;
}

.header-user-chevron {
    font-size: 10px;
    opacity: 0.9;
}

.header-user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 160px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 6px 0;
    z-index: 100;
}

.header-user-dropdown.is-open {
    display: block;
}

/* Mobile: só mostra o avatar; ao clicar abre o dropdown (Sair); esconde o texto "Voltar" */
@media (max-width: 768px) {
    .header-user-info {
        display: none;
    }
    .header-user-trigger {
        padding: 6px;
    }
    .back-button-text {
        display: none;
    }
}

.header-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 14px;
    color: #202020;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.header-user-item:hover {
    background: #f5f5f5;
}

.header-user-item-icon {
    font-size: 16px;
    opacity: 0.8;
}

.header-user-item-icon-img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Main Content - Página Inicial (fundo verde até o fim da página) */
.main-content {
    background: transparent;
    flex: 1;
    min-height: 0; /* permite que flex: 1 preencha o espaço restante */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.game-icon {
    margin-bottom: 20px;
}

.logo-palavreco,
.logo-combinacoes {
    width: 150px;
    height: auto;
    object-fit: contain;
}

.game-title {
    color: #424242;
    font-family: var(--Typography-Font-family-text, "Hanken Grotesk");
    font-size: 48px;
    font-style: normal;
    font-weight: 700;
    line-height: var(--Typography-Font-line-height-10, 64px);
    margin-bottom: 10px;
}

.game-tagline {
    font-size: 18px;
    color: #616161;
    margin-bottom: 30px;
    text-align: center;
}

.start-button {
    display: flex;
    padding: 8px 12px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    background: #202020;
    color: #FCFCFC;
    border: none;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    margin-bottom: 30px;
    transition: background-color 0.3s;
    max-width: 300px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.start-button:hover {
    background-color: #303030;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.action-btn {
    display: flex;
    padding: 8px 12px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border: none;
    cursor: pointer;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    transition: all 0.3s;
    color: #202020;
}

.action-btn-help {
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
}

.action-btn-ranking {
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
}

.action-btn:hover {
    opacity: 0.8;
}

.icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Ad Space */
.ad-space {
    margin-top: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.ad-banner-728x90 {
    width: 728px;
    max-width: 100%;
    height: 90px;
    background-color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

@media (max-width: 728px) {
    .ad-banner-728x90 {
        width: 100%;
    }
}

/* Ad Banner */
.ad-banner {
    background-color: #0d47a1;
    padding: 20px;
    width: 100%;
}

.ad-banner-top {
    background-color: white;
    padding: 15px 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.ad-banner-top .ad-banner-728x90 {
    width: 728px;
    max-width: 100%;
    height: 90px;
    background-color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

.ad-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
}

.ad-image {
    flex-shrink: 0;
}

.ad-placeholder {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
}

.ad-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.disney-logo {
    font-size: 18px;
    font-weight: bold;
}

.ad-subtitle {
    font-size: 14px;
    color: #b0bec5;
}

.ad-button {
    background-color: #00bcd4;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.ad-button:hover {
    background-color: #00acc1;
}

/* Game Header */
.game-header {
    background: var(--Colors-Orange-6, #FFC182);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.game-title-small {
    font-size: 24px;
    font-weight: bold;
    color: #212121;
    margin: 0;
}

.game-icons {
    display: flex;
    gap: 10px;
    position: absolute;
    right: 20px;
}

.icon-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.icon-button-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.game-mode {
    background-color: #EFEFEF;
    padding: 10px 20px;
    color: #616161;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.timer {
    font-family: 'Hanken Grotesk', monospace;
    font-weight: 500;
}

/* Message */
.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #424242;
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-size: 18px;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.message.show {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Help Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: block;
    opacity: 1;
}

.help-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    height: 100%;
    background-color: white;
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

.modal-overlay.show .help-modal {
    transform: translateX(0);
}

.help-modal-header,
.stats-modal-header,
.victory-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--modal-header-padding);
    border-bottom: var(--modal-header-border);
}

.help-modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.help-modal-header h2,
.victory-modal-header h2 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.close-modal:hover {
    opacity: 0.7;
}

.close-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.help-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.help-modal-content h3 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-top: 24px;
    margin-bottom: 12px;
}

.help-modal-content h4 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #202020;
    margin-top: 20px;
    margin-bottom: 12px;
}

.help-modal-content p {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    color: #202020;
    margin-bottom: 16px;
}

.help-modal-content ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 16px;
}

.help-modal-content ul li {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    color: #202020;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.help-modal-content ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #202020;
}

.help-modal-content .feedback-list {
    margin-top: 8px;
    margin-left: 20px;
}

.help-modal-content .feedback-list li {
    padding-left: 24px;
}

.help-modal-content .feedback-list li::before {
    content: "";
    position: absolute;
    left: 0;
}

/* Login Modal – identidade Palavreco */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-modal-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.login-modal {
    background-color: #ffffff;
    border-radius: 12px;
    max-width: 440px;
    width: 90%;
    padding: 28px 24px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.login-modal-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-title {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    color: #424242;
}

.login-subtitle {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.45;
    color: #616161;
}

.login-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 6px;
}

.login-secondary-button,
.login-primary-button {
    display: flex;
    padding: 10px 20px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    border: none;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.login-secondary-button {
    background: transparent;
    color: #616161;
}

.login-secondary-button:hover {
    color: #424242;
    background: rgba(0, 0, 0, 0.06);
}

.login-primary-button {
    background: #202020;
    color: #FCFCFC;
}

.login-primary-button:hover {
    background-color: #303030;
}

.login-secondary-button:hover,
.login-primary-button:hover {
    opacity: 1;
}

@media (max-width: 480px) {
    .help-modal {
        width: 100%;
    }
    
    .message {
        font-size: 14px;
        padding: 14px 14px;
    }
}

/* Victory Modal */
.victory-modal-overlay {
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.victory-modal-overlay.show {
    display: flex;
}

.victory-modal {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}


.victory-modal-content {
    padding: 24px;
}

.victory-time-section {
    text-align: center;
    margin-bottom: 24px;
}

.victory-correct-word-label {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #616161;
    margin-bottom: 16px;
}

.victory-correct-word {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.victory-letter-box {
    padding: 12px 16px;
    border-radius: 4px;
    color: #202020;
}

.victory-group-title {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.victory-group-items {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
}

.victory-letter-box.color-1 {
    background-color: #E9DD71;
}

.victory-letter-box.color-2 {
    background-color: #E9B37A;
}

.victory-letter-box.color-3 {
    background-color: #9DC5F4;
}

.victory-letter-box.color-4 {
    background-color: #C9A0FF;
}

.victory-time-label {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #202020;
    margin-bottom: 8px;
}

.victory-time-value {
    font-family: 'Hanken Grotesk', monospace;
    font-size: 40px;
    font-weight: 700;
    color: #202020;
    margin-bottom: 16px;
}

.victory-next-challenge {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
    color: #616161;
    margin-top: 16px;
}

.victory-countdown {
    font-family: 'Hanken Grotesk', monospace;
    font-size: 18px;
    font-weight: 600;
    color: #202020;
    margin-top: 4px;
}

.victory-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 24px 0;
}

.victory-ranking-section {
    text-align: center;
}

.victory-ranking-question {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #202020;
    margin-bottom: 8px;
}

.victory-ranking-text {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
    color: #616161;
    margin-bottom: 20px;
}

.victory-login-button {
    display: flex;
    padding: 8px 12px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    align-self: stretch;
    border-radius: 8px;
    background: #FFC300;
    color: #202020;
    border: none;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 16px;
    transition: opacity 0.3s;
}

.victory-login-button:hover {
    opacity: 0.9;
}

.victory-action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.victory-action-btn {
    display: flex;
    padding: 8px 8px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: #202020;
    border: none;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    flex: 1;
    transition: opacity 0.3s;
}

.victory-action-btn:hover {
    opacity: 0.8;
}

.victory-btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.victory-share {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.victory-share-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.victory-share-btn:hover {
    opacity: 0.7;
}

.victory-share-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Stats Modal (side panel) */
.stats-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    height: 100%;
    background-color: white;
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

.modal-overlay.show .stats-modal {
    transform: translateX(0);
}

.stats-modal-header h2 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.stats-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 32px;
    margin-bottom: 24px;
}

.stats-summary-kpis {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 16px;
    border-top: 1px solid #ededed;
    padding-top: 18px;
    margin-top: 4px;
}

.stats-summary-item {
    text-align: center;
}

.stats-summary-value {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #202020;
    margin-bottom: 4px;
}

.stats-summary-label {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 12px;
    color: #616161;
}

.stats-section-title {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #202020;
    margin-bottom: 12px;
}

.stats-attempts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-attempt-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-attempt-number {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #202020;
}

.stats-attempt-bar {
    flex: 1;
    height: 24px;
    border-radius: 12px;
    background-color: #e0e0e0;
    overflow: hidden;
    position: relative;
}

.stats-attempt-bar-fill {
    height: 100%;
    background-color: #d4ff4f;
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    box-sizing: border-box;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #202020;
}

.stats-attempt-bar-fill.empty {
    background-color: transparent;
}

@media (max-width: 600px) {
    .stats-modal {
        width: 100%;
    }
    
    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 20px;
    }

    .stats-summary-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading global (overlay + spinner) */
.global-loading {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.global-loading.show {
    opacity: 1;
    visibility: visible;
}
.global-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: global-loading-spin 0.8s linear infinite;
}
.global-loading-text {
    margin-top: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}
@keyframes global-loading-spin {
    to { transform: rotate(360deg); }
}

/* Loading dentro do modal de estatísticas */
.stats-loading {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--color-text-muted);
    font-size: 14px;
}
.stats-loading.show {
    display: flex;
}
.stats-modal-content.has-loading .stats-summary,
.stats-modal-content.has-loading .stats-summary-kpis,
.stats-modal-content.has-loading .stats-section-title,
.stats-modal-content.has-loading .stats-attempts-list {
    visibility: hidden;
}