:root {
    --primary-color: #ffb6c1;
    --secondary-color: #ffd1dc;
    --accent-color: #ff69b4;
    --text-color: #333;
    --light-color: #fff;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --border-radius: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
}

body {
    background-color: #fff5f7;
    color: var(--text-color);
    overflow-x: hidden;
}

/* Importar fuentes bonitas para chino */
@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=ZCOOL+QingKe+HuangYou&family=Noto+Sans+SC:wght@300;400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Liu+Jian+Mao+Cao&display=swap');

.app-container {
    display: flex;
    height: 100vh;
}

/* Barra de herramientas */
.toolbar {
    width: 90px;
    background: linear-gradient(180deg, var(--primary-color), #ffa8b5);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 10;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.toolbar-group {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
}

.tool-btn {
    width: 100%;
    height: 60px;
    border: none;
    border-radius: var(--border-radius);
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    padding: 10px;
}

.tool-btn:hover {
    transform: translateY(-3px);
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tool-btn:active {
    transform: translateY(-1px);
}

.tool-btn.active {
    background: linear-gradient(145deg, var(--accent-color), #ff4da6);
    color: white;
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
}

.tool-btn.active:hover {
    background: linear-gradient(145deg, #ff4da6, #ff3385);
}

#shuffleBtn .icon {
    font-size: 1.4rem;
}

#shuffleBtn:hover {
    background: linear-gradient(145deg, #e1f5fe, #b3e5fc);
}

#shuffleBtn:active {
    transform: translateY(-1px) rotate(15deg);
    transition: all 0.2s ease;
}

/* Indicador de fuente actual */
.font-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background-color: var(--accent-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tool-btn.active .font-indicator {
    background-color: white;
    border: 2px solid var(--accent-color);
}

/* Etiquetas de texto para botones (opcional) */
.btn-label {
    position: absolute;
    bottom: -20px;
    font-size: 0.7rem;
    color: #666;
    white-space: nowrap;
    opacity: 0;
    transition: var(--transition);
}

.tool-btn:hover .btn-label {
    opacity: 1;
}

/* Contenedor de burbujas */
.bubbles-container {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
    overflow-y: auto;
    background-color: #fff9fb;
}

.welcome-message {
    width: 100%;
    text-align: center;
    padding: 20px;
    color: var(--accent-color);
}

.welcome-message h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.welcome-message p {
    font-size: 1.2rem;
    color: #666;
}

/* Burbujas de caracteres */
.bubble {
    width: 180px;
    min-height: 150px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.4) 0%, transparent 60%);
    z-index: 0;
}

.bubble:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.character {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1;
    transition: var(--transition);
}

/* Estilos de fuentes específicas */
.font-ma-shan-zheng .character {
    font-family: 'Ma Shan Zheng', cursive;
}

.font-liu-jian-mao-cao .character {
    font-family: 'Liu Jian Mao Cao', cursive;
    font-weight: normal;
}

.font-zcool .character {
    font-family: 'ZCOOL QingKe HuangYou', sans-serif;
}

.font-noto-sans .character {
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: 500;
}

.font-simhei .character {
    font-family: 'SimHei', 'Microsoft YaHei', sans-serif;
}

.pinyin {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 8px;
    z-index: 1;
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    font-weight: 500;
}

.meaning {
    font-size: 1rem;
    color: #666;
    text-align: center;
    z-index: 1;
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    line-height: 1.3;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--light-color);
    margin: 10% auto;
    padding: 25px;
    border-radius: 20px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover {
    color: var(--accent-color);
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--accent-color);
}

#textInput {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    resize: vertical;
    font-size: 1rem;
    margin-bottom: 20px;
    font-family: 'Ma Shan Zheng', 'ZCOOL QingKe HuangYou', 'Noto Sans SC', sans-serif;
    font-size: 1.2rem;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
}

#confirmTextBtn {
    background-color: var(--accent-color);
    color: white;
}

#confirmTextBtn:hover {
    background-color: #ff4da6;
}

#cancelTextBtn {
    background-color: #e0e0e0;
    color: #666;
}

#cancelTextBtn:hover {
    background-color: #d0d0d0;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .toolbar {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 15px 10px;
        border-radius: 0 0 var(--border-radius) var(--border-radius);
    }
    
    .toolbar-group {
        flex-direction: row;
        margin-bottom: 0;
        gap: 8px;
    }
    
    .tool-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    .bubble {
        width: 150px;
        min-height: 150px;
    }
    
    .character {
        font-size: 2.5rem;
    }
    
    .font-indicator {
        width: 8px;
        height: 8px;
        bottom: 6px;
        right: 6px;
    }
}

/* Estilos adicionales para diferentes tamaños de fuente */
.bubble-size-small .character {
    font-size: 2rem !important;
}

.bubble-size-medium .character {
    font-size: 3rem !important;
}

.bubble-size-large .character {
    font-size: 4rem !important;
}

.bubble-size-xlarge .character {
    font-size: 5rem !important;
}

/* Efectos de profundidad para botones */
.tool-btn {
    border: 2px solid transparent;
}

.tool-btn:hover {
    border: 2px solid rgba(255, 105, 180, 0.2);
}

.tool-btn.active {
    border: 2px solid rgba(255, 255, 255, 0.3);
}


/* Modal de grupos */
.group-modal {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin: 15px 0;
    max-height: 400px;
    overflow-y: auto;
}

.group-btn {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    background: linear-gradient(145deg, #ffffff, #f8f8f8);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    position: relative;
    min-height: 60px;
}

.group-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.group-btn.selected {
    border-color: var(--accent-color);
    background: linear-gradient(145deg, var(--primary-color), #ffc2d1);
}

.group-name {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.group-chars {
    font-size: 0.8rem;
    color: #666;
    font-family: 'Ma Shan Zheng', 'ZCOOL QingKe HuangYou', sans-serif;
    line-height: 1.2;
}

.group-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--secondary-color);
    border-radius: 3px;
    background: white;
}

.group-btn.selected .group-check {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.group-btn.selected .group-check::after {
    content: '✓';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Estilos para el modal de animación de trazos */
.stroke-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stroke-modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.stroke-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}

.stroke-close:hover {
    color: var(--accent-color);
}

#stroke-animation-container {
    margin: 20px auto;
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    background: white;
}

.stroke-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.stroke-controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.stroke-controls button:hover {
    background: #ff4da6;
}
