:root {
    --sidebar-bg: #1f2937; /* Cinza escuro para fundo da sidebar */
    --main-bg: #000000; /* Preto */
    --text-color: #f0f0f0; /* Branco acinzentado */
    --button-bg: #2563eb; /* Azul Tailwind */
    --button-hover-bg: #1d4ed8; /* Azul hover */
    --control-bg: #4b5563; /* Cinza para controles */
    --control-hover-bg: #6b7280; /* Hover para controles */
    --border-color: #374151; /* Cinza escuro para bordas */
    --input-bg: #f3f4f6; /* Cinza claro para inputs */
    --input-text-color: #1f2937; /* Texto escuro */
}

.dark {
    --input-bg: #374151;
    --input-text-color: #f3f4f6;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background-color: var(--main-bg);
    color: var(--text-color);
    box-sizing: border-box;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* Layout principal */
.page-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.main-content {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.page-content {
    width: 100%;
    padding: 0;
    display: flex;
    justify-content: space-between;
    max-width: 100vw;
    overflow-x: hidden;
    gap: 0; /* Removido espaço entre os elementos */
    align-items: flex-start; /* Alinhar elementos ao topo */
    height: auto !important; /* Garantir que não expanda indevidamente */
    overflow-y: visible; /* Permitir rolagem natural da página */
    flex: 1;
    position: relative;
    flex-wrap: nowrap;
    min-height: auto !important;
}

/* Container fluido para ocupar toda a largura */
.container-fluid {
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Área de exibição - Canvas 16:9 ampliado ao centro */
.display-area {
    background-color: var(--main-bg);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 16/9 !important;
    flex: 1;
    min-width: 0;
    margin: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    height: auto !important; /* Garantir que não expanda além do necessário */
    max-height: 700px !important; /* Altura máxima fixa aumentada */
}

/* Sidebar de controles - otimizada para largura menor */
.sidebar {
    background-color: var(--sidebar-bg);
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.6rem 0.5rem;
    height: auto;
    min-height: 400px; /* Altura mínima ainda mais reduzida */
    max-height: 700px !important; /* Altura máxima fixa aumentada */
    flex-shrink: 0;
    flex-grow: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 1rem;
    margin: 0;
    width: 220px;
    max-width: 220px;
    padding-left: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Impede rolagem na sidebar inteira */
}

/* Organização da sidebar em três seções */
.sidebar-header {
    flex-shrink: 0; /* Não permitir encolhimento */
    width: 100%;
    margin-bottom: 5px;
}

.sidebar-scrollable-content {
    flex-grow: 1; /* Crescer para ocupar o espaço disponível */
    overflow-y: auto; /* Habilitar rolagem vertical */
    max-height: calc(100% - 110px); /* Limitar altura máxima para dar espaço ao footer */
    margin-bottom: 5px;
    min-height: 0; /* Permitir que encolha conforme necessário */
    /* Impedir que a altura aumente além do necessário */
    overflow-y: scroll !important; /* Sempre mostrar a barra de rolagem */
}

.sidebar-footer {
    flex-shrink: 0; /* Não permitir encolhimento */
    width: 100%;
    padding-top: 5px;
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Empurrar para o final do container flex */
}

/* Área lateral para anúncios - otimizada para largura menor */
.ads-sidebar {
    background-color: var(--sidebar-bg);
    border-radius: 0.5rem 0 0 0.5rem;
    padding: 0.5rem 0.3rem;
    height: auto;
    min-height: 400px; /* Altura mínima ainda mais reduzida */
    max-height: 700px !important; /* Altura máxima fixa aumentada */
    overflow-y: auto;
    flex-shrink: 0;
    flex-grow: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 1rem;
    margin: 0;
    width: 220px;
    max-width: 220px;
    padding-right: 6px;
}

/* Container principal dos cronômetros */
#cronometros-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 2px;
    padding-bottom: 5px; /* Espaço no final para melhor aparência */
    max-height: 100%; /* Garantir que não ultrapasse a altura do container pai */
}

/* Estilização da barra de rolagem apenas para a área de conteúdo rolável */
.sidebar-scrollable-content {
    scrollbar-width: thin;
    scrollbar-color: var(--control-bg) var(--sidebar-bg);
}

.sidebar-scrollable-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-scrollable-content::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
    border-radius: 4px;
}

.sidebar-scrollable-content::-webkit-scrollbar-thumb {
    background-color: var(--control-bg);
    border-radius: 4px;
}

/* Layout responsivo atualizado */
@media (max-width: 768px) {
    .page-content {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .sidebar, .ads-sidebar {
        width: 100%;
        max-width: 100%;
        margin: 0;
        position: static;
        max-height: none;
        min-height: auto;
        border-radius: 0.5rem;
        padding: 1rem;
    }
    
    .display-area {
        width: calc(100% - 20px);
        aspect-ratio: 16/9 !important;
        margin: 10px;
        max-width: 100%;
    }
}

/* Ajuste para telas médias */
@media (min-width: 769px) and (max-width: 1200px) {
    .sidebar, .ads-sidebar {
        width: 190px;
        max-width: 190px;
        min-width: 180px;
    }
    
    .page-content {
        gap: 0;
    }
    
    .display-area {
        margin: 0;
    }
}

/* Ajuste para telas médias-grandes */
@media (min-width: 1201px) and (max-width: 1500px) {
    .sidebar, .ads-sidebar {
        width: 220px;
        max-width: 220px;
    }
    
    .page-content {
        gap: 0;
    }
    
    .display-area {
        margin: 0;
    }
}

/* Ajuste para telas grandes */
@media (min-width: 1501px) {
    .page-content {
        padding: 0;
        margin: 0;
        max-width: 100%;
        justify-content: space-between;
        gap: 0;
    }
    
    .display-area {
        margin: 0;
        max-width: 100%;
    }
    
    .sidebar, .ads-sidebar {
        width: 220px;
        max-width: 220px;
    }
}

/* Estilos para quebra de layout em telas muito grandes */
@media (min-width: 1800px) {
    .page-content {
        width: 100%;
        max-width: 1800px;
        margin: 0 auto;
    }
}

/* Garante que os elementos tenham a mesma altura em desktop */
@media (min-width: 769px) {
    .page-content {
        align-items: stretch;
    }
    
    .sidebar, .ads-sidebar {
        display: flex;
        flex-direction: column;
    }
}

/* --- Controles de Exibição --- */
.exibicao-controls {
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
    flex-shrink: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.exibicao-controls h2 {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

.buttons-row {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
    width: 100%;
    max-width: 210px;
}

.buttons-row button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48%;
    font-size: 0.7rem;
    transition: background-color 0.3s;
    padding: 0.25rem 0.3rem;
}

.buttons-row button svg {
    margin-bottom: 0.05rem;
    width: 14px;
    height: 14px;
}

.buttons-row button:hover {
    background-color: var(--button-hover-bg);
}

/* --- Checkbox Geral --- */
.checkbox-row {
    margin: 0.3rem 0;
    padding: 0.2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progressivo-row {
    margin: 0.3rem auto;
    display: flex;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 0.3rem 0;
    max-width: 150px;
}

.checkbox-row label {
    font-size: 0.7rem;
    margin-left: 0.25rem;
    user-select: none;
}

.checkbox-row input[type="checkbox"] {
    cursor: pointer;
    transform: scale(1.1);
    accent-color: #0ea5e9;
}

.checkbox-row.progressivo {
    background-color: #1e293b;
}

.controls-row .checkbox-row {
    flex: 0 0 100%;
    margin-top: 0.2rem;
    padding: 0.2rem 0;
    justify-content: center;
    display: flex;
}

/* --- Box do Cronômetro --- */
.cronometro-box {
    margin-bottom: 0.5rem;
    background-color: #374151;
    border: 1px solid #4b5563;
    border-radius: 0.4rem;
    overflow: hidden;
    width: 100%;
    max-width: 210px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex-shrink: 0; /* Evitar que encolha */
    min-height: 0; /* Permitir que encolha verticalmente se necessário */
}

/* Otimiza cabeçalho do cronômetro */
.cronometro-header {
    padding: 0.3rem 0.5rem;
    display: flex;
    align-items: center;
    background-color: #1f2937;
    border-bottom: 1px solid #4b5563;
}

.cronometro-header input[type="checkbox"] {
    margin-right: 0.4rem;
    cursor: pointer;
    transform: scale(1.1);
    accent-color: #0ea5e9;
}

.cronometro-header label {
    font-size: 0.8rem;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: white;
}

.collapse-btn,
.delete-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0 0.15rem;
    margin-left: 0.15rem;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.collapse-btn:hover,
.delete-btn:hover {
    opacity: 1;
}

.delete-btn:hover {
    color: #ef4444;
}

.cronometro-content {
    padding: 0.5rem 0.5rem;
    border-top: 1px solid #4b5563;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    max-height: 1000px;
    overflow: hidden;
    background-color: #2a3441;
}

.cronometro-content > div {
    margin-bottom: 0.5rem;
}

.cronometro-content > div:last-child {
    margin-bottom: 0;
}

.cronometro-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
}

/* Controles em linhas horizontais compactas mais centralizadas */
.controls-row {
    margin-bottom: 0.4rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.15rem;
    padding: 0.15rem 0;
    background-color: #2c3440;
    border-radius: 4px;
}

.controls-row .control-btn {
    flex: 0 0 calc(33% - 6px);
    padding: 0.25rem 0.1rem;
    margin: 0;
    font-size: 0.8rem;
    text-align: center;
    border-radius: 3px;
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.controls-row .control-btn:first-child {
    background-color: #0ea5e9; /* Azul para o Play */
}

.controls-row .control-btn:nth-child(2) {
    background-color: #6366f1; /* Roxo para o Pause */
}

.controls-row .control-btn:last-child {
    background-color: #f43f5e; /* Rosa para o Reset */
}

.controls-row .control-btn:hover {
    transform: translateY(-1px);
    filter: brightness(110%);
}

.controls-row .control-btn:active {
    transform: translateY(1px);
    filter: brightness(90%);
}

/* Layout horizontal para time inputs - melhor centralizado */
.time-input-container {
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    background-color: #2c3440;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.time-input {
    width: 2.6rem;
    padding: 0.15rem;
    font-size: 0.8rem;
    text-align: center;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.time-separator {
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0 -2px;
}

/* Remove esse conteúdo problemático completamente */
.time-input-container::after {
    content: none !important;
    display: none !important;
}

/* Grupos de controles lado a lado mais alinhados */
.input-groups-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
    justify-content: center;
}

.input-groups-container > div {
    flex: 0 0 calc(50% - 0.15rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Seletores de cor mais atrativos */
.color-pickers-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
    width: 100%;
}

.color-picker-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
    padding: 0.2rem;
    background-color: #1e293b;
    border-radius: 4px;
}

.color-picker-group label {
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    text-align: center;
    color: white;
    font-weight: 500;
}

.color-picker-group input[type="color"] {
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Sliders com melhor feedback visual */
.font-size-slider-group,
.label-font-size-slider-group {
    margin-bottom: 0.4rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #1e293b;
    border-radius: 4px;
    padding: 0.3rem;
}

.font-size-slider-group label,
.label-font-size-slider-group label {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    text-align: center;
    width: 100%;
    color: white;
    font-weight: 500;
}

.font-size-slider-group input[type="range"],
.label-font-size-slider-group input[type="range"] {
    height: 0.4rem;
    width: 100%;
    margin: 4px 0;
    cursor: pointer;
    -webkit-appearance: none;
    background: #4b5563;
    border-radius: 4px;
    outline: none;
}

.font-size-slider-group input[type="range"]::-webkit-slider-thumb,
.label-font-size-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #0ea5e9;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Melhorias no select de fonte */
.font-select-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    background-color: #1e293b;
    border-radius: 4px;
    padding: 0.3rem;
}

.font-select-group label {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    text-align: center;
    width: 100%;
    color: white;
    font-weight: 500;
}

.font-select-group select {
    width: 100%;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    border-radius: 3px;
    border: 1px solid #4b5563;
    cursor: pointer;
    background-color: #f8fafc;
    color: #000000;
    height: auto;
    appearance: menulist;
}

.font-select-group select option {
    background-color: #f8fafc;
    color: #000000;
    font-size: 0.9rem;
    padding: 0.4rem;
    height: auto;
}

/* --- Label Controls --- */
.label-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.5rem;
}

.label-input-group label {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    text-align: center;
    color: white;
    font-weight: 500;
}

.label-input-group input[type="text"] {
    width: 100%;
    padding: 0.3rem;
    font-size: 0.75rem;
    border-radius: 3px;
    border: 1px solid #4b5563;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.label-controls-container {
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.3rem;
}

.label-color-picker {
    width: auto;
}

/* --- Botão de Centralizar Rótulo --- */
.label-position-buttons {
    display: none;
}

.btn-centralizar-rotulo {
    display: none;
}

/* Botão para centralizar cronômetro */
.btn-centralizar-cronometro {
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.65rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 3px;
    width: 100%;
}

.btn-centralizar-cronometro:hover {
    background-color: #555;
}

.btn-centralizar-cronometro:active {
    background-color: #333;
}

/* Adicionar um container combinado para input e cor do rótulo */
.label-controls-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 0.3rem;
    background-color: #1e293b;
    border-radius: 4px;
    padding: 0.3rem;
}

.label-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    margin-top: 0.2rem;
}

.label-color-picker {
    flex: 0 0 auto;
    width: auto;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

.label-color-picker label {
    font-size: 0.65rem !important;
    margin-bottom: 0.1rem !important;
}

/* Refinar checkbox no controle de rótulo */
.label-row .checkbox-row {
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-grow: 1;
    justify-content: flex-start !important;
}

.label-row .checkbox-row input[type="checkbox"] {
    margin-right: 0.2rem;
}

.label-row .checkbox-row label {
    font-size: 0.65rem !important;
}

/* Botão adicionar cronômetro centralizado */
.add-button {
    margin: 0.4rem auto 0.2rem auto; /* Reduzir margem inferior */
    padding: 0.25rem 0.4rem;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    width: 100%;
    max-width: 210px;
}

.add-button svg {
    width: 12px;
    height: 12px;
    margin-right: 0.2rem;
}

/* Botão upload logo centralizado */
.logo-upload-section {
    margin: 0.2rem auto 0; /* Reduzir margem superior */
    width: 100%;
    display: flex;
    justify-content: center;
}

.logo-button {
    padding: 0.25rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 3px;
    cursor: pointer;
    width: 100%;
    max-width: 210px;
    text-align: center;
}

/* Separador para melhor organização visual */
hr {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.4rem 0;
    width: 100%;
}

/* --- Elementos na Área de Exibição --- */
.cronometro-display,
.label-display,
.logo-display {
    position: absolute;
    cursor: move;
    padding: 5px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    user-select: none;
    border: 1px dashed transparent;
    min-width: 50px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform-origin: center center;
    transition: border 0.2s, box-shadow 0.2s;
    /* Garantir que as alças fiquem contidas no elemento */
    position: absolute !important;
    transform-style: preserve-3d;
}

/* Adicionar um destaque sutil para mostrar o centro do cronômetro */
.cronometro-display::before,
.label-display::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.cronometro-display .time-display,
.label-display .label-text {
    display: inline-block;
    width: 100%;
    text-align: center;
}

/* Exibir ponto central ao passar o mouse */
.cronometro-display:hover::before,
.label-display:hover::before,
.logo-display:hover::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: rgba(59, 130, 246, 0.7);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

/* Indicadores visuais ao mover/redimensionar */
.dragging, .resizing {
    opacity: 0.8;
    border: 1px dashed #3b82f6 !important;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

/* Estilo para mostrar o centro do elemento quando está sendo manipulado */
.dragging::after, 
.resizing::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #3b82f6;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.9);
}

/* Grade de referência no canvas */
.display-area::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.15) 40%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.15) 60%, 
        rgba(255, 255, 255, 0.05) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.display-area::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.15) 40%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.15) 60%, 
        rgba(255, 255, 255, 0.05) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Marcador de centro do canvas */
.display-area .center-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

/* Estilos adicionados para interact.js */
.draggable,
.resizable {
  touch-action: none;
  user-select: none;
}

/* Estilo para quando o elemento está sendo redimensionado */
.resizing {
    border-style: solid !important;
    opacity: 0.8;
}

.dragging {
     opacity: 0.8;
}

/* Correção para os rótulos (label-display) - garantir que textos permaneçam horizontais */
.label-display {
    font-size: 1.5em;
    font-weight: normal;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 80px;  /* Garantir uma largura mínima */
    min-height: 30px; /* Garantir uma altura mínima */
    padding: 5px;     /* Adicionar espaço interno para o texto */
    box-sizing: border-box !important;
    position: relative;
    overflow: hidden !important; /* Ocultar conteúdo que ultrapassa as dimensões */
    flex-direction: row !important; /* Forçar layout horizontal */
    white-space: nowrap !important; /* Impedir quebra de linha no texto */
    width: auto !important; /* Permitir que a largura seja ajustada automaticamente */
    height: auto !important; /* Permitir que a altura seja ajustada automaticamente */
    max-width: 100% !important; /* Limitar largura máxima */
    line-height: 1.2 !important; /* Limitar altura da linha */
}

.label-display .label-text {
    width: 100% !important;
    text-align: center !important;
    display: inline-block !important;
    white-space: nowrap !important; /* Impedir quebra de linha */
    overflow: hidden !important; /* Evitar overflow do texto */
    flex-wrap: nowrap !important; /* Impedir quebra de linha */
    text-overflow: ellipsis !important; /* Mostrar "..." se o texto for muito longo */
    font-size: inherit !important; /* Herdar tamanho da fonte do elemento pai */
}

.logo-display {
    padding: 0;
    border: 1px dashed transparent;
    background-color: transparent;
    overflow: hidden;
    position: absolute;
    cursor: move;
    outline: none; /* Remove a borda de foco padrão */
}

.logo-display:hover {
    border: 1px dashed rgba(255, 255, 255, 0.5);
}

.logo-display:focus {
    border: 1px dashed rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.6);
}

.logo-display img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-drag: none;
    -webkit-user-drag: none;
    pointer-events: none; /* Garante que o arrasto é pelo contêiner, não pela imagem */
}

/* --- Placeholder para Animação --- */
.background-animation-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* --- Alças de Redimensionamento --- */
.resize-handle {
    position: absolute;
    width: 16px;      /* Aumentar tamanho para facilitar clique */
    height: 16px;     /* Aumentar tamanho para facilitar clique */
    background: white;
    border: 2px solid #2563eb;
    border-radius: 50%;
    z-index: 30;      /* Aumentar z-index para garantir que fique acima de outros elementos */
    visibility: hidden;
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3); /* Adicionar sombra para melhor visibilidade */
    transition: transform 0.1s ease, background-color 0.2s ease;
    /* Garantir que as alças sejam parte do elemento pai e não do canvas */
    position: absolute;
    transform: none !important;
    margin: 0 !important;
    /* Remover qualquer transform herdado */
    transform: translate(0, 0) !important;
}

.draggable:hover .resize-handle,
.draggable:active .resize-handle,
.draggable:focus .resize-handle {
    visibility: visible;
}

.resize-handle:hover {
    transform: scale(1.2);  /* Aumentar ligeiramente ao passar o mouse */
    background-color: #e0f0ff;
}

.handle-se {
    bottom: -8px !important;  /* Posicionamento absoluto */
    right: -8px !important;
    cursor: nwse-resize;
    transform: none !important;
    margin: 0 !important;
    left: auto !important;
    top: auto !important;
}

.handle-nw {
    top: -8px !important;     /* Posicionamento absoluto */
    left: -8px !important;
    cursor: nwse-resize;
    transform: none !important;
    margin: 0 !important;
    right: auto !important;
    bottom: auto !important;
}

.handle-ne {
    top: -8px !important;     /* Posicionamento absoluto */
    right: -8px !important;
    cursor: nesw-resize;
    transform: none !important;
    margin: 0 !important;
    left: auto !important;
    bottom: auto !important;
}

.handle-sw {
    bottom: -8px !important;  /* Posicionamento absoluto */
    left: -8px !important;
    cursor: nesw-resize;
    transform: none !important;
    margin: 0 !important;
    right: auto !important;
    top: auto !important;
}

/* Slider Tamanho Fonte */
.font-size-slider-group {
    margin-bottom: 0.3rem;
}

.font-size-slider-group label {
    font-size: 0.65rem;
    margin-bottom: 0.1rem;
}

.font-size-slider-group input[type="range"] {
    height: 0.3rem;
    width: 100%;
    margin: 2px 0;
}

/* Slider Tamanho Rótulo (similar ao de Fonte) */
.label-font-size-slider-group {
    margin-bottom: 0.3rem;
}

.label-font-size-slider-group label {
    font-size: 0.65rem;
    margin-bottom: 0.1rem;
}

.label-font-size-slider-group input[type="range"] {
    height: 0.3rem;
    width: 100%;
    margin: 2px 0;
}

/* --- Global Styles --- */
body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #222;
    color: #e0e0e0;
}

/* --- Site Header --- */
.site-header {
    background-color: #1a1a1a;
    color: #fff;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid #444;
}

.site-header .logo-placeholder {
    width: 50px;
    height: 50px;
    background-color: #555;
    border-radius: 50%;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
}

.site-header h1 {
    margin: 0;
    font-size: 1.8em;
    font-weight: bold;
}

/* --- Site Footer --- */
.site-footer {
    background-color: #1a1a1a;
    color: #ccc;
    padding: 30px 30px 10px 30px;
    border-top: 2px solid #444;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.footer-column {
    flex: 1;
    min-width: 180px;
    margin: 10px 15px;
}

.footer-column h4 {
    color: #fff;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 8px;
    display: inline-block;
}

.footer-column.footer-about p {
    font-size: 0.9em;
    line-height: 1.5;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column ul li {
    margin-bottom: 10px;
}

.footer-column ul li a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.9em;
}

.footer-column ul li a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-copyright {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #333;
    font-size: 0.85em;
    color: #aaa;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Ads Sidebar --- */
.ad-placeholder {
    width: 100%;
    height: 250px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    opacity: 0.5;
}

.ad-placeholder:last-child {
    margin-bottom: 0;
}

.ad-placeholder::before {
    content: 'Espaço Anúncio';
}

/* --- Refinamentos de Tema e Cores --- */
hr {
    border-top: 1px solid #555;
    margin: 3px 0;
}

/* Otimização para exibir caixas lado a lado */
.color-pickers-row {
    margin-bottom: 0.3rem;
    display: flex;
    justify-content: space-between;
    gap: 0.15rem;
}

/* Controles em linhas horizontais compactas */
.controls-row {
    margin-bottom: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.1rem;
}

.controls-row .control-btn {
    flex: 0 0 calc(33% - 2px);
    padding: 0.15rem 0.1rem;
    margin: 0;
    font-size: 0.7rem;
    text-align: center;
}

.controls-row .checkbox-row {
    flex: 0 0 100%;
    margin-top: 0.1rem;
    padding: 0;
}

/* Layout horizontal para time inputs */
.time-input-container {
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
}

/* Campos de entrada de tipo texto, número e select */
.time-input {
    width: 2.5rem;
    padding: 0.1rem;
    font-size: 0.7rem;
    text-align: center;
}

/* Grupos de controles lado a lado */
.input-groups-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 0.3rem;
}

.input-groups-container > div {
    flex: 0 0 calc(50% - 0.1rem);
}

/* Checkbox mais compacto e horizontal */
.checkbox-row {
    margin-bottom: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.checkbox-row label {
    font-size: 0.7em;
    margin-left: 0.2rem;
}

/* Otimiza cabeçalho do cronômetro */
.cronometro-header {
    padding: 0.15rem 0.2rem;
    display: flex;
    align-items: center;
}

.cronometro-header label {
    font-size: 0.7rem;
    flex-grow: 1;
}

/* Reduz espaço no conteúdo do cronômetro */
.cronometro-content {
    padding: 0.2rem;
}

/* Estilos adicionais para garantir a visibilidade e posicionamento */
.draggable {
    position: absolute !important;
    /* Garantir que as transformações não afetem o posicionamento das alças */
    transform-style: flat;
    /* Elemento relativamente posicionado para conter as alças */
    contain: layout;
}

/* Estilos adicionais para garantir a visibilidade e posicionamento */
.resizing {
    border-style: solid !important;
    opacity: 0.8;
}

.dragging {
     opacity: 0.8;
}

/* Ajustes específicos para alturas fixas */
.page-content {
    position: relative;
    flex-wrap: nowrap;
    min-height: auto !important;
}

/* Fixar alturas para telas pequenas */
@media (max-width: 1200px) {
    .sidebar,
    .display-area,
    .ads-sidebar {
        max-height: 700px !important;
        height: auto !important;
    }
    
    .page-content {
        height: auto !important;
        min-height: auto !important;
        flex-wrap: nowrap;
    }
}

/* Ajustes para scroll da página */
html, body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
}

.cronometro-position-buttons {
    display: flex;
    justify-content: center;
    margin: 0.4rem 0;
}

.bg-controls-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    margin-left: auto;
    justify-content: space-between; /* Distribuir espaço entre os botões */
    align-items: stretch;
    height: 64px; /* Altura total aproximada dos boxes de cores com labels */
    padding-bottom: 2px; /* Pequeno ajuste para alinhar com a base dos boxes */
}

.bg-button {
    padding: 0 3px;
    font-size: 0.7rem;
    border-radius: 4px;
    background-color: var(--control-bg);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 27px; /* Altura maior para alinhar com os boxes de cores */
    white-space: nowrap;
    transition: background-color 0.2s;
    line-height: 1;
}

.bg-button:hover {
    background-color: var(--control-hover-bg);
}

.bg-button:active {
    transform: scale(0.98);
}

.bg-button-remove {
    background-color: #cc0000;
    margin-top: 0; /* Remover margem superior */
}

.bg-button-remove:hover {
    background-color: #ff0000;
} 
/* Seo de controles de imagem de fundo */
.bg-controls-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 5px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.bg-controls-buttons {
    display: flex;
    gap: 6px;
    width: 100%;
}

.bg-controls-buttons .bg-button {
    flex: 1;
}

/* Controle de opacidade */
.bg-opacity-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bg-opacity-control label {
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.9;
}

.opacity-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.opacity-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, rgba(255,255,255,0.2), rgba(255,255,255,0.8));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--button-bg);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.opacity-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--button-bg);
    cursor: pointer;
    border: 2px solid white;
}

.opacity-value {
    font-size: 0.75rem;
    color: var(--text-color);
    min-width: 35px;
    text-align: right;
    font-weight: 500;
}

/* Correes de layout para controles de imagem de fundo */
.color-pickers-row {
    flex-wrap: wrap !important;
}

.bg-controls-section {
    width: 100% !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding: 8px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 6px;
    order: 3;
}

.bg-controls-buttons {
    display: flex;
    gap: 6px;
    width: 100%;
}

.bg-controls-buttons .bg-button {
    flex: 1;
    min-width: 0;
}

.bg-opacity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.bg-opacity-control label {
    font-size: 0.7rem;
    color: white;
    white-space: nowrap;
    min-width: 55px;
}

.opacity-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.opacity-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, rgba(255,255,255,0.2), rgba(255,255,255,0.8));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--button-bg);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.opacity-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--button-bg);
    cursor: pointer;
    border: 2px solid white;
}

.opacity-value {
    font-size: 0.75rem;
    color: white;
    min-width: 35px;
    text-align: right;
    font-weight: 500;
}

/* --- Fixed Width Digits for Jitter Prevention --- */
.digit {
    display: inline-block;
    width: 1ch; /* Width of the '0' character */
    text-align: center;
}

.sep {
    display: inline-block;
    width: 0.5ch; /* Half the width of a digit */
    text-align: center;
}
