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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 도구 모음 */
.toolbar {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-info {
    background: #FF9800;
    color: white;
}

.btn-help {
    background: #9C27B0;
    color: white;
}

/* 만다라트 그리드 */
.mandalart-grid {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

/* 3x3 섹션 (큰 그리드의 각 칸) */
.section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

/* 중심 섹션 강조 */
.section.center-section {
    border-color: #2196F3;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

/* 개별 셀 */
.cell {
    aspect-ratio: 1;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    min-height: 80px;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 0.85em;
    padding: 3px;
    font-family: inherit;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.cell input:focus {
    outline: none;
    background: #fffde7;
}

/* 중심 목표 셀 */
.cell.main-goal {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    font-weight: bold;
    min-height: 90px;
}

.cell.main-goal input {
    color: white;
    font-weight: bold;
    font-size: 0.95em;
}

.cell.main-goal input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* 하위 목표 셀 (중심 섹션의 주변 8개) */
.cell.sub-goal {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    color: white;
    font-weight: 600;
}

.cell.sub-goal input {
    color: white;
    font-weight: 600;
}

.cell.sub-goal input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* 연결된 셀 (다른 섹션에서 하위 목표가 반복되는 셀) */
.cell.linked {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
    font-weight: 600;
    pointer-events: none;
}

.cell.linked input {
    color: white;
    font-weight: 600;
}

/* 현재 편집 섹션 정보 */
.current-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.current-section h3 {
    color: #333;
}

#sectionTitle {
    color: #2196F3;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #000;
}

.help-content {
    margin-top: 20px;
}

.help-content h3 {
    color: #2196F3;
    margin-top: 20px;
    margin-bottom: 10px;
}

.help-content ul {
    margin-left: 20px;
}

.help-content li {
    margin: 5px 0;
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .mandalart-grid {
        padding: 15px;
        gap: 8px;
    }
    
    .cell {
        min-height: 70px;
    }
    
    .cell input {
        font-size: 0.75em;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    .mandalart-grid {
        padding: 10px;
        gap: 5px;
    }
    
    .section {
        gap: 3px;
        padding: 5px;
    }
    
    .cell {
        padding: 3px;
        min-height: 60px;
    }
    
    .cell input {
        font-size: 0.65em;
        padding: 2px;
    }
    
    .toolbar {
        padding: 15px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}

/* 인쇄 스타일 */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .toolbar {
        display: none;
    }
    
    .current-section {
        display: none;
    }
    
    header {
        color: black;
    }
    
    .mandalart-grid {
        box-shadow: none;
        page-break-after: avoid;
    }
    
    .cell {
        border: 1px solid #333;
    }
    
    .cell input {
        border: none;
    }
}
